From 88a01935759943d38e1ab5d318ace12e3d948a60 Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期五, 05 九月 2025 10:32:11 +0800
Subject: [PATCH] 刀具刃磨功能,增加刃磨后刀具信息变更

---
 src/views/tms/modules/inbound/InboundModel.vue |  127 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 11 deletions(-)

diff --git a/src/views/tms/modules/inbound/InboundModel.vue b/src/views/tms/modules/inbound/InboundModel.vue
index 7548919..66cf019 100644
--- a/src/views/tms/modules/inbound/InboundModel.vue
+++ b/src/views/tms/modules/inbound/InboundModel.vue
@@ -46,6 +46,18 @@
             </a-form-model-item>
           </a-col>
         </a-row>
+
+        <!-- <a-row style="width: 100%">
+          <a-col :span="24 / 2">
+            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="搴撲綅鍙�" prop="locationCodeId">
+              <a-select
+                :triggerChange="true"
+                :options="locationCodeOptions"
+                v-model="model.locationCodeId"
+              />
+            </a-form-model-item>
+          </a-col>
+        </a-row> -->
       </a-form-model>
     </a-spin>
     <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectReturnList()" v-show="returnShow && !disableSubmit">閫夋嫨鍊熷嚭宸ュ叿</a-button>
@@ -66,7 +78,7 @@
         <div :key="col.dataIndex">
           <a-input-number
             v-if="col.dataIndex == 'inStorageQuantity'"
-            :disabled="record.accuracyClass == '1'"
+            
             :value="text"
             @change="(e) => handleChange(e, record, col, index)"
             :min="1"
@@ -74,6 +86,8 @@
         </div>
       </template>
       <span slot="action" slot-scope="text, record, index">
+        <a @click="handleChangeClassify(record)" v-if="sharpenShow && !disableSubmit">鍙樻洿宸ュ叿鍒嗙被</a>
+        <a-divider type="vertical" v-if="sharpenShow && !disableSubmit"/>
         <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record, index)" :disabled="disableSubmit">
           <a>鍒犻櫎</a>
         </a-popconfirm>
@@ -90,12 +104,23 @@
     <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-tooling-modal>
     <j-select-return-list-modal ref="returnModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-return-list-modal>
     <j-select-sharpen-list-modal ref="sharpenModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-sharpen-list-modal>
+    <change-classify-modal ref="changeClassifyModalForm" @ok="modalFormOk" :classifyId="classifyId"></change-classify-modal>
+  
+    <div id="printArea" style="display: block;">
+      <div v-for="(item, index) in qrList" :key="index" class="qrcode-item">
+        <p>{{ item.onlyCode }}</p>
+        <p>{{ item.toolName }}</p>
+        <img :src="item.base64" alt="QR Code">
+      </div>
+    </div>
   </a-modal>
+  
 </template>
 
 <script>
 import pick from 'lodash.pick'
 import JSelectToolingModal from '.././inboundOrder/JSelectToolingModal'
+import ChangeClassifyModal from './ChangeClassifyModal'
 import { ajaxGetDictItems } from '@/api/api'
 import moment from 'moment'
 import { getAction, postAction, requestPut } from '@/api/manage'
@@ -105,6 +130,7 @@
 import { filterObj } from '@/utils/util'
 import JSelectReturnListModal from '.././inboundOrder/JSelectReturnListModal'
 import JSelectSharpenListModal from '.././inboundOrder/JSelectSharpenListModal'
+import printJS from 'print-js';
 
 export default {
   name: 'InboundModel',
@@ -115,6 +141,7 @@
     JSelectReturnListModal,
     JSearchSelectTag,
     JSelectSharpenListModal,
+    ChangeClassifyModal
   },
   data() {
     return {
@@ -174,6 +201,12 @@
               message: '璇烽�夋嫨鐢宠鍏ュ簱鏃ユ湡!',
             },
           ],
+          locationCodeId:[
+            {
+              required: true,
+              message: '璇烽�夋嫨搴撲綅鍙�!',
+            },
+          ]
       },
       url: {
         addInStorage: '/tms/inboundOrder/addInStorage',
@@ -221,10 +254,21 @@
           width: 150,
         },
         {
+          title: '搴撲綅鍙�',
+          align: 'center',
+          dataIndex: 'goodsShelvesId',
+          width: 150,
+        },
+        {
           title: '鍏ュ簱鏁伴噺',
           align: 'center',
           dataIndex: 'inStorageQuantity',
           scopedSlots: { customRender: 'inStorageQuantity' },
+        },
+        {
+          title: '鏂板伐鍏风紪鐮�',
+          align: 'center',
+          dataIndex: 'newToolCode',
         },
         {
           title: '鎿嶄綔',
@@ -233,12 +277,19 @@
           scopedSlots: { customRender: 'action' },
         },
       ],
-      classifyId:''
+      classifyId:'',
+      locationCodeOptions:[],
+      qrList: []
     }
   },
   created() {
     //澶囦唤model鍘熷鍊�
     this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    ajaxGetDictItems("tms_goods_shelves,location_code,id", null).then((res) => {
+        if (res.success) {
+          this.locationCodeOptions = res.result
+        }
+      })
   },
   methods: {
     modalFormOk() {
@@ -249,6 +300,7 @@
       return filterObj(this.param)
     },
     add (nodeSelected) {
+      this.qrList = []
       this.classifyId = nodeSelected.key
       this.model.classifyNum =  nodeSelected.entity.classifyId
       this.model.typeName =  nodeSelected.entity.typeName
@@ -291,17 +343,29 @@
     },
     handleOk() {
       const that = this
+      if(this.dataSource.length == 0){
+        that.$message.error("璇峰厛閫夋嫨闇�瑕佸叆搴撶殑宸ュ叿!")
+        return
+      }
       // 瑙﹀彂琛ㄥ崟楠岃瘉
-      this.form.validateFields((err, values) => {
-        if (!err) {
+      this.$refs.form.validate(valid => {
+        if (valid) {
           that.confirmLoading = true
-          let formData = Object.assign(this.model, values)
-          formData.detailData = this.dataSource
-          formData.classifyId = this.classifyId
-          postAction(this.url.addInStorage, formData)
+          this.model.detailData = this.dataSource
+          this.model.classifyId = this.classifyId
+          postAction(this.url.addInStorage, this.model)
             .then((res) => {
               if (res.success) {
-                that.$message.success(res.message)
+                if(this.model.inStorehouseType === '1'){
+                  this.qrList = res.result.map((content, i) => ({
+                  onlyCode:res.result[i].onlyCode,
+                  toolName:res.result[i].toolName,
+                  base64: res.result[i].image
+                  }));
+                  this.handleBacthPrint();
+                }else{
+                   that.$message.success("鍏ュ簱鎴愬姛")
+                }
                 that.$emit('ok', new Date())
               } else {
                 that.$message.warning(res.message)
@@ -388,6 +452,31 @@
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       );
     },
+    
+    // 鎵ц鎵撳嵃
+    handleBacthPrint() {
+      this.$nextTick(() => {
+        printJS({
+          printable: 'printArea',
+          type: 'html',
+          style: `
+            .qrcode-item { 
+              page-break-inside: avoid;
+              margin: 10px; 
+              text-align: center;
+            }
+            img { width: 100px; height: 100px; }
+          `,
+          scanStyles: false
+        });
+      });
+    },
+    //鍒冪(鍚庡彉鏇村伐鍏峰垎绫�
+    handleChangeClassify(record){
+      this.$refs.changeClassifyModalForm.showModal(record.id)
+      this.$refs.changeClassifyModalForm.title = '閫夋嫨宸ュ叿鍒嗙被'
+      this.$refs.changeClassifyModalForm.disableSubmit = false
+    }
   },
   watch: {},
   mounted() {
@@ -402,13 +491,29 @@
           toolModel: data[i].toolModel,
           applicationType: data[i].applicationTypeName,
           onlyCode:data[i].onlyCode,
-          inStorageQuantity:data[i].storageQuantity || data[i].quantity,
+          inStorageQuantity:data[i].storageQuantity || data[i].quantity || 1,
           quantity:data[i].quantity,
-          accuracyClass:data[i].accuracyClass
+          accuracyClass:data[i].accuracyClass,
+          goodsShelvesId:data[i].positionCode
         })
       }
       //this.ipaginationm.total = this.dataSource.length
     })
+    this.$bus.$on('selectionToolCode', (data) => {
+      //getCurrSelected 浜嬩欢 鎺ユ敹缁勪欢浼犻�掔殑鍙傛暟
+      for (let i = 0; i < this.dataSource.length; i++) {
+        console.log("1111",this.dataSource.length,data,this.dataSource[i])
+        if(this.dataSource[i].id == data.oldId){
+          this.dataSource[i].newToolCode = data.toolCode
+          this.dataSource[i].newToolCodeId = data.toolCodeId
+          this.dataSource[i].goodsShelvesId = data.positionCode
+          this.$set(this.dataSource[i],'newToolClassify',data.toolCode)
+        }
+      }
+      // 寮哄埗鏇存柊瑙嗗浘
+      this.$forceUpdate();
+      //this.ipaginationm.total = this.dataSource.length
+    })
   },
 }
 </script>

--
Gitblit v1.9.3