Pārlūkot izejas kodu

流转单个打印未完成

zhongtianhaoyuan 3 gadi atpakaļ
vecāks
revīzija
1f7151451a
1 mainītis faili ar 49 papildinājumiem un 26 dzēšanām
  1. 49 26
      src/views/warehouse/warehouseManagementRecord.vue

+ 49 - 26
src/views/warehouse/warehouseManagementRecord.vue

@@ -463,6 +463,8 @@
         accessoryTFs: false,
         modification: [],
         printList: [], //批量打印数据
+        onePrint: false, //单个打印开关
+        idPrint:"",
       }
     },
 
@@ -514,30 +516,57 @@
       async typePrintClick() {
         debugger
         this.printList = []
-
-        var count = 0
-        for (var i = 0; i < this.modification.length; i++) {
-          await getPrintInfo({
-              id: this.modification[i].id
+        if (this.onePrint) {
+          sessionStorage.removeItem('ck_bd_printData')
+          getPrintInfo({
+              id: this.idPrint
             })
             .toPromise()
             .then((response) => {
-              count++
-              response.companyName = this.companyName
-              this.printList.push(response)
-              if (count == this.modification.length) {
+              if (response) {
                 if (this.checked || this.ddchecked) {
-                  this.makeEWjjSelectPrintList()
-                  //  this.selectEW = true;
+                  var arrayPrint = response
+                  // for (let i = 0; i < arrayPrint.length; i++) {
+                    // let _data = arrayPrint[i];
+                    arrayPrint.companyName = this.companyNameEW;
+                    arrayPrint.customer = this.ewCustomer
+                  // }
+                  localStorage.setItem('ck_bd_printData', JSON.stringify(arrayPrint))
+                  window.open('../../../../static/weightCheckInOut.html?type=2')
+                  return
                 }
-                localStorage.setItem("warehouseBatchPrint", JSON.stringify(this.printList))
-                window.open('../../../../static/warehouseBatchPrint.html?selectEW='+ this
-                  .checked + '&selectEWDD=' + this.ddchecked)
+                localStorage.setItem('ck_bd_printData', JSON.stringify(response))
+                window.open('../../../../static/weightCheckInOut.html?type=2')
               }
             })
+        } else {
+          var count = 0
+          for (var i = 0; i < this.modification.length; i++) {
+            await getPrintInfo({
+                id: this.modification[i].id
+              })
+              .toPromise()
+              .then((response) => {
+                count++
+                response.companyName = this.companyName
+                this.printList.push(response)
+                if (count == this.modification.length) {
+                  if (this.checked || this.ddchecked) {
+                    this.makeEWjjSelectPrintList()
+                    //  this.selectEW = true;
+                  }
+                  localStorage.setItem("warehouseBatchPrint", JSON.stringify(this.printList))
+                  window.open('../../../../static/warehouseBatchPrint.html?selectEW=' + this.checked +
+                    '&selectEWDD=' + this.ddchecked)
+                }
+              })
+          }
         }
 
 
+
+
+
         //   if (this.isExcelPrint) {
         //     this.printBig(2, this.radio)
         //     this.isExcelPrint = false
@@ -570,6 +599,7 @@
 
       },
       typePrintCannelClick() {
+        this.onePrint = false
         this.isShowPrintType = false
       },
       back(row) {
@@ -596,7 +626,7 @@
       },
       batchPrint() {
         debugger
-         this.printList = []
+        this.printList = []
         if (this.modification.length == 0) {
           this.$message.error("请勾选要打印的条目!")
         } else {
@@ -719,17 +749,10 @@
         this.value2 = [formatDate, nowData] // 默认赋值一年时间
       },
       print(row) {
-        debugger
-        sessionStorage.removeItem('record_print')
-        getPrintInfo({
-            id: row.id
-          })
-          .toPromise()
-          .then((response) => {
-            localStorage.setItem('ck_bd_printData', JSON.stringify(response))
-            window.open('../../../../static/weightCheckInOut.html?type=2')
+        this.onePrint = true
+        this.isShowPrintType = true
+        this.idPrint = row.id
 
-          })
       },
       //返回按钮
       returnWarehouse() {
@@ -794,7 +817,7 @@
       record(status, status1) {
         this.status = status1
         this.searchType = status
-        this.currentPage = '1'
+        this.currentPage = 1
         this.getList()
       },
       // 上传附件