diff --git a/yxt-as-ui/src/api/storage/receivingGoods.js b/yxt-as-ui/src/api/storage/receivingGoods.js index 2166182fe8..596ad0009f 100644 --- a/yxt-as-ui/src/api/storage/receivingGoods.js +++ b/yxt-as-ui/src/api/storage/receivingGoods.js @@ -68,5 +68,14 @@ export default { 'Content-Type': 'application/json' } }) + }, + // 打印 + printReceiptBillPdf: function(data) { + return request({ + url: '/wms/apiadmin/inventory/WmsReceiptBill/printReceiptBillPdf', + method: 'post', + params: data, + headers: { 'Content-Type': 'application/json' } + }) } } diff --git a/yxt-as-ui/src/views/storage/receivingGoods/index.vue b/yxt-as-ui/src/views/storage/receivingGoods/index.vue index 80cf322c7e..057d668b4d 100644 --- a/yxt-as-ui/src/views/storage/receivingGoods/index.vue +++ b/yxt-as-ui/src/views/storage/receivingGoods/index.vue @@ -102,7 +102,7 @@ - + @@ -129,6 +129,7 @@ import divInfo from './receivingGoodsInfo.vue' import upShelfAdd from '../upShelf/upShelfAdd.vue' import upShelfInfo from '../upShelf/upShelfInfo.vue' import { typeValues } from '@/api/Common/dictcommons' +import { getStorage } from '@/utils/auth' export default { components: { @@ -340,21 +341,38 @@ export default { this.loadList() }, toPrint() { - for (var i = 0; i < this.selectionList.length; i++) { - if (this.selectionList[i].billState !== '已完成') { - this.$message({ - type: 'warning', - message: '只能选择已完成的记录。', - showClose: true + if (this.sids.length === 1) { + if (this.selectionList[0].billState === '已完成') { + req.printReceiptBillPdf({ sid: this.sids[0] }).then((res) => { + if (res.success) { + var xhr = new XMLHttpRequest() + xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + res.data + '&outFileName=' + '入库单', true) + xhr.setRequestHeader('token', getStorage()) + xhr.responseType = 'blob' + xhr.onload = function(e) { + // 如果请求执行成功 + var blob = this.response + var filename = '入库单.pdf' + var a = document.createElement('a') + // blob.type="application/octet-stream"; + // 创键临时url对象 + var url = URL.createObjectURL(blob) + a.href = url + a.download = filename + a.click() + // 释放之前创建的URL对象 + window.URL.revokeObjectURL(url) + } + // 发送请求 + xhr.send() + } }) - return + } else { + this.$message({ type: 'warning', message: '请选择单据状态为已完成的记录进行操作', showClose: true }) } + } else { + this.$message({ showClose: true, type: 'warning', message: '请选择一条记录进行操作' }) } - this.$message({ - type: 'warning', - message: '打印功能正在完善中。', - showClose: true - }) }, toAdd() { if (this.selectionList.length !== 1) {