From fe87f8fe2250e1ffc7d1474fb97cc0ceb89ae55e Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期三, 06 八月 2025 14:13:18 +0800
Subject: [PATCH] 量具检定

---
 src/views/tms/modules/inbound/InboundListRight.vue |  130 +++++++++++++++++++++++++++++++------------
 1 files changed, 93 insertions(+), 37 deletions(-)

diff --git a/src/views/tms/modules/inbound/InboundListRight.vue b/src/views/tms/modules/inbound/InboundListRight.vue
index 247a0ab..c08e06e 100644
--- a/src/views/tms/modules/inbound/InboundListRight.vue
+++ b/src/views/tms/modules/inbound/InboundListRight.vue
@@ -1,5 +1,5 @@
 <template>
-  <a-card :bordered="false">
+  <a-card :bordered="false" style="flex: 1;overflow:auto;max-height: 600px; min-height: 600px">
     <!-- 鏌ヨ鍖哄煙 -->
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
@@ -9,7 +9,7 @@
             :sm="8"
           >
             <a-form-item
-              label="宸ュ叿缂栧彿"
+              label="宸ュ叿缂栫爜"
               :labelCol="{span: 5}"
               :wrapperCol="{span: 18, offset: 1}"
             >
@@ -76,6 +76,7 @@
         :loading="loading"
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
         class="j-table-force-nowrap"
+        :customRow="customRow"
         @change="handleTableChange">
 
         <template slot="htmlSlot" slot-scope="text">
@@ -98,23 +99,14 @@
           </a-button>
         </template>
 
-        <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
-
-          <a-divider type="vertical" />
-          <a-dropdown>
-            <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
-            <a-menu slot="overlay">
-              <a-menu-item>
-                <a @click="handleDetail(record)">璇︽儏</a>
-              </a-menu-item>
-              <a-menu-item>
-                <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
-                  <a>鍒犻櫎</a>
-                </a-popconfirm>
-              </a-menu-item>
-            </a-menu>
-          </a-dropdown>
+       <span
+          slot="action"
+          slot-scope="text, record"
+        >
+          <a
+            href="javascript:;"
+            @click="handlePrint(record)"
+          >鎵撳嵃浜岀淮鐮�</a>
         </span>
 
       </a-table>
@@ -146,6 +138,13 @@
 
     <inbound-model ref="modalForm" @ok="modalFormOk" :nodeSelected="nodeSelected"></inbound-model>
     <inbound-apply-model-list ref="inboundApplyModelList"></inbound-apply-model-list>
+    <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-card>
 </template>
 
@@ -165,6 +164,7 @@
   import ParaBladeList from '.././baseTools/ParaBladeList'
   import InboundModel from './InboundModel'
   import InboundApplyModelList from './InboundApplyModelList.vue'
+  import printJS from 'print-js';
 
   export default {
     name: 'InboundListRight',
@@ -187,8 +187,8 @@
         /* 鍒嗛〉鍙傛暟 */
       ipagination:{
         current: 1,
-        pageSize: 10,
-        pageSizeOptions: ['10', '20', '50'],
+        pageSize: 5,
+        pageSizeOptions: ['5', '10', '30'],
         showTotal: (total, range) => {
           return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�"
         },
@@ -257,14 +257,14 @@
               return !text?"":(text.length>10?text.substr(0,10):text)
             }
           },
-          // {
-          //   title: '鎿嶄綔',
-          //   dataIndex: 'action',
-          //   align:"center",
-          //   fixed:"right",
-          //   width:147,
-          //   scopedSlots: { customRender: 'action' }
-          // }
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' }
+          }
         ],
         url: {
           list: "/tms/inStoreDetail/list",
@@ -280,13 +280,15 @@
           exportXlsUrl: "/tms/baseTools/exportXls",
           importExcelUrl: "tms/baseTools/importExcel",
           queryParaByToolCode:"/tms/baseTools/queryByToolCode",
-          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode"
+          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode",
+          print:'/tms/inStoreDetail/print'
         },
         dictOptions:{},
         superFieldList:[],
         nodeSelected: {}, // 褰撳墠閫変腑鐨勮妭鐐规暟鎹�
         paraTypeFlag:'',
-        disableMixinCreated:true
+        disableMixinCreated:true,
+        qrList: []
       }
     },
     created() {
@@ -338,10 +340,21 @@
         this.$bus.$emit('queryTreeData') //鍒锋柊宸︿晶鏍�
       },
 
-      onSelectChange(selectedRowKeys) {
+      customRow(record) {
+        return {
+          on: {
+            click: () => {
+              this.onSelectChange(record.id.split(","), [record]);
+            }
+          }
+        }
+      },
+
+      onSelectChange(selectedRowKeys,selectionRows) {
         this.selectedRowKeys = selectedRowKeys;
+        this.selectionRows = selectionRows
         //閫氳繃id鏌ヨ绠$悊鍙傛暟鍜屽弬鏁版暟鎹�
-        getAction(this.url.queryParaByToolCode, { toolCode: this.selectedRowKeys[0],paraTypeFlag:this.paraTypeFlag}).then((res) => {
+        getAction(this.url.queryParaByToolCode, { toolCode: this.selectionRows[0].toolCodeId,paraTypeFlag:this.paraTypeFlag}).then((res) => {
           if (res.success) {
             if(this.paraTypeFlag === "1"){
               this.$refs.paraCommonToolList.getPara(res.result);
@@ -360,7 +373,7 @@
             this.$message.warning(res.message);
           }
         })
-        getAction(this.url.queryByToolCode, { toolCode: this.selectedRowKeys[0]}).then((res) => {
+        getAction(this.url.queryByToolCode, { toolCode: this.selectionRows[0].toolCodeId}).then((res) => {
           if (res.success) {
             this.$refs.toolsConfigPropertyList.getPara(res.result);
           } else {
@@ -478,8 +491,12 @@
             if (res.success) {
               this.dataSource = res.result.records; // 鏇存柊琛ㄦ牸鏁版嵁
               this.ipagination.total = res.result.total
+              //榛樿閫変腑绗竴鏉℃暟鎹�
+              this.selectedRowKeys[0] = res.result.records[0].id
+              this.selectionRows = res.result.records
+              this.onSelectChange(this.selectedRowKeys,this.selectionRows)
             } else {
-              this.$message.warning("璇烽�夋嫨鍙跺瓙鑺傜偣杩涜鏌ヨ");
+              //this.$message.warning("璇烽�夋嫨鍙跺瓙鑺傜偣杩涜鏌ヨ");
               this.ipagination.total = 0
             }
           })
@@ -487,7 +504,7 @@
             this.loading = false;
           });
         } else {
-          this.$message.warning("璇烽�夋嫨鍙跺瓙鑺傜偣杩涜鏌ヨ");
+          //this.$message.warning("璇烽�夋嫨鍙跺瓙鑺傜偣杩涜鏌ヨ");
         }
       },
       onClearSelected() {
@@ -511,7 +528,46 @@
         this.$refs.paraTurningToolsList.visable = false
         this.$refs.paraBladeList.visable = false
         this.$refs.toolsConfigPropertyList.visable = false
-      }
+      },
+      handlePrint(record){
+          this.loading = true
+          getAction(this.url.print, {onlyCode:record.onlyCode})
+            .then((res) => {
+              if (res.success) {
+                this.qrList = res.result.map((content, i) => ({
+                  onlyCode:res.result[i].onlyCode,
+                  toolName:res.result[i].toolName,
+                  base64: res.result[i].image
+                  }));
+                  this.handleBacthPrint();
+                this.$emit('ok', new Date())
+              } else {
+                this.$message.warning(res.message)
+              }
+            })
+            .finally(() => {
+              this.loading = false
+              this.close()
+            })
+    },
+    // 鎵ц鎵撳嵃
+    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
+        });
+      });
+    }
       
     },
   }

--
Gitblit v1.9.3