lyh
19 小时以前 ae9b400eae985f6b6f2e33f66ee1575f72675898
src/views/flowable/workflow/secondMaintenance/SecondMaintenanceApprovalModal.vue
@@ -73,7 +73,7 @@
                          (model.maintenanceStatus&&model.maintenanceStatus!=='UNDER_MAINTENANCE')">
                <j-vxe-table ref="editableDetailTable1" :rowNumber="false" rowSelection bordered
                             alwaysEdit keep-source
                             :dataSource="detail.operatorMaintenanceList" :columns="detail.columns"
                             :dataSource="detail.operatorMaintenanceList" :columns="getColumns()"
                             @selectRowChange="handleTableSelectRowChange($event,'Operator')">
                  <template v-slot:maintenanceResult="props">
                    <j-dict-select-tag v-model="props.row.maintenanceResult" dictCode="maintenance_result"
@@ -95,11 +95,19 @@
                  <template v-slot:reportFlag="props">
                    <j-dict-select-tag v-model="props.row.reportFlag" dictCode="yn" style="width: 100%"
                                       :placeholder="props.row.maintenanceResult&&props.row.maintenanceResult!=='1'?'请选择异常是否报修':''"
                                       :disabled="disableSubmit ||
                                       (model.maintenanceStatus&&model.maintenanceStatus!=='UNDER_MAINTENANCE') ||
                                        !props.row.maintenanceResult ||
                                         props.row.maintenanceResult === '1'"/>
                                       :disabled="true"/>
                  </template>
                  <!-- 操作 -->
                  <template v-slot:action="props">
                    <a
                      v-if="shouldShowActionColumn"
                      :class="{ 'disabled-link': shouldDisableRepairButton(props.row) }"
                      @click="!shouldDisableRepairButton(props.row) && handleRepairReporting(props.row)">
                      报修填报
                    </a>
                  </template>
                </j-vxe-table>
              </a-tab-pane>
@@ -108,7 +116,7 @@
                          (model.maintenanceStatus&&model.maintenanceStatus!=='UNDER_MAINTENANCE')">
                <j-vxe-table ref="editableDetailTable2" :rowNumber="false" rowSelection bordered
                             alwaysEdit kee-source
                             :dataSource="detail.repairerMaintenanceList" :columns="detail.columns"
                             :dataSource="detail.repairerMaintenanceList" :columns="getColumns()"
                             @selectRowChange="handleTableSelectRowChange($event,'Repairer')">
                  <template v-slot:maintenanceResult="props">
                    <j-dict-select-tag v-model="props.row.maintenanceResult" dictCode="maintenance_result"
@@ -131,11 +139,17 @@
                    <j-dict-select-tag v-model="props.row.reportFlag"
                                       :placeholder="props.row.maintenanceResult&&props.row.maintenanceResult!=='1'?'请选择异常是否报修':''"
                                       dictCode="yn" style="width: 100%"
                                       :disabled="disableSubmit||
                                       (model.maintenanceStatus&&model.maintenanceStatus!=='UNDER_MAINTENANCE') ||
                                       !props.row.maintenanceResult ||
                                        props.row.maintenanceResult === '1'"/>
                                       :disabled="true"/>
                  </template>
                  <!-- 操作 -->
                  <template v-slot:action="props">
                    <a :class="{ 'disabled-link': shouldDisableRepairButton(props.row) }"
                       @click="!shouldDisableRepairButton(props.row) && handleRepairReporting(props.row)">
                      报修填报
                    </a>
                  </template>
                </j-vxe-table>
              </a-tab-pane>
@@ -224,6 +238,9 @@
          </a-col>
        </a-row>
      </a-form-model>
      <eamReportRepair-modal ref="modalForm"  @ok="handleRepairComplete" @close="handleRepairClose"/>
    </a-spin>
  </j-modal>
</template>
@@ -233,11 +250,13 @@
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@comp/jeecg/JVxeTable'
  import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect'
  import EamReportRepairModal from "@views/eam/repair/modules/EamReportRepairList/EamReportRepairModal.vue";
  export default {
    name: 'SecondMaintenanceApprovalModal',
    mixins: [JVxeTableModelMixin],
    components: {
      EamReportRepairModal,
      MaintenanceEquipmentSelect
    },
    props: {
@@ -250,6 +269,7 @@
        title: '操作',
        visible: false,
        model: {},
        currentRepairRow: null,
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
@@ -341,6 +361,14 @@
              validateRules: [
                { handler: this.customValidator }
              ]
            },
            {
              title: '操作',
              align: 'center',
              type: JVXETypes.slot,
              width: 150,
              slotName: 'action',
              fixed: 'right'
            }
          ]
        }
@@ -352,9 +380,87 @@
      },
      displayInspectorConfirmFlag() {
        return ['WAIT_INSPECTOR_CONFIRM', 'COMPLETE', 'REJECTED'].includes(this.model.maintenanceStatus) && this.model.manageUserResult === '1'
      },
      // 操作列仅在保养中状态下显示
      shouldShowActionColumn() {
        return this.model.maintenanceStatus === 'UNDER_MAINTENANCE';
      }
    },
    methods: {
      // 添加获取列的方法
      getColumns() {
        const columns = [
          {
            title: 'ID',
            key: 'id',
            type: JVXETypes.hidden
          },
          {
            title: 'orderId',
            key: 'orderId',
            type: JVXETypes.hidden
          },
          {
            title: '序号',
            key: 'itemCode',
            type: JVXETypes.normal,
            width: 60,
            align: 'center'
          },
          {
            title: '保养项',
            key: 'itemName',
            type: JVXETypes.normal,
            align: 'center'
          },
          {
            title: '保养结果',
            key: 'maintenanceResult',
            type: JVXETypes.slot,
            align: 'center',
            slotName: 'maintenanceResult',
            validateRules: [
              { required: true, message: '请选择${title}' }
            ]
          },
          {
            title: '异常描述',
            key: 'exceptionDescription',
            type: JVXETypes.slot,
            align: 'center',
            slotName: 'exceptionDescription',
            validateRules: [
              { handler: this.customValidator }
            ]
          },
          {
            title: '是否报修',
            key: 'reportFlag',
            type: JVXETypes.slot,
            align: 'center',
            slotName: 'reportFlag',
            validateRules: [
              { handler: this.customValidator }
            ]
          }
        ];
        // 仅在保养中状态下添加操作列
        if (this.shouldShowActionColumn) {
          columns.push({
            title: '操作',
            align: 'center',
            type: JVXETypes.slot,
            width: 150,
            slotName: 'action',
            fixed: 'right'
          });
        }
        return columns;
      },
      /**
       * 主页面点击执行审批时触发
       * @param record 主页面列表行记录
@@ -412,7 +518,6 @@
       * @param record
       */
      getFlowTaskListByApi(record) {
        console.log("sss",record)
        let parmhis={
          'procInstId': record.procInstId
        }
@@ -610,6 +715,42 @@
        }
      },
      shouldDisableRepairButton(row) {
        return (
          this.model.maintenanceStatus !== 'UNDER_MAINTENANCE' ||
          row.maintenanceResult === '1' ||
          row.reportFlag === '1'
        );
      },
      handleRepairComplete(success) {
        if (success && this.currentRepairRow) {
          this.$set(this.currentRepairRow, 'reportFlag', '1');
          this.$message.success("报修已成功提交");
        }
        this.currentRepairRow = null;
      },
      /**
       * 异常描述填报故障报修
       * @param exceptionDescription
       */
      handleRepairReporting(row) {
        this.currentRepairRow = row; // 存储当前操作行
        let record = {
          faultDescription: row.exceptionDescription,
          equipmentId: this.model.equipmentId
        }
        this.$refs.modalForm.handleRepair(record)
      },
      handleRepairClose(success) {
        if (!success && this.currentRepairRow) {
          this.currentRepairRow = null; // 清除未成功的操作
        }
      },
      handleCancel() {
        this.close()
      },
@@ -758,4 +899,12 @@
    margin: auto;
  }
  /* 添加禁用样式 */
  .disabled-link {
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
    text-decoration: none;
  }
</style>