haoxuan
2023-10-11 a1a6630f2eabfc78a379b5808b1bf7231a084d0b
src/components/AddControl.vue
@@ -23,14 +23,13 @@
      <div style="color:#333;font-size:15px; font-weight:700;margin-bottom:10px;">工艺参数</div>
      <el-form
        ref="form"
        :model="form"
        label-width="80px"
        label-position="left"
      >
        <div v-for="(item,index) in Arr" :key="index">
          <el-form-item :label="item.value" prop="estimateHour" class="form-item">
          <el-form-item :label="item.Key" prop="estimateHour" class="form-item">
            <el-input
              v-model="item.key"
              v-model="item.Value"
              placeholder="请输入"
              disabled
            ></el-input>
@@ -41,7 +40,7 @@
    <div slot="footer" class="dialog-footer tac">
      <el-button @click="shutdown">关闭</el-button>
      <el-button type="primary" @click="onSubmit(form)">下发参数</el-button>
      <el-button type="primary" @click="onSubmit()">下发参数</el-button>
    </div>
  </el-dialog>
</template>
@@ -55,65 +54,29 @@
export default {
  components: {},
  props: {
    id:{
      type: [Number,String],
    Arr:{
      type: [Array],
      default: () => {
        return '';
        return [];
      },
    }
  },
  data() {
    return {
      islook: false,
      form: {
        consumedHour: null,
        directorID: "",
        endDate: "",
        estimateHour: null,
        priority: null,
        progress: null,
        projectID: "",
        taskName: "",
      },
      Arr:[
        {
          value:'设定长度',
          key:'100m',
        },
        {
          value:'切割时间',
          key:'100s',
        }
      ]
    };
  },
  mounted() {
    this.getStartInfo()
  },
  watch: {
    islook(val) {
      if (val) {
        this.form = {
          consumedHour: null,
          directorID: "",
          endDate: "",
          estimateHour: null,
          priority: null,
          progress: null,
          projectID: "",
          taskName: "",
        };
      }
    },
  },
  methods: {
    getStartInfo(){
      startTask({id:this.id}).then(res=>{
        if(res.code==200){
        }
      })
    },
    validatorNum(rule, value, callback) {
      if (value) {
        if (value == undefined || value == null) {
@@ -133,18 +96,20 @@
    onSubmit() {
      
      sendProcessParams({id:this.id}).then(res=>{
        if(res.code==200){
          this.$message.success("下发成功!");
          this.$emit("shutdown", this.form);
          this.shutdown();
        }
      })
      if(this.id){
        sendProcessParams({id:this.id}).then(res=>{
          if(res.code==200){
            this.$message.success("下发成功!");
            this.shutdown();
          }
        })
      }else{
        this.$message.error("当前设备没有工序!");
      }
    },
    shutdown() {
      this.islook = false;
      this.$refs.form.resetFields();
    },
  },
};