فهرست منبع

增加扫物料码的功能

cz 1 سال پیش
والد
کامیت
8a74e767c9

+ 23 - 30
src/views/product/material/index.vue

@@ -66,22 +66,14 @@
       </template>
     </el-dialog>
 
-    <el-dialog title="打印" v-if="printDialog" v-model="printDialog" width="500">
-      <div style="padding-right: 20px">
+    <el-dialog title="打印" v-if="printDialog" v-model="printDialog" width="280">
+      <div>
         <div id="pdfDom">
-          <div style="display: flex ;border: 1px solid #000; padding: 10px; margin-bottom: 20px">
+          <div style="border: 1px solid #000; padding: 10px;">
             <div :ref="rowData.id"></div>
-            <div style="
-                  margin-left: 20px;
-                  display: flex;
-                  padding: 10px 0;
-                  flex-direction: column;
-                  justify-content: space-between;
-                ">
-
-              <div class="print-row">物料名称:{{ rowData.name }}</div>
-              <div class="print-row">规格型号:{{ rowData.spec }}</div>
-
+            <div>
+              <div class="print-row" style="margin-top: 10px">物料名称:{{ rowData.name }}</div>
+              <div class="print-row" style="margin-top: 5px">规格型号:{{ rowData.spec }}</div>
             </div>
           </div>
         </div>
@@ -281,19 +273,19 @@ const config = computed(() => {
                   });
                 },
               },
-          // props.selectStatus
-          //   ? {}
-          //   : {
-          //       attrs: {
-          //         label: "查看二维码",
-          //         type: "primary",
-          //         text: true,
-          //       },
-          //       el: "button",
-          //       click() {
-          //         handlePrint(row);
-          //       },
-          //     },
+          props.selectStatus
+            ? {}
+            : {
+                attrs: {
+                  label: "查看",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  handlePrint(row);
+                },
+              },
         ];
       },
     },
@@ -578,13 +570,14 @@ const rowData = ref({});
 const handlePrint = (row) => {
   printDialog.value = true;
   rowData.value = row;
-  let url = `http://139.9.102.170:10021/jxst/pro/materialDetails?productId=${row.id}`;
+  // let url = `http://139.9.102.170:10021/jxst/pro/materialDetails?productId=${row.id}`;
+  let url = `materialId=${row.id}`;
   nextTick(() => {
     proxy.$refs[row.id].innerHTML = ""; //清除二维码方法一
     new QRCode(proxy.$refs[row.id], {
       text: url,
-      width: 100,
-      height: 100,
+      width: 200,
+      height: 200,
       colorDark: "#000000",
       colorLight: "#ffffff",
       correctLevel: QRCode.CorrectLevel.H,

+ 40 - 20
src/views/purchaseSales/outAndInWarehouse/manualDelivery/index.vue

@@ -440,32 +440,52 @@ const handleScanValueChange = (val) => {
   if (val) {
     let value = val;
     let arr = [];
-    if (value.includes("sn")) {
+    if (value.includes("sn") || value.includes("materialId")) {
       arr = value.split("=");
     }
     scanValue.value = "";
     timer.value && clearTimeout(timer.value);
     timer.value = setTimeout(() => {
       if (arr.length > 1) {
-        return proxy
-          .post("/productionTaskDetail/snInfo", {
-            productSn: arr[arr.length - 1],
-          })
-          .then(
-            (res) => {
-              formData.data.list.push({
-                isScan: "1",
-                productCode: res.productCode,
-                productId: res.productId,
-                productName: res.productName,
-                productSpec: res.productSpec,
-                productUnit: res.productUnit,
-                quantity: 1,
-                purchaseDetailId: "",
-              });
-            },
-            (err) => {}
-          );
+        if (value.includes("sn")) {
+          return proxy
+            .post("/productionTaskDetail/snInfo", {
+              productSn: arr[arr.length - 1],
+            })
+            .then(
+              (res) => {
+                formData.data.list.push({
+                  isScan: "1",
+                  productCode: res.productCode,
+                  productId: res.productId,
+                  productName: res.productName,
+                  productSpec: res.productSpec,
+                  productUnit: res.productUnit,
+                  quantity: 1,
+                  purchaseDetailId: "",
+                });
+              },
+              (err) => {}
+            );
+        } else {
+          return proxy
+            .post("/productInfo/detail", { id: arr[arr.length - 1] })
+            .then(
+              (res) => {
+                formData.data.list.push({
+                  isScan: "1",
+                  productCode: res.code,
+                  productId: res.id,
+                  productName: res.name,
+                  productSpec: res.spec,
+                  productUnit: res.unit,
+                  quantity: 1,
+                  purchaseDetailId: "",
+                });
+              },
+              (err) => {}
+            );
+        }
       }
 
       proxy.post("/purchaseDetail/detail", { id: value }).then(

+ 42 - 21
src/views/purchaseSales/outAndInWarehouse/manualWarehousing/index.vue

@@ -482,33 +482,54 @@ const handleScanValueChange = (val) => {
   if (val) {
     let value = val;
     let arr = [];
-    if (value.includes("sn")) {
+    if (value.includes("sn") || value.includes("materialId")) {
       arr = value.split("=");
     }
     scanValue.value = "";
     timer.value && clearTimeout(timer.value);
     timer.value = setTimeout(() => {
       if (arr.length > 1) {
-        return proxy
-          .post("/productionTaskDetail/snInfo", {
-            productSn: arr[arr.length - 1],
-          })
-          .then(
-            (res) => {
-              formData.data.list.push({
-                isScan: "1",
-                productCode: res.productCode,
-                productId: res.productId,
-                productName: res.productName,
-                productSpec: res.productSpec,
-                productUnit: res.productUnit,
-                quantity: 1,
-                purchaseDetailId: "",
-              });
-              getSummaryList();
-            },
-            (err) => {}
-          );
+        if (value.includes("sn")) {
+          return proxy
+            .post("/productionTaskDetail/snInfo", {
+              productSn: arr[arr.length - 1],
+            })
+            .then(
+              (res) => {
+                formData.data.list.push({
+                  isScan: "1",
+                  productCode: res.productCode,
+                  productId: res.productId,
+                  productName: res.productName,
+                  productSpec: res.productSpec,
+                  productUnit: res.productUnit,
+                  quantity: 1,
+                  purchaseDetailId: "",
+                });
+                getSummaryList();
+              },
+              (err) => {}
+            );
+        } else {
+          return proxy
+            .post("/productInfo/detail", { id: arr[arr.length - 1] })
+            .then(
+              (res) => {
+                formData.data.list.push({
+                  isScan: "1",
+                  productCode: res.code,
+                  productId: res.id,
+                  productName: res.name,
+                  productSpec: res.spec,
+                  productUnit: res.unit,
+                  quantity: 1,
+                  purchaseDetailId: "",
+                });
+                getSummaryList();
+              },
+              (err) => {}
+            );
+        }
       }
 
       proxy.post("/purchaseDetail/detail", { id: value }).then(