Kaynağa Gözat

散件入库、入库审核 针式打印方式更改

chenrui 3 yıl önce
ebeveyn
işleme
eafb7c6ccf

+ 8 - 4
src/api/receiving.js

@@ -55,9 +55,13 @@ export const receivingDetailList = (params) => {
 }
 // 入库审核 详情  打印
 export const receivingDetailPrint = params => {
-  return axios.request({
+  const data = {
     url: `receiving/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/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)
 }

+ 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 {

+ 11 - 37
src/views/financialManagement/warehousingAudit/detail.vue

@@ -9,12 +9,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template v-if="$hasPermissions('B_warehousingDetail_print')" slot="extra">
-          <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="warehousingAuditDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="1" type="primary" id="warehousingAuditDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
+          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -57,16 +52,16 @@
         </a-collapse>
       </a-card>
     </a-spin>
-    <!-- 打印 -->
-    <div id="print"></div>
   </div>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
 import { receivingDetailList, receivingDetailSn, receivingDetailPrint } from '@/api/receiving'
+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,
@@ -93,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' //  打印机类型
     }
@@ -107,39 +104,16 @@ export default {
       this.$router.push({ path: '/financialManagement/warehousingAudit/list', query: { closeLastOldTab: true } })
     },
     // 打印预览/快捷打印
-    handlePrint (type) {
+    handlePrint (type, printerType) {
       const _this = this
       _this.spinning = true
-      receivingDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
+      const url = receivingDetailPrint
+      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="printfwad" name="printfwad" src="' + url + '" hidden></iframe>'
-      if (type == 'preview') { //  预览
-        window.open(url)
-      } else if (type == 'print') { //  打印
-        window.frames['printfwad'].focus()
-        window.frames['printfwad'].print()
-      }
-    },
     getDetail () {
       receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {