cz 1 year ago
parent
commit
89f0329f2a

BIN
src/assets/images/scaning.gif


BIN
src/assets/images/scanz.png


+ 142 - 69
src/views/purchaseSales/outAndInWarehouse/manualDelivery/index.vue

@@ -11,46 +11,66 @@
       </byTable>
     </div>
 
-    <el-dialog title="手动出库" v-if="dialogVisible" v-model="dialogVisible" width="1000" v-loading="loadingDialog">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
-        <template #workOrderId>
-          <div style="width: 100%">
-            <el-button type="primary" @click="openOrder = true">选择工单</el-button>
-            <div style="margin-top: 10px" v-if="selectOrder">
-              已选择: {{ selectOrder }}
-            </div>
-          </div>
-        </template>
-        <template #details>
-          <div style="width: 100%">
-            <el-button type="primary" @click="clickAdd()">添加明细</el-button>
-            <el-table :data="formData.data.list" style="width: 100%; margin-top: 16px">
-              <el-table-column prop="productCode" label="产品编码" width="140" />
-              <el-table-column prop="productName" label="产品名称" min-width="160" />
-              <el-table-column prop="productSpec" label="规格型号" width="160" />
-              <el-table-column prop="productUnit" label="单位" width="100" :formatter="
-                  (row) => dictValueLabel(row.productUnit, productUnit)
+    <el-dialog title="手动出库" v-if="dialogVisible" v-model="dialogVisible" width="1300" v-loading="loadingDialog">
+      <div style="width:100%;display:flex">
+        <div style="flex:1;overflow:auto;height:calc(100vh - 300px)">
+          <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+            <template #workOrderId>
+              <div style="width: 100%">
+                <el-button type="primary" @click="openOrder = true">选择工单</el-button>
+                <div style="margin-top: 10px" v-if="selectOrder">
+                  已选择: {{ selectOrder }}
+                </div>
+              </div>
+            </template>
+            <template #details>
+              <div style="width: 100%">
+                <el-button type="primary" @click="clickAdd()">添加明细</el-button>
+                <el-table :data="formData.data.list" style=" margin-top: 16px">
+                  <el-table-column label="是否扫码" width="80" :formatter="
+                                     (row) => dictValueLabel(row.isScan, scanData)
+                " />
+                  <el-table-column prop="productCode" label="产品编码" width="140" />
+                  <el-table-column prop="productName" label="产品名称" min-width="160" />
+                  <el-table-column prop="productSpec" label="规格型号" width="120" />
+                  <el-table-column prop="productUnit" label="单位" width="80" :formatter="
+                                  (row) => dictValueLabel(row.productUnit, productUnit)
                 " />
-              <el-table-column prop="productQuantity" label="库存数量" width="120" />
-              <el-table-column label="出库数量" width="160">
-                <template #default="{ row, $index }">
-                  <div style="width: 100%">
-                    <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
-                      <el-input-number v-model="row.quantity" placeholder="请输入出库数量" style="width: 100%" :precision="0" :controls="false" :min="1"
-                                       onmousewheel="return false;" />
-                    </el-form-item>
-                  </div>
-                </template>
-              </el-table-column>
-              <el-table-column align="center" label="操作" width="80" fixed="right">
-                <template #default="{ row, $index }">
-                  <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-        </template>
-      </byForm>
+                  <el-table-column label="出库数量" width="160">
+                    <template #default="{ row, $index }">
+                      <div style="width: 100%">
+                        <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                          <el-input-number v-model="row.quantity" placeholder="请输入出库数量" style="width: 100%" :precision="0" :controls="false" :min="1"
+                                           :disabled="row.isScan =='1'" onmousewheel="return false;" />
+                        </el-form-item>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column align="center" label="操作" width="80" fixed="right">
+                    <template #default="{ row, $index }">
+                      <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </template>
+          </byForm>
+        </div>
+        <div style="width:300px;margin-left:20px">
+          <el-card class="box-card" style="height:100%;position: relative;">
+            <div class="box">
+              <img src="@/assets/images/scanz.png" class="img" v-if="!isScan" />
+              <img src="@/assets/images/scaning.gif" class="img" v-if="isScan" />
+              <div class="titlea" @click.stop="handleClickScan">
+                {{btnTitle}}
+              </div>
+              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
+                        @blur="handleScanBlur" class="input" />
+            </div>
+          </el-card>
+        </div>
+      </div>
+
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
@@ -291,31 +311,10 @@ const clickAdd = () => {
 const changeWarehouse = () => {
   formData.data.list = [];
 };
-const select = (item) => {
-  if (formData.data.list && formData.data.list.length > 0) {
-    let data = formData.data.list.filter(
-      (row) => row.productId === item.productId
-    );
-    if (data && data.length > 0) {
-      return ElMessage("请勿重复添加");
-    }
-  }
-  formData.data.list.push({
-    productCode: item.productCode,
-    productId: item.productId,
-    productName: item.productName,
-    productSpec: item.productSpec,
-    productUnit: item.productUnit,
-    productQuantity: item.quantity,
-    quantity: undefined,
-  });
-  ElMessage({
-    message: "添加成功!",
-    type: "success",
-  });
-};
+
 const pushGoods = (goods) => {
   const arr = goods.map((item) => ({
+    isScan: "0",
     productCode: item.productCode,
     productId: item.productId,
     productName: item.productName,
@@ -323,6 +322,7 @@ const pushGoods = (goods) => {
     productUnit: item.productUnit,
     productQuantity: item.quantity,
     quantity: undefined,
+    purchaseDetailId: "",
   }));
   formData.data.list = formData.data.list.concat(arr);
   openProduct.value = false;
@@ -340,13 +340,13 @@ const submitForm = () => {
       });
     }
     if (formData.data.list && formData.data.list.length > 0) {
-      for (let i = 0; i < formData.data.list.length; i++) {
-        if (
-          formData.data.list[i].productQuantity < formData.data.list[i].quantity
-        ) {
-          return ElMessage("出库数量不能大于库存数量");
-        }
-      }
+      // for (let i = 0; i < formData.data.list.length; i++) {
+      //   if (
+      //     formData.data.list[i].productQuantity < formData.data.list[i].quantity
+      //   ) {
+      //     return ElMessage("出库数量不能大于库存数量");
+      //   }
+      // }
     } else {
       return ElMessage("请添加出库产品");
     }
@@ -381,6 +381,50 @@ const handleSelectRow = (row) => {
   });
   openOrder.value = false;
 };
+const scanData = ref([
+  {
+    label: "是",
+    value: "1",
+  },
+  {
+    label: "否",
+    value: "0",
+  },
+]);
+const scanValue = ref("");
+const isScan = ref(false);
+const btnTitle = ref("扫码出库");
+const scanInput = ref(null);
+const handleClickScan = () => {
+  isScan.value = !isScan.value;
+  btnTitle.value = isScan.value ? "取消扫码" : "扫码出库";
+  if (isScan.value) {
+    scanInput.value.focus();
+  }
+};
+const handleScanBlur = () => {
+  setTimeout(() => {
+    isScan.value = false;
+    btnTitle.value = "扫码出库";
+  }, 100);
+};
+const handleScanValueChange = (val) => {
+  if (val) {
+    proxy.post("/purchaseDetail/detail", { id: val }).then((res) => {
+      formData.data.list.push({
+        isScan: "1",
+        productCode: res.productCode,
+        productId: res.bussinessId,
+        productName: res.productName,
+        productSpec: res.productSpec,
+        productUnit: res.productUnit,
+        quantity: 1,
+        purchaseDetailId: val,
+      });
+      scanValue.value = "";
+    });
+  }
+};
 </script>
 
 <style lang="scss" scoped>
@@ -390,4 +434,33 @@ const handleSelectRow = (row) => {
 ::v-deep(.el-input-number .el-input__inner) {
   text-align: left;
 }
+.box {
+  position: absolute;
+  top: 50%;
+  transform: translate(0, -50%);
+  .img {
+    width: 260px;
+    height: 260px;
+    object-fit: contain;
+    vertical-align: middle;
+    // cursor: pointer;
+    z-index: 10;
+  }
+  .titlea {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    font-size: 20px;
+    font-weight: 700;
+    color: #5df5e9;
+    cursor: pointer;
+  }
+  .input {
+    opacity: 1;
+    position: absolute;
+    top: 0;
+    left: 0;
+  }
+}
 </style>

+ 130 - 37
src/views/purchaseSales/outAndInWarehouse/manualWarehousing/index.vue

@@ -11,46 +11,66 @@
       </byTable>
     </div>
 
-    <el-dialog title="手动入库" v-if="dialogVisible" v-model="dialogVisible" width="1000" v-loading="loadingDialog">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
-        <template #workOrderId>
-          <div style="width: 100%">
-            <el-button type="primary" @click="openOrder = true">选择工单</el-button>
-            <div style="margin-top: 10px" v-if="selectOrder">
-              已选择: {{ selectOrder }}
-            </div>
-          </div>
-        </template>
+    <el-dialog title="手动入库" v-if="dialogVisible" v-model="dialogVisible" width="1300" v-loading="loadingDialog">
+      <div style="width:100%;display:flex">
+        <div style="flex:1;overflow:auto;height:calc(100vh - 300px)">
+          <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+            <template #workOrderId>
+              <div style="width: 100%">
+                <el-button type="primary" @click="openOrder = true">选择工单</el-button>
+                <div style="margin-top: 10px" v-if="selectOrder">
+                  已选择: {{ selectOrder }}
+                </div>
+              </div>
+            </template>
 
-        <template #details>
-          <div style="width: 100%">
-            <el-button type="primary" @click="openProduct = true">添加明细</el-button>
-            <el-table :data="formData.data.list" style="width: 100%; margin-top: 16px">
-              <el-table-column prop="productCode" label="产品编码" width="140" />
-              <el-table-column prop="productName" label="产品名称" min-width="220" />
-              <el-table-column prop="productSpec" label="规格型号" min-width="220" />
-              <el-table-column prop="productUnit" label="单位" width="100" :formatter="
+            <template #details>
+              <div style="width: 100%">
+                <el-button type="primary" @click="openProduct = true">添加明细</el-button>
+                <el-table :data="formData.data.list" style=" margin-top: 16px">
+                  <el-table-column label="是否扫码" width="80" :formatter="
+                                     (row) => dictValueLabel(row.isScan, scanData)
+                " />
+                  <el-table-column prop="productCode" label="产品编码" width="140" />
+                  <el-table-column prop="productName" label="产品名称" min-width="160" />
+                  <el-table-column prop="productSpec" label="规格型号" width="120" />
+                  <el-table-column prop="productUnit" label="单位" width="80" :formatter="
                   (row) => dictValueLabel(row.productUnit, productUnit)
                 " />
-              <el-table-column label="入库数量" width="160">
-                <template #default="{ row, $index }">
-                  <div style="width: 100%">
-                    <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
-                      <el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="1"
-                                       onmousewheel="return false;" />
-                    </el-form-item>
-                  </div>
-                </template>
-              </el-table-column>
-              <el-table-column align="center" label="操作" width="80" fixed="right">
-                <template #default="{ row, $index }">
-                  <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-        </template>
-      </byForm>
+                  <el-table-column label="入库数量" width="160">
+                    <template #default="{ row, $index }">
+                      <div style="width: 100%">
+                        <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                          <el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="1"
+                                           :disabled="row.isScan =='1'" onmousewheel="return false;" />
+                        </el-form-item>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column align="center" label="操作" width="80" fixed="right">
+                    <template #default="{ row, $index }">
+                      <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </template>
+          </byForm>
+        </div>
+        <div style="width:300px;margin-left:20px">
+          <el-card class="box-card" style="height:100%;position: relative;">
+            <div class="box">
+              <img src="@/assets/images/scanz.png" class="img" v-if="!isScan" />
+              <img src="@/assets/images/scaning.gif" class="img" v-if="isScan" />
+              <div class="titlea" @click.stop="handleClickScan">
+                {{btnTitle}}
+              </div>
+              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
+                        @blur="handleScanBlur" class="input" />
+            </div>
+          </el-card>
+        </div>
+      </div>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
@@ -350,6 +370,50 @@ const handleSelectRow = (row) => {
   });
   openOrder.value = false;
 };
+const scanData = ref([
+  {
+    label: "是",
+    value: "1",
+  },
+  {
+    label: "否",
+    value: "0",
+  },
+]);
+const scanValue = ref("");
+const isScan = ref(false);
+const btnTitle = ref("扫码出库");
+const scanInput = ref(null);
+const handleClickScan = () => {
+  isScan.value = !isScan.value;
+  btnTitle.value = isScan.value ? "取消扫码" : "扫码入库";
+  if (isScan.value) {
+    scanInput.value.focus();
+  }
+};
+const handleScanBlur = () => {
+  setTimeout(() => {
+    isScan.value = false;
+    btnTitle.value = "扫码入库";
+  }, 100);
+};
+const handleScanValueChange = (val) => {
+  if (val) {
+    proxy.post("/purchaseDetail/detail", { id: val }).then((res) => {
+      formData.data.list.push({
+        isScan: "1",
+        productCode: res.productCode,
+        productId: res.bussinessId,
+        productName: res.productName,
+        productSpec: res.productSpec,
+        productUnit: res.productUnit,
+        quantity: 1,
+        purchaseDetailId: val,
+      });
+      scanValue.value = "";
+    });
+  }
+};
 </script>
 
 <style lang="scss" scoped>
@@ -359,4 +423,33 @@ const handleSelectRow = (row) => {
 ::v-deep(.el-input-number .el-input__inner) {
   text-align: left;
 }
+.box {
+  position: absolute;
+  top: 50%;
+  transform: translate(0, -50%);
+  .img {
+    width: 260px;
+    height: 260px;
+    object-fit: contain;
+    vertical-align: middle;
+    // cursor: pointer;
+    z-index: 10;
+  }
+  .titlea {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    font-size: 20px;
+    font-weight: 700;
+    color: #5df5e9;
+    cursor: pointer;
+  }
+  .input {
+    opacity: 1;
+    position: absolute;
+    top: 0;
+    left: 0;
+  }
+}
 </style>

+ 202 - 13
src/views/purchaseSales/outAndInWarehouse/waitingForDelivery/index.vue

@@ -34,9 +34,79 @@
       </byTable>
     </div>
 
-    <el-dialog title="出库" v-if="dialogVisible" v-model="dialogVisible" width="400" v-loading="loadingDialog">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
-      </byForm>
+    <el-dialog title="出库" v-if="dialogVisible" v-model="dialogVisible" width="1300" v-loading="loadingDialog">
+      <div style="width:100%;display:flex">
+        <div style="flex:1;overflow:auto;height:calc(100vh - 300px)">
+          <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+            <template #details>
+              <div style="width: 100%">
+                <el-button type="primary" @click="clickAdd()">添加明细</el-button>
+                <el-table :data="formData.data.stockWaitDetailsList" style=" margin-top: 16px">
+                  <el-table-column label="是否扫码" width="80" :formatter="
+                                     (row) => dictValueLabel(row.isScan, scanData)
+                " />
+                  <el-table-column prop="productCode" label="产品编码" width="140" />
+                  <el-table-column prop="productName" label="产品名称" min-width="160" />
+                  <el-table-column prop="productSpec" label="规格型号" width="120" />
+                  <el-table-column prop="productUnit" label="单位" width="80" :formatter="
+                                  (row) => dictValueLabel(row.productUnit, productUnit)
+                " />
+                  <el-table-column label="出库数量" width="160">
+                    <template #default="{ row, $index }">
+                      <div style="width: 100%">
+                        <el-form-item :prop="'stockWaitDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                          <el-input-number v-model="row.quantity" placeholder="请输入出库数量" style="width: 100%" :precision="0" :controls="false" :min="1"
+                                           :disabled="row.isScan =='1'" onmousewheel="return false;" />
+                        </el-form-item>
+                      </div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column align="center" label="操作" width="80" fixed="right">
+                    <template #default="{ row, $index }">
+                      <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </template>
+          </byForm>
+        </div>
+        <div style="width:300px;margin-left:20px">
+          <el-card class="box-card" style="height:100%;position: relative;">
+            <div class="box">
+              <img src="@/assets/images/scanz.png" class="img" v-if="!isScan" />
+              <img src="@/assets/images/scaning.gif" class="img" v-if="isScan" />
+              <div class="titlea" @click.stop="handleClickScan">
+                {{btnTitle}}
+              </div>
+              <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
+                        @blur="handleScanBlur" class="input" />
+            </div>
+          </el-card>
+        </div>
+
+      </div>
+
+      <!-- <div style="display:flex">
+        <div style="width:50%">
+          <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+          </byForm>
+        </div>
+        <div style="width:50%;padding-left:20px;padding-top:10px">
+          <div>
+            <el-button type="primary" @click="handleClickScan">{{btnTitle}}</el-button>
+          </div>
+          <div style="margin:15px 0px">
+            <el-input v-model="textarea" :rows="5" type="textarea" :disabled="!isScan" ref="scanInput" />
+          </div>
+          <TitleInfo content="已扫码产品"></TitleInfo>
+          <el-table :data="scanCodeData" style="margin-top: 10px">
+            <el-table-column prop="productName" label="产品名称" />
+            <el-table-column prop="productSpec" label="规格型号" width="100" />
+            <el-table-column prop="productSpec" label="单价" width="100" />
+          </el-table>
+        </div>
+      </div> -->
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
@@ -51,6 +121,7 @@ import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
 import useUserStore from "@/store/modules/user";
+import TitleInfo from "@/components/TitleInfo/index.vue";
 
 const { proxy } = getCurrentInstance();
 const warehouseList = ref([]);
@@ -359,13 +430,18 @@ const formConfig = computed(() => {
       required: true,
       data: warehouseList.value,
     },
+    // {
+    //   type: "number",
+    //   prop: "warehousingQuantity",
+    //   label: "出库数量",
+    //   precision: 0,
+    //   min: 1,
+    //   controls: false,
+    // },
     {
-      type: "number",
-      prop: "warehousingQuantity",
-      label: "出库数量",
-      precision: 0,
-      min: 1,
-      controls: false,
+      type: "slot",
+      slotName: "details",
+      label: "出库明细",
     },
     {
       type: "input",
@@ -386,6 +462,7 @@ const rules = ref({
   warehousingQuantity: [
     { required: true, message: "请输入出库数量", trigger: "blur" },
   ],
+  quantity: [{ required: true, message: "请输入出库数量", trigger: "blur" }],
   exWarehousePerson: [
     { required: true, message: "请输入出库人", trigger: "blur" },
   ],
@@ -396,9 +473,17 @@ const rules = ref({
 const submitForm = () => {
   submit.value.handleSubmit(() => {
     loadingDialog.value = true;
-    if (
-      formData.data.warehousingQuantity > Number(formData.data.waitQuantity)
-    ) {
+    if (!(formData.data.stockWaitDetailsList.length > 0)) {
+      return ElMessage({
+        message: "请添加出库明细",
+        type: "info",
+      });
+    }
+    const total = formData.data.stockWaitDetailsList.reduce(
+      (val, x) => (val += x.quantity),
+      0
+    );
+    if (Number(total) > Number(formData.data.waitQuantity)) {
       return ElMessage({
         message: "出库数量不可大于待出库数量",
         type: "info",
@@ -406,11 +491,12 @@ const submitForm = () => {
     }
     proxy
       .post("/stockWait/add", {
-        id: formData.data.id,
+        id: formData.data.stockWaitId,
         warehouseId: formData.data.warehouseId,
         quantity: formData.data.warehousingQuantity,
         exWarehousePerson: formData.data.exWarehousePerson,
         receivingPerson: formData.data.receivingPerson,
+        stockWaitDetailsList: formData.data.stockWaitDetailsList,
       })
       .then(
         () => {
@@ -428,12 +514,86 @@ const submitForm = () => {
       );
   });
 };
+const rowData = ref({});
 const clickOperation = (row) => {
+  rowData.value = row;
   formData.data = row;
+  formData.data.stockWaitDetailsList = [];
   formData.data.exWarehousePerson = useUserStore().user.nickName;
   loadingDialog.value = false;
   dialogVisible.value = true;
 };
+
+const scanData = ref([
+  {
+    label: "是",
+    value: "1",
+  },
+  {
+    label: "否",
+    value: "0",
+  },
+]);
+const scanValue = ref("");
+const isScan = ref(false);
+const btnTitle = ref("扫码出库");
+const scanInput = ref(null);
+const handleClickScan = () => {
+  isScan.value = !isScan.value;
+  btnTitle.value = isScan.value ? "取消扫码" : "扫码出库";
+  if (isScan.value) {
+    scanInput.value.focus();
+  }
+};
+const handleScanBlur = () => {
+  setTimeout(() => {
+    isScan.value = false;
+    btnTitle.value = "扫码出库";
+  }, 100);
+};
+const handleScanValueChange = (val) => {
+  if (val) {
+    proxy.post("/purchaseDetail/detail", { id: val }).then((res) => {
+      if (res.bussinessId != rowData.value.productId) {
+        ElMessage({
+          message: "请扫正确的产品",
+          type: "info",
+        });
+      } else {
+        formData.data.stockWaitDetailsList.push({
+          id: rowData.value.id,
+          isScan: "1",
+          productCode: res.productCode,
+          productId: res.bussinessId,
+          productName: res.productName,
+          productSpec: res.productSpec,
+          productUnit: res.productUnit,
+          quantity: 1,
+          purchaseDetailId: val,
+        });
+      }
+      scanValue.value = "";
+    });
+  }
+};
+
+const clickAdd = () => {
+  formData.data.stockWaitDetailsList.push({
+    id: formData.data.id,
+    isScan: "0",
+    productCode: formData.data.productCode,
+    productId: formData.data.productId,
+    productName: formData.data.productName,
+    productSpec: formData.data.productSpec,
+    productUnit: formData.data.productUnit,
+    quantity: undefined,
+    purchaseDetailId: "",
+  });
+};
+
+const handleDelete = (index) => {
+  formData.data.stockWaitDetailsList.splice(index, 1);
+};
 </script>
 
 <style lang="scss" scoped>
@@ -449,4 +609,33 @@ const clickOperation = (row) => {
   color: #fff;
   border-radius: 4px;
 }
+.box {
+  position: absolute;
+  top: 50%;
+  transform: translate(0, -50%);
+  .img {
+    width: 260px;
+    height: 260px;
+    object-fit: contain;
+    vertical-align: middle;
+    // cursor: pointer;
+    z-index: 10;
+  }
+  .titlea {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    font-size: 20px;
+    font-weight: 700;
+    color: #5df5e9;
+    cursor: pointer;
+  }
+  .input {
+    opacity: 1;
+    position: absolute;
+    top: 0;
+    left: 0;
+  }
+}
 </style>

+ 82 - 1
src/views/purchaseSales/outAndInWarehouse/waitingForStorage/index.vue

@@ -38,6 +38,32 @@
         <el-button type="primary" v-print="printObj" size="large">打 印</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="打印二维码" v-if="printDialogOne" v-model="printDialogOne" width="400">
+      <div style=" padding-right: 20px">
+        <div id="pdfDom" style="width:100%">
+          <div v-for="(item,index) in qrList" :key="index"
+               style="border: 1px solid #000; padding: 10px; margin:0 auto;margin-bottom: 20px;display:flex">
+            <div :ref="item.scanValue">
+              {{item.scanValue}}
+            </div>
+            <div style="margin-left:10px;display:flex;flex-direction:column;justify-content:space-around">
+              <div> 产品名称:{{item.productName}}</div>
+              <div>
+                规格型号:{{item.productSpec}}
+              </div>
+            </div>
+            <!-- 换页 -->
+            <div style="page-break-after: always"></div>
+          </div>
+        </div>
+      </div>
+
+      <template #footer>
+        <el-button @click="printDialogOne = false" size="large">取 消</el-button>
+        <el-button type="primary" v-print="printObj" size="large">打 印</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -48,6 +74,7 @@ import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
 // import JsBarcode from "jsbarcode";
 import ProductionPDF from "@/components/PDF/productionPDF.vue";
+import QRCode from "qrcodejs2-fix";
 
 const { proxy } = getCurrentInstance();
 const warehouseList = ref([]);
@@ -250,6 +277,19 @@ const config = computed(() => {
                 },
               }
             : {},
+          row.businessType == 3
+            ? {
+                attrs: {
+                  label: "打印二维码",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  handlePrintOne(row);
+                },
+              }
+            : {},
         ];
       },
     },
@@ -399,11 +439,21 @@ const submitForm = () => {
     //     type: "info",
     //   });
     // }
+    let stockWaitDetailsList = [
+      {
+        id: formData.data.id,
+        productId: formData.data.productId,
+        quantity: formData.data.warehousingQuantity,
+        isScan: "0",
+        purchaseDetailId: "",
+      },
+    ];
     proxy
       .post("/stockWait/add", {
-        id: formData.data.id,
+        id: formData.data.stockWaitId,
         warehouseId: formData.data.warehouseId,
         quantity: formData.data.warehousingQuantity,
+        stockWaitDetailsList,
       })
       .then(
         () => {
@@ -470,6 +520,37 @@ const printObj = ref({
     "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
   extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
 });
+
+const printDialogOne = ref(false);
+const qrList = ref([]);
+const handlePrintOne = (row) => {
+  const { purchaseDetailId, quantity } = row;
+  const arr = [];
+  for (let i = 0; i < 1; i++) {
+    let obj = {
+      productName: row.productName,
+      productSpec: row.productSpec,
+      scanValue: purchaseDetailId,
+    };
+    arr.push(obj);
+  }
+  qrList.value = arr;
+  printDialogOne.value = true;
+  nextTick(() => {
+    for (let i = 0; i < qrList.value.length; i++) {
+      const ele = qrList.value[i];
+      proxy.$refs[ele.scanValue][0].innerHTML = ""; //清除二维码方法一
+      new QRCode(proxy.$refs[ele.scanValue][0], {
+        text: ele.scanValue,
+        width: 100,
+        height: 100,
+        colorDark: "#000000",
+        colorLight: "#ffffff",
+        correctLevel: QRCode.CorrectLevel.H,
+      });
+    }
+  });
+};
 </script>
 
 <style lang="scss" scoped>