Преглед изворни кода

feat(仓库管理): 优化二维码生成功能并增加类型区分

liujt пре 1 месец
родитељ
комит
eead28e63e

+ 9 - 8
src/views/warehouseManagement/warehouseDefinition/add.vue

@@ -43,7 +43,7 @@
             >
               <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
                 <template slot-scope="{ row, $index }">
-                  <el-link type="primary" @click="generateQrcode(row)">二维码</el-link>
+                  <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '库区')">二维码</el-link>
                 </template>
               </el-table-column>
               <el-table-column label="库区编号" prop="code" min-width="120">
@@ -339,7 +339,7 @@
             >
               <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
                 <template slot-scope="{ row, $index }">
-                  <el-link type="primary" @click="generateQrcode(row)">二维码</el-link>
+                  <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '货架')">二维码</el-link>
                 </template>
               </el-table-column>
               <el-table-column
@@ -578,6 +578,11 @@
               :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
             >
               <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
+              <el-table-column label="二维码" prop="qrcode" min-width="100" align="center">
+                <template slot-scope="{ row, $index }">
+                  <el-link v-if="row.id && !row.isEdit" type="primary" @click="generateQrcode(row, '货位')">二维码</el-link>
+                </template>
+              </el-table-column>
               <el-table-column label="货架编号" prop="goodsShelvesCode" align="center">
                 <template slot-scope="{ row }">
                   {{ row.warehouseAreaCode + '-' + row.warehouseAreaGoodsCode }}
@@ -1907,18 +1912,14 @@
         }
         return newArr;
       },
-      generateQrcode(row) {
+      generateQrcode(row, type) {
         console.log(row);
         if(row.isEdit){
           this.$message.warning('请先保存库区');
           return;
         }
-        const codes = this.areaForm.areaGoodsshelvesList
-          .filter((item) => item.reservoirAreaCode === row.code)
-          .map((i) => i.code)
-          .join(',');
         this.$nextTick(() => {
-          this.$refs.qsCodeRef.open(row, codes);
+          this.$refs.qsCodeRef.open(row, type);
         });
       }
     }

+ 18 - 22
src/views/warehouseManagement/warehouseDefinition/components/qsCode.vue

@@ -10,7 +10,7 @@
       title="二维码"
     >
       <div class="qr-code-container">
-        <ele-qr-code :value="text" :size="120" />
+        <ele-qr-code :value="text" :size="140" />
       </div>
     
       <template v-slot:footer>
@@ -44,33 +44,29 @@ export default {
   },
   watch: {},
   methods: {
-    open(row, codes) {
+    open(row, type) {
       this.codeVisible=true
       // let addr =
       //         '' + row.addressName ? row.addressName.replaceAll(',', '') : '';
       //       addr += row.address ? row.address : '';
-      const paramsStr = this.obj_to_str({
-        name: encodeURIComponent(row.name),
-        areaType: encodeURIComponent(warehouseDefinition_areaType.find(item=>item.code==row.extInfo[0].areaType)?.label),
-        attribute: encodeURIComponent(warehouseDefinition_areaAttribute.find(item=>item.code==row.extInfo[0].attribute)?.label),
-        code: encodeURIComponent(row.code),
-        codeList: encodeURIComponent(codes),
-        address: encodeURIComponent(row.extInfo[0].address),
-        areaLength: encodeURIComponent(row.extInfo[0].areaLength),
-        areaWidth: encodeURIComponent(row.extInfo[0].areaWidth),
-        areaHigh: encodeURIComponent(row.extInfo[0].areaHigh),
-        subCount: encodeURIComponent(row.subCount),
-        remark: encodeURIComponent(row.remark),
-      });
+      // const paramsStr = this.obj_to_str({
+      //   name: encodeURIComponent(row.name),
+      //   // areaType: encodeURIComponent(warehouseDefinition_areaType.find(item=>item.code==row.extInfo[0].areaType)?.label),
+      //   // attribute: encodeURIComponent(warehouseDefinition_areaAttribute.find(item=>item.code==row.extInfo[0].attribute)?.label),
+      //   code: encodeURIComponent(row.code),
+      //   // codeList: encodeURIComponent(codes),
+      //   // address: encodeURIComponent(row.extInfo[0].address),
+      //   // areaLength: encodeURIComponent(row.extInfo[0].areaLength),
+      //   // areaWidth: encodeURIComponent(row.extInfo[0].areaWidth),
+      //   // areaHigh: encodeURIComponent(row.extInfo[0].areaHigh),
+      //   // subCount: encodeURIComponent(row.subCount),
+      //   // remark: encodeURIComponent(row.remark),
+      // });
 
-      console.log('二维码参数~~~', paramsStr);
-      this.text =
-        window.location.origin +
-        '/wms/fromQRCode/designDrawing.html' +
-        '?' +
-        paramsStr;
+      console.log('二维码参数~~~', row, type);
+      this.text = `/pages/warehouse/hwQrcode/index?type=${type}&code=${row.code}&id=${row.id}`;
 
-        console.log('二维码~~~', window.location.origin, this.text);
+        console.log('二维码~~~', this.text);
     },
 
     obj_to_str(obj) {