diff --git a/src/service/api/board/kanBan/index.ts b/src/service/api/board/kanBan/index.ts index 662939d..4f0fe72 100644 --- a/src/service/api/board/kanBan/index.ts +++ b/src/service/api/board/kanBan/index.ts @@ -15,6 +15,9 @@ export const getEcmElectricityConsumption = () => { return request.get('/ecm/ecmElectricityConsumption/getKanban'); }; +export const getEcmElectricityIndex = () => { + return request.get('/ecm/ecmElectricityConsumption/getKanbanByIndex'); +}; // 获取生产 export const getMesProductWorkorder = () => { return request.get('/mes/mesProductWorkorder/getkanbanPage'); diff --git a/src/views/home/components/top-chart/index.vue b/src/views/home/components/top-chart/index.vue index ecee5f3..eb99380 100644 --- a/src/views/home/components/top-chart/index.vue +++ b/src/views/home/components/top-chart/index.vue @@ -8,37 +8,37 @@
- + kwh
-

点焊车间能耗

-
- - kwh -
-

CNC车间能耗

-
- - kwh -
-

滚筒车间能耗

+

{{yearElectricQuantity.length && yearElectricQuantity[0].workshopType}}能耗

+
+ + kwh +
+

{{yearElectricQuantity.length && yearElectricQuantity[2].workshopType}}能耗

+ + + + +
-
- - kwh -
-

钉胶车间能耗

-
- - kwh -
-

抛光车间能耗

-
- - kwh -
-

割片车间能耗

+
+ + kwh +
+

{{yearElectricQuantity.length && yearElectricQuantity[1].workshopType}}能耗

+
+ + kwh +
+

{{yearElectricQuantity.length && yearElectricQuantity[3].workshopType}}能耗

+ + + + +
@@ -63,11 +63,16 @@ import { ref, onMounted } from 'vue'; import type { Ref } from 'vue'; // eslint-disable-next-line import/no-unresolved import { type ECOption, useEcharts } from '@/composables'; +import { + getEcmElectricityIndex, +} from '@/service/api/board/kanBan'; defineOptions({ name: 'DashboardAnalysisTopCard' }); const myData = ref(['fda']); +const yearElectricQuantity = ref([]); onMounted(() => { + getData(); // eslint-disable-next-line no-plusplus for (let i = 0; i < 1000; i++) { myData.value.push(i); @@ -76,6 +81,18 @@ onMounted(() => { // myData.value.push('321'); // }, 1000); }); + +function getData() { + getEcmElectricityIndex().then(res => { + if (res.code === 200) { + console.log(res.data); + res.data.yearElectricQuantity.forEach((item: any) => { + item.electricQuantity = item.electricQuantity / 1000; + }); + yearElectricQuantity.value = res.data.yearElectricQuantity; + } + }); +} const lineOptions = ref({ tooltip: { trigger: 'axis',