lilei 2 years ago
parent
commit
008d65c3df

File diff suppressed because it is too large
+ 1 - 0
public/js/axios.min.js


File diff suppressed because it is too large
+ 0 - 0
public/js/echarts.min.js


File diff suppressed because it is too large
+ 5 - 0
public/js/vue-router.min.js


File diff suppressed because it is too large
+ 5 - 0
public/js/vue.min.js


File diff suppressed because it is too large
+ 5 - 0
public/js/vuex.min.js


+ 9 - 0
src/api/productUniversalCode.js

@@ -46,3 +46,12 @@ export const productCodeQueryList = (params) => {
     method: 'post'
   })
 }
+// 导出 
+export const productUniversalExport = (params) => {
+  return axios({
+    url: '/productUniversalCode/exportExcel',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 65 - 16
src/libs/JGPrint.js

@@ -143,20 +143,69 @@ 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);
-    }
+export const groupLessThan = function(html) {
+  const pageMidHeight = 535 // 半页高度
+  const pageHeight = pageMidHeight*2 // 页高度
+  const arr = []
+  const result = []
+  for (let i = 0; i < html.length; i++) {
+    const h = html[i].clientHeight // 总高度
+    const pz = h<=pageMidHeight ? '0.5' : (h/pageHeight).toFixed(2) // 页数
+    arr.push({
+      h: h,
+      pz: pz,
+      t: '<div style="height:'+(pz<=0.5?pageMidHeight:'auto')+'px'+';border:1px solid #fff;">'+html[i].innerHTML+'</div>',
+      flag: 0
+    })
   }
-  return result;
+  console.log(arr)
+   // 找出所有小于半张纸的
+   const a = arr.filter(item => item.pz <= 0.5)
+   // 先找出所有超过半张纸的,小于一张纸的
+   const b = arr.filter(item => item.pz >0.5 && item.pz <= 1)
+   // 找出所有超过一张纸的
+   const c = arr.filter(item => item.pz > 1)
+   // 先给c 找匹配的另一半
+   for(let i=0;i<c.length;i++){
+    const pz = Number(c[i].pz.split('.')[1])
+    // 先从b中找
+    const hasOther = b.findIndex(item => (item.pz + pz) < 1)
+    if(hasOther>=0){
+      result.push(c[i].t + b[hasOther].t)
+      // 删除hasOther
+      b.splice(hasOther,1)
+    }else{
+      // 再从a中找
+      const hasOtherA = a.findIndex(item => (item.pz + pz) < 1)
+      if(hasOtherA>=0){
+        result.push(c[i].t + a[hasOtherA].t)
+        // 删除hasOtherA
+        b.splice(hasOther,1)
+      }else{
+        // 都没匹配到
+        result.push(c[i].t)
+      }
+    }
+   }
+
+   // 将b依次加入
+   for(let i=0;i<b.length;i++){
+    result.push(b[i].t)
+   }
+
+   // 将a中每2个放到一个容器中
+   if(a.length%2!=0){
+    a.push({t:''})
+   }
+   for(let i=0;i<a.length;i=i+2){
+    result.push(a[i].t + a[i+1].t)
+   }
+
+  //  console.log(a)
+  //  console.log(b)
+  //  console.log(c)
+  //  console.log(result)
+   return result
 }
 
 // 批量打印销售收款单html
@@ -189,9 +238,9 @@ export const jGPlPrint = function (data, type, callback, printLogParams, taskNam
   // LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
   // TaskID:任务id,Value:job代码
   LODOP.On_Return = function (TaskID, Value) {
-    console.log(TaskID, Value, printLogParams)
+    console.log(TaskID, Value!=0, printLogParams)
     // 已打印
-    if (Value) {
+    if (Number(Value)) {
       if(printLogParams){
         console.log('已打印,统计打印次数')
         printLog(printLogParams, callback)
@@ -209,7 +258,7 @@ export const jGPlPrint = function (data, type, callback, printLogParams, taskNam
   if(data.length>1){
     // 循环页
     for(var i=0;i<data.length;i++){
-      LODOP.NewPage();
+      LODOP.NewPageA();
       LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data[i])
     }
   }else{

+ 2 - 17
src/views/expenseManagement/expenseReimbursement/previewModal.vue

@@ -143,26 +143,11 @@ 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<=pageHeight?pageHeight:h,
-          t: '<div style="height:'+(h<=pageHeight?(pageHeight+'px'):'auto')+';border:1px solid #fff;">'+html[i].innerHTML+'</div>'
-        })
-      }
-      // 排序从小到大
-      printCons.sort((a, b) => {
-        return a['h'] - b['h']
-      })
-      console.log(printCons)
       // 自动排版
-      const htmlStr = groupLessThan(printCons, pageHeight*2)
+      const result = groupLessThan(html)
       this.$store.state.app.curActionPermission = 'B_eRPrint'
       // html, type, callback, printLogParams
-      // console.log(htmlStr)
-      jGPlPrint(htmlStr.join('').split('&-NEWPAGE-&'), 'print', function (res) {
+      jGPlPrint(result, 'print', function (res) {
         _this.$store.state.app.curActionPermission = ''
         _this.$emit('printOk', res)
       },null,'费用报销单')

+ 15 - 6
src/views/productManagement/productUniversal/list.vue

@@ -35,6 +35,14 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productUniversalList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="productUniversalList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="productUniversalList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -94,7 +102,8 @@ import { commonMixin } from '@/utils/mixin'
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import productUniversalEditModal from './editModal.vue'
-import { productUniversalCodeList, productUniversalCodeDel } from '@/api/productUniversalCode'
+import { exportExcel } from '@/libs/JGPrint.js'
+import { productUniversalCodeList, productUniversalCodeDel, productUniversalExport } from '@/api/productUniversalCode'
 export default {
   name: 'ProductUniversalList',
   mixins: [commonMixin],
@@ -194,12 +203,12 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
-      this.exportLoading = true
-      // customerBundleExportDelay(params).then(res => {
-      //   this.exportLoading = false
-      //   this.download(res)
-      // })
+      this.spinning = true
+      exportExcel(productUniversalExport, params, '通用产品列表', function () {
+        _this.spinning = false
+      })
     },
     download (data) {
       if (!data) { return }

+ 2 - 19
src/views/salesManagement/receiptPrint/printModel.vue

@@ -106,28 +106,11 @@ 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<=pageHeight?pageHeight:h,
-          t: '<div style="height:'+(h<=pageHeight?(pageHeight+'px'):'auto')+';border:1px solid #fff;">'+html[i].innerHTML+'</div>'
-        })
-      }
-
-      // 排序从小到大
-      printCons.sort((a, b) => {
-        return a['h'] - b['h']
-      })
-
-      // 自动排版
-      const htmlStr = groupLessThan(printCons, pageHeight*2)
-      // console.log(htmlStr.join('').split('&-NEWPAGE-&'))
+      const result = groupLessThan(html)
       this.$store.state.app.curActionPermission = 'B_SkPrint'
       // html, type, callback, printLogParams
       this.spinning = true
-      jGPlPrint(htmlStr.join('').split('&-NEWPAGE-&'), 'print', function (res) {
+      jGPlPrint(result, 'print', function (res) {
         if(res){
           _this.handleCommonCancel()
         }

+ 7 - 6
vue.config.js

@@ -27,10 +27,11 @@ const assetsCDN = {
   css: [],
   // https://unpkg.com/browse/vue@2.6.10/
   js: [
-    '//vuepkg.oss-cn-beijing.aliyuncs.com/vue.min.js',
-    '//vuepkg.oss-cn-beijing.aliyuncs.com/vue-router.min.js',
-    '//vuepkg.oss-cn-beijing.aliyuncs.com/vuex.min.js',
-    '//vuepkg.oss-cn-beijing.aliyuncs.com/axios.min.js'
+    BASE_URL + 'js/vue.min.js',
+    BASE_URL + 'js/vue-router.min.js',
+    BASE_URL + 'js/vuex.min.js',
+    BASE_URL + 'js/axios.min.js',
+    // BASE_URL + 'js/echarts.min.js'
   ]
 }
 
@@ -107,9 +108,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.111/ocs-admin',
+        target: 'http://192.168.2.111/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: {

Some files were not shown because too many files changed in this diff