diff --git a/src/components/TeamChartMonth.vue b/src/components/TeamChartMonth.vue index 0fa4d39..1e07c7d 100644 --- a/src/components/TeamChartMonth.vue +++ b/src/components/TeamChartMonth.vue @@ -62,7 +62,7 @@ onMounted(() => { + + diff --git a/src/components/datapage/LineMonth.vue b/src/components/datapage/LineMonth.vue new file mode 100644 index 0000000..5426fa5 --- /dev/null +++ b/src/components/datapage/LineMonth.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/datapage/LineMonthOptions.js b/src/components/datapage/LineMonthOptions.js new file mode 100644 index 0000000..3aa26fc --- /dev/null +++ b/src/components/datapage/LineMonthOptions.js @@ -0,0 +1,176 @@ +export const options = { + grid: { + top: 0, + left: 0, + right: 0, + bottom: 0 + }, + title: [ + { + text: "当前产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "70%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "目标产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "85%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "当前成品率:" + 22 + "%", + left: "72%", + textAlign: "center", + top: "70%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "目标成品率:" + 22 + "%", + left: "72%", + textAlign: "center", + top: "85%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + ], + series: [ + { + type: "gauge", + startAngle: 90, + center: ["27%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + valueAnimation: true, + fontSize: 16, + offsetCenter: [0, "0%"], + formatter: "{value}%", + color: "rgba(255, 255, 255, 1)", + }, + data: [ + { + // value: (nowProduction / targetProduction * 100).toFixed(1), + value: 100, + }, + ], + }, + { + type: "gauge", + startAngle: 90, + center: ["73%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + show: true, + valueAnimation: true, + fontSize: 16, + offsetCenter: [0, "0%"], + // formatter: 0 + "%", + // formatter: (nowYield / targetYield * 100).toFixed(1) + '%', + color: "#fff", + }, + data: [ + { + // value: targetYield, + value: 100, + name: "Perfect", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "-20%"], + }, + }, + { + value: 100, + // value: nowYield, + name: "Good", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "10%"], + }, + }, + { + value: 0, + detail: { + show: true, + }, + }, + ], + }, + ], +}; +export default function setup(echartInstance, data) { + const new_options = { ...options }; + new_options.title[0].text = "当前产量:" + data.nowProduction + " 片"; + new_options.title[1].text = "目标产量:" + data.targetProduction + " 片"; + new_options.title[2].text = "当前成品率:" + data.nowYield + "%"; + new_options.title[3].text = "目标成品率:" + data.targetYield + "%"; + new_options.series[0].data[0].value = (data.nowProduction / data.targetProduction * 100).toFixed(1) + new_options.series[1].data[0].value = data.targetYield + new_options.series[1].data[1].value = data.nowYield + new_options.series[1].detail.formatter = (data.nowYield / data.targetYield * 100).toFixed(2) + '%', + echartInstance.setOption(new_options); +} diff --git a/src/components/datapage/LineToday.vue b/src/components/datapage/LineToday.vue new file mode 100644 index 0000000..cfd5525 --- /dev/null +++ b/src/components/datapage/LineToday.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/datapage/LineTodayOptions.js b/src/components/datapage/LineTodayOptions.js new file mode 100644 index 0000000..3aa26fc --- /dev/null +++ b/src/components/datapage/LineTodayOptions.js @@ -0,0 +1,176 @@ +export const options = { + grid: { + top: 0, + left: 0, + right: 0, + bottom: 0 + }, + title: [ + { + text: "当前产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "70%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "目标产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "85%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "当前成品率:" + 22 + "%", + left: "72%", + textAlign: "center", + top: "70%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + { + text: "目标成品率:" + 22 + "%", + left: "72%", + textAlign: "center", + top: "85%", + textStyle: { + fontSize: 16, + color: '#fffa' + }, + }, + ], + series: [ + { + type: "gauge", + startAngle: 90, + center: ["27%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + valueAnimation: true, + fontSize: 16, + offsetCenter: [0, "0%"], + formatter: "{value}%", + color: "rgba(255, 255, 255, 1)", + }, + data: [ + { + // value: (nowProduction / targetProduction * 100).toFixed(1), + value: 100, + }, + ], + }, + { + type: "gauge", + startAngle: 90, + center: ["73%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + show: true, + valueAnimation: true, + fontSize: 16, + offsetCenter: [0, "0%"], + // formatter: 0 + "%", + // formatter: (nowYield / targetYield * 100).toFixed(1) + '%', + color: "#fff", + }, + data: [ + { + // value: targetYield, + value: 100, + name: "Perfect", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "-20%"], + }, + }, + { + value: 100, + // value: nowYield, + name: "Good", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "10%"], + }, + }, + { + value: 0, + detail: { + show: true, + }, + }, + ], + }, + ], +}; +export default function setup(echartInstance, data) { + const new_options = { ...options }; + new_options.title[0].text = "当前产量:" + data.nowProduction + " 片"; + new_options.title[1].text = "目标产量:" + data.targetProduction + " 片"; + new_options.title[2].text = "当前成品率:" + data.nowYield + "%"; + new_options.title[3].text = "目标成品率:" + data.targetYield + "%"; + new_options.series[0].data[0].value = (data.nowProduction / data.targetProduction * 100).toFixed(1) + new_options.series[1].data[0].value = data.targetYield + new_options.series[1].data[1].value = data.nowYield + new_options.series[1].detail.formatter = (data.nowYield / data.targetYield * 100).toFixed(2) + '%', + echartInstance.setOption(new_options); +} diff --git a/src/pages/DataPage.vue b/src/pages/DataPage.vue index cac3f58..b43e950 100644 --- a/src/pages/DataPage.vue +++ b/src/pages/DataPage.vue @@ -3,17 +3,25 @@ import HourChart from "../components/datapage/HourChart.vue"; import TeamChartDay from "../components/datapage/TeamChartDay.vue"; import TeamChartMonth from "../components/datapage/TeamChartMonth.vue"; - +import LatestWeekYield from '../components/datapage/LatestWeekYield.vue' +import LineToday from '../components/datapage/LineToday.vue'; +import LineMonth from '../components/datapage/LineMonth.vue';