qinhb 2 місяців тому
батько
коміт
8322fc50fd

+ 2 - 2
src/views/plan/requisition/index.vue

@@ -41,13 +41,13 @@
         <el-button type="primary" link size="small" @click="openDialog(2, row)"
           ><i-ep-edit />{{ row.state === "0" ? "编辑" : "流程" }}</el-button
         >
-        <el-button
+<!--        <el-button
           type="primary"
           link
           size="small"
           @click="openDialog1(row)"
           ><i-ep-position />导出物料信息</el-button
-        >
+        >-->
       </template>
     </avue-crud>
     <el-dialog

+ 23 - 27
src/views/storage/stock/index.vue

@@ -16,7 +16,7 @@
         @current-change="dataList"
         :row-style="rowStyle"
         :cell-style="cellStyle"
-        @selection-change="selectionChange"
+        @selection-change="selectionChange1"
     >
 <!--      <template #menu-left="{ size }">
         <el-button
@@ -37,29 +37,31 @@
           </template>
         </el-button>&ndash;&gt;
       </template>-->
+      <template #menu-left="{}">
+        <el-button
+            :disabled="toDeleteIds.length < 1"
+            class="ml-3"
+            @click="printCode">二维码打印
+        </el-button>
+      </template>
     </avue-crud>
     <el-dialog
         v-model="dialog1.visible"
         :title="dialog1.title"
-        width="950px"
         @close="dialog1.visible = false"
+        width="85%"
     >
-      <choice-item-page @materialInfo="materialInfo" :enabled="null"/>
+      <print-stock-info :excelRow="clickObjs" />
     </el-dialog>
-    <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
   </div>
 </template>
 <script setup>
 import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
-import { syncPositionVehicle} from "@/api/storage";
 import { useCommonStoreHook } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
+import PrintStockInfo from "./print-stock-info.vue";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-const test = () => {
-  isShowTable.value = true;
-  tableType.value = tableType.value == 1 ? 2 : 1;
-};
 
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
@@ -72,31 +74,25 @@ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等
 
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 const dialog1 = reactive({
-  title: "物料选择",
+  title: "物料打印",
   visible: false,
 });
-const materialInfo = (value) => {
-  form.value.materialNo = value.materialCode
-  form.value.materialName = value.materialName
-  form.value.materialModel = value.spec
-  form.value.unit = value.unitDictValue
-  dialog1.visible = false
+const clickObjs = ref([])
+const selectionChange1 =(row)=>{
+  toDeleteIds.value = [];
+  row?.forEach((element) => {
+    toDeleteIds.value.push(element.id);
+  });
+  row.printNum = 1
+  clickObjs.value = row
 }
-const syncPosition = () => {
-  ElMessageBox.confirm("当前非同步任务,预计5秒内完成,确定同步库存吗?")
-      .then(() => {
-        syncPositionVehicle({}).then((data) => {
-          ElMessage.success(data.msg);
-        });
-      })
-      .catch(() => {
-        // catch error
-      });
+const printCode = () => {
+  dialog1.visible = true
 };
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   delBtn: true,
-  selection: false,
+  selection: true,
   addBtn: false,
   editBtn: true,
   column: [

+ 95 - 0
src/views/storage/stock/print-stock-info.vue

@@ -0,0 +1,95 @@
+<template>
+  <div class="mainContentBox">
+    <div class="btns">
+      <el-button type="primary" @click="dialog.visible = true">打印预览</el-button>
+    </div>
+    <el-table ref="tableRef" :data="clickObjs" style="height: 70vh" border>
+      <el-table-column label="物料编码" prop="materialCode" />
+      <el-table-column label="物料名称" prop="materialName" />
+      <el-table-column label="物料型号" prop="materialModel" />
+      <el-table-column label="批次号" prop="batchCode" >
+        <template #default="{ row }">
+          <el-input v-model="row.batchCode" />
+        </template>
+      </el-table-column>
+      <el-table-column label="更改数量" prop="num">
+        <template #default="{ row }">
+          <el-input v-model="row.num" />
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-dialog
+        v-model="dialog.visible"
+        :title="dialog.title"
+        width="1250px"
+        @close="dialog.visible = false"
+    >
+      <div style="display: flex;flex-wrap: wrap;" ref="toPrintRef">
+        <div v-for="item of clickObjs" style="width: 238px;overflow: hidden;font-size:10px;">
+          <div style="float: left;padding-bottom: 30px">
+            <vue-qrcode  :value="item.code"  size="45" error-level="H"></vue-qrcode>
+            <div>
+              <el-text>物料编码:</el-text><el-text>{{item.materialCode}}</el-text>
+            </div>
+            <div>
+              <el-text>物料名称:</el-text><el-text>{{item.materialName}}</el-text>
+            </div>
+            <div>
+              <el-text>物料型号:</el-text><el-text>{{item.materialModel}}</el-text>
+            </div>
+            <div>
+              <el-text>批次号:</el-text><el-text>{{item.batchCode}}</el-text>
+            </div>
+            <div>
+              <el-text>数量:</el-text><el-text>{{item.num}}</el-text>
+            </div>
+          </div>
+
+        </div>
+      </div>
+
+      <div class="dialog-footer" align="center">
+        <el-button @click="dialog.visible = false">取消</el-button>
+        <el-button type="primary" @click="printPage">打印</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script setup>
+import { ref, defineProps } from "vue";
+import { html2CanvasPrint } from "@/utils/common";
+const props = defineProps({
+  excelRow: {
+    type: Array,
+    default: () => {
+      return [];
+    },
+  },
+});
+
+const clickObjs = ref([])
+const toPrintRef = ref(null);
+const printPage = ()=>{
+  html2CanvasPrint(toPrintRef.value);
+}
+const tableRef = ref(null);
+const dialog = reactive({
+  title: "打印预览",
+  visible: false,
+});
+const handleData = (row) => {
+  clickObjs.value = []
+  row.forEach(item=>{
+    let code = "BM" + item.materialNo + ";MC" + item.materialName + ";PH"+ item.batchCode + ";SL"+ item.num + ";"
+    clickObjs.value.push({code: code,materialCode: item.materialNo,materialName: item.materialName,materialModel: item.spec,num: item.num,batchCode: item.batchCode})
+  })
+}
+onMounted(() => {
+  handleData(props.excelRow)
+});
+watch(()=>props.excelRow, () => {
+  handleData(props.excelRow)
+},{
+  deep:true
+});
+</script>

+ 0 - 2
src/views/storage/task/index.vue

@@ -222,7 +222,6 @@ option.value = Object.assign(option.value, {
       label: "领用单号",
       prop: "applyCode",
       search: true,
-      width: 150,
       overHidden: true,
     },
     {
@@ -236,7 +235,6 @@ option.value = Object.assign(option.value, {
       label: "订单编号",
       prop: "orderCode",
       search: true,
-      width: 150,
       overHidden: true,
     },
     {