Przeglądaj źródła

Merge branch 'develop_yh13' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh13

chenrui 2 lat temu
rodzic
commit
88a2956ad7

+ 1 - 1
public/version.json

@@ -1,4 +1,4 @@
 {
-    "version": "2.2.1",
+    "version": "2.2.4",
     "message": "发现有新版本发布,确定更新系统?"
 }

+ 20 - 5
src/libs/JGPrint.js

@@ -142,6 +142,23 @@ export const jGPrint = function (data, type, callback, printLogParams, printPage
   }
 }
 
+// 自动排版, 遍历数组,将数组中每一个数值加起来,如果和小于某个数,则将这些数值存放到一个新数组中。
+export const groupLessThan = function(numbers, targetSum) {
+  let currentSum = 0;
+  let result = [];
+  for (let i = 0; i < numbers.length; i++) {
+    currentSum += numbers[i].h;
+    if (currentSum <= targetSum) {
+      result.push(numbers[i].t);
+    } else {
+      result.push('&-NEWPAGE-&'); // 用'&-NEWPAGE-&'作为分页符
+      currentSum = numbers[i].h; // 重新计算当前总和
+      result.push(numbers[i].t);
+    }
+  }
+  return result;
+}
+
 // 批量打印销售收款单html
 export const jGPlPrint = function (data, type, callback, printLogParams, taskName) {
   if (!data) {
@@ -189,11 +206,9 @@ export const jGPlPrint = function (data, type, callback, printLogParams, taskNam
   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.NewPage();
-     }
-     LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data[i]+(data[i+1]||''))
+  for(var i=0;i<data.length;i++){
+    LODOP.NewPage();
+    LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data[i])
   }
   
   if (type == 'preview') { //  预览

+ 3 - 0
src/utils/mixin.js

@@ -101,6 +101,9 @@ const commonMixin = {
         if(this.addMoreLoading != undefined){
           this.addMoreLoading = a
         }
+        if(this.confirmLoading != undefined){
+          this.confirmLoading = a
+        }
       }
     }
   },

+ 9 - 13
src/views/expenseManagement/expenseReimbursement/previewModal.vue

@@ -125,7 +125,8 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { jGPlPrint } from '@/libs/JGPrint.js'
+import { jGPlPrint, groupLessThan } from '@/libs/JGPrint.js'
+
 export default {
   mixins: [commonMixin],
   data () {
@@ -142,31 +143,26 @@ export default {
     prints(){
       const _this = this
       const html = document.getElementsByClassName('expense-detail-print')
+      const pageHeight = 535
       const printCons = []
       for (let i = 0; i < html.length; i++) {
         const h = html[i].clientHeight
         printCons.push({
-          h: h,
-          t: html[i].innerHTML
+          h: h<=pageHeight?pageHeight:h,
+          t: '<div style="height:'+(h<=pageHeight?(pageHeight+'px'):'auto')+';">'+html[i].innerHTML+'</div>'
         })
       }
       // 排序从小到大
       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('')
-        }
-        printCons[i].t = '<div style="height:530px;margin:0 auto;">' +printCons[i].t+'</div>'
-        htmlStr.push(printCons[i].t)
-      }
+      // 自动排版
+      const htmlStr = groupLessThan(printCons, pageHeight*2)
+      // console.log(htmlStr.join('').split('&-NEWPAGE-&'))
       this.$store.state.app.curActionPermission = 'B_eRPrint'
       // html, type, callback, printLogParams
       // console.log(htmlStr)
-      jGPlPrint(htmlStr, 'print', function (res) {
+      jGPlPrint(htmlStr.join('').split('&-NEWPAGE-&'), 'preview', function (res) {
         _this.$store.state.app.curActionPermission = ''
         _this.$emit('printOk', res)
       },null,'费用报销单')

+ 9 - 14
src/views/salesManagement/receiptPrint/printModel.vue

@@ -15,7 +15,7 @@
           <tr>
             <td>
               <div class="print-box" style="width: 564pt;margin-left:1.5pt;">
-                <div style="text-align:center;margin:15pt 0 5pt;font-size:22px;font-weight: bold;">收款通知单</div>
+                <div style="text-align:center;margin:5pt 0;font-size:22px;font-weight: bold;">收款通知单</div>
                 <div>
                   <div>
                     <table border="1" style="width: 564pt;border-collapse: collapse;text-align: center;">
@@ -82,7 +82,7 @@
 </template>
 
 <script>
-import { jGPlPrint } from '@/libs/JGPrint.js'
+import { jGPlPrint, groupLessThan } from '@/libs/JGPrint.js'
 import moment from 'moment'
 export default {
   data () {
@@ -106,12 +106,13 @@ export default {
     handleCommonOk () {
       const _this = this
       const html = document.getElementsByClassName('sendGood-print-box')
+      const pageHeight = 535
       const printCons = []
       for (let i = 0; i < html.length; i++) {
         const h = html[i].clientHeight
         printCons.push({
-          h: h,
-          t: html[i].innerHTML
+          h: h<=pageHeight?pageHeight:h,
+          t: '<div style="height:'+(h<=pageHeight?(pageHeight+'px'):'auto')+';">'+html[i].innerHTML+'</div>'
         })
       }
 
@@ -120,19 +121,13 @@ export default {
         return a['h'] - b['h']
       })
 
-      const htmlStr = []
-      for (let i = 0; i < printCons.length; i++) {
-        if (printCons[i].h > 560) {
-          htmlStr.push('')
-        }else{
-          printCons[i].t = '<div style="width:564pt;margin:0 auto;height:535px;">' +printCons[i].t+'</div>'
-        }
-        htmlStr.push(printCons[i].t)
-      }
+      // 自动排版
+      const htmlStr = groupLessThan(printCons, pageHeight*2)
+      // console.log(htmlStr.join('').split('&-NEWPAGE-&'))
       this.$store.state.app.curActionPermission = 'B_SkPrint'
       // html, type, callback, printLogParams
       this.spinning = true
-      jGPlPrint(htmlStr, 'print', function (res) {
+      jGPlPrint(htmlStr.join('').split('&-NEWPAGE-&'), 'preview', function (res) {
         if(res){
           _this.handleCommonCancel()
         }

+ 2 - 2
vue.config.js

@@ -107,9 +107,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.113:8660/ocs-admin',
+        // target: 'http://192.168.2.113:8660/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        // target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
+        target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {