|
@@ -20,6 +20,7 @@ import {
|
|
|
allChartColors,
|
|
|
chartLegend,
|
|
|
} from "@/views/screens/configs/chartsConfig";
|
|
|
+import { deviceMonitor } from "@/api/screens";
|
|
|
|
|
|
const props = defineProps({
|
|
|
moduleId: {
|
|
@@ -30,38 +31,43 @@ const props = defineProps({
|
|
|
|
|
|
const chartRef = ref(null);
|
|
|
|
|
|
-const options = {
|
|
|
- color: allChartColors,
|
|
|
- tooltip: {
|
|
|
- trigger: "item",
|
|
|
- },
|
|
|
- legend: chartLegend,
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: "设备监控",
|
|
|
- type: "pie",
|
|
|
- radius: ["40%", "70%"],
|
|
|
- avoidLabelOverlap: false,
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: "center",
|
|
|
- color: "#fff",
|
|
|
- formatter: function () {
|
|
|
- return "设备总数:1000";
|
|
|
+onMounted(async () => {
|
|
|
+ const chart = echarts.init(chartRef.value);
|
|
|
+
|
|
|
+ let result: any = await deviceMonitor();
|
|
|
+
|
|
|
+ console.log(result.data);
|
|
|
+
|
|
|
+ const options = {
|
|
|
+ color: allChartColors,
|
|
|
+ tooltip: {
|
|
|
+ trigger: "item",
|
|
|
+ },
|
|
|
+ legend: chartLegend,
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "设备监控",
|
|
|
+ type: "pie",
|
|
|
+ radius: ["40%", "70%"],
|
|
|
+ avoidLabelOverlap: false,
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: "center",
|
|
|
+ color: "#fff",
|
|
|
+ formatter: function () {
|
|
|
+ return `设备总数:${result.data.total}`;
|
|
|
+ },
|
|
|
},
|
|
|
+ data: [
|
|
|
+ { value: result.data.runNum, name: "运行" },
|
|
|
+ { value: result.data.offLineNum, name: "离线" },
|
|
|
+ { value: result.data.faultNum, name: "故障" },
|
|
|
+ { value: result.data.repairNum, name: "维修" },
|
|
|
+ ],
|
|
|
},
|
|
|
- data: [
|
|
|
- { value: 1048, name: "运行" },
|
|
|
- { value: 735, name: "空闲" },
|
|
|
- { value: 580, name: "维护" },
|
|
|
- { value: 484, name: "维修" },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
-};
|
|
|
+ ],
|
|
|
+ };
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- const chart = echarts.init(chartRef.value);
|
|
|
chart.setOption(options);
|
|
|
});
|
|
|
</script>
|