From f18ddd74a2ec30b677ff632967e973dfed0bb31b Mon Sep 17 00:00:00 2001 From: wangxinyao Date: Tue, 5 Jul 2022 11:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=9C=80=E6=96=B0=E9=A2=84?= =?UTF-8?q?=E6=B5=8B=E5=81=8F=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/workbench/predictVersion/index.vue | 68 ++++++++++++++----- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/src/views/plan/workbench/predictVersion/index.vue b/src/views/plan/workbench/predictVersion/index.vue index 42cbdd8..b5243cf 100644 --- a/src/views/plan/workbench/predictVersion/index.vue +++ b/src/views/plan/workbench/predictVersion/index.vue @@ -4,7 +4,7 @@ 导出 + 导出最新预测偏差 @@ -247,23 +254,31 @@ export default { }, // 物料列表 setArtList() { - this.artIdLoading = true - getArtIdList().then(({ data = [] }) => { - this.artIdLoading = false - this.artList = data; - }).catch(() => { - this.artIdLoading = false - }) + if (this.artList.length > 0) { + // 已经有数据了,请求过接口 + } else { + this.artIdLoading = true + getArtIdList().then(({ data = [] }) => { + this.artIdLoading = false + this.artList = data; + }).catch(() => { + this.artIdLoading = false + }) + } }, // 客户列表 setCustomerList() { - this.customerLoading = true - get('/admin/base/customer/customerlst').then(({ data = [] }) => { - this.customerLoading = false - this.customerArray = data - }).catch(() => { - this.customerLoading = false - }) + if (this.customerArray.length > 0) { + // 已经有数据了,请求过接口 + } else { + this.customerLoading = true + get('/admin/base/customer/customerlst').then(({ data = [] }) => { + this.customerLoading = false + this.customerArray = data + }).catch(() => { + this.customerLoading = false + }) + } }, // 搜索按钮操作 handleQuery() { @@ -304,6 +319,25 @@ export default { link.click(); }) }, + // 导出最新预测偏差 + handleNewExport() { + for (let key in this.queryParams) { + if (this.queryParams[key] == '' || key == 'versionId') { + this.queryParams[key] = undefined + } + } + get(`/admin/ap/custdemandverhead/difference`, { + ...this.queryParams, + "customerId": this.queryParams.customerId ? this.queryParams.customerId.join(",") : undefined + }).then(res => { + let link = document.createElement('a'); + link.style.display = 'none'; + link.href = (process.env.VUE_APP_BASE_URL || "http://101.201.121.115:9003/") + res.data; + link.setAttribute('download', '最新预测偏差.xlsx'); + document.body.appendChild(link); + link.click(); + }) + }, }, created() { this.getVersionOfCustom()