Parcourir la source

Merge branch '生产工单' into 测试

lxf il y a 1 an
Parent
commit
139edb21f2

+ 1 - 1
package.json

@@ -40,6 +40,7 @@
     "jquery": "^3.7.0",
     "js-cookie": "3.0.1",
     "js-table2excel": "^1.1.2",
+    "jsbarcode": "^3.11.5",
     "jsencrypt": "3.3.1",
     "jspdf": "^2.5.1",
     "lossless-json": "^2.0.8",
@@ -58,7 +59,6 @@
     "vue-lazyload": "^3.0.0",
     "vue-router": "4.1.4",
     "vue-super-flow": "^1.3.8",
-    "vue3-barcode": "^1.0.1",
     "vue3-clipboard": "^1.0.0",
     "vue3-print-nb": "^0.1.4"
   },

+ 28 - 0
src/components/CycleBarcode/index.vue

@@ -0,0 +1,28 @@
+<template>
+  <div>
+    <img :id="'barcode' + index" style="max-width: 100%" />
+  </div>
+</template>
+
+<script setup>
+import JsBarcode from "jsbarcode";
+const props = defineProps({
+  value: {
+    type: String,
+    default: "",
+  },
+  index: {
+    type: Number,
+  },
+});
+onMounted(() => {
+  JsBarcode("#barcode" + props.index, String(props.value), {
+    format: "CODE128",
+    lineColor: "#000",
+    background: "white",
+    width: 1.6,
+    height: 50,
+    displayValue: true,
+  });
+});
+</script>

+ 0 - 4
src/main.js

@@ -31,9 +31,6 @@ import { createPinia } from "pinia"; //引入pinia
 import piniaPluginPersist from "pinia-plugin-persist"; //引入pinia数据持久化插件
 import VueLazyLoad from "vue-lazyload";
 
-// 条形码
-import Vue3Barcode from 'vue3-barcode'
-
 // 按钮防抖
 import preReClick from "./directive/preReClick.js";
 
@@ -104,7 +101,6 @@ app.config.globalProperties.useUserStore = useUserStore;
 // 全局组件挂载
 app.component("Pagination", Pagination);
 app.component("TreeSelect", TreeSelect);
-app.component("barcode", Vue3Barcode);
 
 app.use(router);
 app.use(store);

+ 15 - 16
src/views/production/schedule/production-work-order/index.vue

@@ -29,16 +29,12 @@
         <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
       </template>
     </byTable>
-    <!-- style="display: none" -->
-    <div>
+    <div style="display: none">
       <div style="width: 250px" id="printMe">
         <div v-for="(item, index) in QRcodeList" :key="index">
           <div style="height: 442px; padding-top: 2px; overflow: hidden; position: relative">
-            <div style="border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center" v-if="item.orderWlnCode">
-              <barcode :value="item.orderWlnCode" :height="50" :width="1.6" />
-            </div>
-            <div style="border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center" v-else>
-              <barcode :value="item.orderCode" :height="50" :width="1.6" />
+            <div style="border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center">
+              <CycleBarcode :value="item.orderCode" :index="index" style="max-width: 100%"></CycleBarcode>
             </div>
             <div style="display: flex; align-items: center; justify-content: center">
               <div style="width: 150px; height: 150px; margin-top: 8px" :id="'print' + index" :ref="'print' + index">
@@ -59,7 +55,7 @@
           <div style="page-break-after: always"></div>
         </div>
       </div>
-      <el-button type="primary" v-print="printObj" id="printBtnMini"></el-button>
+      <el-button type="primary" style="display: none" v-print="printObj" id="printBtnMini"></el-button>
     </div>
   </el-card>
 </template>
@@ -69,6 +65,7 @@ import byTable from "/src/components/byTable/index";
 import { getNearDays } from "/src/utils/util";
 import QRCode from "qrcodejs2-fix";
 import { ElMessage } from "element-plus";
+import CycleBarcode from "/src/components/CycleBarcode";
 
 const { proxy } = getCurrentInstance();
 const sourceList = ref({
@@ -86,7 +83,7 @@ const sourceList = ref({
     productionWorkOrderCode: "",
     beginTime: "",
     endTime: "",
-    type: 15,
+    type: 3,
   },
 });
 const loading = ref(false);
@@ -279,9 +276,9 @@ const getList = async (req, status) => {
     sourceList.value.pagination = {
       pageNum: sourceList.value.pagination.pageNum,
       pageSize: sourceList.value.pagination.pageSize,
-      type: 15,
-      beginTime: getNearDays(15).beginTime,
-      endTime: getNearDays(15).endTime,
+      type: 3,
+      beginTime: getNearDays(3).beginTime,
+      endTime: getNearDays(3).endTime,
     };
   } else {
     sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
@@ -304,7 +301,7 @@ const getList = async (req, status) => {
     }, 200);
   });
 };
-getList({ beginTime: getNearDays(15).beginTime, endTime: getNearDays(15).endTime });
+getList({ beginTime: getNearDays(3).beginTime, endTime: getNearDays(3).endTime });
 const clickReset = () => {
   getList("", true);
 };
@@ -338,7 +335,7 @@ const clickPrint = (list) => {
   nextTick(() => {
     for (let i = 0; i < QRcodeList.value.length; i++) {
       proxy.$refs["print" + i][0].innerHTML = ""; //清除二维码方法一
-      let text = QRcodeList.value[i].skuSpecCode
+      let text = QRcodeList.value[i].skuSpecCode;
       new QRCode(proxy.$refs["print" + i][0], {
         text: text, //页面地址 ,如果页面需要参数传递请注意哈希模式#
         width: 150,
@@ -348,8 +345,10 @@ const clickPrint = (list) => {
         correctLevel: QRCode.CorrectLevel.H,
       });
     }
-    const btn = document.getElementById("printBtnMini");
-    btn.click();
+    nextTick(() => {
+      const btn = document.getElementById("printBtnMini");
+      btn.click();
+    });
   });
 };
 const clickSelectPrint = () => {