فهرست منبع

Merge branch 'deploy_0804' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into deploy_0804
冲突解决

lilei 3 سال پیش
والد
کامیت
84231a4128

+ 8 - 4
src/api/allocLinkageOut.js

@@ -104,9 +104,13 @@ export const getTenantList = (params) => {
 }
 // 连锁调拨调出 详情  打印
 export const allocLinkageOutDetailPrint = params => {
-  return axios.request({
+  const data = {
     url: `allocLinkageOut/print/${params.sn}/${params.type}`,
-    method: 'get',
-    responseType: 'blob'
-  })
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
 }

+ 9 - 5
src/api/allocLinkagePut.js

@@ -62,9 +62,13 @@ export const allocLinkagePutDetailUpdate = (params) => {
 }
 // 连锁调拨调入 详情  打印
 export const allocLinkagePutDetailPrint = params => {
-  return axios.request({
+  const data = {
     url: `allocLinkagePut/print/${params.sn}/${params.type}`,
-    method: 'get',
-    responseType: 'blob'
-  })
-}
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
+}

+ 1 - 1
src/api/receiving.js

@@ -60,7 +60,7 @@ export const receivingDetailPrint = params => {
     method: 'get'
   }
   // 喷墨打印
-  if(params.type=='INK'){
+  if (params.type == 'INK') {
     data.responseType = 'blob'
   }
   return axios.request(data)

+ 8 - 4
src/api/sparePartsPur.js

@@ -113,9 +113,13 @@ export const sparePartsPurDetailDel = (params) => {
 }
 // 散件采购(入库) 详情  打印
 export const sparePartsPurDetailPrint = params => {
-  return axios.request({
+  const data = {
     url: `sparePartsPur/print/${params.sn}/${params.type}`,
-    method: 'get',
-    responseType: 'blob'
-  })
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
 }

+ 8 - 4
src/api/storeCallOut.js

@@ -101,9 +101,13 @@ export const storeCallOutDetailDel = (params) => {
 }
 // 店内调出 详情  打印
 export const storeCallOutDetailPrint = params => {
-  return axios.request({
+  const data = {
     url: `storeCallOut/print/${params.sn}/${params.type}/${params.costFlag}`,
-    method: 'get',
-    responseType: 'blob'
-  })
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
 }

+ 10 - 39
src/views/allocationManagement/chainTransferIn/detail.vue

@@ -15,12 +15,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_allocLinkagePutPrint')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="chainTransferInDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="chainTransferInDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -59,8 +54,6 @@
         </s-table>
       </a-card>
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -68,8 +61,10 @@
 import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { allocLinkagePutDetailList, allocLinkagePutDetailSn, allocLinkagePutDetailCount, allocLinkagePutDetailPrint } from '@/api/allocLinkagePut'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -106,8 +101,7 @@ export default {
       },
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
-      localDataSource: [],
-      printerType: 'NEEDLE' //  打印机类型
+      localDataSource: []
     }
   },
   computed: {
@@ -145,38 +139,15 @@ export default {
       this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${this.basicInfoData.id}/${this.basicInfoData.allocationLinkagePutSn}` })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      allocLinkagePutDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = allocLinkagePutDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfcid" name="printfcid" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfcid'].focus()
-        window.frames['printfcid'].print()
-      }
     }
   },
   mounted () {

+ 9 - 37
src/views/allocationManagement/chainTransferIn/edit.vue

@@ -8,12 +8,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_allocLinkagePutPrint')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="chainTransferInEdit-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="chainTransferInEdit-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -111,8 +106,6 @@
         @click="handleSubmit"
         style="padding: 0 60px;">提交入库</a-button>
     </div>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -122,8 +115,10 @@ import { getOperationalPrecision } from '@/libs/tools.js'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseCascadeList } from '@/api/warehouse'
 import { allocLinkagePutDetailSn, allocLinkagePutDetailList, allocLinkagePutDetailCount, allocLinkagePutDetailUpdate, allocLinkagePutSubmit, allocLinkagePutDetailPrint } from '@/api/allocLinkagePut'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -313,39 +308,16 @@ export default {
       })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      allocLinkagePutDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = allocLinkagePutDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfcie" name="printfcie" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfcie'].focus()
-        window.frames['printfcie'].print()
-      }
-    },
     pageInit () {
       this.getDetail()
       this.getWarehouseCascade()

+ 10 - 39
src/views/allocationManagement/chainTransferOut/detail.vue

@@ -15,12 +15,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_allocLinkageOutPrint')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="chainTransferOutDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="chainTransferOutDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -65,8 +60,6 @@
         </a-collapse>
       </a-card>
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -74,8 +67,10 @@
 import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailCount, allocLinkageOutDetailPrint } from '@/api/allocLinkageOut'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   props: {
     outBizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -116,8 +111,7 @@ export default {
       },
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
-      localDataSource: [],
-      printerType: 'NEEDLE' //  打印机类型
+      localDataSource: []
     }
   },
   computed: {
@@ -155,38 +149,15 @@ export default {
       this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${this.basicInfoData.id}/${this.basicInfoData.allocationLinkageOutSn}` })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      allocLinkageOutDetailPrint({ sn: this.outBizSn || this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = allocLinkageOutDetailPrint
+      const params = { sn: this.outBizSn || this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfcod" name="printfcod" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfcod'].focus()
-        window.frames['printfcod'].print()
-      }
     }
   },
   mounted () {

+ 10 - 39
src/views/allocationManagement/chainTransferOut/edit.vue

@@ -9,12 +9,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_allocLinkageOutPrint')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="chainTransferOutEdit-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="chainTransferOutEdit-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 选择产品 -->
@@ -191,8 +186,6 @@
         @click="handleSubmit"
         style="padding: 0 60px;">提交</a-button>
     </div>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -204,8 +197,10 @@ import { productQuery } from '@/api/allocWarehouse'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseAllList } from '@/api/warehouse'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -296,8 +291,7 @@ export default {
       },
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
-      localDataSource: [],
-      printerType: 'NEEDLE' //  打印机类型
+      localDataSource: []
     }
   },
   methods: {
@@ -482,39 +476,16 @@ export default {
       })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      allocLinkageOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = allocLinkageOutDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfcoe" name="printfcoe" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfcoe'].focus()
-        window.frames['printfcoe'].print()
-      }
-    },
     pageInit () {
       this.chooseResetSearchForm()
       this.getDetail()

+ 9 - 38
src/views/allocationManagement/storeTransferOut/detail.vue

@@ -16,12 +16,7 @@
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_storeCallOutPrint')">
           <a-checkbox key="4" v-model="printCostChecked">打印成本</a-checkbox>
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <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>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
@@ -61,8 +56,6 @@
         </s-table>
       </a-card>
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -70,8 +63,10 @@
 import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn, storeCallOutDetailPrint } from '@/api/storeCallOut'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   props: {
     outBizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -111,7 +106,6 @@ export default {
       localDataSource: [],
       basicInfoData: null, //  基本信息
       productTotal: null, //  合计
-      printerType: 'NEEDLE', //  打印机类型
       printCostChecked: true //  打印成本
     }
   },
@@ -126,39 +120,16 @@ export default {
       this.$router.push({ path: '/allocationManagement/storeTransferOut/list', query: { closeLastOldTab: true } })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      storeCallOutDetailPrint({ sn: this.outBizSn || this.$route.params.sn, type: this.printerType, costFlag: this.printCostChecked ? '1' : '0' }).then(res => {
+      const url = storeCallOutDetailPrint
+      const params = { sn: this.outBizSn || this.$route.params.sn, type: printerType, costFlag: this.printCostChecked ? '1' : '0' }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfsod" name="printfsod" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfsod'].focus()
-        window.frames['printfsod'].print()
-      }
-    },
     // 基本信息
     getDetail () {
       storeCallOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {

+ 10 - 45
src/views/allocationManagement/storeTransferOut/edit.vue

@@ -9,12 +9,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_storeCallOutPrint')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="storeTransferOutEdit-preview-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="storeTransferOutEdit-print-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 选择产品 -->
@@ -186,8 +181,6 @@
         @click="handleSubmit"
         style="padding: 0 60px;">提交</a-button>
     </div>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -199,8 +192,10 @@ import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseAllList } from '@/api/warehouse'
 import { productQuery } from '@/api/allocWarehouse'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -263,12 +258,6 @@ export default {
         { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
-      // chooseLoadData: [],
-      // choosePaginationProps: {
-      //   total: 0, //  分页总条数
-      //   current: 1,
-      //   pageSize: 20
-      // },
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
         this.chooseDisabled = true
@@ -290,8 +279,7 @@ export default {
       },
       chooseLoadDataSource: [],
       basicInfoData: null, //  基本信息
-      productTotal: null, //  合计
-      printerType: 'NEEDLE' //  打印机类型
+      productTotal: null //  合计
     }
   },
   methods: {
@@ -308,39 +296,16 @@ export default {
       this.$refs.table.refresh(true)
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      storeCallOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType, costFlag: '0' }).then(res => {
+      const url = storeCallOutDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType, costFlag: '0' }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfsoe" name="printfsoe" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfsoe'].focus()
-        window.frames['printfsoe'].print()
-      }
-    },
     // 双击快速添加
     handleClickRow (record) {
       return {

+ 10 - 39
src/views/bulkManagement/bulkWarehousingOrder/detail.vue

@@ -20,12 +20,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_bulkWarehousingOrder_print')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <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>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -98,8 +93,6 @@
         </a-collapse>
       </a-card> -->
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -107,8 +100,10 @@
 import { STable, VSelect } from '@/components'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -142,8 +137,7 @@ export default {
       },
       localDataSource: [],
       basicInfoData: null, //  基本信息
-      productTotal: null, //  合计
-      printerType: 'NEEDLE' //  打印机类型
+      productTotal: null //  合计
     }
   },
   computed: {
@@ -157,39 +151,16 @@ export default {
       this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list', query: { closeLastOldTab: true } })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      sparePartsPurDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = sparePartsPurDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfbwod" name="printfbwod" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfbwod'].focus()
-        window.frames['printfbwod'].print()
-      }
-    },
     // 基本信息
     getDetail () {
       sparePartsPurDetail({ id: this.$route.params.id }).then(res => {

+ 10 - 41
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -10,12 +10,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_bulkWarehousingOrder_print')">
-          <a-radio-group key="3" v-model="printerType">
-            <a-radio value="NEEDLE">针式</a-radio>
-            <a-radio value="INK">喷墨</a-radio>
-          </a-radio-group>
-          <a-button key="2" id="bulkWarehousingOrderEdit-preview-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="bulkWarehousingOrderEdit-print-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="chooseLoadDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -24,7 +19,6 @@
           <a-collapse-panel key="1">
             <template slot="header">
               基础信息
-              <!-- <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="bulkWarehousingOrderEdit-edit-circle-btn" @click.stop="handleEditInfo" /> -->
             </template>
             <a-descriptions :column="3">
               <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
@@ -152,7 +146,6 @@
           <a-collapse-panel key="1">
             <template slot="header">
               已选产品
-              <!-- <a-button size="small" class="import-btn" id="bulkWarehousingOrderEdit-import-btn" @click.stop="handleImport">导入明细</a-button> -->
             </template>
             <!-- 已选产品 -->
             <div>
@@ -237,8 +230,6 @@
     </div>
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
@@ -251,8 +242,10 @@ import { dealerProductTypeList } from '@/api/dealerProductType'
 import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
 import { dealerProductList } from '@/api/dealerProduct'
 import { warehouseCascadeList } from '@/api/warehouse'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
-  components: { STable, VSelect, basicInfoModal },
+  components: { STable, VSelect, basicInfoModal, Print },
   data () {
     return {
       spinning: false,
@@ -366,8 +359,7 @@ export default {
       chooseWarehouseList: [], //  已选产品 仓库  下拉数据
       chooseWarehouseLocList: {}, //  已选产品 仓位  下拉数据
       basicInfoData: null, //  基本信息
-      productTotal: null, //  合计
-      printerType: 'NEEDLE' //  打印机类型
+      productTotal: null //  合计
     }
   },
   methods: {
@@ -382,39 +374,16 @@ export default {
       this.$refs.table.refresh(true)
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      sparePartsPurDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = sparePartsPurDetailPrint
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '', function () {
         _this.spinning = false
-        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="printfbwoe" name="printfbwoe" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfbwoe'].focus()
-        window.frames['printfbwoe'].print()
-      }
-    },
     // 双击快速添加
     handleClickRow (record) {
       return {

+ 1 - 0
src/views/common/print.vue

@@ -47,6 +47,7 @@ export default {
 
 <style lang="less">
   .print-page-header{
+    display: inline-block;
     > *{
       margin-left: 5px;
     }

+ 5 - 3
src/views/financialManagement/warehousingAudit/detail.vue

@@ -9,7 +9,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template v-if="$hasPermissions('B_warehousingDetail_print')" slot="extra">
-          <Print :showExport="false" @handlePrint="handlePrint"></Print>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -88,10 +88,12 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
+          this.localDataSource = data.list
           this.disabled = false
           return data
         })
       },
+      localDataSource: [],
       basicInfoData: null, //  基本信息
       printerType: 'NEEDLE' //  打印机类型
     }
@@ -106,8 +108,8 @@ export default {
       const _this = this
       _this.spinning = true
       const url = receivingDetailPrint
-      const params = { sn: this.$route.params.sn, type: this.printerType }
-      // 打印
+      const params = { sn: this.$route.params.sn, type: printerType }
+      // 打印或导出
       hdPrint(printerType, type, url, params, '入库审核', function () {
         _this.spinning = false
       })