Ver Fonte

打印模板

yusheng há 1 ano atrás
pai
commit
ac8b682d67

BIN
public/importTemplate/销售订单导入模板.xlsx


+ 22 - 12
src/api/system/file/index.js

@@ -1,11 +1,11 @@
 import request from '@/utils/request';
-import {download } from '@/utils/file';
+import { download } from '@/utils/file';
 
 /**
  * 上传文件
  * @param file 文件
  */
-export async function uploadFile (data) {
+export async function uploadFile(data) {
   const formData = new FormData();
   formData.append('multiPartFile', data.multiPartFile);
   formData.append('module', data.module);
@@ -19,7 +19,7 @@ export async function uploadFile (data) {
  * 上传文件 批量
  * @param file 文件
  */
-export async function uploadBatch (data) {
+export async function uploadBatch(data) {
   const formData = new FormData();
   data.multiPartFiles.forEach((item, index) => {
     formData.append(`multiPartFiles`, item);
@@ -37,7 +37,7 @@ export async function uploadBatch (data) {
 /**
  * 获取文件路径
  */
-export async function getPathAddress () {
+export async function getPathAddress() {
   const res = await request.post('/main/file/getPathAddress');
   if (res.data.code === '0') {
     return res.data.data;
@@ -47,7 +47,7 @@ export async function getPathAddress () {
 /**
  * 获取文件
  */
-export async function getFile (params, fileName) {
+export async function getFile(params, fileName) {
   const res = await request.get('/main/file/getFile', {
     params,
     responseType: 'blob'
@@ -62,7 +62,7 @@ export async function getFile (params, fileName) {
 /**
  * 删除文件
  */
-export async function removeFile (data) {
+export async function removeFile(data) {
   const res = await request.post(
     `/main/file/delete?fileId=${data.fileId}`,
     data
@@ -75,7 +75,7 @@ export async function removeFile (data) {
 /**
  * 文件列表
  */
-export async function getFileList (data) {
+export async function getFileList(data) {
   const res = await request.post(`/main/file/list`, data);
   if (res.data.code === '0') {
     return res.data.data;
@@ -83,7 +83,6 @@ export async function getFileList (data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 /**
  * 导入文件 批量
  * @param file 文件
@@ -93,13 +92,24 @@ export async function importBatch(data) {
   data.multiPartFiles.forEach((item, index) => {
     formData.append(`file`, item);
   });
-  const res = await request.post(
-    `/eom/saleorder/importFile`,
-    formData
-  );
+  const res = await request.post(`/eom/saleorder/importFile`, formData);
   if (res.data.code === '0') {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 下载模板
+ */
+export async function downLoadTemplate() {
+  const res = await request.post(
+    '/main/user/downLoadTemplate',
+    {},
+    {
+      responseType: 'blob'
+    }
+  );
+  console.log(res.data, '***********');
+  download(res.data, '员工档案导入模板.xlsx');
 
+}

+ 9 - 5
src/components/upload/import-dialog.vue

@@ -14,7 +14,7 @@
           <el-button icon="el-icon-plus" size="small" type="primary"
             >文件上传</el-button
           >
-          <!-- <div slot="tip" class="el-upload__tip">
+          <div slot="tip" class="el-upload__tip" v-if="fileUrl">
             只能上传excel文件,点击
             <el-link
               type="primary"
@@ -23,7 +23,7 @@
             >
               下载模板</el-link
             >
-          </div> -->
+          </div>
         </el-upload>
       </el-form-item>
       <el-form-item label="上传列表">
@@ -43,12 +43,15 @@
 </template>
 
 <script>
-import { importBatch,downLoadTemplate } from '@/api/system/file/index.js';
+import { importBatch } from '@/api/system/file/index.js';
+import { download1 } from '@/utils/file';
 
 export default {
   props: {
     // eslint-disable-next-line vue/require-prop-type-constructor
-    defModule: ''
+    defModule: '',
+    fileUrl: '',
+    fileName: '',
   },
   //注册组件
   data() {
@@ -61,6 +64,7 @@ export default {
       file: ''
     };
   },
+  
   created() {},
   methods: {
     open() {
@@ -102,7 +106,7 @@ export default {
     },
     //下载模板
     downLoadTemplate(){
-      downLoadTemplate()
+      download1(window.location.origin+this.fileUrl,this.fileName)
     }
   }
 };

+ 1 - 1
src/config/setting.js

@@ -21,7 +21,7 @@ export const SYSTEM_NAME = 'eos';
 export const REPEATABLE_TABS = [];
 
 // 不需要登录的路由
-export const WHITE_LIST = ['/login', '/forget','/fromQRCode/designDrawing.html'];
+export const WHITE_LIST = ['/login', '/forget','/fromQRCode/designDrawing.html','/importTemplate/销售订单导入模板.xlsx'];
 
 // 开启 KeepAlive 后仍然不需要缓存的路由地址
 export const KEEP_ALIVE_EXCLUDES = [

+ 9 - 0
src/utils/file.js

@@ -34,3 +34,12 @@ export function download (data, name) {
   a.click();
   window.URL.revokeObjectURL(url);
 }
+// 下载方法
+
+export function download1 (url, name) {
+  const a = document.createElement('a');
+  const filename = name;
+  a.href = url;
+  a.download = filename;
+  a.click();
+}

+ 2 - 1
src/views/saleManage/saleOrder/index.vue

@@ -242,9 +242,10 @@
       @reload="reload"
     ></addInvoiceManage>
     <importDialog
-      :defModule="moudleName"
       ref="importDialogRef"
       @success="reload"
+      :fileUrl="'/eos/importTemplate/销售订单导入模板.xlsx'"
+      fileName="销售订单导入模板"
     />
   </div>
 </template>

+ 160 - 0
src/views/saleManage/saleOrder/invoice/components/print-template-wl.vue

@@ -0,0 +1,160 @@
+<template>
+  <ele-modal
+    title="出库单"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="90%"
+  >
+    <div
+      id="printSection"
+      style="
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        flex-direction: column;
+      "
+    >
+      <table
+        cellspacing="0"
+        border
+        style="
+          width: 100%;
+          table-layout: fixed;
+          word-break: break-all;
+          word-wrap: break-word;
+          font-size: 12px;
+        "
+      >
+        <tbody>
+          <tr>
+            <td colspan="5" style="padding: 5px">
+              <div>
+                <div style="text-align:center;font-size:20px;font-weight:800">湖南万隆智能科技有限公司送货单</div>
+                <div style="margin-top:15px">出库时间:{{ outBound.createTime  }}</div>
+                <div style="margin-top:15px">客户:{{ formData.contactName }}</div>
+              </div>
+            </td>
+          </tr>
+          <tr align="center">
+            <td style="padding: 5px"> 物料编码 </td>
+            <td style="padding: 5px"> 物料名称 </td>
+            <td style="padding: 5px">重量(KG) </td>
+            <td style="padding: 5px"> 送货数</td>
+            <td style="padding: 5px"> 备注</td>
+          </tr>
+
+          <tr
+            align="center"
+            v-for="(item, index) in formData?.productList"
+          >
+            <td style="padding: 5px"> {{ item.productCode }} </td>
+            <td style="padding: 5px"> {{ item.productName }} </td>
+            <td style="padding: 5px"> {{ item.totalWeight }}</td>
+            <td style="padding: 5px"> {{ item.totalCount }}</td>
+            <td style="padding: 5px"> {{ item.remark }}</td>
+          </tr>
+          <tr   align="center"> 
+            <td style="padding: 5px"> </td>
+            <td style="padding: 5px"> 总重量</td>
+            <td style="padding: 5px"> {{ getAll('totalWeight') }}</td>
+            <td style="padding: 5px">  {{ getAll('totalCount') }}</td>
+            <td style="padding: 5px"> </td>
+          </tr>
+          <tr>
+            <td style="padding: 5px">送货员: </td>
+            <td style="padding: 5px"> 车牌:{{ formData.carNo }}</td>
+            <td style="padding: 5px" colspan="3">
+              <span style="width:180px;display:inline-block"> 商务: </span>
+              <span style="width:180px;display:inline-block"> 仓管: </span>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+    
+    </div>
+    <div slot="footer">
+        <el-button @click="print">打印预览</el-button>
+        <el-button @click="close">关闭</el-button>
+      </div>
+  </ele-modal>
+</template>
+
+<script>
+  import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
+  import { getInfoBySourceBizNoAll } from '@/api/wms';
+  import { mapGetters } from 'vuex';
+  export default {
+    name: 'print',
+    computed: {
+      ...mapGetters(['user'])
+    },
+    props: {},
+    data() {
+      return {
+        checked: '',
+        QRvisible: false,
+        isPrintPrice: false,
+        formData: {},
+        outBound: {}
+      };
+    },
+
+    methods: {
+      async open(id) {
+        this.formData = await getSendSaleOrderrecordDetailSplit(id);
+        this.QRvisible = true;
+        let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
+        this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
+        // this.outBound['outInDetailRecordRequestList'] = [];
+
+        // dataArray.forEach((item) => {
+        //   item.outInDetailList.forEach((val) => {
+        //     val.outInDetailRecordRequestList.forEach((j) => {
+        //       j['categoryName'] = val.categoryName;
+        //       j['categoryModel'] = val.categoryModel;
+        //       j['specification'] = val.specification;
+        //       j['categoryCode'] = val.categoryCode;
+        //     });
+        //     this.outBound['outInDetailRecordRequestList'].push(
+        //       ...val.outInDetailRecordRequestList
+        //     );
+        //   });
+        // });
+        //包装维度
+      },
+      close() {
+        this.QRvisible = false;
+      },
+      getAll(key){
+        let num=0
+       this.formData.productList.forEach(item=>{
+         if(item[key]){
+          num+=Number(item[key])
+         }
+       })
+       return num
+
+      },
+      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.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 8 - 1
src/views/saleManage/saleOrder/invoice/index.vue

@@ -60,6 +60,10 @@
                   @click.native="handlePrint('printTemplateJsYpRef')"
                   >出库单模板二(药品)</el-dropdown-item
                 >
+                <el-dropdown-item
+                  @click.native="handlePrint('printTemplateWlRef')"
+                  >送货单模板一</el-dropdown-item
+                >
               </el-dropdown-menu>
             </el-dropdown>
           </template>
@@ -172,6 +176,8 @@
     <printTemplateBy ref="printTemplateByRef"></printTemplateBy>
     <printTemplateJs ref="printTemplateJsRef"></printTemplateJs>
     <printTemplateJsYp ref="printTemplateJsYpRef"></printTemplateJsYp>
+    <printTemplateWl ref="printTemplateWlRef"></printTemplateWl>
+    
     <process-submit-dialog
       :isNotNeedProcess="false"
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
@@ -200,6 +206,7 @@
   import printTemplateBy from '@/views/saleManage/saleOrder/invoice/components/print-template-by.vue';
   import printTemplateJs from '@/views/saleManage/saleOrder/invoice/components/print-template-js.vue';
   import printTemplateJsYp from '@/views/saleManage/saleOrder/invoice/components/print-template-jsyp.vue';
+  import printTemplateWl from '@/views/saleManage/saleOrder/invoice/components/print-template-wl.vue';
   import {
     deleteSendInformation,
     getSendTableList,
@@ -220,7 +227,7 @@
       orderDetailDialog,
       addInvoiceDialog,
       detailDialog,
-      addInvoiceConfirm,printTemplateJs,printTemplateJsYp
+      addInvoiceConfirm,printTemplateJs,printTemplateJsYp,printTemplateWl
     },
 
     //客户管理数据