Jelajahi Sumber

【修改】bug

howie 3 tahun lalu
induk
melakukan
346b15a9f2

+ 3 - 2
src/views/finance/components/design/preview.vue

@@ -3,7 +3,7 @@
     @cancel="hideModal" :width="350 + 'mm'">
     <div :spinning="spinning" style="min-height: 100px">
       <div id="preview_content" ref="printDom">
-              444444
+
       </div>
     </div>
     <template slot="title">
@@ -58,7 +58,6 @@ export default {
     },
     show(hiprintTemplate, printData, width = '210') {
       this.visible = true
-      this.spinning = true
       this.width = width
       this.hiprintTemplate = hiprintTemplate
       printData.addPrintHtml({ options: { width: 140, height: 35, top: 180, left: 20, content:this.$refs.printData } });
@@ -86,6 +85,8 @@ export default {
 </script>
 
 <style scoped>
+
+
 ::v-deep .el-dialog__body {
   padding: 0;
 }

+ 64 - 19
src/views/finance/receipt_list.vue

@@ -361,12 +361,12 @@
                   @click="seeFn(scope.row.id)"
                   >查看</el-button
                 >
-                <!-- <el-button
+                <el-button
                   type="text"
                   class="textColor"
                   @click="toPrint(scope.row, 2)"
                   >打印</el-button
-                > -->
+                >
               </template>
             </el-table-column>
           </el-table>
@@ -398,12 +398,9 @@
 </template>
 
 <script>
-import {
-  disAutoConnect,
-  hiprint,
-} from "vue-plugin-hiprint";
+import { disAutoConnect, hiprint } from "vue-plugin-hiprint";
 disAutoConnect();
-import printPreview from './components/design/preview.vue'
+import printPreview from "./components/design/preview.vue";
 import { getCustomerList } from "@/api/finance/wallet";
 import {
   getK3ReceiptList,
@@ -413,6 +410,7 @@ import ReceiptListDetail from "./components/receipt_list-detail";
 import ReceiptPrint from "@/views/finance/components/receipt_print.vue";
 
 import { numToFixed } from "@/filters";
+import ret from "bluebird/js/release/util";
 export default {
   components: {
     ReceiptPrint,
@@ -440,8 +438,8 @@ export default {
       detailId: null,
       queryItem: {},
       tableSelection: [],
-      panel:'',
-      hiprintTemplate:''
+      panel: "",
+      hiprintTemplate: "",
     };
   },
   computed: {
@@ -455,9 +453,7 @@ export default {
     this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
     this.getCustomerDataList();
   },
-  mounted() {
-
-  },
+  mounted() {},
   methods: {
     //获取经销商列表
     async getCustomerDataList() {
@@ -566,15 +562,26 @@ export default {
     toPrint(row, type) {
       hiprint.init();
       this.hiprintTemplate = new hiprint.PrintTemplate();
-       this.panel = this.hiprintTemplate.addPrintPanel({
-        width: 100,
-        height: 130,
+      this.panel = this.hiprintTemplate.addPrintPanel({
+        height: 140,
+        width: 241,
+        fontFamily: "黑体",
+        fontSize: 12.5,
         paperFooter: 340,
         paperHeader: 10,
         paperNumberDisabled: true,
       });
+      this.panel.addPrintHtml({
+        options: {
+          width: 633,
+          top: 30,
+          left: 20,
+          fontFamily: "黑体",
+          fontSize: 12.5,
+          content: this.setTableDom(),
+        },
+      });
 
-      //打印
       // this.tableSelection = this.$refs.table.selection;
       if (!type) {
         // getDetail(this.tableSelection);
@@ -582,9 +589,47 @@ export default {
         this.queryItem = row;
         // getDetail(row.id)
       }
-      this.$refs.preView.show(this.hiprintTemplate,this.panel)
-
-
+      this.$refs.preView.show(this.hiprintTemplate, this.panel);
+    },
+    // 收款单打印模板
+    setTableDom() {
+      return `
+       <div style="font-family:'黑体';">
+          <h1 style="text-align:center">弘格贸易有限公司其他收款单</h1>
+          <div >
+            <table border=".5" cellspacing="0" width="856" height="250">
+                <tr>
+                  <td>单据编号</td>
+                  <td>January</td>
+                  <td>业务日期</td>
+                  <td>January</td>
+                  <td>打印日期</td>
+                  <td>January</td>
+                </tr>
+                <tr>
+                  <td>付款单位</td>
+                  <td colspan="3">January</td>
+                  <td>项目费用名称</td>
+                  <td>January</td>
+                </tr>
+                <tr>
+                  <td>钱包</td>
+                  <td>January</td>
+                  <td>实收金额</td>
+                  <td>January</td>
+                  <td colspan="2"></td>
+                </tr>
+                <tr>
+                  <td>备注</td>
+                  <td colspan="5">January</td>
+                </tr>
+            </table>
+          </div>
+          <div style="margin:100px 0 0 0">
+            <div>打印</div>
+          </div>
+       </div>
+      `;
     },
   },
 };