chenrui %!s(int64=4) %!d(string=hai) anos
pai
achega
1887142811

+ 18 - 3
src/views/allocationManagement/storeTransferOut/detail.vue

@@ -19,8 +19,8 @@
           <a-radio value="INK">针式</a-radio>
           <a-radio value="NEEDLE">喷墨</a-radio>
         </a-radio-group>
-        <a-button key="2" id="storeTransferOutDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
-        <a-button key="1" type="primary" id="storeTransferOutDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
+        <a-button key="2" id="storeTransferOutDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
+        <a-button key="1" type="primary" id="storeTransferOutDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
       </template>
     </a-page-header>
     <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
@@ -88,9 +88,11 @@ export default {
             // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
           }
+          this.localDataSource = data.list
           return data
         })
       },
+      localDataSource: [],
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
       printerType: 'INK', //  打印机类型
@@ -109,8 +111,21 @@ export default {
     },
     // 打印预览/快捷打印
     handlePrint (type) {
+      const _this = this
       storeCallOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType, costFlag: this.printCostChecked ? '1' : '0' }).then(res => {
-        this.print(res, type)
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
       })
     },
     print (data, type) {

+ 43 - 4
src/views/allocationManagement/storeTransferOut/edit.vue

@@ -8,8 +8,12 @@
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
-        <a-button key="2" id="storeTransferOutEdit-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="storeTransferOutEdit-print-btn">快速打印</a-button>
+        <a-radio-group key="3" v-model="printerType">
+          <a-radio value="INK">针式</a-radio>
+          <a-radio value="NEEDLE">喷墨</a-radio>
+        </a-radio-group>
+        <a-button key="2" id="storeTransferOutEdit-preview-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('preview')">打印预览</a-button>
+        <a-button key="1" type="primary" id="storeTransferOutEdit-print-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('print')">快捷打印</a-button>
       </template>
     </a-page-header>
     <!-- 选择产品 -->
@@ -176,13 +180,15 @@
           style="padding: 0 60px;">提交</a-button>
       </div>
     </a-affix>
+    <!-- 打印 -->
+    <div id="print"></div>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
-import { storeCallOutDetailList, storeCallOutDetail, storeCallOutDetailCount, storeCallOutDetailSave, storeCallOutDetailDel, storeCallOutSubmit } from '@/api/storeCallOut'
+import { storeCallOutDetailList, storeCallOutDetail, storeCallOutDetailCount, storeCallOutDetailSave, storeCallOutDetailDel, storeCallOutSubmit, storeCallOutDetailPrint } from '@/api/storeCallOut'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseAllList } from '@/api/warehouse'
@@ -260,7 +266,8 @@ export default {
         onChange: (current) => this.changeChoosePage(current)
       },
       basicInfoData: null, //  基本信息
-      productTotal: null //  合计
+      productTotal: null, //  合计
+      printerType: 'INK' //  打印机类型
     }
   },
   methods: {
@@ -276,6 +283,38 @@ export default {
       this.productType = []
       this.$refs.table.refresh(true)
     },
+    // 打印预览/快捷打印
+    handlePrint (type) {
+      const _this = this
+      storeCallOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType, costFlag: '0' }).then(res => {
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
+      })
+    },
+    print (data, type) {
+      if (!data) {
+        return
+      }
+      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
+      document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
+      if (type == 'preview') { //  预览
+        window.open(url)
+      } else if (type == 'print') { //  打印
+        window.frames['printf'].focus()
+        window.frames['printf'].print()
+      }
+    },
     // 双击快速添加
     handleClickRow (record) {
       return {

+ 18 - 3
src/views/bulkManagement/bulkWarehousingOrder/detail.vue

@@ -23,8 +23,8 @@
           <a-radio value="INK">针式</a-radio>
           <a-radio value="NEEDLE">喷墨</a-radio>
         </a-radio-group>
-        <a-button key="2" id="bulkWarehousingOrderDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
-        <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
+        <a-button key="2" id="bulkWarehousingOrderDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
+        <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
       </template>
     </a-page-header>
     <!-- 基础信息 -->
@@ -124,10 +124,12 @@ export default {
             // 采购金额  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
           }
+          this.localDataSource = data.list
           this.disabled = false
           return data
         })
       },
+      localDataSource: [],
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
       printerType: 'INK' //  打印机类型
@@ -145,8 +147,21 @@ export default {
     },
     // 打印预览/快捷打印
     handlePrint (type) {
+      const _this = this
       sparePartsPurDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
-        this.print(res, type)
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
       })
     },
     print (data, type) {

+ 43 - 4
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -9,8 +9,12 @@
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
-        <a-button key="2" id="bulkWarehousingOrderEdit-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="bulkWarehousingOrderEdit-print-btn">快速打印</a-button>
+        <a-radio-group key="3" v-model="printerType">
+          <a-radio value="INK">针式</a-radio>
+          <a-radio value="NEEDLE">喷墨</a-radio>
+        </a-radio-group>
+        <a-button key="2" id="bulkWarehousingOrderEdit-preview-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('preview')">打印预览</a-button>
+        <a-button key="1" type="primary" id="bulkWarehousingOrderEdit-print-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('print')">快捷打印</a-button>
       </template>
     </a-page-header>
     <!-- 基础信息 -->
@@ -224,6 +228,8 @@
     </a-affix>
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <!-- 打印 -->
+    <div id="print"></div>
   </div>
 </template>
 
@@ -233,7 +239,7 @@ import basicInfoModal from './basicInfoModal.vue'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
-import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit } from '@/api/sparePartsPur'
+import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
 import { dealerProductList } from '@/api/dealerProduct'
 import { warehouseCascadeList } from '@/api/warehouse'
 export default {
@@ -306,7 +312,8 @@ export default {
       chooseWarehouseList: [], //  已选产品 仓库  下拉数据
       chooseWarehouseLocList: {}, //  已选产品 仓位  下拉数据
       basicInfoData: null, //  基本信息
-      productTotal: null //  合计
+      productTotal: null, //  合计
+      printerType: 'INK' //  打印机类型
     }
   },
   methods: {
@@ -324,6 +331,38 @@ export default {
       this.paginationProps.current = 1
       this.getDealerProductList(1)
     },
+    // 打印预览/快捷打印
+    handlePrint (type) {
+      const _this = this
+      sparePartsPurDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
+      })
+    },
+    print (data, type) {
+      if (!data) {
+        return
+      }
+      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
+      document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
+      if (type == 'preview') { //  预览
+        window.open(url)
+      } else if (type == 'print') { //  打印
+        window.frames['printf'].focus()
+        window.frames['printf'].print()
+      }
+    },
     // 双击快速添加
     handleClickRow (record) {
       return {

+ 14 - 1
src/views/financialManagement/warehousingAudit/detail.vue

@@ -104,8 +104,21 @@ export default {
     },
     // 打印预览/快捷打印
     handlePrint (type) {
+      const _this = this
       receivingDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
-        this.print(res, type)
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.print(res, type)
+        }
       })
     },
     print (data, type) {