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..bf022b3 100644 --- a/src/components/datapage/LineToday.vue +++ b/src/components/datapage/LineToday.vue @@ -1,79 +1,83 @@