Jelajahi Sumber

Merge branch 'develop_yh10' of jianguan-web/jg-ocs-html into develop_yh11

李磊 2 tahun lalu
induk
melakukan
6f550f0d0a

+ 58 - 1
src/libs/JGPrint.js

@@ -126,7 +126,8 @@ export const jGPrint = function (data, type, callback, printLogParams, printPage
     LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
     LODOP.SET_PRINT_PAGESIZE(3, '210mm', 100, '')
   } else {
-    LODOP.ADD_PRINT_HTM('1cm', 0, '100%', '99%', data)
+    LODOP.SET_PRINT_PAGESIZE(1,'210mm','297mm',"");
+    LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
     LODOP.SET_SHOW_MODE('BKIMG_PRINT', 0)
   }
   if (type == 'preview') { //  预览
@@ -135,6 +136,62 @@ export const jGPrint = function (data, type, callback, printLogParams, printPage
     LODOP.PRINTA()
   }
 }
+
+// 批量打印销售收款单html
+export const jGPlPrint = function (data, type, callback, printLogParams, orginData) {
+  if (!data) {
+    return
+  }
+  const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
+  if (!LODOP) {
+    confirm({
+      title: '提示?',
+      content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
+      okText: '立即下载',
+      okType: 'danger',
+      cancelText: '暂不打印',
+      onOk () {
+        var agent = navigator.userAgent.toLowerCase()
+        if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
+          window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
+        } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
+          window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
+        }
+      }
+    })
+    return
+  }
+  LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
+  // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
+  LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+  // TaskID:任务id,Value:job代码
+  LODOP.On_Return = function (TaskID, Value) {
+    console.log(TaskID, Value)
+    // 已打印
+    if (Value && printLogParams) {
+      console.log('已打印,统计打印次数')
+      printLog(printLogParams, callback)
+    } else {
+      callback()
+    }
+  }
+  LODOP.SET_PRINT_PAGESIZE(1,'210mm','297mm',"");
+  LODOP.SET_SHOW_MODE('BKIMG_PRINT', 0)
+  // 循环页
+  for(var i=0;i<data.length;i=i+2){
+     if(i%2==0){
+       LODOP.NewPageA();
+     }
+     LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data[i]+(data[i+1]||''))
+  }
+  
+  if (type == 'preview') { //  预览
+    LODOP.PREVIEW()
+  } else if (type == 'print') { //  打印
+    LODOP.PRINTA()
+  }
+}
+
 // 浏览器打印pdf功能
 export const winPrintPdf = function (data, type, callback) {
   if (!data) {

+ 1 - 0
src/views/financialManagement/financialCollection/edit.vue

@@ -277,6 +277,7 @@ export default {
               data[i].no = i + 1
               const cons = data[i].bizType == 'DISPATCH' ? {
                 buyerName: data[i].dispatchBill.buyerName,
+                receiverName: data[i].dispatchBill.receiverName,
                 sendNo: data[i].dispatchBill.sendNo,
                 totalCategory: data[i].dispatchBill.totalCategory,
                 totalQty: data[i].dispatchBill.totalQty,

+ 1 - 1
src/views/financialManagement/financialCollection/selectGlAllocatModal.vue

@@ -163,7 +163,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, width: '13%', align: 'center' },
-        { title: '客户名称', dataIndex: 'buyerName', width: '13%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'targetName', width: '13%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '收货客户名称', dataIndex: 'receiverName', width: '13%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '发货编号', dataIndex: 'sendNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '产品款数', dataIndex: 'totalCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 84 - 65
src/views/salesManagement/receiptPrint/printModel.vue

@@ -4,79 +4,76 @@
     <div id="sendGood-print" v-if="financeBookList&&financeBookList.length">
       <div
         v-for="(fcItem,index) in financeBookList"
+        class="sendGood-print-box"
         :key="index+'-fcitem'"
-        style="width: 562pt;margin:0 auto;font-size:14px;"
-      >
+        style="width:564pt;margin:0 auto;font-size:14px;">
         <table
           ref="printBox"
           cellspacing="0"
           cellpadding="0"
-          style="border-collapse: collapse;width: 562pt;margin:0 auto;font-size:14px;"
+          style="border-collapse: collapse;width: 564pt;font-size:14px;">
           <tr>
-          <td>
-            <div class="print-box" style="width: 562pt;margin:0 auto;">
-              <h1 style="text-align:center;margin:0.2cm 0">收款通知单</h1>
-              <div>
+            <td>
+              <div class="print-box" style="width: 564pt;margin-left:1.5pt;">
+                <div style="text-align:center;margin:15pt 0 5pt;font-size:24px;font-weight: bold;">收款通知单</div>
                 <div>
-                  <table border="1" style="width: 562pt;border-collapse: collapse;text-align: center;">
-                    <tr>
-                      <th style="line-height: 20pt;width: 52pt;background:#f6f6f6;">日期</th>
-                      <th style="line-height: 20pt;width: 80pt;background:#f6f6f6;">客户名称</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">订单金额</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">收款金额</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">使用授信</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">余款抵扣</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">汇入银行</th>
-                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">足额打款</th>
-                      <th style="line-height: 20pt;width: 70pt;background:#f6f6f6;">说明</th>
-                    </tr>
-                    <tr v-for="item in fcItem.subList" :key="item.bookDetailSn">
-                      <td style="padding:3pt;width: 46pt;">{{ moment(item.receiptDate).format('M月D日') }}</td>
-                      <td style="padding:3pt;width: 74pt;text-align:left;">
-                        {{ item.payerName }}
-                        <div>
-                          {{ item.dealerEntity ? item.dealerEntity.kdMidCustomerFnumber : '' }}
-                        </div>
-                      </td>
-                      <td style="padding:3pt;width: 54pt;text-align:center;">
-                        {{ item.orderAmount?item.orderAmount.toFixed(2):'0.00' }}
-                      </td>
-                      <td style="padding:3pt;width: 54pt;text-align:center;">
-                        {{ item.receiptAmount?item.receiptAmount.toFixed(2):'0.00' }}
-                      </td>
-                      <td style="padding:3pt;width: 54pt;text-align:center;">
-                        {{ getTotal(item.detailItemUseList||[]) }}
-                      </td>
-                      <td style="padding:3pt;width: 54pt;text-align:center;">
-                        {{ item.balanceAmount?item.balanceAmount.toFixed(2):'0.00' }}
-                      </td>
-                      <td style="padding:3pt;width: 54pt;">
-                        {{ item.bankAccount }}<br>
-                        {{ item.bankName }}
-                      </td>
-                      <td style="padding:3pt;width: 54pt;">{{ item.fullPaymentFlagDictValue }}</td>
-                      <td style="padding:3pt;width: 84pt;word-break:break-all;">{{ item.remarks }}</td>
-                    </tr>
-                  </table>
-                  <div style="line-height: 30pt;border-bottom: 1px solid #666;">使用授信明细:{{ fcItem.detail||'--' }}</div>
-                  <div style="line-height: 30pt;" v-if="fcItem.audit&&fcItem.audit.taskVOList">
-                    审批人员:
-                    <span v-for="audit in fcItem.audit.taskVOList" :key="audit.processInstanceId">
-                      {{ audit.userName }}({{ audit.state }});
-                    </span>
-                  </div>
-                  <div style="line-height: 30pt;" v-else>
-                    审批人员:--
+                  <div>
+                    <table border="1" style="width: 564pt;border-collapse: collapse;text-align: center;">
+                      <tr>
+                        <th style="line-height: 20pt;width: 56pt;background:#f6f6f6;">日期</th>
+                        <th style="line-height: 20pt;width: 80pt;background:#f6f6f6;">客户名称</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">订单金额</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">收款金额</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">使用授信</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">余款抵扣</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">汇入银行</th>
+                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">足额打款</th>
+                        <th style="line-height: 20pt;width: 68pt;background:#f6f6f6;">说明</th>
+                      </tr>
+                      <tr v-for="item in fcItem.subList" :key="item.bookDetailSn">
+                        <td style="padding:3pt;width: 50pt;">{{ moment(item.receiptDate).format('MM月DD日') }}</td>
+                        <td style="padding:3pt;width: 74pt;text-align:left;">
+                          {{ item.payerName }}
+                          <div>
+                            {{ item.dealerEntity ? item.dealerEntity.kdMidCustomerFnumber : '' }}
+                          </div>
+                        </td>
+                        <td style="padding:3pt;width: 54pt;text-align:center;">
+                          {{ item.orderAmount?item.orderAmount.toFixed(2):'0.00' }}
+                        </td>
+                        <td style="padding:3pt;width: 54pt;text-align:center;">
+                          {{ item.receiptAmount?item.receiptAmount.toFixed(2):'0.00' }}
+                        </td>
+                        <td style="padding:3pt;width: 54pt;text-align:center;">
+                          {{ getTotal(item.detailItemUseList||[]) }}
+                        </td>
+                        <td style="padding:3pt;width: 54pt;text-align:center;">
+                          {{ item.balanceAmount?item.balanceAmount.toFixed(2):'0.00' }}
+                        </td>
+                        <td style="padding:3pt;width: 54pt;">
+                          {{ item.bankAccount }}<br>
+                          {{ item.bankName }}
+                        </td>
+                        <td style="padding:3pt;width: 54pt;">{{ item.fullPaymentFlagDictValue }}</td>
+                        <td style="padding:3pt;width: 62pt;word-break:break-all;">{{ item.remarks }}</td>
+                      </tr>
+                    </table>
+                    <div style="padding:5pt 0;border-bottom: 1px solid #333;">使用授信明细:{{ fcItem.detail||'' }}</div>
+                    <div style="padding:5pt 0;" v-if="fcItem.audit&&fcItem.audit.taskVOList">
+                      审批人员:
+                      <span v-for="audit in fcItem.audit.taskVOList" :key="audit.processInstanceId">
+                        {{ audit.userName }}({{ audit.state }});
+                      </span>
+                    </div>
+                    <div style="padding:5pt 0;" v-else>
+                      审批人员:
+                    </div>
                   </div>
                 </div>
               </div>
-            </div>
-          </td>
+            </td>
           </tr>
         </table>
-        <div
-          style="page-break-after:always"
-          v-if="(index+1)%2==0">&nbsp;</div>
       </div>
     </div>
     <div class="btn-box" style="display:flex;align-item:center;justify-content: center;">
@@ -87,7 +84,7 @@
 </template>
 
 <script>
-import { jGPrint } from '@/libs/JGPrint.js'
+import { jGPlPrint } from '@/libs/JGPrint.js'
 import moment from 'moment'
 export default {
   data () {
@@ -110,14 +107,36 @@ export default {
     },
     handleCommonOk () {
       const _this = this
-      const html = document.getElementById('sendGood-print').innerHTML
+      const html = document.getElementsByClassName('sendGood-print-box')
+      const printCons = []
+      for (let i = 0; i < html.length; i++) {
+        const h = html[i].clientHeight
+        printCons.push({
+          h: h,
+          t: html[i].innerHTML
+        })
+      }
+
+      // 排序从小到大
+      printCons.sort((a, b) => {
+        return a['h'] - b['h']
+      })
+
+      const htmlStr = []
+      for (let i = 0; i < printCons.length; i++) {
+        if (printCons[i].h > 560) {
+          htmlStr.push('')
+        }
+        htmlStr.push(printCons[i].t)
+      }
+
       _this.spinning = true
       // html, type, callback, printLogParams
-      jGPrint(html, 'preview', function (res) {
+      jGPlPrint(htmlStr, 'preview', function (res) {
         _this.spinning = false
         _this.handleCommonCancel()
         _this.$emit('printOk')
-      }, this.printNums)
+      }, this.printNums, this.financeBookList)
     },
     getData (data, list) {
       console.log(data)