From e8cc80495f66ce4b92d38b66b174b7cc087c86fa Mon Sep 17 00:00:00 2001 From: "DESKTOP-FUDKNA8\\znjsz" Date: Fri, 26 Apr 2024 11:23:40 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BA=A7=E9=87=8Ffto=E6=8A=95?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/home.js | 1 - .../copilot/components/charts/BipvOutput.vue | 4 +- .../copilot/components/charts/ChipOutput.vue | 4 +- .../copilot/components/charts/FtoInvest.vue | 86 ++++++++----------- .../copilot/components/charts/StdOutput.vue | 2 +- .../components/charts/base/BarChartBase.vue | 4 +- .../components/charts/base/CityData.vue | 12 +-- 7 files changed, 49 insertions(+), 64 deletions(-) diff --git a/src/store/modules/home.js b/src/store/modules/home.js index ea4d46a..669f429 100644 --- a/src/store/modules/home.js +++ b/src/store/modules/home.js @@ -87,7 +87,6 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse) { const { chipInvest, ftoInvest, chipOutput, stdOutput, bipvOutput } = init(); if (factoryListResponse) { for (const factory of factoryListResponse) { - debugger; const fId = getFactoryId(factory); // 获取目标值 if (targetListResponse) { diff --git a/src/views/copilot/components/charts/BipvOutput.vue b/src/views/copilot/components/charts/BipvOutput.vue index fd40bef..dba836b 100644 --- a/src/views/copilot/components/charts/BipvOutput.vue +++ b/src/views/copilot/components/charts/BipvOutput.vue @@ -6,7 +6,7 @@ --> diff --git a/src/views/copilot/components/charts/ChipOutput.vue b/src/views/copilot/components/charts/ChipOutput.vue index 498c72e..099dd42 100644 --- a/src/views/copilot/components/charts/ChipOutput.vue +++ b/src/views/copilot/components/charts/ChipOutput.vue @@ -6,7 +6,7 @@ --> diff --git a/src/views/copilot/components/charts/FtoInvest.vue b/src/views/copilot/components/charts/FtoInvest.vue index fc490dc..7971edc 100644 --- a/src/views/copilot/components/charts/FtoInvest.vue +++ b/src/views/copilot/components/charts/FtoInvest.vue @@ -44,8 +44,8 @@ export default { const year = new Date().getFullYear(); const month = new Date().getMonth() + 1; return [ - { label: `${year}年${month}月`, color: "#12f7f1" }, - { label: `${year - 1}年${month}月`, color: "#58adfa" }, + { label: `${year - 1}年${month}月`, color: "#12f7f1" }, + { label: `${year}年${month}月`, color: "#58adfa" }, ]; } case "年": { @@ -63,59 +63,45 @@ export default { } }, series() { - const template = - this.period == "日" || this.period == "周" - ? [ - { - name: "样例数据--2023年", - data: Array.from({ length: 7 }, () => - Math.floor(Math.random() * 1000) - ), - }, - ] - : [ - { - name: "样例数据--2023年", - data: Array.from({ length: 7 }, () => - Math.floor(Math.random() * 1000) - ), - }, - { - name: "样例数据--2024年", - data: Array.from({ length: 7 }, () => - Math.floor(Math.random() * 1000) - ), - }, - ]; - const ftoInvest = this.$store.getters.home.ftoInvest; - if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) { - return [ - { - name: "样例数据--2023年", - data: Array.from({ length: 7 }, () => - Math.floor(Math.random() * 1000) - ), - }, - { - name: "样例数据--2024年", - data: Array.from({ length: 7 }, () => - Math.floor(Math.random() * 1000) - ), - }, - ]; + const { ftoInvest } = this.$store.getters.copilot.yield; + let dataList = null; + + switch (this.period) { + case "日": + case "周": + dataList = ftoInvest?.current; + break; + default: + dataList = []; + dataList[0] = ftoInvest?.pervious; + dataList[1] = ftoInvest?.current; } - return [ + return getTemplate(this.period, dataList); + }, + }, +}; + +function getTemplate(period, dataList) { + const year = new Date().getFullYear(); + const month = new Date().getMonth() + 1; + return period == "日" || period == "周" + ? [ + { + name: period == "日" ? "昨天" : "本周", + data: dataList ?? [], + }, + ] + : [ { - name: `${new Date().getFullYear() - 1}年`, - data: ftoInvest.previous, + name: period == "年" ? `${year - 1}年` : `${year - 1}年${month}月`, + data: dataList ? dataList[0] : [], }, { - name: `${new Date().getFullYear()}年`, - data: ftoInvest.current, + name: period == "年" ? `${year}年` : `${year}年${month}月`, + data: dataList ? dataList[1] : [], + // : Array.from({ length: 7 }, () => Math.floor(Math.random() * 1000)), }, ]; - }, - }, -}; +} diff --git a/src/views/copilot/components/charts/StdOutput.vue b/src/views/copilot/components/charts/StdOutput.vue index 9ff5e7d..064b8b6 100644 --- a/src/views/copilot/components/charts/StdOutput.vue +++ b/src/views/copilot/components/charts/StdOutput.vue @@ -6,7 +6,7 @@ -->