ysy il y a 2 ans
Parent
commit
d0adef6541
3 fichiers modifiés avec 42 ajouts et 28 suppressions
  1. 0 1
      package.json
  2. 9 0
      src/api/produceOrder/index.js
  3. 33 27
      src/views/produceOrder/index.vue

+ 0 - 1
package.json

@@ -39,7 +39,6 @@
     "json-bigint": "^1.0.0",
     "jspdf": "^2.5.1",
     "nprogress": "^0.2.0",
-    "qrcodejs2": "^0.0.2",
     "tinymce": "^5.10.5",
     "vue": "^2.7.10",
     "vue-clipboard2": "^0.3.3",

+ 9 - 0
src/api/produceOrder/index.js

@@ -153,3 +153,12 @@ export async function getSoltNum (id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 打印前查询
+export async function queryPrint (data) {
+  const res = await request.post(`/mes/workorder/queryPrint`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 33 - 27
src/views/produceOrder/index.vue

@@ -23,6 +23,9 @@
           <el-button type="success" @click="toEnd()">批量完结</el-button>
           <!-- <el-button type="success" @click="handleCreate">创建工单</el-button> -->
           <!-- <el-button type="success">工单操作控制</el-button> -->
+
+          <el-button type="success" @click="allPrinting()">批量打印二维码</el-button>
+
         </template>
 
 
@@ -71,10 +74,9 @@
 
     <ele-modal title="二维码" :visible.sync="QRvisible" width="450px">
 
-      <div style="width: 400px ;text-align: center;  display: flex;  flex-direction: column;  align-items: center;"
-        id="printSection">
-        <div id="qrCode" ref="qrCode"></div>
-        <div style="width: 400px; font-size: 12px;     margin-top: 16px; text-align: left;">{{ qrCode }}</div>
+      <div >
+   
+      
       </div>
 
       <div slot="footer">
@@ -94,13 +96,15 @@
 import {
   getPage,
   batchCompletion,
-  cancelCompletion
+  cancelCompletion,
+  queryPrint
 } from '@/api/produceOrder/index.js';
 import produceOrderSearch from './components/produceOrder-search.vue';
 import createDialog from './components/createDialog.vue';
 import unpackDialog from './components/unpackDialog.vue';
 import pickingDialog from './components/pickingDialog.vue';
-import QRCode from 'qrcodejs2'
+
+
 export default {
   components: {
     produceOrderSearch,
@@ -135,7 +139,7 @@ export default {
       selection: [],
 
       QRvisible: false,
-      qrCode: null,
+
     };
   },
   computed: {
@@ -311,8 +315,8 @@ export default {
           showOverflowTooltip: true,
         },
 
-        
-    
+
+
 
 
         {
@@ -497,29 +501,31 @@ export default {
       this.QRvisible = true
 
       this.$nextTick(() => {
-        this.creatQrCode("qrCode", row.code);
+
       })
     },
 
-    // 生成二维码
-    creatQrCode(refName, text) {
-      if (document.getElementById(refName)) {
-        document.getElementById(refName).innerHTML = ''; //防止重复生成二维码
-        this.qrCode = null
-        this.$nextTick(function () {
-          this.qrCode = text
-          new QRCode(document.getElementById(refName), {
-            text: text, // 二维码内容
-            width: 120,
-            height: 120,
-            colorDark: '#333333', // 二维码颜色
-            colorLight: '#ffffff', // 二维码背景色
-            correctLevel: QRCode.CorrectLevel.L,
-          })
-        })
-      }
+    allPrinting() {
+      console.log(this.selection)
+      let ids = this.findAllIds(this.selection);
+      console.log(ids)
     },
 
+    findAllIds(nodes) {
+      let ids = [];
+      nodes.forEach(node => {
+        ids.push(node.id); // 添加当前节点的id
+        if (node.children && node.children.length > 0) {
+          // 递归调用自身来处理子节点
+          ids = ids.concat(this.findAllIds(node.children));
+        }
+      });
+      return ids;
+    },
+
+
+
+
     print() {
       const printSection = document.getElementById('printSection');
       // 创建打印任务