wente
2024-06-13 0f96b0f3f0b21c0ef6e4097dfceeb28f9215e327
web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue
@@ -5,14 +5,14 @@
        <el-input v-model="dataForm.phaseName"></el-input>
      </zt-form-item>
      <zt-form-item label="阶段时长比" prop="phaseDuration">
        <el-input v-model="dataForm.phaseDurationRate"></el-input>
        <el-input v-model="dataForm.phaseDurationRate" @change="check"></el-input>
      </zt-form-item>
      <zt-form-item label="阶段时速" prop="phaseSpeed">
<!--      <zt-form-item label="阶段时速" prop="phaseSpeed">
        <el-input v-model="dataForm.phaseSpeed"></el-input>
      </zt-form-item>
      <zt-form-item label="阶段顺序" prop="phaseSort">
        <el-input v-model="dataForm.phaseSort"></el-input>
      </zt-form-item>
      </zt-form-item>-->
      <!--      <zt-form-item label="阶段顺序" prop="phaseSort">
              <el-input v-model="dataForm.phaseSort"></el-input>
            </zt-form-item>-->
      <zt-form-item label="备注" prop="remark">
        <el-input v-model="dataForm.remark"></el-input>
      </zt-form-item>
@@ -34,6 +34,7 @@
          remark: '',
          productId: ''
        },
        oldTime: null,
        time: null
      }
    },
@@ -43,6 +44,13 @@
        this.dataForm.productId = param.productId
        this.time = param.time
      },
      check() {
        let reg = /^(-?\d+)\.?(\d*)$/;
        if (this.dataForm.phaseDurationRate.match(reg) == null && this.dataForm.phaseDurationRate !=='') {
          this.dataForm.phaseDurationRate = '';
          this.$alert("输入的数据格式有误")
        }
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/taskReliability/TaskPhase/${this.dataForm.id}`)
@@ -50,21 +58,26 @@
          ...this.dataForm,
          ...res.data
        }
        this.oldTime = this.dataForm.phaseDurationRate
      },
      // 表单提交
      async formSubmit() {
        console.log(this.time,'dataLoaded')
        if (this.time + Number(this.dataForm.phaseDurationRate > 1)) {
      /*  let flag = true
        if (this.time + Number(this.dataForm.phaseDurationRate)-Number(this.oldTime) > 1) {
          this.$alert("请重新设置当前时长比分配")
        }else{
          let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/taskReliability/TaskPhase/', this.dataForm)
          if (res.success) {
            await this.$tip.success()
            this.$refs.dialog.close()
            this.$emit('refreshDataList')
          }
          flag = false
        }
        if (!flag) {
          return
        }*/
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/taskReliability/TaskPhase/', this.dataForm)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>