From f849afc378a7a33db97b90041d8df6f1b9cc6114 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期一, 15 九月 2025 15:37:30 +0800
Subject: [PATCH] 设备/工艺点检表单增加批量正常选择

---
 src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue b/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue
index 4b0ad49..7d2d55e 100644
--- a/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue
+++ b/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue
@@ -40,6 +40,11 @@
             </a-form-model-item>
           </a-col>
         </a-row>
+        <a-row :gutter="24" v-if="selectedCount > 1" style="margin-bottom: 10px;">
+          <a-col :span="24">
+            <a-button type="primary" @click="batchSetNormal">鎵归噺鐐规姝e父</a-button>
+          </a-col>
+        </a-row>
         <a-row :gutter="24">
           <vxe-table
             ref="table"
@@ -50,7 +55,11 @@
             :data="dataSource"
             :edit-config="{trigger: 'click', mode: 'cell'}"
             :edit-rules="editRules"
+            :checkbox-config="{trigger: 'cell', highlight: true}"
+            @checkbox-change="onSelectChange"
+            @checkbox-all="onSelectChange"
           >
+            <vxe-table-column type="checkbox" width="40"></vxe-table-column>
             <vxe-table-column title="搴忓彿" field="itemCode" width="50" align="center"></vxe-table-column>
             <vxe-table-column title="閮ㄤ綅" field="itemPart" align="center"></vxe-table-column>
             <vxe-table-column title="淇濆吇椤圭洰" field="itemName" align="center"></vxe-table-column>
@@ -142,7 +151,8 @@
         updateOrderInspectionStatus: '/mes/mesProductionWorkOrder/edit'
       },
       inspectionEquipmentOptions: [],
-      workOrderId: null
+      workOrderId: null,
+      selectedCount: 0
     }
   },
   computed: {
@@ -172,7 +182,6 @@
     handleEquipmentChange(id) {
       getAction(this.url.queryByEquipmentId, {equipmentId: id}).then(res => {
         if (res.success) {
-          console.log(res.result)
           this.model = {
             ...this.model,
             standardId: res.result.id,
@@ -184,12 +193,27 @@
         }
       })
     },
+    onSelectChange({records}) {
+      this.selectedCount = records.length;
+    },
+    batchSetNormal() {
+      const selectRecords = this.$refs.table.getCheckboxRecords();
+      selectRecords.forEach(record => {
+        record.inspectionResult = '1'
+        record.exceptionDescription = ''
+      });
+      this.$refs.table.syncData()
+    },
     handleOk () {
       this.$refs.table.validate((valid) => {
         if (valid) {
           this.$message.error("璇峰畬鎴愭墍鏈夊繀濉俊鎭悗鍐嶆彁浜わ紒")
         } else {
           let tableData = this.$refs.table.getTableData().fullData
+          if (!tableData || tableData.length === 0) {
+            this.$message.error("鐐规椤逛负绌猴紝鏃犳硶鎻愪氦锛�")
+            return
+          }
           const data = {
             ...this.model,
             workOrderId: this.workOrderId,
@@ -226,9 +250,15 @@
       })
     },
     resetFormData() {
-      this.$refs.form.resetFields()
+      if (this.$refs.form) {
+        this.$refs.form.resetFields()
+      }
       this.model = {}
       this.dataSource = []
+      this.selectedCount = 0
+      if (this.$refs.table) {
+        this.$refs.table.clearCheckboxRow()
+      }
     },
     submitCallback(){
       this.$emit('ok');

--
Gitblit v1.9.3