From 2094d14b908959353558ef5af1a85a8322031c58 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期四, 04 九月 2025 10:50:28 +0800
Subject: [PATCH] 排产工单模块设备点检功能页面

---
 src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue |  251 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/views/mes/MesProductionWorkOrderListView.vue                         |   10 +
 2 files changed, 259 insertions(+), 2 deletions(-)

diff --git a/src/views/mes/MesProductionWorkOrderListView.vue b/src/views/mes/MesProductionWorkOrderListView.vue
index ac4b633..5c4defa 100644
--- a/src/views/mes/MesProductionWorkOrderListView.vue
+++ b/src/views/mes/MesProductionWorkOrderListView.vue
@@ -109,7 +109,7 @@
             </span>
             <span v-if="record.workOrderStatus === 'PUBLISHED' && record.completenessCheckFlag === '1' && record.equipmentInspectionFlag === '0'">
               <a-divider type="vertical" />
-              <a @click="handleCompletenessCheck(record)">璁惧鐐规</a>
+              <a @click="handleEquipmentInspection(record)">璁惧鐐规</a>
             </span>
             <span v-if="record.workOrderStatus === 'PUBLISHED' && record.completenessCheckFlag === '1' && record.equipmentInspectionFlag === '1' && record.processInspectionFlag === '0'">
               <a-divider type="vertical" />
@@ -195,6 +195,7 @@
     <MesProductionWorkOrderRepublishModal ref="MesProductionWorkOrderRepublishModal" @ok="modalFormOk"></MesProductionWorkOrderRepublishModal>
     <MesProductionWorkOrderReportModal ref="MesProductionWorkOrderReportModal" @ok="modalFormOk"></MesProductionWorkOrderReportModal>
     <MesProductionWorkOrderCompletenessCheckModal ref="MesProductionWorkOrderCompletenessCheckModal" @ok="modalFormOk"></MesProductionWorkOrderCompletenessCheckModal>
+    <MesProductionWorkOrderEquipmentInspectionModal ref="MesProductionWorkOrderEquipmentInspectionModal" @ok="modalFormOk"></MesProductionWorkOrderEquipmentInspectionModal>
   </a-card>
 </template>
 
@@ -212,6 +213,7 @@
 import MesProductionWorkOrderRepublishModal from '@views/mes/modules/MesProductionWorkOrderRepublishModal.vue'
 import MesProductionWorkOrderReportModal from '@views/mes/modules/MesProductionWorkOrderReportModal.vue'
 import MesProductionWorkOrderCompletenessCheckModal from '@views/mes/modules/MesProductionWorkOrderCompletenessCheckModal.vue'
+import MesProductionWorkOrderEquipmentInspectionModal from '@views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue'
 import JSelectFactory from '@comp/jeecgbiz/JSelectFactory.vue'
 import moment from 'moment/moment'
 
@@ -226,7 +228,8 @@
     MesProductionWorkOrderScheduleModal,
     MesProductionWorkOrderRepublishModal,
     MesProductionWorkOrderReportModal,
-    MesProductionWorkOrderCompletenessCheckModal
+    MesProductionWorkOrderCompletenessCheckModal,
+    MesProductionWorkOrderEquipmentInspectionModal
   },
   data() {
     return {
@@ -645,6 +648,9 @@
     handleCompletenessCheck(record) {
       this.$refs.MesProductionWorkOrderCompletenessCheckModal.check(record)
     },
+    handleEquipmentInspection(record) {
+      this.$refs.MesProductionWorkOrderEquipmentInspectionModal.inspect(record)
+    },
     async handleUnLoadingDetail(row){
       console.log('row---->',row)
       const unloadingResult = await getAction(this.url.queryUnloadingByLoadingId,{'loadingId':row.id})
diff --git a/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue b/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue
new file mode 100644
index 0000000..4b0ad49
--- /dev/null
+++ b/src/views/mes/modules/MesProductionWorkOrderEquipmentInspectionModal.vue
@@ -0,0 +1,251 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴">
+
+    <a-spin :spinning="spinning">
+      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
+        <a-row :gutter="24">
+          <a-col :span="8">
+            <a-form-model-item prop="standardCode" label="宸ュ崟鍙�">
+              <a-input placeholder="宸ュ崟鍙疯嚜鍔ㄧ敓鎴�" v-model="model.orderNum" readOnly/>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="8">
+            <a-form-model-item prop="equipmentId" label="璁惧缂栧彿">
+              <a-select placeholder="璇烽�夋嫨璁惧" v-model="model.equipmentId" :options="inspectionEquipmentOptions" @change="handleEquipmentChange"></a-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="8">
+            <a-form-model-item prop="standardName" label="鏍囧噯鍚嶇О">
+              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.standardName"/>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="8">
+            <a-form-model-item prop="standardCode" label="鏍囧噯缂栫爜">
+              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.standardCode"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="8">
+            <a-form-model-item label="淇濆吇鍛ㄦ湡">
+              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.maintenancePeriod" readOnly/>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <vxe-table
+            ref="table"
+            border
+            show-overflow
+            show-header-overflow
+            :scroll-x="{enabled: true}"
+            :data="dataSource"
+            :edit-config="{trigger: 'click', mode: 'cell'}"
+            :edit-rules="editRules"
+          >
+            <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>
+            <vxe-table-column title="妫�鏌ユ爣鍑嗘垨瑕佹眰" field="itemDemand" align="center"></vxe-table-column>
+            <vxe-table-column title="淇濆吇瑕佹眰" field="itemDemandAlias" align="center"></vxe-table-column>
+            <vxe-table-column title="妫�鏌ユ柟娉�" field="checkMethod" align="center"></vxe-table-column>
+            <vxe-table-column title="鐐规缁撴灉" field="inspectionResult" align="center"
+                              :edit-render="{name: '$select', options: inspectionResultOptions}">
+              <template #default="{ row }">
+                <span v-if="row.inspectionResult">{{ getInspectionResultLabel(row.inspectionResult) }}</span>
+                <span v-else class="placeholder-text">璇烽�夋嫨鐐规缁撴灉</span>
+              </template>
+            </vxe-table-column>
+            <vxe-table-column title="寮傚父鎻忚堪" field="exceptionDescription" align="center"
+                              :edit-render="{name: '$input', placeholder: '璇疯緭鍏ュ紓甯告弿杩�'}">
+              <template #default="{ row }">
+                <span v-if="row.inspectionResult === '2' && !row.exceptionDescription" class="placeholder-text">璇疯緭鍏ュ紓甯告弿杩�</span>
+                <span v-else-if="row.exceptionDescription">{{ row.exceptionDescription }}</span>
+              </template>
+              <template #edit="{ row }">
+                <vxe-input v-if="row.inspectionResult === '2'" v-model="row.exceptionDescription" placeholder="璇疯緭鍏ュ紓甯告弿杩�" />
+              </template>
+            </vxe-table-column>
+          </vxe-table>
+        </a-row>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+import { postAction, getAction, putAction } from '@api/manage'
+
+export default {
+  name: 'MesProductionWorkOrderReportModal',
+  data () {
+    return {
+      title: '璁惧鐐规',
+      width: 1200,
+      visible: false,
+      loading: false,
+      disableSubmit: false,
+      model: {},
+      spinning: false,
+      validatorRules: {
+      },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 },
+      },
+      inspectionResultOptions: [
+        {
+          label: '姝e父',
+          value: '1'
+        },
+        {
+          label: '寮傚父',
+          value: '2'
+        }
+      ],
+      dataSource: [],
+      editRules: {
+        inspectionResult: [
+          { required: true, message: '妫�鏌ョ粨鏋滃繀椤婚�夋嫨' }
+        ],
+        exceptionDescription: [
+          {
+            required: true,
+            message: '寮傚父鎻忚堪涓嶈兘涓虹┖',
+            validator: ({ cellValue, row }) => {
+              // 褰撶偣妫�缁撴灉涓哄紓甯告椂锛屽紓甯告弿杩板繀濉�
+              if (row.inspectionResult === '2') {
+                return cellValue && cellValue.trim() !== '' ? true : new Error('寮傚父鎻忚堪蹇呴』濉啓');
+              }
+              return true;
+            }
+          }
+        ]
+      },
+      url: {
+        report: '/mesworkreporting/mesWorkReporting/add',
+        listInspectionEquipment: '/eam/equipment/listProductionLineInspectionEquipment',
+        queryByEquipmentId: '/eam/maintenanceStandard/queryByEquipmentId',
+        addInspectionOrder: '/eam/eamInspectionOrder/add',
+        updateOrderInspectionStatus: '/mes/mesProductionWorkOrder/edit'
+      },
+      inspectionEquipmentOptions: [],
+      workOrderId: null
+    }
+  },
+  computed: {
+    formDisabled(){
+      return this.disabled
+    }
+  },
+  methods: {
+    getInspectionResultLabel(value) {
+      const option = this.inspectionResultOptions.find(item => item.value === value);
+      return option ? option.label : value;
+    },
+    inspect (record) {
+      this.resetFormData()
+      this.workOrderId = record.id
+      getAction(this.url.listInspectionEquipment, {orderId: record.id}).then(res => {
+        if (res.success) {
+          this.inspectionEquipmentOptions = res.result
+        }
+      })
+      this.visible = true
+    },
+    close () {
+      this.$emit('close');
+      this.visible = false;
+    },
+    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,
+            standardName: res.result.standardName,
+            standardCode: res.result.standardCode,
+            maintenancePeriod: res.result.maintenancePeriod
+          }
+          this.dataSource = res.result.maintenanceStandardDetailList
+        }
+      })
+    },
+    handleOk () {
+      this.$refs.table.validate((valid) => {
+        if (valid) {
+          this.$message.error("璇峰畬鎴愭墍鏈夊繀濉俊鎭悗鍐嶆彁浜わ紒")
+        } else {
+          let tableData = this.$refs.table.getTableData().fullData
+          const data = {
+            ...this.model,
+            workOrderId: this.workOrderId,
+            tableDetailList: tableData
+          }
+          postAction(this.url.addInspectionOrder, data).then(res=> {
+            if (res.success) {
+              this.$message.success(res.message)
+              getAction(this.url.listInspectionEquipment, {orderId: this.workOrderId}).then(res => {
+                if (res.success) {
+                  if (res.result && res.result.length > 0) {
+                    // 杩樻湁璁惧闇�瑕佺偣妫�锛屾竻绌鸿〃鍗曞拰琛ㄦ牸鏁版嵁
+                    this.inspectionEquipmentOptions = res.result
+                    this.resetFormData()
+                  } else {
+                    // 娌℃湁闇�瑕佺偣妫�鐨勮澶囷紝鏇存柊鐐规鐘舵��
+                    putAction(this.url.updateOrderInspectionStatus, {id: this.workOrderId, equipmentInspectionFlag: '1'}).then(res => {
+                      if (res.success) {
+                        this.$message.success('璁惧鐐规瀹屾垚')
+                        this.submitCallback()
+                      } else {
+                        this.$message.warning(res.message)
+                      }
+                    })
+                    this.submitCallback()
+                  }
+                }
+              })
+            } else {
+              this.$message.warning(res.message)
+            }
+          })
+        }
+      })
+    },
+    resetFormData() {
+      this.$refs.form.resetFields()
+      this.model = {}
+      this.dataSource = []
+    },
+    submitCallback(){
+      this.$emit('ok');
+      this.visible = false;
+    },
+    handleCancel () {
+      this.close()
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+.placeholder-text {
+  color: #999;
+  font-style: italic;
+}
+
+</style>

--
Gitblit v1.9.3