diff --git a/src/api/inout/orderDetailResult.js b/src/api/inout/orderDetailResult.js index 6fe3e9ae..6499485a 100644 --- a/src/api/inout/orderDetailResult.js +++ b/src/api/inout/orderDetailResult.js @@ -77,6 +77,16 @@ export function printOrderDeptSup(data) { }); } +export function printOrderInvProducts(data) { + return axios({ + url: "/udiwms/inout/resultDetail/printOrderInvProducts", + method: "post", + headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}, + responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf + data: data + }); +} + export function printDev(data) { return axios({ url: "/udiwms/inout/resultDetail/filterDevPrint", diff --git a/src/views/inventory/InvProducts.vue b/src/views/inventory/InvProducts.vue index 28fe0953..9adf7a6b 100644 --- a/src/views/inventory/InvProducts.vue +++ b/src/views/inventory/InvProducts.vue @@ -224,11 +224,14 @@ >查询 </el-button > + <el-button type="primary" icon="el-icon-printer" @click="optinPrint" :loading="optinPrintLoading">选中打印</el-button> + <el-button type="primary" icon="el-icon-printer" @click="selectPrint" :loading="selectPrinttLoading">查询结果打印</el-button> </el-button-group> </div> <el-divider style="margin: 15px"></el-divider> - <el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row - border> + <el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row borderv + @selection-change="handleCheckedChange" :row-style="{ height: '32px' }"> + <el-table-column type="selection" width="55"></el-table-column> <!-- <el-table-column label="序号" type="index"></el-table-column> <el-table-column label="供应商" prop="supName" v-if="showSup" show-overflow-tooltip width="120"></el-table-column> @@ -403,6 +406,10 @@ </template> <script> +import { + verifyTemplateFile, + printOrderInvProducts, +} from '@/api/inout/orderDetailResult' import {getInvListByUserOptimize} from "@/api/system/invWarehouse"; import {getInvProduct, deleteInvProduct, getProduct} from "@/api/inventory/invPorduct"; import {getBasicUnitMaintainsOptimize} from "@/api/basic/basicUnitMaintain"; @@ -419,6 +426,8 @@ export default { name: "InvProducts", data() { return { + optinPrintLoading: false, + selectPrinttLoading: false, showSearch: true, filterQuery: { nameCode: null, @@ -471,9 +480,154 @@ export default { addInvRemindSetDialogVisible: false, invId: null, spaceList: [], + orderSelection: [], + actDateRange: [], }; }, methods: { + handleCheckedChange(val) { + this.orderSelection = val; + }, + optinPrint() { + this.$confirm("是否确定打印选中入账库信息, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + if (this.orderSelection == null || this.orderSelection.length <= 0) { + return this.$message.error("请选择打印的明细!"); + } + let query = {id: 10}; + this.optinPrintLoading = true + verifyTemplateFile(query).then((res) => { + this.optinPrintLoading = false + if (res.code === 20000) { + let printParams = { + mainAction :this.filterQuery.mainAction, + fromInvCode :this.filterQuery.fromInvCode, + startAduditTime :this.filterQuery.startAduditTime, + endAduditTime: this.filterQuery.endAduditTime, + confirmStarTime : this.filterQuery.confirmStarTime , + confirmEndTime : this.filterQuery.confirmEndTime , + corpName : this.filterQuery.corpName , + cpmctymc: this.filterQuery.cpmctymc, + udiCode: this.filterQuery.udiCode, + nameCode: this.filterQuery.nameCode, + ggxh: this.filterQuery.ggxh, + batchNo: this.filterQuery.batchNo, + zczbhhzbapzbh: this.filterQuery.zczbhhzbapzbh, + ylqxzcrbarmc: this.filterQuery.ylqxzcrbarmc, + invCode: this.filterQuery.invCode, + invSpaceCode: this.filterQuery.invSpaceCode, + filterNoInv: this.filterQuery.filterNoInv, + supId: this.filterQuery.supId, + employeeName: this.$store.getters.user.employeeName, + locInvName:this.$store.getters.locInvName, + templateId: res.data, + list: this.orderSelection + }; + printOrderInvProducts(printParams).then((response) => { + //将pdf文件转换为url。 + const binaryData = []; + binaryData.push(response); + //获取blob链接。 + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/pdf"}) + ); + this.loading = false; + window.open(url);//打开新标签页,预览pdf。 + }) + } else { + this.optinPrintLoading = false + return this.$message.error(res.message); + } + }).catch((error) => { + this.optinPrintLoading = false + this.loading = false; + this.$message.error(error.message); + }) + }) + .catch(() => { + }); + + + }, + selectPrint() { + this.$confirm("是否确定打印所有查询结果数据", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + + let query = {id: 10}; + this.selectPrinttLoading = true + verifyTemplateFile(query).then((res) => { + this.selectPrinttLoading = false + if (res.code === 20000) { + let printParams = { + templateId: res.data, + orderIdFk: this.filterQuery.orderIdFk, + fromInvCode: this.filterQuery.fromInvCode, + coName: this.filterQuery.coName, + spec: this.filterQuery.spec, + manufacturer: this.filterQuery.manufacturer, + actionType: this.filterQuery.actionType, + keyWords: this.filterQuery.keyWords, + mainAction: this.filterQuery.mainAction, + action: this.filterQuery.action, + cpmctymc: this.filterQuery.cpmctymc, + udiCode: this.filterQuery.udiCode, + nameCode: this.filterQuery.nameCode, + ggxh: this.filterQuery.ggxh, + batchNo: this.filterQuery.batchNo, + zczbhhzbapzbh: this.filterQuery.zczbhhzbapzbh, + ylqxzcrbarmc: this.filterQuery.ylqxzcrbarmc, + invCode: this.filterQuery.invCode, + invSpaceCode: this.filterQuery.invSpaceCode, + filterNoInv: this.filterQuery.filterNoInv, + supId: this.filterQuery.supId, + locInvName:this.$store.getters.locInvName, + employeeName: this.$store.getters.user.employeeName, + }; + if (this.actDateRange !== null) { + printParams.startAduditTime = this.actDateRange[0]; + printParams.endAduditTime = this.actDateRange[1]; + } else { + printParams.startAduditTime = null; + printParams.endAduditTime = null; + } + + printOrderInvProducts(printParams).then((response) => { + //将pdf文件转换为url。 + const binaryData = []; + binaryData.push(response); + //获取blob链接。 + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/pdf"}) + ); + this.loading = false; + window.open(url);//打开新标签页,预览pdf。 + }) + } else { + this.$message.error(res.message); + return + } + }).catch((error) => { + this.selectPrinttLoading = false + this.loading = false; + this.$message.error(error.message); + }) + + }) + .catch(() => { + }); + return; + + + }, + onReset() { this.$router.push({ path: "",