Преглед на файлове

feat(inventoryAllocation): 新增华泰打印送货单的按钮和对应的打印模板组件,增加了新的权限控制,支持打印调拨单送货单

liujt преди 1 месец
родител
ревизия
a748c7c695

+ 220 - 0
src/views/warehouseManagement/inventoryAllocation/components/print-template-ht.vue

@@ -0,0 +1,220 @@
+<template>
+  <el-dialog
+    title="送货单"
+    :visible.sync="visible"
+    center
+    append-to-body
+    width="70%"
+    :close-on-click-modal="false"
+
+>
+
+    <div id="printSection">
+      <div style="text-align: center; padding-bottom: 20px;">
+        <h3 style="margin: 0; font-size: 18px; font-weight: 800;">{{ groupName }}送货单</h3>
+      </div>
+
+      <div style="margin-bottom: 15px; width: 100%;">
+        <div style="display: flex; margin-bottom: 8px; width: 100%;">
+          <div style="flex: 1; text-align: left;">单据日期:{{ infoData.createTime || '' }}</div>
+          <div style="flex: 1; text-align: left;">单据编号:{{ infoData.allotCode || '' }}</div>
+        </div>
+        <div style="display: flex; margin-bottom: 8px;">
+          <div style="flex: 1; text-align: left;">调出仓库:{{ infoData.sourceWarehouse || '' }}</div>
+          <div style="flex: 1; text-align: left;">调入仓库:{{ infoData.targetWarehouse || '' }}</div>
+        </div>
+      </div>
+
+      <table style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
+        <thead>
+          <tr>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 5%;">序号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 15%;">存货编码</th>
+            <!-- <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 15%;">存货名称</th> -->
+            <!-- <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 15%;">规格型号</th> -->
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 8%;">颜色</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 15%;">型号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 8%;">计量单位</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 8%;">数量</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 8%;">批号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 8%;">裁线米段</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 10%;">备注</th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr v-for="(item, index) in detailList" :key="index">
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ index + 1 }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryCode || '' }}</td>
+            <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryName || '' }}</td> -->
+            <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryModel || '' }}</td> -->
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.colorKey || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryModel || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.measureUnit || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.quantity || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.batchNo || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.cuttingLength || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">
+              <span v-if="isPrint">{{ item.remark }}</span>
+              <el-input
+                v-else
+                type="textarea"
+                style="width: 100%; border: none;"
+                placeholder=""
+                v-model="item.remark"
+                class="input-with-select"
+                autosize
+              ></el-input>
+            </td>
+          </tr>
+          <tr style="height: 40px;">
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td  style="border: 1px solid #000; padding: 8px; text-align: center;">合计</td>
+            <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td> -->
+            <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td> -->
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ detailList.reduce((total, item) => total + Number(item.quantity || 0), 0) || ''}}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+          </tr>
+        </tbody>
+      </table>
+
+      <div style="display: flex; width: 100%;">
+        <div style="flex: 1;">制单人:{{ infoData.allotName || '' }}</div>
+        <div style="flex: 1;">经手人:</div>
+        <div style="flex: 1;">签收人:</div>
+      </div>
+    </div>
+
+    <div
+      slot="footer"
+      style="text-align: right"
+    >
+      <el-button type="primary" @click="confirm">打印预览</el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import storageApi from '@/api/warehouseManagement/index.js';
+export default {
+  props: {
+    groupName: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      visible: false,
+      isPrint: false,
+      row: {
+        customerName: '',
+        contactPerson: '',
+        contactPhone: '',
+        items: [{
+          model: '',
+          partName: '',
+          unit: '',
+          deliveryQuantity: '',
+          receivedQuantity: '',
+          remark: '',
+          orderNumber: '',
+          processingTechnology: '',
+        }],
+        deliverer: '',
+        carrier: '',
+        receiver: '',
+      },
+      detailList: [],
+      infoData: {},
+    }
+  },
+  computed: {
+
+  },
+  methods: {
+    async open (row) {
+      console.log('row', row)
+      this.row = row;
+      this.getData();
+      this.visible = true;
+    },
+    async getData() {
+      const res = await storageApi.getAllotDetailList({
+          applyId: this.row.id
+        });
+        const data = await storageApi.getAllotDetail(this.row.id);
+        this.infoData = data;
+        if (this.infoData.type == 1) {
+          // 库内调拨
+          /* this.infoData.auditStatus = 2; */
+          this.infoData.auditStatus = data.status;
+        } else {
+          // 库外调拨
+          this.infoData.auditStatus = data.status;
+        }
+        this.detailList = res.map((item) => {
+          return {
+            ...item,
+            // categoryCode: this.infoData.categoryCode,
+            // categoryName: this.infoData.categoryName,
+            // brandNum: this.infoData.brandNum,
+            // categoryModel: this.infoData.model,
+            // specification: this.infoData.specification
+          };
+        });
+        console.log('infoData', this.infoData)
+        console.log('detailList', this.detailList)
+    },
+    confirm () {
+      this.isPrint = true;
+      this.$nextTick(() => {
+        this.print();
+      });
+    },
+    print() {
+      const printSection = document.getElementById('printSection');
+      // 创建打印任务
+      const printWindow = window.open('', '_blank');
+      printWindow.document.open();
+      printWindow.document.write('<html><head><title>打印预览</title>');
+      printWindow.document.write(
+        '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+      );
+      printWindow.document.write('</head><body>');
+      printWindow.document.write(printSection.innerHTML);
+      printWindow.document.write('</body></html>');
+      printWindow.document.close();
+
+      // 监听打印窗口关闭事件,恢复输入框
+        printWindow.onbeforeunload = function() {
+          self.isPrint = false;
+        };
+        
+        printWindow.onunload = function() {
+          self.isPrint = false;
+        };
+        
+        printWindow.onafterprint = function() {
+          self.isPrint = false;
+        };
+        
+      printWindow.onload = function () {
+        printWindow.print();
+      };
+    },
+    cancel () {
+      this.visible = false
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 16 - 1
src/views/warehouseManagement/inventoryAllocation/index.vue

@@ -22,6 +22,10 @@
           <el-button v-if="$hasPermission('wms:inventoryAllocation:print2')" :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExl2"
             >打印送货单带车</el-button
           >
+
+          <el-button v-if="$hasPermission('wms:inventoryAllocation:printHT')" :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExlHT"
+            >打印送货单</el-button
+          >
           <el-button v-if="$hasPermission('wms:inventoryAllocation:statement')" :disabled="selection.length == 0" type="primary"  @click="handleGenerateStatement('add')"
             >生成对账单</el-button
           >
@@ -75,6 +79,7 @@
     <!-- 打印弹窗 -->
     <printTemplateBs :groupName="groupName" ref="printTemplateBsRef"></printTemplateBs>
     <printTemplateBsCar :groupName="groupName" ref="printTemplateBsCarRef"></printTemplateBsCar>
+    <printTemplateHT :groupName="groupName" ref="printTemplateHTRef"></printTemplateHT>
     <add-account-dialog
       v-if="addAccountDialogFlag"
       :addAccountDialogFlag.sync="addAccountDialogFlag"
@@ -95,6 +100,7 @@
   import storageApi from '@/api/warehouseManagement/index.js';
   import InventorySearch from './components/inventory-search.vue';
   import printTemplateBs from './components/print-template-bs.vue';
+  import printTemplateHT from './components/print-template-ht.vue';
   import printTemplateBsCar from './components/print-template-bs-car.vue';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import { pageRoles } from '@/api/system/role';
@@ -107,7 +113,8 @@
       InventorySearch,
       printTemplateBs,
       printTemplateBsCar,
-      generateStatement
+      generateStatement,
+      printTemplateHT
     },
     data() {
       return {
@@ -340,6 +347,14 @@
           }
         });
       },
+      printExlHT() {
+        console.log('selection', this.selection)
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择要打印的记录');
+          return;
+        }
+        this.$refs.printTemplateHTRef.open(this.selection[0]);
+      },
       printExl() {
         console.log('selection', this.selection)
         if (this.selection.length == 0) {