lilei 2 éve
szülő
commit
ce3dfe6512

+ 17 - 12
src/libs/JGPrint.js

@@ -110,26 +110,31 @@ export const jGPrint = function (data, type, callback, printLogParams, printPage
   }
   LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
   // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
-  LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+  // LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
   // TaskID:任务id,Value:job代码
   LODOP.On_Return = function (TaskID, Value) {
-    console.log(TaskID, Value)
+    console.log(TaskID, Value, printLogParams)
     // 已打印
-    if (Value && printLogParams) {
-      console.log('已打印,统计打印次数')
-      printLog(printLogParams, callback)
+    if (Value) {
+      if(printLogParams){
+        console.log('已打印,统计打印次数')
+        printLog(printLogParams, callback)
+      }else{
+        callback({status:200,message:'已打印'})
+      }
     } else {
+      // 取消打印
       callback()
     }
   }
   if (printPageSize) {
-    LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
     LODOP.SET_PRINT_PAGESIZE(3, '210mm', 100, '')
   } else {
-    LODOP.SET_PRINT_PAGESIZE(1,'210mm','297mm',"");
-    LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
     LODOP.SET_SHOW_MODE('BKIMG_PRINT', 0)
+    LODOP.SET_PRINT_PAGESIZE(1,'210mm','297mm',"");
   }
+  LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
+
   if (type == 'preview') { //  预览
     LODOP.PREVIEW()
   } else if (type == 'print') { //  打印
@@ -163,10 +168,10 @@ export const jGPlPrint = function (data, type, callback, printLogParams, orginDa
   }
   LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
   // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
-  LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+  // LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
   // TaskID:任务id,Value:job代码
   LODOP.On_Return = function (TaskID, Value) {
-    console.log(TaskID, Value)
+    console.log(TaskID, Value, printLogParams)
     // 已打印
     if (Value) {
       if(printLogParams){
@@ -292,14 +297,14 @@ export const jGPrintPdf = function (data, type, taskName, printLogParams, callba
     LODOP.PRINT_INIT(taskName)
     LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
     // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
-    LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+    // LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
     // 隐藏打印按钮
     if (hidePrint) {
       LODOP.SET_SHOW_MODE('HIDE_PBUTTIN_PREVIEW', true)
     }
     // TaskID:任务id,Value:job代码
     LODOP.On_Return = function (TaskID, Value) {
-      console.log(TaskID, Value)
+      console.log(TaskID, Value, printLogParams)
       // 已打印
       if (Value && printLogParams) {
         console.log('已打印,统计打印次数')

+ 11 - 6
src/views/salesManagement/receiptPrint/list.vue

@@ -109,7 +109,9 @@
         </s-table>
 
         <!-- 收款打印 -->
-        <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
+        <commonModal modalTit="收款打印预览" width="700pt" :showFooter="false" :openModal="showTipModal" @cancel="closeTipModal">
+           <printModel ref="printModel" @cancel="closeTipModal" @printOk="printOk"></printModel>
+        </commonModal>
         <!-- 打印记录 -->
         <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
         <!-- 操作提示 -->
@@ -169,6 +171,7 @@ export default {
       showTipModal: false,
       showRecordModal: false,
       showPrintModal: false,
+      showViewModal: false,
       tipData: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -298,11 +301,12 @@ export default {
         this.$refs.printModel.getData(type ? row : [{ audit: auditStr, detail: detailItemUseStr, subList: [row] }], type ? list : [list])
       })
     },
-    printOk () {
-      this.spinning = false
-      console.log(1)
-      this.$refs.table.refresh()
-      this.$refs.table.clearSelected()
+    printOk (res) {
+      if(res){
+        this.spinning = false
+        this.$refs.table.refresh()
+        this.$refs.table.clearSelected()
+      }
     },
     //  时间  change
     dateChange (date) {
@@ -336,6 +340,7 @@ export default {
         }
       })
     },
+    // 关闭打印预览
     closeTipModal () {
       this.showTipModal = false
       this.spinning = false

+ 12 - 13
src/views/salesManagement/receiptPrint/printModel.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 发货打印 -->
-  <div style="position:absolute;left:-10000px;top:-10000px;height:0;overflow: hidden;">
-    <div id="sendGood-print" v-if="financeBookList&&financeBookList.length">
+  <div>
+    <div id="sendGood-print" style="height:500px;overflow:auto;" v-if="financeBookList&&financeBookList.length">
       <div
         v-for="(fcItem,index) in financeBookList"
         class="sendGood-print-box"
@@ -74,10 +74,10 @@
         </table>
       </div>
     </div>
-    <!-- <div class="btn-box" style="display:flex;align-item:center;justify-content: center;">
+    <div class="btn-box" style="display:flex;align-item:center;justify-content: center;" v-if="financeBookList&&financeBookList.length">
       <a-button @click="handleCommonCancel">取消</a-button>
       <a-button :loading="spinning" type="primary" @click="handleCommonOk">立即打印</a-button>
-    </div> -->
+    </div>
   </div>
 </template>
 
@@ -87,7 +87,7 @@ import moment from 'moment'
 export default {
   data () {
     return {
-      // spinning: false,
+      spinning: false,
       detail: null,
       financeBookList: [],
       printNums: []
@@ -131,9 +131,13 @@ export default {
       }
       this.$store.state.app.curActionPermission = 'B_SkPrint'
       // html, type, callback, printLogParams
-      jGPlPrint(htmlStr, 'preview', function (res) {
-        _this.handleCommonCancel()
-        _this.$emit('printOk')
+      this.spinning = true
+      jGPlPrint(htmlStr, 'print', function (res) {
+        if(res){
+          _this.handleCommonCancel()
+        }
+        _this.$emit('printOk', res)
+        _this.spinning = false
       }, this.printNums, this.financeBookList)
     },
     getData (data, list) {
@@ -147,11 +151,6 @@ export default {
           printType: '收款打印'
         })
       })
-
-      // 打印预览
-      this.$nextTick(() => {
-        this.handleCommonOk()
-      })
     },
     handleCommonCancel () {
       this.$emit('cancel')

+ 14 - 8
src/views/salesManagement/sendOutOrder/detailModal.vue

@@ -11,10 +11,10 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="common-main">
         <div style="display: flex;align-items: center;justify-content: space-between;padding-bottom: 10px;">
-          <a-alert type="info" v-if="sendBillStockOutList.length" style="margin-bottom:10px">
+          <a-alert type="info" v-if="sendBillStockOutList.length">
             <div slot="message">{{ customeName||'' }},共 {{ sendBillStockOutList && sendBillStockOutList.length }} 个出库单,产品款数合计 <span>{{ productTotal&&productTotal.totalCategory }}</span> ,产品数量合计 <span>{{ productTotal&&productTotal.totalQty }}</span>。</div>
           </a-alert>
-          <a-button size="small" v-if="type==1" @click="printOrder" type="primary">发货单打印</a-button>
+          <a-button size="small" v-if="type==1" @click="showTipModal = true" type="primary">发货单打印</a-button>
         </div>
         <div>
           <a-table class="sTable" :columns="outColumns" :pagination="false" :data-source="sendBillStockOutList" bordered></a-table>
@@ -69,7 +69,9 @@
         <a-button type="primary" @click="handleCommonOk">{{ okText }}</a-button>
       </div>
       <!-- 发货打印 -->
-      <printModel ref="printModel" :detail="detail"></printModel>
+      <commonModal modalTit="发货打印预览" width="700pt" okText="立即打印" :openModal="showTipModal" @cancel="showTipModal=false" @ok="$refs.printModel.printDom()">
+        <printModel ref="printModel" :detail="detail" @ok="printOk"></printModel>
+      </commonModal>
     </a-spin>
   </a-modal>
 </template>
@@ -79,11 +81,12 @@ import { commonMixin } from '@/utils/mixin'
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import printModel from './printModel.vue'
+import commonModal from '@/views/common/commonModal.vue'
 import { updateTransportInfo, sendBillFindBySn } from '@/api/sendBill'
 export default {
   name: 'SendOutDetailModal',
   mixins: [commonMixin],
-  components: { STable, VSelect, printModel },
+  components: { STable, VSelect, printModel, commonModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -144,7 +147,8 @@ export default {
         { title: '收款时间', dataIndex: 'settleTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       sendBillSn: null,
-      customeName: ''
+      customeName: '',
+      showTipModal: false
     }
   },
   methods: {
@@ -153,9 +157,11 @@ export default {
       const v = e.target.checked
       this.form.receiveDate = v ? moment() : ''
     },
-    // 打印
-    printOrder () {
-      this.$refs.printModel.printDom()
+    // 打印回调
+    printOk(res){
+      if(res){
+        this.showTipModal = false
+      }
     },
     // 编辑
     getDetail (data, type, title) {

+ 17 - 14
src/views/salesManagement/sendOutOrder/printModel.vue

@@ -1,14 +1,14 @@
 <template>
   <!-- 发货打印 -->
-  <div id="sendGood-print" style="height:0;overflow: hidden;" v-if="detail">
-    <div class="print-box" style="width: 574pt;font-size: 12pt;">
+  <div id="sendGood-print" style="height:500px;overflow: auto;" v-if="detail">
+    <div class="print-box" style="width: 564pt;font-size: 12pt;margin:0 auto;">
       <div style="display: flex;align-items: center;justify-content: center;">
         <img src="@/assets/logo.png" height="50px"/>
-        <h1 style="margin:0;">东莞市箭冠汽车配件制造有限公司</h1>
+        <h2 style="margin:0;font-size: 22pt;">东莞市箭冠汽车配件制造有限公司</h2>
       </div>
-      <div style="text-align: center;padding: 5px 0;position: relative;">
-        <h2 style="margin:0;">托运单</h2>
-        <span style="position: absolute;top: 10px;right: 0;">No:{{ detail.sendBillNo }}</span>
+      <div style="text-align: center;padding: 0 0 15px 0;position: relative;">
+        <h3 style="margin:0;font-size: 18pt;">托运单</h3>
+        <span style="position: absolute;top: 6px;right: 0;">No:{{ detail.sendBillNo }}</span>
       </div>
       <div style="display: flex;align-items: center;justify-content:space-between;padding: 5px;">
         <span style="width: 70%;">托运日期:{{ detail.sendDate }}</span>
@@ -24,10 +24,10 @@
             <span>详细地址:{{ detail.customerAddressDetail }}</span>
           </div>
         </div>
-        <table border="1" style="width: 574pt;border-collapse: collapse;text-align: center;border-color:#000;">
+        <table border="1" style="width: 564pt;border-collapse: collapse;text-align: center;border-color:#000;">
           <tr style="padding: 0;">
-            <td style="padding: 5px 0;width:70pt;">货物名称</td>
-            <td style="padding: 0;width:56pt;">件数</td>
+            <td style="padding: 5px 0;width:66pt;">货物名称</td>
+            <td style="padding: 0;width:50pt;">件数</td>
             <td style="padding: 0;width:56pt;">体积(m³)</td>
             <td style="padding: 0;width:56pt;">重量(kg)</td>
             <td style="padding: 0;width:56pt;">计费单价(元)</td>
@@ -38,8 +38,8 @@
             <td style="padding: 0;width:60pt;">合计</td>
           </tr>
           <tr style="padding: 0;" v-for="item in detail.detailList" :key="item.id">
-            <td style="padding: 5px 0;width:70pt;">{{ item.goodsName }}</td>
-            <td style="padding: 0;width:56pt;">{{ item.goodsQty }}</td>
+            <td style="padding: 5px 0;width:66pt;">{{ item.goodsName }}</td>
+            <td style="padding: 0;width:50pt;">{{ item.goodsQty }}</td>
             <td style="padding: 0;width:56pt;">{{ item.goodsVolume.toFixed(2) }}</td>
             <td style="padding: 0;width:56pt;">{{ item.goodsWeight.toFixed(2) }}</td>
             <td style="padding: 0;width:56pt;">{{ item.unitPrice.toFixed(2) }}</td>
@@ -57,8 +57,8 @@
           </div>
           <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
             <div style="border-right: 1px solid #000;flex:1;text-align: center;padding: 5px;">付款方式:</div>
-            <div style="border-right: 1px solid #000;flex:2;padding: 5px;text-align:center;">{{ detail.payTypeDictValue }}</div>
-            <div style="border-right: 1px solid #000;flex:1;text-align: center;padding: 5px;">交货方式:</div>
+            <div style="flex:2;padding: 5px;text-align:center;">{{ detail.payTypeDictValue }}</div>
+            <div style="border-left: 1px solid #000;border-right: 1px solid #000;flex:1;text-align: center;padding: 5px;">交货方式:</div>
             <div style="flex:2;padding: 5px;text-align:center;">{{ detail.handoverTypeDictValue }}</div>
           </div>
           <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
@@ -108,7 +108,10 @@ export default {
     dealBigMoney: dealBigMoney,
     printDom () {
       const html = document.getElementById('sendGood-print').innerHTML
-      jGPrint(html, 'preview', function () {}, null, 3)
+      const _this = this
+      jGPrint(html, 'print', function (res) {
+        _this.$emit('ok',res)
+      }, null, 3)
     }
   }
 }