wente
2024-08-19 6bae24b32e3196f5e01d4a9fed62a4e51528b809
web/src/views/modules/taskReliability/TaskPhase.vue
@@ -1,12 +1,12 @@
<template>
  <div>
    <el-row :gutter="5">
      <el-col :span="7">
      <el-col :span="8">
        <div class="fa-card-a" style="margin-right: 5px;">
          <task @onTaskSelected="onTaskSelected" ref="task"/>
        </div>
      </el-col>
      <el-col :span="11">
      <el-col :span="10">
        <div class="mod-taskReliability-taskPhase fa-card-a" style="margin-left: 5px;margin-right: 5px;">
          <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="/taskReliability/TaskPhase/page"
                           delete-url="/taskReliability/TaskPhase/"
@@ -18,19 +18,20 @@
                <zt-button v-if="dataForm.taskId" type="delete" @click="table.deleteHandle()"/>
              </el-form-item>
            </el-form>
            <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:30}"
            <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:30}" border
                      :row-class-name="tableRowClassName"
                      @row-click="selectPhase" @selection-change="table.selectionChangeHandle">
              <el-table-column type="selection" width="40" align="center"/>
              <el-table-column prop="phaseName" label="阶段名称" align="center"/>
              <el-table-column prop="phaseDurationRate" label="阶段时长比" align="right"/>
              <el-table-column prop="phaseSpeed" label="阶段时速" align="right"/>
              <el-table-column prop="phaseDurationRate" label="阶段时长比" align="right" width="120"/>
                <el-table-column prop="remark" label="备注" align="center" width="100"/>
              <!--  <el-table-column prop="phaseSpeed" label="阶段时速" align="right"/>-->
              <!--<el-table-column prop="phaseSort" label="阶段顺序" align="center"/>-->
              <el-table-column prop="operatConditDuration" label="工况时长分配" align="center"/>
              <!--<el-table-column prop="operatConditDuration" label="工况时长分配" align="center"/>-->
              <zt-table-column-handle :table="table" edit-perm="testReviewComment:update"
                                      delete-perm="taskReliability::delete">
                                      delete-perm="taskReliability::delete" width="100">
                <template v-slot="{row}">
                  <zt-table-button type="primary"  @click="openEditWin(row)">修改</zt-table-button>
                  <zt-table-button type="primary" @click="openEditWin(row)">修改</zt-table-button>
                </template>
              </zt-table-column-handle>
            </el-table>
@@ -55,12 +56,14 @@
    data() {
      return {
        dataForm: {
          id:'',
          id: '',
          taskId: '',
          productId: ''
        },
        dataList: [],
        time: null
        time: null,
        currentId: '',
        isChange: ''
      }
    },
    components: {
@@ -69,7 +72,7 @@
      AddOrUpdate
    },
    methods: {
      refreshData(){
      refreshData() {
        this.$refs.tableObj.query()
        this.$refs.task.$refs.tableObj.query()
      },
@@ -89,7 +92,7 @@
          time: this.time
        })
      },
      openEditWin(row){
      openEditWin(row) {
        console.log(row)
        this.$refs.AddOrUpdate.$refs.dialog.init(row.id, {
          taskId: this.dataForm.taskId,
@@ -98,11 +101,27 @@
        })
      },
      onTaskSelected(row) {
        this.isChange = this.$refs.model.isChange
        this.$refs.task.init(this.isChange)
        if (this.isChange) {
          this.$alert("有未保存的工况模型")
          return;
        }
        this.dataForm.taskId = row.id
        this.dataForm.productId = row.productId
        this.$refs.tableObj.query()
        let param = {
          row: {id: 0},
          productId: 0
        }
        this.$refs.model.init(param)
      },
      selectPhase(row) {
        if (this.$refs.model.isChange) {
          this.$alert("有未保存的工况模型")
          return;
        }
        this.currentId = row.id
        this.$emit('selectPhase', row)
        let param = {
          row: row,
@@ -110,6 +129,22 @@
        }
        this.$refs.model.init(param)
      },
      tableRowClassName(
        {
          row,
          rowIndex
        }) {
        if (row.id == this.currentId) {
          return 'select-row';
        } else {
          return 'not-select-row';
        }
      }
    }
  }
</script>
<style>
  .el-table .select-row {
    background: rgba(23, 179, 163, 0.2) !important;
  }
</style>