From f6f8dc9a6d4111a541fffe105d3979b40a2c2f75 Mon Sep 17 00:00:00 2001
From: Houjie <714924425@qq.com>
Date: 星期二, 10 六月 2025 09:42:15 +0800
Subject: [PATCH] 刀具刃磨-新增异常调整  工具报损 -选择工具调整  刃磨-选择工具调整

---
 src/views/tms/requirement/modules/ToolsSharpeningModal.vue |  112 ++++++++++++++++++++++++++------------------------------
 1 files changed, 52 insertions(+), 60 deletions(-)

diff --git a/src/views/tms/requirement/modules/ToolsSharpeningModal.vue b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue
index 9346322..d49bc28 100644
--- a/src/views/tms/requirement/modules/ToolsSharpeningModal.vue
+++ b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue
@@ -11,18 +11,20 @@
     @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="12">
-            <a-form-model-item prop="standardCode" label="宸ュ叿缂栧彿">
-              <a-input-search v-model="model.toolId" placeholder="璇烽�夋嫨宸ュ叿缂栧彿" :disabled="disableSubmit"
+            <a-form-model-item prop="standardCode" label="宸ュ叿缂栫爜">
+              <a-input-search v-model="model.toolId" placeholder="璇烽�夋嫨宸ュ叿缂栫爜" :disabled="disableSubmit"
                               @search="selectTools" enter-button
               />
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
-            <a-form-model-item prop="classify_id" label="宸ュ叿鍒嗙被缂栫爜">
+            <a-form-model-item prop="classify_id" label="宸ュ叿鍒嗙被鍚嶇О">
               <a-input placeholder="璇疯緭鍏ュ伐鍏峰垎绫诲悕绉�" v-model="model.classifyId" readOnly :disabled="disableSubmit" />
             </a-form-model-item>
           </a-col>
@@ -31,13 +33,13 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-model-item prop="paramaTableName" label="宸ュ叿鍙傛暟鏍囪瘑">
-              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.paramaTableName" readOnly
+              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.paramaTableName_dictText" readOnly
                        :disabled="disableSubmit" />
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="宸ュ叿绫诲瀷">
-              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.applicationType" readOnly
+              <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.applicationType_dictText" readOnly
                        :disabled="disableSubmit" />
             </a-form-model-item>
           </a-col>
@@ -99,13 +101,7 @@
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-model-item label="瀛樺偍浣嶇疆" prop="storageLocation">
-              <a-input placeholder="閫夋嫨濉啓瀛樺偍浣嶇疆" v-model="model.positionCode" readOnly
-                       :disabled="disableSubmit" />
-            </a-form-model-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-model-item label="澶囨敞">
+            <a-form-model-item label="澶囨敞" prop="remark">
               <a-textarea v-model="model.remark" rows="3" placeholder="璇疯緭鍏ュ娉�" :disabled="disableSubmit" />
             </a-form-model-item>
           </a-col>
@@ -119,7 +115,7 @@
 
       <a-button @click="handleOk()" :disabled="disableSubmit" type="primary" :loading="confirmLoading">纭畾</a-button>
     </template>
-    <tools-modal ref="toolListModel"></tools-modal>
+    <tools-modal ref="toolListModel"  @sendSelectionRows="getRows"></tools-modal>
 
 
   </j-modal>
@@ -129,11 +125,14 @@
 import { getAction, postAction, requestPut } from '@/api/manage'
 import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
 import ToolsModal from '@views/tms/requirement/modules/ToolsModal.vue'
+import pick from 'lodash.pick'
+import DeviceListModel from '@views/mdc/base/modules/EquipmentList/DeviceListModal.vue'
 
 export default {
   name: 'ToolsSharpeningModal',
   mixins: [JVxeTableModelMixin],
   components: {
+    DeviceListModel,
     ToolsModal
   },
   data() {
@@ -165,36 +164,33 @@
           { required: true, message: '璇疯緭鍏ュ垉纾ㄧ粨鏋滃強寤鸿!' }
         ]
       },
+      lastSelectionData: null,
       url: {
         add: '/tms/toolSharpening/add',
         edit: '/tms/toolSharpening/edit',
-        queryDetailList: '/tms/toolSharpening/listToolSharpening'
+        // queryDetailList: '/tms/toolSharpening/listToolSharpening'
       }
     }
   },
   created() {
   },
-  mounted() {
-    this.$bus.$on('selectionRows', (data) => {
-      console.log('selectionRows', data)
-      if (data && data.length > 0) {
-        const item = data[0]
-        // 浣跨敤 $set 纭繚 model 鐨勫睘鎬ф槸鍝嶅簲寮忕殑
-        this.$set(this.model, 'toolId', item.toolCode)
-        this.$set(this.model, 'toolCode', item.id)
+
+  methods: {
+    getRows(item) {
+      console.log(item)
+      if (item.id) {
+        this.$set(this.model, 'toolId', item.toolId)
+        this.$set(this.model, 'toolCode', item.toolCode)
         this.$set(this.model, 'classifyId', item.classifyId)
-        this.$set(this.model, 'paramaTableName', item.paramaTableName_dictText)
-        this.$set(this.model, 'applicationType', item.applicationType_dictText)
+        this.$set(this.model, 'paramaTableName_dictText', item.paramaTableName_dictText)
+        this.$set(this.model, 'applicationType_dictText', item.applicationType_dictText)
         this.$set(this.model, 'toolModel', item.toolModel)
         this.$set(this.model, 'provinceCity', item.provinceCity)
         this.$set(this.model, 'warehouseId', item.warehouseId)
         this.$set(this.model, 'positionCode', item.positionCode)
         this.$set(this.model, 'mainUnit', item.mainUnit)
       }
-    })
-
-  },
-  methods: {
+    },
 
     selectTools: function() {
       this.$refs.toolListModel.showModals()
@@ -203,35 +199,32 @@
     },
 
     add() {
-      this.addShow = false
-      this.edit()
+      this.edit({})
     },
-
     edit(record) {
-      console.log(record)
-      // this.model = Object.assign({}, record)
-      this.visible = true
-      getAction(this.url.queryDetailList, {
-        id: record.id,
-        pageNo: 1,
-        pageSize: 99999
-      }).then((res) => {
-        if (res.success) {
-          const readOnlyData = res.result.records[0] || {}
-          this.model = Object.assign({}, this.model, {
-            paramaTableName: readOnlyData.paramaTableName_dictText,
-            applicationType: readOnlyData.applicationType_dictText,
-            provinceCity: readOnlyData.provinceCity,
-            warehouseId: readOnlyData.warehouseId,
-            positionCode: readOnlyData.positionCode,
-            mainUnit: readOnlyData.mainUnit,
-            toolModel: readOnlyData.toolModel
-          })
+      let that = this
+      that.visible = true
+      that.model = Object.assign({}, record)
+      // this.$nextTick(() => {
+      //   this.form.setFieldsValue(pick(that.model, 'selectedDeparts', 'selectedProduction', 'equipmentId', 'equipmentName', 'equipmentModel', 'equipmentType', 'equipmentIp', 'dataPort',
+      //     'driveType', 'sortNo', 'remark', 'systemVersion', 'devicePower', 'controlSystem', 'saveTableName', 'systemValue'))
+      // })
+    },
+    // edit(record) {
+    //   let that = this
+    //   that.visible = true
+    //   that.model = Object.assign({}, record)
+    //
+    //   // 濡傛灉鏈� selectionRows 鏁版嵁锛屽垯閲嶆柊璧嬪��
+    //   if (this.lastSelectionData && this.lastSelectionData.length > 0) {
+    //     this.assignModelFromSelection(this.lastSelectionData[0])
+    //     console.log('this.model',this.assignModelFromSelection(this.lastSelectionData[0]))
+    //   }
+    // },
+    close() {
+      this.$emit('close')
+      this.visible = false
 
-        } else {
-          this.dataSource = null
-        }
-      })
     },
     handleOk() {
       const that = this
@@ -272,15 +265,14 @@
       this.close()
     },
 
-    close() {
-      this.$emit('close')
-      this.visible = false
-      this.$refs.form.clearValidate()
-    }
+
   }
 }
 </script>
 
 <style lang="less" scoped>
 
-</style>
\ No newline at end of file
+</style>
+
+
+

--
Gitblit v1.9.3