From 13de0ce8ea94c1853e2be74f93ef22799925e7f9 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 8 Sep 2023 14:18:35 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AE=A2=E5=8D=95-=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/components/ListSectionWithHead.vue | 61 ++++++++++++++++++- src/views/modules/pms/order/config.js | 13 +++- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/views/modules/pms/order/components/ListSectionWithHead.vue b/src/views/modules/pms/order/components/ListSectionWithHead.vue index 398eb30..9dfa10a 100644 --- a/src/views/modules/pms/order/components/ListSectionWithHead.vue +++ b/src/views/modules/pms/order/components/ListSectionWithHead.vue @@ -156,7 +156,7 @@ export default { if ("list" in res.data) { this.dataList = res.data.list; this.totalPage = res.data.total; - } + } } else { this.dataList.splice(0); this.totalPage = 0; @@ -211,7 +211,9 @@ export default { type: "success", duration: 2000, onClose: () => { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign({}, this.listQuery, this.extraSearchConditions, this.params) + ); this.$emit("refresh-tables", ["ongoing"]); }, }); @@ -254,7 +256,9 @@ export default { type: "success", duration: 2000, onClose: () => { - this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params)); + this.getAList( + Object.assign({}, this.listQuery, this.extraSearchConditions, this.params) + ); this.$emit("refresh-tables", ["finished"]); }, }); @@ -384,6 +388,57 @@ export default { this.showUploadDialog(payload); // alert('/pms/order/importExcelOrder'); break; + case "导出订单": + this.$confirm(`确定要导出订单吗?`, "提示", { + confirmButtonText: "是", + cancelButtonText: "否", + type: "warning", + }) + .then(() => { + this.overlayVisible = true; + console.log("导出: ", payload); + return this.$http({ + url: "/pms/order/export", + method: "post", + headers: { + "Content-Type": "application/json", + }, + responseType: "blob", + }); + }) + .then(({ data: res }) => { + const blob = new Blob([res]); + + /** 通知 */ + this.$notify({ + title: "成功", + message: "开始下载", + type: "success", + duration: 1200, + }); + + const fileName = "订单导出.xlsx"; + if ("download" in document.createElement("a")) { + const alink = document.createElement("a"); + alink.download = fileName; + alink.style.display = "none"; + alink.target = "_blank"; + alink.href = URL.createObjectURL(blob); + document.body.appendChild(alink); + alink.click(); + URL.revokeObjectURL(alink.href); + document.body.removeChild(alink); + } else { + navigator.msSaveBlob(blob, fileName); + } + + this.overlayVisible = false; + }) + .catch((err) => { + this.$message.error("导出出错!"); + this.overlayVisible = false; + }); + break; case "压制工艺": // 跳转至压制工艺页面 this.$router.push({ name: "pms-shapeStep" }); diff --git a/src/views/modules/pms/order/config.js b/src/views/modules/pms/order/config.js index e1f7950..6f03e91 100644 --- a/src/views/modules/pms/order/config.js +++ b/src/views/modules/pms/order/config.js @@ -168,8 +168,7 @@ export default function () { plain: true, }, }, - { - // 导入订单 - TODO: 需完善具体接口和功能 + { button: { type: "success", name: "导入订单", @@ -179,6 +178,16 @@ export default function () { plain: true, }, }, + { + button: { + type: "warning", + name: "导出订单", + permission :'' + }, + bind: { + plain: true, + }, + }, { button: { name: '压制工艺'