瀏覽代碼

打印导出

lilei 3 年之前
父節點
當前提交
6e662e1249

+ 20 - 0
src/api/purchaseReturn.js

@@ -102,3 +102,23 @@ export const purchaseReturnOutStockBill = (params) => {
     method: 'post'
   })
 }
+// 采购退货详情  打印
+export const purchaseReturnDetailPrint = params => {
+  const data = {
+    url: `/purchaseReturn/print/${params.sn}/${params.type}`,
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
+}
+// 采购退货 详情  导出
+export const purchaseReturnDetailExport = params => {
+  return axios.request({
+    url: `/purchaseReturn/excel/${params.sn}`,
+    method: 'get',
+    responseType: 'blob'
+  })
+}

+ 20 - 0
src/api/sparePartsRet.js

@@ -107,3 +107,23 @@ export const sparePartsRetDetail = (params) => {
     method: 'get'
   })
 }
+// 散件退货详情  打印
+export const sparePartsRetDetailPrint = params => {
+  const data = {
+    url: `/sparePartsRet/print/${params.sn}/${params.type}`,
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
+}
+// 散件退货详情  导出
+export const sparePartsRetDetailExport = params => {
+  return axios.request({
+    url: `/sparePartsRet/excel/${params.sn}`,
+    method: 'get',
+    responseType: 'blob'
+  })
+}

+ 23 - 2
src/views/bulkManagement/bulkReturnGoods/detailModal.vue

@@ -9,6 +9,9 @@
     @cancle="isShow = false"
     :width="960">
     <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false" class="bulkReturnGoodsDetail-cont">
+        <div style="float:right"><Print :disabled="dataSource.length==0" @handlePrint="handlePrint"></Print></div>
+      </a-card>
       <a-card size="small" :bordered="false" class="bulkReturnGoodsDetail-cont">
         <a-descriptions size="small">
           <a-descriptions-item label="散件退货单号">{{ (basicInfoData&&basicInfoData.sparePartsReturnNo) || '--' }}</a-descriptions-item>
@@ -49,10 +52,12 @@
 
 <script>
 import { STable } from '@/components'
-import { sparePartsRetDetail, sparePartsRetDetailList, sparePartsRetDetailCount } from '@/api/sparePartsRet'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
+import { sparePartsRetDetail, sparePartsRetDetailList, sparePartsRetDetailCount, sparePartsRetDetailPrint, sparePartsRetDetailExport } from '@/api/sparePartsRet'
 export default {
   name: 'BulkReturnGoodsDetailModal',
-  components: { STable },
+  components: { STable, Print },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -71,6 +76,7 @@ export default {
     return {
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
+      dataSource: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -82,6 +88,7 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
+          this.dataSource = data.list
           this.disabled = false
           return data
         })
@@ -121,6 +128,20 @@ export default {
     }
   },
   methods: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = sparePartsRetDetailPrint
+      const params = { sn: this.basicInfoData.sparePartsReturnSn }
+      if (type == 'export') { //  导出
+        url = sparePartsRetDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, this.basicInfoData && this.basicInfoData.isGrab == 1 ? '散件退货单(抓单)' : '散件退货单(不抓单)', function () {
+        _this.spinning = false
+      })
+    },
     // 详情
     getDetail () {
       sparePartsRetDetail({ sn: this.itemSn }).then(res => {

+ 32 - 2
src/views/bulkManagement/bulkReturnGoods/edit.vue

@@ -6,6 +6,10 @@
         <template slot="subTitle">
           <a id="bulkReturnGoodsEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         </template>
+        <!-- 操作区,位于 title 行的行尾 -->
+        <template slot="extra">
+          <Print :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print>
+        </template>
       </a-page-header>
       <!-- 选择产品 -->
       <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
@@ -181,10 +185,20 @@
 
 <script>
 import { STable, VSelect } from '@/components'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 import { warehouseAllList } from '@/api/warehouse'
-import { sparePartsRetDetailList, stockDetailProductList, sparePartsRetDetailSave, sparePartsRetDetailCount, sparePartsRetDetailDel, sparePartsRetSubmit } from '@/api/sparePartsRet'
+import {
+  sparePartsRetDetailList,
+  stockDetailProductList,
+  sparePartsRetDetailSave,
+  sparePartsRetDetailCount,
+  sparePartsRetDetailDel,
+  sparePartsRetSubmit,
+  sparePartsRetDetailPrint,
+  sparePartsRetDetailExport } from '@/api/sparePartsRet'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -194,6 +208,7 @@ export default {
         warehouseSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
+      dataSource: [],
       // 表头
       columns: [
         { title: '产品编码', dataIndex: 'productCode', width: '19%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -215,6 +230,7 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
+          this.dataSource = data.list
           this.disabled = false
           return data
         })
@@ -260,6 +276,20 @@ export default {
     }
   },
   methods: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = sparePartsRetDetailPrint
+      const params = { sn: this.$route.params.sn }
+      if (type == 'export') { //  导出
+        url = sparePartsRetDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '散件退货单(不抓单)', function () {
+        _this.spinning = false
+      })
+    },
     // 合计
     getDetailCount (params) {
       sparePartsRetDetailCount(params).then(res => {

+ 31 - 2
src/views/bulkManagement/bulkReturnGoods/grabEdit.vue

@@ -6,6 +6,10 @@
         <template slot="subTitle">
           <a id="bulkReturnGoodsEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         </template>
+        <!-- 操作区,位于 title 行的行尾 -->
+        <template slot="extra">
+          <Print :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print>
+        </template>
       </a-page-header>
       <!-- 选择产品 -->
       <a-card size="small" :bordered="false" class="bulkReturnGoodsEdit-cont">
@@ -172,11 +176,20 @@
 
 <script>
 import { STable, VSelect } from '@/components'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 import { warehouseAllList } from '@/api/warehouse'
 import { sparePartsPurDetailFinishList } from '@/api/sparePartsPur'
-import { sparePartsRetDetailList, sparePartsRetDetailSave, sparePartsRetDetailCount, sparePartsRetDetailDel, sparePartsRetSubmit } from '@/api/sparePartsRet'
+import {
+  sparePartsRetDetailList,
+  sparePartsRetDetailSave,
+  sparePartsRetDetailCount,
+  sparePartsRetDetailDel,
+  sparePartsRetSubmit,
+  sparePartsRetDetailPrint,
+  sparePartsRetDetailExport } from '@/api/sparePartsRet'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -186,6 +199,7 @@ export default {
         sparePartsPurchaseNo: ''
       },
       disabled: false, //  查询、重置按钮是否可操作
+      dataSource: [],
       // 表头
       columns: [
         { title: '散件入库单号', dataIndex: 'sparePartsPurchaseNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -210,6 +224,7 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
+          this.dataSource = data.list
           this.disabled = false
           return data
         })
@@ -253,6 +268,20 @@ export default {
     }
   },
   methods: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = sparePartsRetDetailPrint
+      const params = { sn: this.$route.params.sn }
+      if (type == 'export') { //  导出
+        url = sparePartsRetDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '散件退货单(抓单)', function () {
+        _this.spinning = false
+      })
+    },
     // 合计
     getDetailCount () {
       sparePartsRetDetailCount(Object.assign(this.chooseQueryParam, { sparePartsReturnSn: this.$route.params.sn })).then(res => {

+ 24 - 2
src/views/purchasingManagement/purchaseReturn/detail.vue

@@ -12,6 +12,10 @@
           id="purchaseReturnDetail-edit-btn"
           @click.stop="handleEdit">编辑</a-button>
       </template>
+      <!-- 操作区,位于 title 行的行尾 -->
+      <template slot="extra">
+        <Print :disabled="dataSource.length==0" @handlePrint="handlePrint"></Print>
+      </template>
     </a-page-header>
     <!-- 基础信息 -->
     <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
@@ -52,10 +56,12 @@
 
 <script>
 import { STable, VSelect } from '@/components'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 import { getOperationalPrecision } from '@/libs/tools.js'
-import { purchaseReturnDetailSn, purchaseReturnDetailList } from '@/api/purchaseReturn'
+import { purchaseReturnDetailSn, purchaseReturnDetailList, purchaseReturnDetailPrint, purchaseReturnDetailExport } from '@/api/purchaseReturn'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   props: {
     outBizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -78,6 +84,7 @@ export default {
         { title: '退货金额小计', dataIndex: 'purchaseReturnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货原因', dataIndex: 'remarks', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ],
+      dataSource: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -90,6 +97,7 @@ export default {
             data.list[i].purchaseReturnAmount = getOperationalPrecision(data.list[i].cost, data.list[i].qty)
           }
           this.disabled = false
+          this.dataSource = data.list
           return data
         })
       },
@@ -102,6 +110,20 @@ export default {
     }
   },
   methods: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = purchaseReturnDetailPrint
+      const params = { sn: this.$route.params.sn }
+      if (type == 'export') { //  导出
+        url = purchaseReturnDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '采购退货单', function () {
+        _this.spinning = false
+      })
+    },
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/purchasingManagement/purchaseReturn/list', query: { closeLastOldTab: true } })

+ 32 - 2
src/views/purchasingManagement/purchaseReturn/edit.vue

@@ -7,6 +7,10 @@
           <a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <span style="margin: 0 15px;color: #666;">供应商名称:{{ $route.params.name || '--' }}</span>
         </template>
+        <!-- 操作区,位于 title 行的行尾 -->
+        <template slot="extra">
+          <Print :disabled="dataSource.length==0" @handlePrint="handlePrint"></Print>
+        </template>
       </a-page-header>
       <!-- 选择产品 -->
       <a-card size="small" :bordered="false" class="purchaseReturnEdit-cont">
@@ -153,9 +157,19 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { purchaseReturnPurchaseBillDetailList, purchaseReturnDetailList, purchaseReturnDetailSave, purchaseReturnDetailDel, purchaseReturnSubmit, purchaseReturnDelAll } from '@/api/purchaseReturn'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
+import {
+  purchaseReturnPurchaseBillDetailList,
+  purchaseReturnDetailList,
+  purchaseReturnDetailSave,
+  purchaseReturnDetailDel,
+  purchaseReturnSubmit,
+  purchaseReturnDelAll,
+  purchaseReturnDetailPrint,
+  purchaseReturnDetailExport } from '@/api/purchaseReturn'
 export default {
-  components: { STable, VSelect },
+  components: { STable, VSelect, Print },
   data () {
     return {
       spinning: false,
@@ -164,6 +178,7 @@ export default {
         productCode: '',
         productName: ''
       },
+      dataSource: [],
       disabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
       // 表头
@@ -191,6 +206,7 @@ export default {
             data.list[i].no = no + i + 1
           }
           this.disabled = false
+          this.dataSource = data.list
           return data
         })
       },
@@ -226,6 +242,20 @@ export default {
     }
   },
   methods: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = purchaseReturnDetailPrint
+      const params = { sn: this.$route.params.sn }
+      if (type == 'export') { //  导出
+        url = purchaseReturnDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '采购退货单', function () {
+        _this.spinning = false
+      })
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.purchaseBillNo = ''