jinlin
2024-04-09 4d2033854f0770dba993bff26ea09a0a523682fc
修改
12个文件已修改
167 ■■■■■ 已修改文件
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/Task.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/taskReliability/TaskDao.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/ParamData.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/TyProductModel-AddOrUpdate.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/OperatConditModel.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/Task-AddOrUpdate.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/Task.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/TaskPhase-AddOrUpdate.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/TaskPhase.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/TaskPhaseModel.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/model/Task.java
@@ -37,8 +37,7 @@
    @TableField(exist = false)
    private String name;
    @TableField(exist = false)
    private Double phaseDuration;
    private Double taskDuration;
}
modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml
@@ -30,6 +30,8 @@
        from product_model_common a
        where a.is_delete = 0
          and a.node_type <> 1
        ORDER BY
            node_type,sort
    </select>
    <select id="getNo" resultType="java.lang.Integer">
        SELECT COUNT(*)
modules/mainPart/src/main/resources/mapper/taskReliability/TaskDao.xml
@@ -4,12 +4,9 @@
<mapper namespace="com.zt.life.modules.mainPart.taskReliability.dao.TaskDao">
    <select id="getList" resultType="com.zt.life.modules.mainPart.taskReliability.model.Task">
        select a.*,
        b.phaseDuration
        select a.*
        FROM
        task a
        LEFT JOIN (select task_id , SUM(phase_duration_rate) as phaseDuration from task_phase
        where is_delete =0 group by task_id) b ON a.id = b.task_id
        <where>
            a.is_delete = 0
            and a.product_id=${productId}
web/src/views/modules/basicInfo/ParamData.vue
@@ -21,10 +21,12 @@
                <zt-dict v-model="dataForm.repairable" dict="is_or_not" placeholder="是否可维修" clearable></zt-dict>
              </el-form-item>
              <el-form-item>
                <zt-dict v-model="dataForm.reliabDistribType" dict="ReliabDistribType" placeholder="请选择可靠性分布类型" clearable></zt-dict>
                <zt-dict v-model="dataForm.reliabDistribType" dict="ReliabDistribType" placeholder="请选择可靠性分布类型"
                         clearable></zt-dict>
              </el-form-item>
              <el-form-item>
                <zt-dict v-model="dataForm.repairDistribType" dict="RepairDistribType"  placeholder="请选择维修分布类型" clearable></zt-dict>
                <zt-dict v-model="dataForm.repairDistribType" dict="RepairDistribType" placeholder="请选择维修分布类型"
                         clearable></zt-dict>
              </el-form-item>
              <el-form-item>
                <zt-button v-if="dataForm.srcId" type="warning" @click="handleSaveRows">保存</zt-button>
@@ -44,7 +46,8 @@
                  <span v-else v-text="scope.row.baseOperatRatio"></span>
                </template>
              </el-table-column>
              <el-table-column v-if="dataForm.productType==='5'||dataForm.productType==='4'" :key="4" prop="actualRunTime"
              <el-table-column v-if="dataForm.productType==='5'||dataForm.productType==='4'" :key="4"
                               prop="actualRunTime"
                               label="实际运行时间">
                <!--                <template slot-scope="scope">
                                    <span v-if="editingCell && editingCell.row === scope.row && editingCell.column.property === scope.column.property">
@@ -212,7 +215,8 @@
              <!--  <zt-table-column-dict v-if="dataForm.productType==='3'" :key="27" prop="reliabDistribType" label="可靠性分布类型"
                                      width="160"/>-->
              <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" prop="reliabDistribType" label="可靠性分布类型" :key="27"
              <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" prop="reliabDistribType"
                               label="可靠性分布类型" :key="27"
                               width="160">
                <template v-slot="{ row }">
                  <el-select v-if="row.isEdit" v-model="row.reliabDistribType"
@@ -228,7 +232,8 @@
                               :hit="hit"/>
                </template>
              </el-table-column>
              <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="28" prop="runTime" label="运行时间" width="100">
              <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="28" prop="runTime"
                               label="运行时间" width="100">
                <template slot-scope="scope">
                  <el-input v-if="scope.row.isEdit" v-model="scope.row.runTime"></el-input>
                  <span v-else v-text="scope.row.runTime"></span>
@@ -278,10 +283,10 @@
          name: '',
          dataThreeList: null,
          productType: '5',
          basicJoinCompute:'',
          repairable:'',
          repairDistribType:'',
          reliabDistribType:''
          basicJoinCompute: '',
          repairable: '',
          repairDistribType: '',
          reliabDistribType: ''
        },
        isOrNot: [{
          value: 1,
@@ -311,13 +316,13 @@
        ],
        // editingCell:null,
        dataList: [],
        originalTableData:[],
        originalTableData: [],
        originalData: null, // 记录修改前的数据
      }
    },
    // 在组件中定义 beforeRouteLeave 导航守卫
    beforeRouteLeave(to, from, next) {
      console.log(this.$store.state.contentTabs,'this.$store.state.contentTabsActiveName')
      console.log(this.$store.state.contentTabs, 'this.$store.state.contentTabsActiveName')
      if (this.hasUnsavedChanges()) { // 检查是否有未保存的变更
        this.$confirm('您有未保存的更改,请先保存。是否继续离开?', '提示', {
          confirmButtonText: '保存',
@@ -363,7 +368,7 @@
          this.dataForm.dataThreeList = null
          this.$refs.tableObj.query()
          this.originalTableData = JSON.parse(JSON.stringify(this.dataList)); // 更新初始数据为当前数据
          console.log(this.originalTableData,'this.originalTableData 当前表格json数据')
          console.log(this.originalTableData, 'this.originalTableData 当前表格json数据')
        }
      },
      edit(row) {
@@ -396,9 +401,11 @@
      // },
      onProductSelected(data) {
        this.dataForm.srcId = data.id
        this.dataForm.productType =data.productType
        this.dataForm.productType = data.productType
        console.log(data, 'onProductSelected(data)')
        this.$refs.tableObj.query()
        this.$nextTick(() => {
          this.$refs.tableObj.query()
        })
      },
      dataLoaded(data) {
        this.dataList = data
@@ -409,7 +416,7 @@
          console.log(dataList, 'dataList')
        }
        this.originalTableData = JSON.parse(JSON.stringify(this.dataList))
        console.log(this.originalTableData,'this.originalTableData 初始表格json数据')
        console.log(this.originalTableData, 'this.originalTableData 初始表格json数据')
      },
      hasUnsavedChanges() {
        // 检查当前表格数据与初始数据是否相同
web/src/views/modules/basicInfo/TyProductModel-AddOrUpdate.vue
@@ -70,6 +70,7 @@
      },
      selectDefaultProduct() {
        this.dataForm.nodeType = 1
        this.getDefaultImg(this.dataForm.nodeType)
      },
      // 获取系统列表
      async getProductList() {
@@ -86,7 +87,6 @@
        console.log(row, 'openAddWin(row)')
      },
      async getDefaultImg(selected) {
        console.log(selected, 'async getDefaultImg')
        let params = {
          productType: selected
        }
web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -8,11 +8,11 @@
        <el-input v-model="dataForm.name"></el-input>
      </zt-form-item>
      <zt-form-item label="节点类型" prop="productType" rules="required">
        <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"></zt-dict>
        <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"
                 :disabled="disabled"></zt-dict>
      </zt-form-item>
      <zt-form-item label="运行状态图" prop="operatImg" v-if="isShow">
        <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"
                  :readonly="readonly"></el-input>
        <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input>
        <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image>
      </zt-form-item>
      <zt-form-item label="排序" prop="sort">
@@ -31,6 +31,7 @@
  export default {
    data() {
      return {
        disabled: false,
        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
        isTree: false,
        isShow: true,
@@ -61,11 +62,11 @@
          this.dataForm.pid = params.pid
          this.dataForm.productType = params.type
        }
        if (this.dataForm.productType==='10'){
        if (this.dataForm.productType === 10 && id == null) {
          this.getDefaultImg(this.dataForm.productType)
        }
        this.disabled = !!id;
      },
      // 获取系统列表
      async getProductList() {
        let res = await this.$http.get('/basicInfo/XhProductModel/getProductList')
@@ -100,19 +101,19 @@
      // 表单提交
      async formSubmit() {
        let flag = true
        if (this.isTree){
        if (this.isTree) {
          if (this.dataForm.productType !== '5' || this.dataForm.productType !== '4') {
            this.$alert("不支持新增此节点")
            flag =false
            flag = false
          }
        }else{
        } else {
          if (this.dataForm.productType === '5' || this.dataForm.productType === '4') {
            this.$alert("不支持新增此节点")
            flag =false
            flag = false
          }
        }
        if (!flag){
        if (!flag) {
          return
        }
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/XhProductModel/', this.dataForm)
web/src/views/modules/taskReliability/OperatConditModel.vue
@@ -10,7 +10,7 @@
                  row-key="id"
                  :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
                  :default-expand-all="true">
          <el-table-column prop="product" label="产品节点1" width="160"/>
          <el-table-column prop="product" label="产品节点" width="160"/>
          <el-table-column prop="modelName" label="产品模型"/>
          <zt-table-column-handle :table="table" edit-perm="taskReliability:update"
                                  delete-perm="taskReliability::delete" :has-view="false">
web/src/views/modules/taskReliability/Task-AddOrUpdate.vue
@@ -4,9 +4,9 @@
      <zt-form-item label="任务名称" prop="taskName" rules="required">
        <el-input v-model="dataForm.taskName"></el-input>
      </zt-form-item>
<!--      <zt-form-item label="任务顺序" prop="taskSort" rules="required">
        <el-input v-model="dataForm.taskSort"></el-input>
      </zt-form-item>-->
      <zt-form-item label="任务总时长" prop="taskDuration">
        <el-input v-model="dataForm.taskDuration"></el-input>
      </zt-form-item>
    </el-form>
  </zt-dialog>
</template>
@@ -22,7 +22,7 @@
          taskName: '',
          taskSort: '',
          remark: '',
          status: ''
          taskDuration: ''
        }
      }
    },
web/src/views/modules/taskReliability/Task.vue
@@ -17,7 +17,7 @@
        <el-table-column type="selection" width="40" align="center"/>
        <el-table-column prop="taskName" label="任务名称"/>
        <!--<el-table-column prop="taskSort" label="任务顺序" align="center"/>-->
        <el-table-column prop="phaseDuration" label="任务时长分配" align="right"/>
        <el-table-column prop="taskDuration" label="任务总时长" align="right"/>
        <zt-table-column-handle :table="table"
                                delete-perm="taskReliability::delete"/>
      </el-table>
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">
        <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 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>
web/src/views/modules/taskReliability/TaskPhase.vue
@@ -27,8 +27,12 @@
              <el-table-column prop="phaseSpeed" label="阶段时速" align="right"/>
              <!--<el-table-column prop="phaseSort" label="阶段顺序" align="center"/>-->
              <el-table-column prop="operatConditDuration" label="工况时长分配" align="center"/>
              <zt-table-column-handle :table="table"
                                      delete-perm="taskReliability::delete"/>
              <zt-table-column-handle :table="table" edit-perm="testReviewComment:update"
                                      delete-perm="taskReliability::delete">
                <template v-slot="{row}">
                  <zt-table-button type="primary"  @click="openEditWin(row)">修改</zt-table-button>
                </template>
              </zt-table-column-handle>
            </el-table>
            <!-- 弹窗, 新增 / 修改 -->
            <add-or-update @refreshDataList="refreshData" ref="AddOrUpdate"/>
@@ -75,17 +79,24 @@
        for (let i = 0; i < this.dataList.length; i++) {
          this.time = this.time + Number(this.dataList[i].phaseDurationRate)
        }
        if (this.time>1){
          this.$alert("当前运行时长比已超出,请重新设置")
        }
        console.log(this.time)
      },
      add() {
        console.log(this.time)
        this.$refs.AddOrUpdate.$refs.dialog.init(null, {
          taskId: this.dataForm.taskId,
          productId: this.dataForm.productId,
          time: this.time
        })
      },
      openEditWin(row){
        console.log(row)
        this.$refs.AddOrUpdate.$refs.dialog.init(row.id, {
          taskId: this.dataForm.taskId,
          productId: this.dataForm.productId,
          time: this.time
        })
      },
      onTaskSelected(row) {
        this.dataForm.taskId = row.id
        this.dataForm.productId = row.productId
web/src/views/modules/taskReliability/TaskPhaseModel.vue
@@ -13,8 +13,8 @@
                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="时长比" align="right" width="100">
        <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')
        if (time> 1) {
        /*console.log(time, 'async handleSaveRows')
        if (time > 1) {
          this.$alert("请重新设置当前时长比分配")
          return
        }
        }*/
        if (!flag) {
          return
        }
@@ -100,7 +107,7 @@
          this.originalData = null
          this.dataForm.dataThreeList = null
          this.$refs.tableObj.query()
         this.$emit('getList')
          this.$emit('getList')
          this.originalTableData = JSON.parse(JSON.stringify(this.dataList)); // 更新初始数据为当前数据
          console.log(this.originalTableData, 'this.originalTableData 当前表格json数据')
        }