zh пре 2 година
родитељ
комит
28acbf0545

+ 21 - 5
src/mixin/print.js

@@ -2,6 +2,8 @@ import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-
 
 disAutoConnect()
 import panel from '@/utils/panel'
+import panel2 from '@/utils/panel2'
+
 import { addPrint, getDtailPrintDis } from '@/api/supply/pickup'
 import { getDeliverDetail } from '@/api/supply/deliver'
 import { addPrints } from '@/api/supply/pickup'
@@ -49,7 +51,10 @@ export default {
       scaleMin: 0.5,
       loading: false,
       hiprintTemplate: '',
-      addIds: []
+      addIds: [],
+      dataLength: 5,
+      panelData: '',
+      moduleType: ''
     }
   },
   computed: {
@@ -71,7 +76,7 @@ export default {
   },
   methods: {
     // 初始化打印模板
-    initPrint() {
+    initPrint(type) {
       hiprint.init({
         providers: [new defaultElementTypeProvider()]
       })
@@ -91,10 +96,16 @@ export default {
           ]
         }
       })
+      let panelData = panel
+
+      if (type === 0) {
+        panelData = panel2
+        this.dataLength = 4
+      }
       // eslint-disable-next-line no-undef
       hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
       this.hiprintTemplate = new hiprint.PrintTemplate({
-        template: panel,
+        template: panelData,
         settingContainer: '#PrintElementOptionSetting',
         paginationContainer: '.hiprint-printPagination'
       })
@@ -283,6 +294,10 @@ export default {
       remark = funcType === 'getDtailPrintDis' ? data.invoicePickBeans[0].remark || '' : data.remark || ''
       console.log(data.invoicePickBeans[0], 'oo')
       const tuiHuoRen = data.createBy
+      let address = null
+      if (data.pickType === 2) {
+        address = data.invoicePickBeans[0].address || ''
+      }
       // 数量合计
       let total = 0
       // 初始化打印次数
@@ -292,14 +307,14 @@ export default {
       // 需要计算长度和数据裁切
       const invoicePickBeans = data.invoicePickBeans
       // 获取length向上取整
-      const len = Math.ceil(invoicePickBeans.length / 5)
+      const len = Math.ceil(invoicePickBeans.length / this.dataLength)
       for (let index = 0; index < len; index++) {
         const table = []
         //  length <= 0 则不执行打印
         if (invoicePickBeans.length) {
           // 取第一个条数据printNum
           printNum = invoicePickBeans[0].printNum
-          const newInvoicePickBeans = invoicePickBeans.splice(0, 5)
+          const newInvoicePickBeans = invoicePickBeans.splice(0, this.dataLength)
           for (let e = newInvoicePickBeans.length; e > 0; e--) {
             const tempData = newInvoicePickBeans[e - 1]
             total += Math.abs(+tempData.refundableQty)
@@ -353,6 +368,7 @@ export default {
           correspondNames: '',
           pickCar: data.pickCar || '',
           createBy: JSON.parse(localStorage.getItem('supply_user')).nickName,
+          address,
           table
         })
       }

+ 445 - 0
src/utils/panel2.js

@@ -0,0 +1,445 @@
+export default {
+  panels: [
+    {
+      index: 0,
+      height: 150,
+      width: 241,
+      paperCount: 222,
+      printElements: [
+        {
+          options: {
+            left: 0,
+            top: 25,
+            height: 27,
+            width: 640,
+            field: 'company',
+            fontSize: 19,
+            fontWeight: '600',
+            fontFamily: '黑体,宋体,微软雅黑',
+            textAlign: 'center',
+            lineHeight: 26
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 35,
+            height: 13,
+            lineHeight: 13,
+            width: 328,
+            fontSize: 12.5,
+            title: '打印日期',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'nowDate',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 590,
+            top: 35,
+            height: 13,
+            lineHeight: 13,
+            width: 328,
+            fontSize: 12.5,
+            title: '打印次数',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'printNum',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        // {
+        //   "options": {
+        //     "left": 25,
+        //     "top": 35,
+        //     "height": 13,
+        //     "lineHeight": 13,
+        //     "width": 328,
+        //     "fontSize": 12.5,
+        //     "title": "经销商编码",
+        //     "fontFamily": '黑体,宋体,微软雅黑',
+        //     "field": "customerNumber",
+        //     "color": "#000",
+        //     "textAlign": "left"
+        //   }, "printElementType": { "title": "", "type": "text" }
+        // },
+
+        {
+          options: {
+            left: 25,
+            top: 55,
+            height: 13,
+            lineHeight: 13,
+            width: 640,
+            fontSize: 12.5,
+            title: '经销商',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'customerName',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 500,
+            top: 55,
+            height: 13,
+            lineHeight: 13,
+            width: 300,
+            fontSize: 12.5,
+            title: '提货方式',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'pickTypeName',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 72,
+            height: 13,
+            lineHeight: 13,
+            width: 150,
+            fontSize: 12.5,
+            title: '出库单号',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'salesId',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 300,
+            top: 72,
+            height: 13,
+            lineHeight: 13,
+            width: 200,
+            fontSize: 12.5,
+            title: '发货单号',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'invoiceId',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+
+        {
+          options: {
+            left: 500,
+            top: 72,
+            height: 13,
+            lineHeight: 13,
+            width: 300,
+            fontSize: 12.5,
+            title: '仓库',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'correspondName',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 89,
+            height: 13,
+            lineHeight: 13,
+            width: 328,
+            fontSize: 12.5,
+            title: '工程登录编号',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'refEnginRecordNo',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 300,
+            top: 89,
+            height: 13,
+            lineHeight: 13,
+            width: 410,
+            fontSize: 12.5,
+            title: '使用单位',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'refUseUnit',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 106,
+            height: 13,
+            lineHeight: 13,
+            width: 633,
+            fontSize: 12.5,
+            title: '备注',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'headerRemark',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text', fontSize: 8 }
+        },
+        {
+          options: {
+            left: 23,
+            top: 123,
+            height: 410,
+            width: 630,
+            fontSize: 12.5,
+            field: 'table',
+            fontFamily: '黑体,宋体,微软雅黑',
+            lineHeight: 16,
+            tableFooterRepeat: 'last',
+            columns: [
+              [
+                {
+                  title: '订单号',
+                  field: 'enginOrderType',
+                  width: 60,
+                  align: 'left',
+                  colspan: 1,
+                  rowspan: 1,
+                  fontSize: 12.5
+                },
+                {
+                  title: '发货日期',
+                  field: 'createTime',
+                  width: 50,
+                  align: 'left',
+                  colspan: 1,
+                  rowspan: 1,
+                  fontSize: 12.5
+                },
+
+                {
+                  title: '存货名称',
+                  field: 'materialName',
+                  width: 100,
+                  align: 'left',
+                  colspan: 1,
+                  rowspan: 1,
+                  fontSize: 12.5
+                },
+                {
+                  title: '规格型号',
+                  field: 'specification',
+                  width: 140,
+                  align: 'left',
+                  overflow: 'hidden',
+                  colspan: 1,
+                  rowspan: 1,
+                  fontSize: 12.5
+                },
+                {
+                  title: '数量',
+                  field: 'refundableQty',
+                  width: 23,
+                  align: 'center',
+                  colspan: 1,
+                  rowspan: 1,
+                  fontSize: 12.5,
+                  tableSummary: 'sum'
+                },
+                // , {
+                //   "title": "订单备注",
+                //   "field": "headerRemark",
+                //   "width": 40,
+                //   "align": "center",
+                //   "colspan": 1,
+                //   "rowspan": 1,
+                //   "fontSize": 12.5,
+                // }
+                {
+                  title: '备注说明',
+                  field: 'pjxh1Text',
+                  width: 40,
+                  align: 'left',
+                  colspan: 2,
+                  rowspan: 1,
+                  fontSize: 12.5
+                }
+              ]
+            ]
+          },
+          printElementType: {
+            title: '表格',
+            type: 'table',
+            editable: true,
+            columnDisplayEditable: true, // 列显示是否能编辑
+            columnDisplayIndexEditable: true, // 列顺序显示是否能编辑
+            columnTitleEditable: true, // 列标题是否能编辑
+            columnResizable: true, // 列宽是否能调整
+            columnAlignEditable: true, // 列对齐是否调整
+            isEnableEditField: true, // 编辑字段
+            isEnableContextMenu: true, // 开启右键菜单 默认true
+            isEnableInsertRow: true, // 插入行
+            isEnableDeleteRow: true, // 删除行
+            isEnableInsertColumn: true, // 插入列
+            isEnableDeleteColumn: true, // 删除列
+            isEnableMergeCell: true // 合并单元格
+          }
+        },
+
+        {
+          options: {
+            left: 25,
+            top: 376,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'takerName',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 410,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '打单',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'createBy',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 238,
+            top: 410,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '提单',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'takerDa',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 238,
+            top: 376,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '联系方式',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'takerPhone',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 463,
+            top: 376,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '车辆',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'pickCar',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 463,
+            top: 410,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: '仓库',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'correspondNames',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        },
+        {
+          options: {
+            left: 25,
+            top: 393,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 12.5,
+            title: "提货人收货地址",
+            fontFamily: "黑体,宋体,微软雅黑",
+            field: "address",
+            testData: "",
+            color: "#000",
+            textAlign: "left",
+          },
+          printElementType: { title: "", type: "text" },
+        },
+        {
+          options: {
+            left: 610,
+            top: 410,
+            height: 13,
+            lineHeight: 13,
+            width: 218,
+            fontSize: 16,
+            title: '',
+            fontFamily: '黑体,宋体,微软雅黑',
+            field: 'pageNumber',
+            testData: '',
+            color: '#000',
+            textAlign: 'left'
+          },
+          printElementType: { title: '', type: 'text' }
+        }
+      ],
+      paperNumberDisabled: true
+    }
+  ]
+}

+ 13 - 2
src/views/finance/components/design/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
     <a-button type="primary" icon="eye" @click="preView"> 预览 </a-button>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </div>
 </template>
 
@@ -22,7 +23,17 @@ export default {
   },
 
   methods: {
-    preView() {}
+    preView() {} ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
+    }
   }
 }
 </script>

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

@@ -23,8 +23,14 @@
 
 <script>
 export default {
-  name: 'printPreview',
-  props: {},
+    name: 'PrintPreview',
+  props: {
+    addPrint: {
+      type: Function,
+      default: null
+    },
+  },
+ 
   data() {
     return {
       visible: false,

+ 14 - 1
src/views/finance/receipt_list.vue

@@ -18,7 +18,8 @@
     <div class="app-container" v-else>
       <ReceiptListDetail :detailId="detailId" />
     </div>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </div>
 </template>
 
@@ -137,6 +138,7 @@ export default {
     selectionChange(data) {
       this.tableSelection = data
     },
+    
     operation() {
       return (h, { row, index, column }) => {
         return (
@@ -410,6 +412,17 @@ export default {
           </div>
        </div>
       `
+    },
+
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 12 - 1
src/views/finance/receivable_list.vue

@@ -15,7 +15,8 @@
       <ReceivableListApproval :approvalId="approvalId" v-if="showPage == 3" @close="handleClose" />
       <ReceivableListDetail :approvalId="approvalId" :czType="czType" v-if="showPage == 4" @close="handleClose" />
     </Popu>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </template-page>
 </template>
 
@@ -445,6 +446,16 @@ export default {
       var currentdate = year + seperator1 + month + seperator1 + strDate
       console.log(currentdate)
       return currentdate
+    } ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 12 - 1
src/views/supply/apply/components/apply_detail.vue

@@ -283,7 +283,8 @@
         </div>
       </div>
     </div>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
     <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
   </div>
 </template>
@@ -406,6 +407,16 @@ export default {
     backDetail() {
       this.printId = ''
       this.isShowPrint = false
+    },
+    handleRefreshList(){
+      // this.recordSelected = []
+      // this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 13 - 2
src/views/supply/apply/components/design/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
     <a-button type="primary" icon="eye" @click="preView"> 预览 </a-button>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </div>
 </template>
 
@@ -22,7 +23,17 @@ export default {
   },
 
   methods: {
-    preView() {}
+    preView() {} ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
+    }
   }
 }
 </script>

+ 65 - 45
src/views/supply/apply/components/design/preview.vue

@@ -1,14 +1,15 @@
 <template>
   <el-dialog
+    class="sub-main"
     :visible.sync="visible"
     :show-close="false"
-    :maskClosable="false"
+    :mask-closable="false"
     :close-on-click-modal="false"
-    @cancel="hideModal"
     :width="350 + 'mm'"
+    @cancel="hideModal"
   >
-    <div :spinning="spinning" style="min-height: 100px">
-      <div id="preview_content" ref="printDom"></div>
+    <div v-loading="spinning" style="min-height: 100px">
+      <div id="preview_content" ref="printDom" />
     </div>
     <template slot="title">
       <div>
@@ -18,7 +19,7 @@
       </div>
     </template>
     <template slot="footer">
-      <el-button key="close" type="info" @click="hideModal"> 关闭 </el-button>
+      <el-button key="close" type="info" @click="hideModal"> 关闭</el-button>
     </template>
   </el-dialog>
 </template>
@@ -27,9 +28,16 @@
 // import { downloadPDF } from '@/utils/pdf'
 import { addPrint } from './print-data'
 import { detailArr } from './print-data'
+
 export default {
-  name: 'printPreview',
-  props: {},
+    name: 'PrintPreview',
+  props: {
+    addPrint: {
+      type: Function,
+      default: null
+    },
+  },
+ 
   data() {
     return {
       visible: false,
@@ -40,13 +48,16 @@ export default {
       // 模板
       hiprintTemplate: {},
       // 数据
-      printData: {}
+      printData: {},
+      loading: true
     }
   },
   computed: {},
   watch: {},
-  created() {},
-  mounted() {},
+  created() {
+  },
+  mounted() {
+  },
   methods: {
     // handleExport() {
     //   downloadPDF(this.$refs.printDom);
@@ -54,16 +65,15 @@ export default {
     hideModal() {
       this.visible = false
       this.waitShowPrinter = false
-      this.$parent.initPrint()
+      this.$emit('initPrint')
       // console.log(this.$parent);
     },
     show(hiprintTemplate, printData, width = '210') {
-      console.log(hiprintTemplate, '111')
       this.visible = true
-      this.spinning = true
       this.width = width
       this.hiprintTemplate = hiprintTemplate
       this.printData = printData
+
       setTimeout(() => {
         // eslint-disable-next-line no-undef
         $('#preview_content').html(hiprintTemplate.getHtml(printData))
@@ -71,31 +81,37 @@ export default {
       }, 500)
     },
     print() {
-      this.hiprintTemplate.print(
-        this.printData,
-        {},
-        {
-          callback: () => {
-            addPrint()
-            this.hiprintTemplate = {}
-            this.$parent.getList()
-            this.$parent.tableSelection = []
-          }
+
+      try {
+        if (typeof this.addPrint === 'function') {
+          this.addPrint('addPrints').then(() => {
+            this.hiprintTemplate.print(
+              this.printData,
+              {},
+              {
+                callback: async() => {
+                  this.hiprintTemplate = {}
+                  // setTimeout(() => {
+                  //   console.error('更新发货汇总列表')
+                  //   // this.$successMsg('更新成功')
+                  // }, 1000)
+                  setTimeout(() => {
+                    console.error('更新发货汇总列表')
+                    this.$emit('refreshList')
+                  }, 1000)
+                }
+              }
+            )
+
+          })
+        } else {
+          throw new Error('加载失败,刷新重试')
         }
-      )
-      this.hiprintTemplate.on('printSuccess', function (data) {
-        console.log('打印完成')
-        //  addPrint()
-        this.hiprintTemplate = {}
-        this.$parent.getList()
-        this.$parent.tableSelection = []
-      })
-      // this.hiprintTemplate.on('printError', function (data) {
-      //   console.log('打印失败')
-      //   this.hiprintTemplate = {}
-      //     this.$parent.getList()
-      //     this.$parent.tableSelection =[]
-      // })
+      } catch (e) {
+        this.$errorMsg(e)
+        // '调用打印次数接口失败'
+      }
+
       setTimeout(() => {
         this.hideModal()
       }, 2000)
@@ -107,6 +123,7 @@ export default {
   }
 }
 </script>
+
 <style scoped>
 ::v-deep .el-dialog__body {
   padding: 0;
@@ -116,14 +133,22 @@ export default {
   height: 40px !important;
 }
 
+::v-deep td {
+  height: 40px !important;
+  overflow: hidden;
+  /* display: -webkit-box; */
+  -webkit-line-clamp: 2;
+  /* 数值代表显示几行 */
+  -webkit-box-orient: vertical;
+}
+
 ::v-deep .hiprint-printPaper {
   margin: 0 auto;
 }
 
 /* ::v-deep tr td {
   border: 0 !important;
-  width: 911px !important;
-    height: 529px !important;
+
 } */
 
 ::v-deep .hiprint-paperNumber {
@@ -139,11 +164,10 @@ export default {
 }
 
 @media print {
-  /*    
+  /*
   td {
     border: none !important;
   } */
-
   .drag_item_box {
     height: 100%;
     padding: 6px;
@@ -205,10 +229,6 @@ export default {
     height: 529px !important; */
   }
 
-  ::v-deep .hiprint-paperNumber {
-    display: none;
-  }
-
   .ant-modal-body {
     padding: 0px;
   }

+ 13 - 1
src/views/supply/apply/components/engin_detail.vue

@@ -306,7 +306,8 @@
       </div>
     </div>
 
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
 
     <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
   </div>
@@ -435,6 +436,17 @@ export default {
     backDetail() {
       this.printId = ''
       this.isShowPrint = false
+    },
+    
+    handleRefreshList(){
+      // this.recordSelected = []
+      // this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 12 - 1
src/views/supply/deliver/components/commerce_detail.vue

@@ -261,7 +261,8 @@
         </div>
       </div>
     </div>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
 
     <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
   </div>
@@ -373,6 +374,16 @@ export default {
       } catch (error) {
         this.$message.error(`操作失败: ${error}`)
       }
+    } ,
+    handleRefreshList(){
+      // this.recordSelected = []
+      // this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 12 - 1
src/views/supply/deliver/components/deliver_detail.vue

@@ -269,7 +269,8 @@
         </div>
       </div>
     </div>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
 
     <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
   </div>
@@ -364,6 +365,16 @@ export default {
     backDetail() {
       this.printId = ''
       this.isShowPrint = false
+    } ,
+    handleRefreshList(){
+      // this.recordSelected = []
+      // this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 13 - 2
src/views/supply/deliver/components/design/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
     <a-button type="primary" icon="eye" @click="preView"> 预览 </a-button>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </div>
 </template>
 
@@ -22,7 +23,17 @@ export default {
   },
 
   methods: {
-    preView() {}
+    preView() {} ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
+    }
   }
 }
 </script>

+ 14 - 13
src/views/supply/deliver/components/design/preview.vue

@@ -31,7 +31,13 @@ import { detailArr } from './print-data'
 
 export default {
   name: 'PrintPreview',
-  props: {},
+  props: {
+    addPrint: {
+      type: Function,
+      default: null
+    }
+  },
+
   data() {
     return {
       visible: false,
@@ -48,10 +54,8 @@ export default {
   },
   computed: {},
   watch: {},
-  created() {
-  },
-  mounted() {
-  },
+  created() {},
+  mounted() {},
   methods: {
     // handleExport() {
     //   downloadPDF(this.$refs.printDom);
@@ -59,7 +63,7 @@ export default {
     hideModal() {
       this.visible = false
       this.waitShowPrinter = false
-      this.$parent.initPrint()
+      this.$emit('initPrint')
       // console.log(this.$parent);
     },
     show(hiprintTemplate, printData, width = '210') {
@@ -75,29 +79,26 @@ export default {
       }, 500)
     },
     print() {
-
       try {
-        if (typeof this.$parent.addPrint === 'function') {
-          this.$parent.addPrint('addPrints').then(() => {
+        if (typeof this.addPrint === 'function') {
+          this.addPrint('addPrints').then(() => {
             this.hiprintTemplate.print(
               this.printData,
               {},
               {
-                callback: async() => {
+                callback: async () => {
                   this.hiprintTemplate = {}
-                  this.$parent.tableSelection = []
                   // setTimeout(() => {
                   //   console.error('更新发货汇总列表')
                   //   // this.$successMsg('更新成功')
                   // }, 1000)
                   setTimeout(() => {
                     console.error('更新发货汇总列表')
-                    this.$parent.getList()
+                    this.$emit('refreshList')
                   }, 1000)
                 }
               }
             )
-
           })
         } else {
           throw new Error('加载失败,刷新重试')

+ 12 - 1
src/views/supply/deliver/components/home_detail.vue

@@ -268,7 +268,8 @@
         </div>
       </div>
     </div>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
 
     <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
   </div>
@@ -362,6 +363,16 @@ export default {
     backDetail() {
       this.printId = ''
       this.isShowPrint = false
+    } ,
+    handleRefreshList(){
+      // this.recordSelected = []
+      // this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
     }
   }
 }

+ 14 - 4
src/views/supply/deliver/sum_list.vue

@@ -19,7 +19,7 @@
       <apply-return-form v-if="isShow === 2" @backListFormDetail="backList" />
       <engin-return-form v-if="isShow === 3" @backListFormDetail="backList" />
     </Popu>
-    <print-preview ref="preView" />
+    <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
     <el-dialog
       title="密码确认"
       :visible.sync="isShowDialog"
@@ -427,9 +427,7 @@ export default {
       this.tableSelection = data
     },
 
-    handleSelectAll(selection) {
-      this.tableSelection = this.$refs.table.selection
-    },
+
 
     // 点击打印
     toPrint() {
@@ -493,6 +491,18 @@ export default {
       this.isShow = 1
       this.$refs.pageRef.refreshList()
     }
+    ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.tableSelection = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
+    }
   }
 }
 </script>

+ 17 - 3
src/views/supply/pickup/check.vue

@@ -417,7 +417,7 @@
         <el-button type="primary" @click="submitDialogForm">确 定</el-button>
       </div>
     </el-dialog>
-    <print-preview ref="preView" />
+    <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint" />
 
     <!-- <PickupPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" /> -->
   </div>
@@ -536,10 +536,10 @@ export default {
   //   this.initPrint()
   // },
   mounted() {
-    this.initPrint()
+    this.initPrint(this.check)
   },
   methods: {
-    handleReset() {
+    handleReset(e) {
       this.screenForm.customerId = ''
       this.screenForm.logisticsId = ''
       this.screenForm.warehouse = ''
@@ -548,6 +548,10 @@ export default {
       this.dataList = []
       this.listTotal = 0
       this.listLoading = false
+      this.hiprintTemplate = null
+      this.$nextTick(() => {
+        this.initPrint(this.check)
+      })
     },
     getDate() {
       var date = new Date()
@@ -794,6 +798,16 @@ export default {
           })
         }
       })
+    },
+
+    handleRefreshList() {
+      this.tableSelection = []
+      // this.$refs.pageRef.refreshList()
+    },
+    handleInitPrint() {
+      this.$nextTick(() => {
+        this.initPrint(this.check)
+      })
     }
   }
 }

+ 13 - 2
src/views/supply/pickup/components/design/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
     <a-button type="primary" icon="eye" @click="preView"> 预览 </a-button>
-    <print-preview ref="preView" />
+         <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
+
   </div>
 </template>
 
@@ -22,7 +23,17 @@ export default {
   },
 
   methods: {
-    preView() {}
+    preView() {} ,
+    handleRefreshList(){
+      this.recordSelected = []
+      this.$refs.pageRef.refreshList()
+
+    },
+    handleInitPrint(){
+      this.$nextTick(() => {
+      this.initPrint()
+    })
+    }
   }
 }
 </script>

+ 41 - 11
src/views/supply/pickup/components/design/preview.vue

@@ -1,5 +1,6 @@
 <template>
   <el-dialog
+    class="sub-main"
     :visible.sync="visible"
     :show-close="false"
     :mask-closable="false"
@@ -7,7 +8,7 @@
     :width="350 + 'mm'"
     @cancel="hideModal"
   >
-    <div :spinning="spinning" style="min-height: 100px">
+    <div v-loading="spinning" style="min-height: 100px">
       <div id="preview_content" ref="printDom" />
     </div>
     <template slot="title">
@@ -24,9 +25,19 @@
 </template>
 
 <script>
+// import { downloadPDF } from '@/utils/pdf'
+import { addPrint } from './print-data'
+import { detailArr } from './print-data'
+
 export default {
-  name: 'PrintPreview',
-  props: {},
+    name: 'PrintPreview',
+  props: {
+    addPrint: {
+      type: Function,
+      default: null
+    },
+  },
+ 
   data() {
     return {
       visible: false,
@@ -37,7 +48,8 @@ export default {
       // 模板
       hiprintTemplate: {},
       // 数据
-      printData: {}
+      printData: {},
+      loading: true
     }
   },
   computed: {},
@@ -53,7 +65,7 @@ export default {
     hideModal() {
       this.visible = false
       this.waitShowPrinter = false
-      this.$parent.initPrint()
+      this.$emit('initPrint')
       // console.log(this.$parent);
     },
     show(hiprintTemplate, printData, width = '210') {
@@ -61,6 +73,7 @@ export default {
       this.width = width
       this.hiprintTemplate = hiprintTemplate
       this.printData = printData
+
       setTimeout(() => {
         // eslint-disable-next-line no-undef
         $('#preview_content').html(hiprintTemplate.getHtml(printData))
@@ -68,21 +81,24 @@ export default {
       }, 500)
     },
     print() {
+
       try {
-        if (typeof this.$parent.addPrint === 'function') {
-          this.$parent.addPrint('getDtailPrintDis').then(() => {
+        if (typeof this.addPrint === 'function') {
+          this.addPrint('addPrints').then(() => {
             this.hiprintTemplate.print(
               this.printData,
               {},
               {
                 callback: async() => {
                   this.hiprintTemplate = {}
-                  this.$parent.tableSelection = []
-
+                  // setTimeout(() => {
+                  //   console.error('更新发货汇总列表')
+                  //   // this.$successMsg('更新成功')
+                  // }, 1000)
                   setTimeout(() => {
                     console.error('更新发货汇总列表')
-                    this.$parent.getList()
-                  }, 2000)
+                    this.$emit('refreshList')
+                  }, 1000)
                 }
               }
             )
@@ -95,10 +111,15 @@ export default {
         this.$errorMsg(e)
         // '调用打印次数接口失败'
       }
+
       setTimeout(() => {
         this.hideModal()
       }, 2000)
     }
+    // toPdf() {
+    //   downloadPDF(this.$refs.printDom);
+    //   this.hiprintTemplate.toPdf({}, '打印预览');
+    // },
   }
 }
 </script>
@@ -112,6 +133,15 @@ export default {
   height: 40px !important;
 }
 
+::v-deep td {
+  height: 40px !important;
+  overflow: hidden;
+  /* display: -webkit-box; */
+  -webkit-line-clamp: 2;
+  /* 数值代表显示几行 */
+  -webkit-box-orient: vertical;
+}
+
 ::v-deep .hiprint-printPaper {
   margin: 0 auto;
 }