Selaa lähdekoodia

Merge tag 'Hotfix-zh-176' into develop

Finish Hotfix-zh-176
Howie 3 vuotta sitten
vanhempi
commit
7fbcf10bfb

+ 117 - 2
src/views/supply/apply/components/apply_detail.vue

@@ -175,13 +175,20 @@
       </div>
 
     </div>
-
+    <!-- <print-preview ref="preView" /> -->
     <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" />
 
   </div>
 </template>
 
 <script>
+  import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
+disAutoConnect();
+
+import panel from './design/panel'
+import { getDetail, detailArr } from './design/print-data'
+
+import printPreview from './design/preview.vue'
 import { getApplyDetail } from "@/api/supply/apply";
 import { getFileUrl } from '@/api/common';
 import CommonPrint from "@/views/supply/deliver/components/common_print";
@@ -192,6 +199,7 @@ export default {
   props: ['listItem'],
   components: {
     CommonPrint,
+    printPreview
   },
   filters: {
     statusFilter(val) {
@@ -213,6 +221,41 @@ export default {
       printType: 1,
       printId: '',
       isShowPrint: false,
+      curPaper: {
+        type: 'A5',
+        width: 500,
+        height: 147.6
+      },
+      paperTypes: {
+        'A3': {
+          width: 420,
+          height: 296.6
+        },
+        'A4': {
+          width: 210,
+          height: 296.6
+        },
+        'A5': {
+          width: 210,
+          height: 147.6
+        },
+        'B3': {
+          width: 500,
+          height: 352.6
+        },
+        'B4': {
+          width: 250,
+          height: 352.6
+        },
+        'B5': {
+          width: 250,
+          height: 175.6
+        }
+      },
+      scaleValue: 1,
+      scaleMax: 5,
+      scaleMin: 0.5,
+      hiprintTemplate:'',
     }
   },
 
@@ -220,13 +263,62 @@ export default {
     isExamine() {
       return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === "FAIL"
     },
+    curPaperType() {
+      let type = 'other'
+      let types = this.paperTypes
+      for (const key in types) {
+        let item = types[key]
+        let { width, height } = this.curPaper
+        if (item.width === width && item.height === height) {
+          type = key
+        }
+      }
+      return type
+    }
   },
 
   created() {
     this.getDetail();
+   
+  },
+  activated(){
+    this.initPrint()
   },
-
   methods: {
+    initPrint(){
+      hiprint.init({
+      providers: [new defaultElementTypeProvider()]
+    });
+    // 还原配置
+    hiprint.setConfig()
+    // 替换配置
+    hiprint.setConfig({
+      movingDistance: 2.5,
+      text: {
+        supportOptions: [
+          {
+            name: 'styler',
+            hidden: true
+          },
+          {
+            name: 'formatter',
+            hidden: true
+          },
+        ]
+      }
+    })
+    // eslint-disable-next-line no-undef
+    hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
+    this.hiprintTemplate = new hiprint.PrintTemplate({
+      template: panel,
+      settingContainer: '#PrintElementOptionSetting',
+      paginationContainer: '.hiprint-printPagination'
+    });
+    this.hiprintTemplate.design('#hiprint-printTemplate');
+    // 获取当前放大比例, 当zoom时传true 才会有
+    // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
+    }
+,
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -276,13 +368,36 @@ export default {
     toPrint() {
       this.printId = this.listItem.id;
       this.isShowPrint = true;
+        //   getDetail(this.listItem.id)
+        // this.$refs.preView.show(this.hiprintTemplate, detailArr)
+      
     },
 
     backDetail() {
       this.printId = '';
       this.isShowPrint = false;
     },
+    
 
+/**
+  * 设置纸张大小
+  * @param type [A3, A4, A5, B3, B4, B5, other]
+  * @param value {width,height} mm
+  */
+setPaper(type, value) {
+  try {
+    if (Object.keys(this.paperTypes).includes(type)) {
+      this.curPaper = { type: type, width: value.width, height: value.height }
+      this.hiprintTemplate.setPaper(value.width, value.height)
+    } else {
+      this.curPaper = { type: 'other', width: value.width, height: value.height }
+      this.hiprintTemplate.setPaper(value.width, value.height)
+
+    }
+  } catch (error) {
+    this.$message.error(`操作失败: ${error}`)
+  }
+},
   }
 }
 </script>

+ 81 - 0
src/views/supply/apply/components/design/index.vue

@@ -0,0 +1,81 @@
+<template>
+  <div>
+      <a-button type="primary" icon="eye" @click="preView">
+        预览
+      </a-button>
+    <print-preview ref="preView"/>
+  </div>
+</template>
+
+<script>
+import {disAutoConnect, hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
+// disAutoConnect();
+
+let hiprintTemplate;
+import panel from './panel'
+import printData from './print-data'
+import printPreview from './preview'
+
+export default {
+  name: "printDesign",
+  components: {},
+  data() {
+    return {
+      
+    }
+  },
+
+  methods: {
+    preView() {
+     
+    },
+   
+  }
+}
+</script>
+
+<style  scoped>
+  td {
+    border:none !important;
+  }
+.drag_item_box {
+  height: 100%;
+  padding: 6px;
+}
+
+.drag_item_box > div {
+  height: 100%;
+  width: 100%;
+  background-color: #fff;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.drag_item_box > div > a {
+  text-align: center;
+  text-decoration-line: none;
+}
+
+.drag_item_box > div > a > span {
+  font-size: 28px;
+}
+
+.drag_item_box > div > a > p {
+  margin: 0;
+}
+
+.drag_item_title {
+  font-size: 16px;
+  padding: 12px 6px 0 6px;
+  font-weight: bold;
+}
+
+
+.card-design {
+  overflow: hidden;
+  overflow-x: auto;
+  overflow-y: auto;
+}
+
+</style>

+ 310 - 0
src/views/supply/apply/components/design/panel.js

@@ -0,0 +1,310 @@
+
+export default {
+  "panels": [{
+    "index": 0,
+    "height": 140,
+    "width": 241,
+    "printElements": [{
+      "options": {
+        "left": 0,
+        "top": 20,
+        "height": 27,
+        "width": 656,
+        "field": "company",
+        "fontSize": 19,
+        "fontWeight": "600",
+        "fontFamily": '黑体',
+        "textAlign": "center",
+        "lineHeight": 26
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 40,
+        "top": 50,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "经销商编码",
+        "fontFamily": '黑体',
+        "field": "customerNumber",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 348,
+        "top": 50,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "打印日期",
+        "fontFamily": '黑体',
+        "field": "nowDate",
+        "testData": "",
+        "color": "#000",
+
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+      , {
+      "options": {
+        "left": 40,
+        "top": 70,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "经销商",
+        "fontFamily": '黑体',
+        "field": "customerName",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 348,
+        "top": 70,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "仓库",
+        "fontFamily": '黑体',
+        "field": "correspondName",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    , {
+      "options": {
+        "left": 40,
+        "top": 90,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "备注",
+        "fontFamily": '黑体',
+        "field": "headerRemark",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 15,
+        "top": 115,
+        "height": 381,
+        "width": 656,
+        "fontSize": 13,
+        "field": "table",
+        "fontFamily": '黑体',
+        "lineHeight": 16,
+        "tableFooterRepeat": "",
+        "columns": [[
+          {
+            "title": "出库单号",
+            "field": "salesId",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+          }, {
+            "title": "发货单号",
+            "field": "invoiceId",
+            "width": 45,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+            
+
+          }
+          , {
+            "title": "发货日期",
+            "field": "createTime",
+            "width": 50,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+           
+
+          }
+          , {
+            "title": "订单号",
+            "field": "enginOrderType",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+            
+          }
+          , {
+            "title": "存货名称",
+            "field": "materialName",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+
+          }, {
+            "title": "规格型号",
+            "field": "specification",
+            "width": 100,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+
+          }
+          , {
+            "title": "数量",
+            "field": "refundableQty",
+            "width": 23,
+            "align": "right",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+          }
+          // , {
+          //   "title": "订单备注",
+          //   "field": "headerRemark",
+          //   "width": 40,
+          //   "align": "center",
+          //   "colspan": 1,
+          //   "rowspan": 1,
+          //   "fontSize": 13,
+          // }
+          
+          , 
+          
+          {
+            "title": "备注说明",
+            "field": "pjxh1Text",
+            "width": 60,
+            "align": "left",
+            "colspan": 2,
+            "rowspan": 1,
+            "fontSize": 13,
+          }]]
+      }, "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": 40,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "",
+        "fontFamily": '黑体',
+        "field": "tiTui",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        
+        "left": 40,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "打单",
+        "fontFamily": '黑体',
+        "field": "createBy",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 238,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "提单",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 238,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "联系方式",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 463,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "车辆",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 463,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "仓库",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }],
+
+    "paperNumberLeft": 0,
+    "paperNumberTop": 380
+  }]
+}

+ 222 - 0
src/views/supply/apply/components/design/preview.vue

@@ -0,0 +1,222 @@
+<template>
+  <el-dialog :visible.sync="visible" :show-close="false" :maskClosable="false" :close-on-click-modal="false"
+    @cancel="hideModal" :width="350 + 'mm'">
+    <div :spinning="spinning" style="min-height: 100px">
+      <div id="preview_content" ref="printDom">
+
+      </div>
+    </div>
+    <template slot="title">
+      <div>
+        <!-- <div style="margin-right: 20px">打印预览</div> -->
+        <el-button :loading="waitShowPrinter" type="primary" icon="printer" @click.stop="print">打印</el-button>
+        <!-- <el-button type="primary" icon="printer" @click.stop="toPdf">pdf</el-button> -->
+      </div>
+    </template>
+    <template slot="footer">
+      <el-button key="close" type="info" @click="hideModal">
+        关闭
+      </el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+// import { downloadPDF } from '@/utils/pdf'
+import { addPrint } from './print-data'
+import { detailArr } from './print-data'
+export default {
+  name: "printPreview",
+  props: {},
+  data() {
+    return {
+      visible: false,
+      spinning: true,
+      waitShowPrinter: false,
+      // 纸张宽 mm
+      width: 0,
+      // 模板
+      hiprintTemplate: {},
+      // 数据
+      printData: {}
+    }
+  },
+  computed: {},
+  watch: {},
+  created() {
+  },
+  mounted() {
+  },
+  methods: {
+    // handleExport() {
+    //   downloadPDF(this.$refs.printDom);
+    // },
+    hideModal() {
+      this.visible = false
+      this.waitShowPrinter = false
+      this.$parent.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))
+        this.spinning = false
+      }, 500)
+    },
+    print() {
+       
+      this.hiprintTemplate.print(this.printData, {}, {
+        callback: () => {
+          addPrint()
+          this.hiprintTemplate = {}
+          this.$parent.getList()
+          this.$parent.tableSelection =[]
+        }
+      })
+      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 =[]
+      // })
+      setTimeout(()=>{
+        this.hideModal()
+      },2000)
+    },
+    // toPdf() {
+    //   downloadPDF(this.$refs.printDom);
+    //   this.hiprintTemplate.toPdf({}, '打印预览');
+    // },
+  }
+}
+
+</script>
+<style scoped>
+::v-deep .el-dialog__body {
+  padding: 0;
+}
+
+
+::v-deep tr {
+  height: 40px !important;
+}
+
+::v-deep .hiprint-printPaper {
+  margin: 0 auto;
+}
+
+::v-deep tr td {
+  border: 0 !important;
+  /* width: 911px !important;
+    height: 529px !important; */
+}
+
+::v-deep .hiprint-paperNumber {
+  display: none;
+}
+
+.ant-modal-body {
+  padding: 0px;
+}
+
+.ant-modal-content {
+  margin-bottom: 24px;
+
+}
+
+@media print {
+
+  td {
+    border: none !important;
+  }
+
+  .drag_item_box {
+    height: 100%;
+    padding: 6px;
+  }
+
+  .drag_item_box>div {
+    height: 100%;
+    width: 100%;
+    background-color: #fff;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+
+  .drag_item_box>div>a {
+    text-align: center;
+    text-decoration-line: none;
+  }
+
+  .drag_item_box>div>a>span {
+    font-size: 28px;
+  }
+
+  .drag_item_box>div>a>p {
+    margin: 0;
+  }
+
+  .drag_item_title {
+    font-size: 16px;
+    padding: 12px 6px 0 6px;
+    font-weight: bold;
+  }
+
+
+  .card-design {
+    overflow: hidden;
+    overflow-x: auto;
+    overflow-y: auto;
+  }
+
+  ::v-deep .el-dialog__body {
+    padding: 0;
+  }
+
+  ::v-deep table {
+    height: 240px !important;
+  }
+
+  ::v-deep tr {
+    height: 40px !important;
+  }
+
+  ::v-deep .hiprint-printPaper {
+    margin: 0 auto;
+  }
+
+  ::v-deep tr td {
+    border: 0 !important;
+    /* width: 911px !important;
+    height: 529px !important; */
+  }
+
+  ::v-deep .hiprint-paperNumber {
+    display: none;
+  }
+
+  .ant-modal-body {
+    padding: 0px;
+  }
+
+  .ant-modal-content {
+    margin-bottom: 24px;
+
+  }
+}
+</style>

+ 124 - 0
src/views/supply/apply/components/design/print-data.js

@@ -0,0 +1,124 @@
+import { getDeliverDetail } from '@/api/supply/deliver'
+import { addPrints } from '@/api/supply/pickup'
+import { getCompanyList } from '@/api/user'
+
+let detailArr = []
+let detailData = []
+let company = ''
+// 获取详情
+getCompanyLists()
+function getDetail(id) {
+
+           detailArr = []
+      getDeliverDetail({id}).then(res => {
+        const item = res.data
+        detailData.push(item)
+        const table = []
+        item.invoicePickBeans.length = 5
+        item.invoicePickBeans.forEach(e => {
+          table.push({
+            salesId: e.salesOrderId,
+            invoiceId: e.invoiceId,
+            id: e.id,
+            createTime: e.id ? dateToDayFilter(item.createTime) : '',
+            enginOrderType: e.enginOrderType == 'HOME' || e.enginOrderType == 'TRADE' ? e.enginOrderNo : e.mainOrderId,
+            materialName: e.materialName || '',
+            specification: e.specification || '',
+            refundableQty: e.refundableQty || 0,
+            // headerRemark:e.headerRemark,
+            pjxh1Text: e.pjxh1Text || ''
+          })
+        });
+  
+        console.log(company);
+        detailArr.push({
+          type: item.type,
+          tiTui:item.type === 2 ? `退货人` : `提货人`,
+          headerRemark:item.remark,
+          total_num: item.total_num,
+          company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
+          pickOrderWater: item.pickOrderWater,
+          customerNumber: item.customerNumber,
+          nowDate: nowDate(),
+          customerName: item.customerName || '',
+          correspondName: item.correspondName || '',
+          createBy: item.createBy,
+          table
+        })
+      })
+
+  // let  filterId =[]
+  //     filterId = newIds.map(k=>{
+  //             return k.id
+  //           })
+  //       filterId = [...new Set(filterId)]    
+  // for (let i = 0; i < filterId.length; i++) {
+
+  // }
+}
+
+function nowDate() {
+  var date = new Date();
+  var seperator1 = "-";
+  var year = date.getFullYear();
+  var month = date.getMonth() + 1;
+  var strDate = date.getDate();
+  if (month >= 1 && month <= 9) {
+    month = "0" + month;
+  }
+  if (strDate >= 0 && strDate <= 9) {
+    strDate = "0" + strDate;
+  }
+  var currentdate = year + seperator1 + month + seperator1 + strDate;
+  console.log(currentdate);
+  return currentdate;
+}
+
+function dateToDayFilter(date) {
+  if (!date) { return '' }
+  return date.slice(0, 10)
+}
+
+function getCompanyLists() {
+  getCompanyList().then(res => {
+    company = res.data ? res.data[0].companyName : ''
+  })
+  return company
+}
+
+// 添加次数
+function addPrint() {
+        // console.log(detailData);
+  let ids = detailData.map(item => {
+    console.log(item.invoicePickBeans);
+    if (item.invoicePickBeans && item.invoicePickBeans.length) {
+      for (let index = 0; index < item.invoicePickBeans.length; index++) {
+        const element = item.invoicePickBeans[index];
+            // console.log(element.id ,'element.id ');
+        return  element.id 
+      }
+    } else {
+      // console.log(item.invoiceOrderId ,'item.invoiceOrderId ');
+      return item.invoiceOrderId || item.id
+    }
+  
+  })
+    ids = [...new Set(ids)]
+  // console.log(document.execCommand('print'),'4545');
+  addPrints({ ids: ids.join(',') }).then(res => {
+      console.log('chenggong ');
+    // this.$successMsg('提交成功');
+    // this.$parent.getList()
+ 
+  })
+}
+
+
+
+
+
+export {
+  getDetail, getCompanyLists,
+  detailArr,
+  addPrint
+}

+ 102 - 2
src/views/supply/apply/components/engin_detail.vue

@@ -210,6 +210,8 @@
       </div>
 
     </div>
+      
+    <!-- <print-preview ref="preView" /> -->
 
     <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" />
 
@@ -219,6 +221,14 @@
 <script>
 import { getEnginDetail } from "@/api/supply/apply";
 import { getFileUrl } from '@/api/common';
+
+import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
+disAutoConnect();
+
+import panel from './design/panel'
+import { getDetail, detailArr } from './design/print-data'
+
+import printPreview from './design/preview.vue'
 import CommonPrint from "@/views/supply/deliver/components/common_print";
 
 export default {
@@ -227,6 +237,7 @@ export default {
   props: ['listItem'],
   components: {
     CommonPrint,
+    printPreview
   },
   filters: {
     statusFilter(val) {
@@ -256,6 +267,41 @@ export default {
       printId: '',
       isShowPrint: false,
         isCustomer: JSON.parse(localStorage.getItem("supply_user")).isCustomer,
+        curPaper: {
+        type: 'A5',
+        width: 500,
+        height: 147.6
+      },
+      paperTypes: {
+        'A3': {
+          width: 420,
+          height: 296.6
+        },
+        'A4': {
+          width: 210,
+          height: 296.6
+        },
+        'A5': {
+          width: 210,
+          height: 147.6
+        },
+        'B3': {
+          width: 500,
+          height: 352.6
+        },
+        'B4': {
+          width: 250,
+          height: 352.6
+        },
+        'B5': {
+          width: 250,
+          height: 175.6
+        }
+      },
+      scaleValue: 1,
+      scaleMax: 5,
+      scaleMin: 0.5,
+      hiprintTemplate:'',
     }
   },
 
@@ -263,18 +309,69 @@ export default {
     isExamine() {
       return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === "FAIL"
     },
+    
+    curPaperType() {
+      let type = 'other'
+      let types = this.paperTypes
+      for (const key in types) {
+        let item = types[key]
+        let { width, height } = this.curPaper
+        if (item.width === width && item.height === height) {
+          type = key
+        }
+      }
+      return type
+    }
   },
 
   created() {
     this.getDetail();
   },
-
+  mounted() {
+    this.initPrint()
+  },
+  activated(){
+    this.initPrint()
+  },
   methods: {
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
     },
-
+    initPrint(){
+      hiprint.init({
+      providers: [new defaultElementTypeProvider()]
+    });
+    // 还原配置
+    hiprint.setConfig()
+    // 替换配置
+    hiprint.setConfig({
+      movingDistance: 2.5,
+      text: {
+        supportOptions: [
+          {
+            name: 'styler',
+            hidden: true
+          },
+          {
+            name: 'formatter',
+            hidden: true
+          },
+        ]
+      }
+    })
+    // eslint-disable-next-line no-undef
+    hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
+    this.hiprintTemplate = new hiprint.PrintTemplate({
+      template: panel,
+      settingContainer: '#PrintElementOptionSetting',
+      paginationContainer: '.hiprint-printPagination'
+    });
+    this.hiprintTemplate.design('#hiprint-printTemplate');
+    // 获取当前放大比例, 当zoom时传true 才会有
+    // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
+    }
+,
     // 获取详情
     getDetail() {
       getEnginDetail({id: this.listItem.id}).then(res => {
@@ -317,7 +414,10 @@ export default {
 
     // 点击打印
     toPrint() {
+      this.initPrint()
       this.printId = this.listItem.id;
+      // getDetail(this.tableSelection)
+      //   this.$refs.preView.show(this.hiprintTemplate, detailArr)
       this.isShowPrint = true;
     },
 

+ 1 - 1
src/views/supply/deliver/components/design/panel.js

@@ -7,7 +7,7 @@ export default {
     "printElements": [{
       "options": {
         "left": 0,
-        "top": 20,
+        "top": 25,
         "height": 27,
         "width": 656,
         "field": "company",

+ 8 - 3
src/views/supply/deliver/components/design/print-data.js

@@ -12,9 +12,14 @@ function getDetail(ids) {
   detailArr = []
   // detailData = ids 
   let newIds = []
-  newIds = ids
-  for (let i = 0; i < newIds.length; i++) {
-    getDeliverDetail({ id: newIds[i].id }).then(res => {
+      newIds = ids
+  let  filterId =[]
+      filterId = newIds.map(k=>{
+              return k.id
+            })
+        filterId = [...new Set(filterId)]    
+  for (let i = 0; i < filterId.length; i++) {
+    getDeliverDetail({ id: filterId[i] }).then(res => {
       const item = res.data
       detailData.push(item)
       const table = []

+ 3 - 2
src/views/supply/deliver/sum_list.vue

@@ -385,7 +385,6 @@ export default {
         type: 'A5',
         width: 500,
         height: 147.6
-
       },
       paperTypes: {
         'A3': {
@@ -416,6 +415,7 @@ export default {
       scaleValue: 1,
       scaleMax: 5,
       scaleMin: 0.5,
+      hiprintTemplate:'',
       isShowDialog: false,
       dialogForm: {
         password: "",
@@ -425,7 +425,7 @@ export default {
       dialogFormRules: {
         password: [{ required: true, message: "请输入密码", trigger: "blur" }],
       },
-    hiprintTemplate:''
+
     }
   },
 
@@ -603,6 +603,7 @@ export default {
     },
 
     handleSelect(selection, row) {
+     
       this.$refs.table.toggleRowSelection(row);
       this.dataList.forEach((item) => {
         if (item.id === row.id) {

+ 101 - 4
src/views/supply/pickup/check.vue

@@ -219,8 +219,9 @@
         <el-button type="primary" @click="submitDialogForm">确 定</el-button>
       </div>
     </el-dialog>
+    <print-preview ref="preView" />
 
-    <PickupPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" />
+    <!-- <PickupPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" /> -->
 
   </div>
 </template>
@@ -236,9 +237,17 @@ import { getDealerList, getListCustomer } from "@/api/basic_data/dealer";
 
 import PickupPrint from "@/views/supply/pickup/components/pickup_print";
 
+import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
+disAutoConnect();
+
+import panel from './components/design/panel'
+import { getDetails, detailArr } from './components/design/print-data'
+
+import printPreview from './components/design/preview.vue'
 export default {
   components: {
     PickupPrint,
+    printPreview
   },
   data() {
     return {
@@ -281,6 +290,43 @@ export default {
         password: [{ required: true, message: "请输入密码", trigger: "blur" }],
       },
       userList:[]
+      ,
+      curPaper: {
+        type: 'A5',
+        width: 500,
+        height: 147.6
+      },
+      paperTypes: {
+        'A3': {
+          width: 420,
+          height: 296.6
+        },
+        'A4': {
+          width: 210,
+          height: 296.6
+        },
+        'A5': {
+          width: 210,
+          height: 147.6
+        },
+        'B3': {
+          width: 500,
+          height: 352.6
+        },
+        'B4': {
+          width: 250,
+          height: 352.6
+        },
+        'B5': {
+          width: 250,
+          height: 175.6
+        }
+      },
+      scaleValue: 1,
+      scaleMax: 5,
+      scaleMin: 0.5,
+      hiprintTemplate:'',
+      isShowDialog: false,
     };
   },
 
@@ -291,13 +337,62 @@ export default {
         status: this.screenForm.status,
       };
     },
+    
+    curPaperType() {
+      let type = 'other'
+      let types = this.paperTypes
+      for (const key in types) {
+        let item = types[key]
+        let { width, height } = this.curPaper
+        if (item.width === width && item.height === height) {
+          type = key
+        }
+      }
+      return type
+    }
   },
 
   created() {
     // this.getDealerList()
   },
-
+  activated(){
+    this.initPrint()
+  },
   methods: {
+    initPrint(){
+      hiprint.init({
+      providers: [new defaultElementTypeProvider()]
+    });
+    // 还原配置
+    hiprint.setConfig()
+    // 替换配置
+    hiprint.setConfig({
+      movingDistance: 2.5,
+      text: {
+        supportOptions: [
+          {
+            name: 'styler',
+            hidden: true
+          },
+          {
+            name: 'formatter',
+            hidden: true
+          },
+        ]
+      }
+    })
+    // eslint-disable-next-line no-undef
+    hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
+    this.hiprintTemplate = new hiprint.PrintTemplate({
+      template: panel,
+      settingContainer: '#PrintElementOptionSetting',
+      paginationContainer: '.hiprint-printPagination'
+    });
+    this.hiprintTemplate.design('#hiprint-printTemplate');
+    // 获取当前放大比例, 当zoom时传true 才会有
+    // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
+    }
+,
     getDate() {
       var date = new Date();
       var seperator1 = "-";
@@ -447,7 +542,8 @@ export default {
 
       if (!this.tableSelection[0].printNum) {
         this.queryItem = this.tableSelection;
-        this.isShowPrint = true;
+        getDetails(this.tableSelection)
+        this.$refs.preView.show(this.hiprintTemplate, detailArr)
       } else {
         this.queryItem = this.tableSelection;
         this.dialogForm.createMan = JSON.parse(
@@ -487,7 +583,8 @@ export default {
           };
           checkPassword(params).then((res) => {
             this.cancelDialogForm();
-            this.isShowPrint = true;
+            getDetails(this.tableSelection)
+            this.$refs.preView.show(this.hiprintTemplate, detailArr)
           });
         }
       });

+ 81 - 0
src/views/supply/pickup/components/design/index.vue

@@ -0,0 +1,81 @@
+<template>
+  <div>
+      <a-button type="primary" icon="eye" @click="preView">
+        预览
+      </a-button>
+    <print-preview ref="preView"/>
+  </div>
+</template>
+
+<script>
+import {disAutoConnect, hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint'
+// disAutoConnect();
+
+let hiprintTemplate;
+import panel from './panel'
+import printData from './print-data'
+import printPreview from './preview'
+
+export default {
+  name: "printDesign",
+  components: {},
+  data() {
+    return {
+      
+    }
+  },
+
+  methods: {
+    preView() {
+     
+    },
+   
+  }
+}
+</script>
+
+<style  scoped>
+  td {
+    border:none !important;
+  }
+.drag_item_box {
+  height: 100%;
+  padding: 6px;
+}
+
+.drag_item_box > div {
+  height: 100%;
+  width: 100%;
+  background-color: #fff;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.drag_item_box > div > a {
+  text-align: center;
+  text-decoration-line: none;
+}
+
+.drag_item_box > div > a > span {
+  font-size: 28px;
+}
+
+.drag_item_box > div > a > p {
+  margin: 0;
+}
+
+.drag_item_title {
+  font-size: 16px;
+  padding: 12px 6px 0 6px;
+  font-weight: bold;
+}
+
+
+.card-design {
+  overflow: hidden;
+  overflow-x: auto;
+  overflow-y: auto;
+}
+
+</style>

+ 310 - 0
src/views/supply/pickup/components/design/panel.js

@@ -0,0 +1,310 @@
+
+export default {
+  "panels": [{
+    "index": 0,
+    "height": 140,
+    "width": 241,
+    "printElements": [{
+      "options": {
+        "left": 0,
+        "top": 25,
+        "height": 27,
+        "width": 656,
+        "field": "company",
+        "fontSize": 19,
+        "fontWeight": "600",
+        "fontFamily": '黑体',
+        "textAlign": "center",
+        "lineHeight": 26
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 40,
+        "top": 50,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "经销商编码",
+        "fontFamily": '黑体',
+        "field": "customerNumber",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 348,
+        "top": 50,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "打印日期",
+        "fontFamily": '黑体',
+        "field": "nowDate",
+        "testData": "",
+        "color": "#000",
+
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+      , {
+      "options": {
+        "left": 40,
+        "top": 70,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "经销商",
+        "fontFamily": '黑体',
+        "field": "customerName",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }, {
+      "options": {
+        "left": 348,
+        "top": 70,
+        "height": 13,
+        "width": 328,
+        "fontSize": 13,
+        "title": "仓库",
+        "fontFamily": '黑体',
+        "field": "correspondName",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    // , {
+    //   "options": {
+    //     "left": 40,
+    //     "top": 90,
+    //     "height": 13,
+    //     "width": 328,
+    //     "fontSize": 13,
+    //     "title": "备注",
+    //     "fontFamily": '黑体',
+    //     "field": "headerRemark",
+    //     "testData": "",
+    //     "color": "#000",
+    //     "textAlign": "left"
+    //   }, "printElementType": { "title": "", "type": "text" }
+    // },
+    {
+      "options": {
+        "left": 15,
+        "top": 115,
+        "height": 381,
+        "width": 656,
+        "fontSize": 13,
+        "field": "table",
+        "fontFamily": '黑体',
+        "lineHeight": 16,
+        "tableFooterRepeat": "",
+        "columns": [[
+          {
+            "title": "出库单号",
+            "field": "salesId",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+          }, {
+            "title": "发货单号",
+            "field": "invoiceId",
+            "width": 45,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+            
+
+          }
+          , {
+            "title": "发货日期",
+            "field": "createTime",
+            "width": 50,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+           
+
+          }
+          , {
+            "title": "订单号",
+            "field": "enginOrderType",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+            
+          }
+          , {
+            "title": "存货名称",
+            "field": "materialName",
+            "width": 40,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+
+          }, {
+            "title": "规格型号",
+            "field": "specification",
+            "width": 100,
+            "align": "left",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+
+          }
+          , {
+            "title": "数量",
+            "field": "refundableQty",
+            "width": 23,
+            "align": "right",
+            "colspan": 1,
+            "rowspan": 1,
+            "fontSize": 13,
+
+          }
+          // , {
+          //   "title": "订单备注",
+          //   "field": "headerRemark",
+          //   "width": 40,
+          //   "align": "center",
+          //   "colspan": 1,
+          //   "rowspan": 1,
+          //   "fontSize": 13,
+          // }
+          
+          , 
+          
+          {
+            "title": "备注说明",
+            "field": "pjxh1Text",
+            "width": 60,
+            "align": "left",
+            "colspan": 2,
+            "rowspan": 1,
+            "fontSize": 13,
+          }]]
+      }, "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": 40,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "",
+        "fontFamily": '黑体',
+        "field": "tiTui",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        
+        "left": 40,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "打单",
+        "fontFamily": '黑体',
+        "field": "createBy",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 238,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "提单",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 238,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "联系方式",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 463,
+        "top": 360,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "车辆",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    },
+    {
+      "options": {
+        "left": 463,
+        "top": 381,
+        "height": 13,
+        "width": 218,
+        "fontSize": 13,
+        "title": "仓库",
+        "fontFamily": '黑体',
+        "field": "",
+        "testData": "",
+        "color": "#000",
+        "textAlign": "left"
+      }, "printElementType": { "title": "", "type": "text" }
+    }],
+
+    "paperNumberLeft": 0,
+    "paperNumberTop": 380
+  }]
+}

+ 222 - 0
src/views/supply/pickup/components/design/preview.vue

@@ -0,0 +1,222 @@
+<template>
+  <el-dialog :visible.sync="visible" :show-close="false" :maskClosable="false" :close-on-click-modal="false"
+    @cancel="hideModal" :width="350 + 'mm'">
+    <div :spinning="spinning" style="min-height: 100px">
+      <div id="preview_content" ref="printDom">
+
+      </div>
+    </div>
+    <template slot="title">
+      <div>
+        <!-- <div style="margin-right: 20px">打印预览</div> -->
+        <el-button :loading="waitShowPrinter" type="primary" icon="printer" @click.stop="print">打印</el-button>
+        <!-- <el-button type="primary" icon="printer" @click.stop="toPdf">pdf</el-button> -->
+      </div>
+    </template>
+    <template slot="footer">
+      <el-button key="close" type="info" @click="hideModal">
+        关闭
+      </el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+// import { downloadPDF } from '@/utils/pdf'
+import { addPrints } from './print-data'
+import { detailArr } from './print-data'
+export default {
+  name: "printPreview",
+  props: {},
+  data() {
+    return {
+      visible: false,
+      spinning: true,
+      waitShowPrinter: false,
+      // 纸张宽 mm
+      width: 0,
+      // 模板
+      hiprintTemplate: {},
+      // 数据
+      printData: {}
+    }
+  },
+  computed: {},
+  watch: {},
+  created() {
+  },
+  mounted() {
+  },
+  methods: {
+    // handleExport() {
+    //   downloadPDF(this.$refs.printDom);
+    // },
+    hideModal() {
+      this.visible = false
+      this.waitShowPrinter = false
+      this.$parent.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))
+        this.spinning = false
+      }, 500)
+    },
+    print() {
+       
+      this.hiprintTemplate.print(this.printData, {}, {
+        callback: () => {
+          addPrints()
+          this.hiprintTemplate = {}
+          this.$parent.getList()
+          this.$parent.tableSelection =[]
+        }
+      })
+      this.hiprintTemplate.on('printSuccess', function (data) {
+        console.log('打印完成')
+          //  addPrints()
+          this.hiprintTemplate = {}
+          this.$parent.getList()
+          this.$parent.tableSelection =[]
+      })
+      // this.hiprintTemplate.on('printError', function (data) {
+      //   console.log('打印失败')
+      //   this.hiprintTemplate = {}
+      //     this.$parent.getList()
+      //     this.$parent.tableSelection =[]
+      // })
+      setTimeout(()=>{
+        this.hideModal()
+      },2000)
+    },
+    // toPdf() {
+    //   downloadPDF(this.$refs.printDom);
+    //   this.hiprintTemplate.toPdf({}, '打印预览');
+    // },
+  }
+}
+
+</script>
+<style scoped>
+::v-deep .el-dialog__body {
+  padding: 0;
+}
+
+
+::v-deep tr {
+  height: 40px !important;
+}
+
+::v-deep .hiprint-printPaper {
+  margin: 0 auto;
+}
+
+::v-deep tr td {
+  border: 0 !important;
+  /* width: 911px !important;
+    height: 529px !important; */
+}
+
+::v-deep .hiprint-paperNumber {
+  display: none;
+}
+
+.ant-modal-body {
+  padding: 0px;
+}
+
+.ant-modal-content {
+  margin-bottom: 24px;
+
+}
+
+@media print {
+
+  td {
+    border: none !important;
+  }
+
+  .drag_item_box {
+    height: 100%;
+    padding: 6px;
+  }
+
+  .drag_item_box>div {
+    height: 100%;
+    width: 100%;
+    background-color: #fff;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+
+  .drag_item_box>div>a {
+    text-align: center;
+    text-decoration-line: none;
+  }
+
+  .drag_item_box>div>a>span {
+    font-size: 28px;
+  }
+
+  .drag_item_box>div>a>p {
+    margin: 0;
+  }
+
+  .drag_item_title {
+    font-size: 16px;
+    padding: 12px 6px 0 6px;
+    font-weight: bold;
+  }
+
+
+  .card-design {
+    overflow: hidden;
+    overflow-x: auto;
+    overflow-y: auto;
+  }
+
+  ::v-deep .el-dialog__body {
+    padding: 0;
+  }
+
+  ::v-deep table {
+    height: 240px !important;
+  }
+
+  ::v-deep tr {
+    height: 40px !important;
+  }
+
+  ::v-deep .hiprint-printPaper {
+    margin: 0 auto;
+  }
+
+  ::v-deep tr td {
+    border: 0 !important;
+    /* width: 911px !important;
+    height: 529px !important; */
+  }
+
+  ::v-deep .hiprint-paperNumber {
+    display: none;
+  }
+
+  .ant-modal-body {
+    padding: 0px;
+  }
+
+  .ant-modal-content {
+    margin-bottom: 24px;
+
+  }
+}
+</style>

+ 126 - 0
src/views/supply/pickup/components/design/print-data.js

@@ -0,0 +1,126 @@
+
+import { getDetail, addPrint } from "@/api/supply/pickup";
+// import { addPrints } from '@/api/supply/pickup'
+import { getCompanyList } from '@/api/user'
+
+let detailArr = []
+let detailData = []
+let company = ''
+// 获取详情
+getCompanyLists()
+function getDetails(ids) {
+
+  detailArr = []
+  // detailData = ids 
+  let newIds = []
+      newIds = ids
+  let  filterId =[]
+      filterId = newIds.map(k=>{
+              return k.id
+            })
+        filterId = [...new Set(filterId)]    
+  for (let i = 0; i < filterId.length; i++) {
+    getDetail({ id: filterId[i] }).then(res => {
+      const item = res.data
+      detailData.push(item)
+      const table = []
+      item.invoicePickBeans.length = 5
+      item.invoicePickBeans.forEach(e => {
+        table.push({
+          salesId: e.salesOrderId,
+          invoiceId: e.invoiceId,
+          id: e.id,
+          createTime: e.id ? dateToDayFilter(item.createTime) : '',
+          enginOrderType: e.enginOrderType == 'HOME' || e.enginOrderType == 'TRADE' ? e.enginOrderNo : e.mainOrderId,
+          materialName: e.materialName || '',
+          specification: e.specification || '',
+          refundableQty: e.refundableQty || 0,
+          // headerRemark:e.headerRemark,
+          pjxh1Text: e.pjxh1Text || ''
+        })
+      });
+
+      console.log(company);
+      detailArr.push({
+        type: item.type,
+        tiTui:item.type === 2 ? `退货人` : `提货人`,
+        headerRemark:item.remark,
+        total_num: item.total_num,
+        company: item.type === 2 ? `${company}销售退货单` : `${company}销售发货单`,
+        pickOrderWater: item.pickOrderWater,
+        customerNumber: item.customerNumber,
+        nowDate: nowDate(),
+        customerName: item.customerName || '',
+        correspondName: item.correspondName || '',
+        createBy: item.createBy,
+        table
+      })
+    })
+  }
+}
+
+function nowDate() {
+  var date = new Date();
+  var seperator1 = "-";
+  var year = date.getFullYear();
+  var month = date.getMonth() + 1;
+  var strDate = date.getDate();
+  if (month >= 1 && month <= 9) {
+    month = "0" + month;
+  }
+  if (strDate >= 0 && strDate <= 9) {
+    strDate = "0" + strDate;
+  }
+  var currentdate = year + seperator1 + month + seperator1 + strDate;
+  console.log(currentdate);
+  return currentdate;
+}
+
+function dateToDayFilter(date) {
+  if (!date) { return '' }
+  return date.slice(0, 10)
+}
+
+function getCompanyLists() {
+  getCompanyList().then(res => {
+    company = res.data ? res.data[0].companyName : ''
+  })
+  return company
+}
+
+// 添加次数
+function addPrints() {
+        // console.log(detailData);
+  let ids = detailData.map(item => {
+    console.log(item.invoicePickBeans);
+    if (item.invoicePickBeans && item.invoicePickBeans.length) {
+      for (let index = 0; index < item.invoicePickBeans.length; index++) {
+        const element = item.invoicePickBeans[index];
+            // console.log(element.id ,'element.id ');
+        return  element.invoiceOrderId
+      }
+    } else {
+      // console.log(item.invoiceOrderId ,'item.invoiceOrderId ');
+      return item.invoiceOrderId || item.id
+    }
+  
+  })
+    ids = [...new Set(ids)]
+  // console.log(document.execCommand('print'),'4545');
+  addPrint({ ids: ids.join(',') }).then(res => {
+      console.log('chenggong ');
+    // this.$successMsg('提交成功');
+    // this.$parent.getList()
+ 
+  })
+}
+
+
+
+
+
+export {
+  getDetails, getCompanyLists,
+  detailArr,
+  addPrints
+}