From bb7f77e3ac2644ada31e6640684f1c8102aeb732 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FUDKNA8\\znjsz" Date: Mon, 18 Mar 2024 17:13:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20=E5=AF=BC=E8=88=AA=20&=20update=20cha?= =?UTF-8?q?rt=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AlertListScreen.vue | 6 + src/MainScreen.vue | 58 ++++++++ src/components/Chart/RateChart.vue | 147 +++++++++++++++++++++ src/components/Chart/YieldChart.vue | 93 +++++++++++++ src/components/Chart/rateOption.js | 146 ++++++++++++++++++++ src/components/Chart/yieldOption.js | 102 ++++++++++++++ src/components/datapage/LineToday copy.vue | 102 ++++++++++++++ src/components/datapage/LineToday.vue | 142 ++++++++++++-------- src/components/mainscreen/SumYield.vue | 2 + src/components/mainscreen/TodayYield.vue | 2 + 10 files changed, 745 insertions(+), 55 deletions(-) create mode 100644 src/components/Chart/RateChart.vue create mode 100644 src/components/Chart/YieldChart.vue create mode 100644 src/components/Chart/rateOption.js create mode 100644 src/components/Chart/yieldOption.js create mode 100644 src/components/datapage/LineToday copy.vue diff --git a/src/AlertListScreen.vue b/src/AlertListScreen.vue index 8ef187d..baca643 100644 --- a/src/AlertListScreen.vue +++ b/src/AlertListScreen.vue @@ -134,6 +134,12 @@ function handleResolutionChange(width, height) { + + diff --git a/src/MainScreen.vue b/src/MainScreen.vue index 225da7a..05d6866 100644 --- a/src/MainScreen.vue +++ b/src/MainScreen.vue @@ -75,10 +75,68 @@ function handleResolutionChange(width, height) { + + diff --git a/src/components/Chart/YieldChart.vue b/src/components/Chart/YieldChart.vue new file mode 100644 index 0000000..3c945df --- /dev/null +++ b/src/components/Chart/YieldChart.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/Chart/rateOption.js b/src/components/Chart/rateOption.js new file mode 100644 index 0000000..519b5b0 --- /dev/null +++ b/src/components/Chart/rateOption.js @@ -0,0 +1,146 @@ +const radius = ["58%", "72%"]; +const radius2 = ["45%", "58%"]; +const grid = { + top: 0, + left: 24, + right: 24, + bottom: 32, +}; +const title = { + // 由外部负责展示,此处占位 + text: " ", + left: "50%", + top: "30%", + textAlign: "center", + textStyle: { + fontWeight: 400, + fontSize: 48, + color: "#fffd", + }, + subtext: "当前成品率\u2002", + subtextStyle: { + fontSize: 20, + fontWeight: 100, + color: "#fffd", + align: "right", + }, +}; +const tooltip = { + // trigger: "item", + show: false, +}; +const legend = { + top: "5%", + left: "center", +}; +const bgSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + emptyCircleStyle: { + color: "#042c5f33", + }, +}; +const dataSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + // position: "center", + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "当前成品率", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#4CF0E811" }, + { offset: 1, color: "#4CF0E8" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; +const targetSerie = { + type: "pie", + radius: radius2, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "目标成品率", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#1065ff66" }, + { offset: 1, color: "#1065ff" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; + +export default (data) => { + dataSerie.data[0].value = data.nowYield; + dataSerie.data[1].value = data.targetYield - data.nowYield; + return { + tooltip, + title, + grid, + series: [ + // background + bgSerie, + // actual data + dataSerie, + // target data + targetSerie, + ], + }; +}; diff --git a/src/components/Chart/yieldOption.js b/src/components/Chart/yieldOption.js new file mode 100644 index 0000000..f630fa1 --- /dev/null +++ b/src/components/Chart/yieldOption.js @@ -0,0 +1,102 @@ +const radius = ["55%", "70%"]; +const grid = { + top: 0, + left: 24, + right: 24, + bottom: 32, +}; +const title = { + text: "75%", + left: "50%", + top: "30%", + textAlign: "center", + textStyle: { + fontWeight: 400, + fontSize: 48, + color: "#fffd", + }, + subtext: "当前产量\u2002", + subtextStyle: { + fontSize: 20, + fontWeight: 100, + color: "#fffd", + align: "right", + }, +}; +const tooltip = { + // trigger: "item", + show: false, +}; +const legend = { + top: "5%", + left: "center", +}; +const bgSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + emptyCircleStyle: { + color: "#042c5f33", + }, +}; +const dataSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + // position: "center", + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "当前产量", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#4CF0E811" }, + { offset: 1, color: "#4CF0E8" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; + +export default (data) => { + title.text = + (100 * (+data.nowProduction / +data.targetProduction)).toFixed(0) + "%"; + dataSerie.data[0].value = data.nowProduction; + dataSerie.data[1].value = data.targetProduction - data.nowProduction; + return { + tooltip, + title, + grid, + series: [ + // background + bgSerie, + // actual data + dataSerie, + ], + }; +}; diff --git a/src/components/datapage/LineToday copy.vue b/src/components/datapage/LineToday copy.vue new file mode 100644 index 0000000..f1e8986 --- /dev/null +++ b/src/components/datapage/LineToday copy.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/datapage/LineToday.vue b/src/components/datapage/LineToday.vue index f1e8986..2959b47 100644 --- a/src/components/datapage/LineToday.vue +++ b/src/components/datapage/LineToday.vue @@ -1,79 +1,83 @@ + + + + diff --git a/src/components/Chart/YieldChart.vue b/src/components/Chart/YieldChart.vue new file mode 100644 index 0000000..3c945df --- /dev/null +++ b/src/components/Chart/YieldChart.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/Chart/rateOption.js b/src/components/Chart/rateOption.js new file mode 100644 index 0000000..519b5b0 --- /dev/null +++ b/src/components/Chart/rateOption.js @@ -0,0 +1,146 @@ +const radius = ["58%", "72%"]; +const radius2 = ["45%", "58%"]; +const grid = { + top: 0, + left: 24, + right: 24, + bottom: 32, +}; +const title = { + // 由外部负责展示,此处占位 + text: " ", + left: "50%", + top: "30%", + textAlign: "center", + textStyle: { + fontWeight: 400, + fontSize: 48, + color: "#fffd", + }, + subtext: "当前成品率\u2002", + subtextStyle: { + fontSize: 20, + fontWeight: 100, + color: "#fffd", + align: "right", + }, +}; +const tooltip = { + // trigger: "item", + show: false, +}; +const legend = { + top: "5%", + left: "center", +}; +const bgSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + emptyCircleStyle: { + color: "#042c5f33", + }, +}; +const dataSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + // position: "center", + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "当前成品率", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#4CF0E811" }, + { offset: 1, color: "#4CF0E8" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; +const targetSerie = { + type: "pie", + radius: radius2, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "目标成品率", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#1065ff66" }, + { offset: 1, color: "#1065ff" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; + +export default (data) => { + dataSerie.data[0].value = data.nowYield; + dataSerie.data[1].value = data.targetYield - data.nowYield; + return { + tooltip, + title, + grid, + series: [ + // background + bgSerie, + // actual data + dataSerie, + // target data + targetSerie, + ], + }; +}; diff --git a/src/components/Chart/yieldOption.js b/src/components/Chart/yieldOption.js new file mode 100644 index 0000000..f630fa1 --- /dev/null +++ b/src/components/Chart/yieldOption.js @@ -0,0 +1,102 @@ +const radius = ["55%", "70%"]; +const grid = { + top: 0, + left: 24, + right: 24, + bottom: 32, +}; +const title = { + text: "75%", + left: "50%", + top: "30%", + textAlign: "center", + textStyle: { + fontWeight: 400, + fontSize: 48, + color: "#fffd", + }, + subtext: "当前产量\u2002", + subtextStyle: { + fontSize: 20, + fontWeight: 100, + color: "#fffd", + align: "right", + }, +}; +const tooltip = { + // trigger: "item", + show: false, +}; +const legend = { + top: "5%", + left: "center", +}; +const bgSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + emptyCircleStyle: { + color: "#042c5f33", + }, +}; +const dataSerie = { + type: "pie", + radius: radius, + center: ["50%", "40%"], + avoidLabelOvervlap: false, + label: { + show: false, + // position: "center", + }, + labelLine: { + show: false, + }, + data: [ + { + value: 90, + name: "当前产量", + selected: false, + itemStyle: { + borderJoin: "round", + borderCap: "round", + borderWidth: 12, + borderRadius: "50%", + color: { + type: "linear", + x: 1, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: "#4CF0E811" }, + { offset: 1, color: "#4CF0E8" }, + ], + }, + }, + }, + { + value: 20, + name: "-", + itemStyle: { color: "transparent" }, + label: { show: false }, + }, + ], +}; + +export default (data) => { + title.text = + (100 * (+data.nowProduction / +data.targetProduction)).toFixed(0) + "%"; + dataSerie.data[0].value = data.nowProduction; + dataSerie.data[1].value = data.targetProduction - data.nowProduction; + return { + tooltip, + title, + grid, + series: [ + // background + bgSerie, + // actual data + dataSerie, + ], + }; +}; diff --git a/src/components/datapage/LineToday copy.vue b/src/components/datapage/LineToday copy.vue new file mode 100644 index 0000000..f1e8986 --- /dev/null +++ b/src/components/datapage/LineToday copy.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/datapage/LineToday.vue b/src/components/datapage/LineToday.vue index f1e8986..bf022b3 100644 --- a/src/components/datapage/LineToday.vue +++ b/src/components/datapage/LineToday.vue @@ -1,79 +1,83 @@