jinlin
2024-04-09 4d2033854f0770dba993bff26ea09a0a523682fc
web/src/views/modules/taskReliability/TaskPhaseModel.vue
@@ -6,15 +6,15 @@
                     delete-url="/taskReliability/TaskPhaseModel/" v-slot="{ table }">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
        <el-form-item>
          <zt-button type="warning" @click="handleSaveRows">保存</zt-button>
          <zt-button v-if="dataForm.phaseId" type="warning" @click="handleSaveRows">保存</zt-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px"
                v-adaptive="{bottomOffset:30}" border
                @cell-click="handleCellClick"
                @selection-change="table.selectionChangeHandle">
        <el-table-column prop="operatConditName" label="工况名称" width="160"/>
        <el-table-column prop="operatConditDurationRate" label="工况时长比">
        <el-table-column prop="operatConditName" label="工况名称" width="100"/>
        <el-table-column prop="operatConditDurationRate" label="工况时长比" align="right" width="160">
          <template slot-scope="scope">
                    <span
                      v-if="editingCell && editingCell.row === scope.row && editingCell.column.property === scope.column.property">
@@ -67,10 +67,18 @@
      //批量保存
      async handleSaveRows() {
        let time = null
        let operatConditDurationRate = null
        let flag = true
        let list = []
        let reg = /^(-?\d+)\.?(\d*)$/;
        this.dataForm.dataThreeList = this.$refs.tableObj.dataList
        for (let i = 0; i < this.dataForm.dataThreeList.length; i++) {
          operatConditDurationRate = this.dataForm.dataThreeList[i].operatConditDurationRate
          console.log(operatConditDurationRate)
          if (String(operatConditDurationRate).match(reg) == null && operatConditDurationRate !== null) {
            this.$alert("输入的数据格式有误")
            flag = false
          }
          time = time + Number(this.dataForm.dataThreeList[i].operatConditDurationRate)
          if (this.dataForm.dataThreeList[i].isCheck === '0' && this.dataForm.dataThreeList[i].operatConditDurationRate != null) {
            this.$alert("有未勾选的工况")
@@ -79,17 +87,16 @@
            this.$alert("有未填写的工况时长")
            flag = false
          }
          if (this.dataForm.dataThreeList[i].isCheck==='1'){
          if (this.dataForm.dataThreeList[i].isCheck === '1') {
            list.push(this.dataForm.dataThreeList[i])
          }
        }
        this.dataForm.dataThreeList = list
        console.log(time, 'async handleSaveRows')
        /*console.log(time, 'async handleSaveRows')
        if (time > 1) {
          this.$alert("时长比和已超过,请重新设置")
          this.$alert("请重新设置当前时长比分配")
          return
        }
        }*/
        if (!flag) {
          return
        }
@@ -100,6 +107,7 @@
          this.originalData = null
          this.dataForm.dataThreeList = null
          this.$refs.tableObj.query()
          this.$emit('getList')
          this.originalTableData = JSON.parse(JSON.stringify(this.dataList)); // 更新初始数据为当前数据
          console.log(this.originalTableData, 'this.originalTableData 当前表格json数据')
        }