From ae9b400eae985f6b6f2e33f66ee1575f72675898 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期六, 09 八月 2025 00:18:41 +0800
Subject: [PATCH] 添加流程节点

---
 src/views/flowable/workflow/secondMaintenance/SecondMaintenanceApprovalModal.vue |  171 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 160 insertions(+), 11 deletions(-)

diff --git a/src/views/flowable/workflow/secondMaintenance/SecondMaintenanceApprovalModal.vue b/src/views/flowable/workflow/secondMaintenance/SecondMaintenanceApprovalModal.vue
index 1eadc4c..73f1c4f 100644
--- a/src/views/flowable/workflow/secondMaintenance/SecondMaintenanceApprovalModal.vue
+++ b/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>
\ No newline at end of file

--
Gitblit v1.9.3