From e42b7035fe1acef94e9f2b5beb0b13f2a24e0d6f Mon Sep 17 00:00:00 2001 From: lb Date: Wed, 6 Sep 2023 10:39:32 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AE=8C=E6=88=90=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E5=9B=BE=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/timing-diagram/output/index.vue | 73 +++++++++++++++++-- .../equipment/timing-diagram/status/index.vue | 63 +++++++++++++++- 2 files changed, 128 insertions(+), 8 deletions(-) diff --git a/src/views/equipment/timing-diagram/output/index.vue b/src/views/equipment/timing-diagram/output/index.vue index 3d78c2bd..50306c55 100644 --- a/src/views/equipment/timing-diagram/output/index.vue +++ b/src/views/equipment/timing-diagram/output/index.vue @@ -16,13 +16,36 @@
-
+

{{ eq.key }}

- +

请添加设备

+ + + + + + +
@@ -88,6 +111,8 @@ export default { equipmentId: null, recordTime: [], }, + open: false, + eqList: [], graphList: [], templateConfig: { grid: { @@ -141,6 +166,7 @@ export default { created() { this.initProductline(); this.initWorksection(); + this.initEquipment(); this.getList(); }, methods: { @@ -154,7 +180,7 @@ export default { this.getList(); break; case 'compare': - this.$message.info('暂未实现该接口'); + this.open = true; break; } }, @@ -215,7 +241,9 @@ export default { /** 获得设备产量的时间 */ getTimeinfo(equipmentArr) { - return equipmentArr.map((item) => new Date(item.startTime).toLocaleTimeString()); + return equipmentArr.map((item) => + new Date(item.startTime).toLocaleTimeString() + ); }, getRealConfig(index) { @@ -224,11 +252,29 @@ export default { // config.legend.data = this.graphList[index].key; config.series[0].name = this.graphList[index]?.key; // console.log("this.graphList?.[index]", this.graphList?.[index]); - config.series[0].data = this.getEquipmentQuantity(this.graphList?.[index] || []); + config.series[0].data = this.getEquipmentQuantity( + this.graphList?.[index] || [] + ); config.xAxis.data = this.getTimeinfo(this.graphList?.[index] || []); return config; }, + /** 准备设备数据 */ + async initEquipment() { + const { code, data } = await this.$axios({ + url: '/base/equipment/listAll', + method: 'get', + }); + if (code == 0) { + this.eqList = data.map((item) => { + return { + name: item.name, + id: item.id, + }; + }); + } + }, + /** 准备产线数据 */ async initProductline() { const { code, data } = await this.$axios({ @@ -260,6 +306,23 @@ export default { }); } }, + + async submitForm() { + const { code, data } = await this.$axios({ + url: '/analysis/equipment-analysis/quantity', + method: 'get', + params: this.queryParams, + }); + if (code == 0) { + const newEqlist = this.objectToArray(data); + if (!newEqlist || newEqlist.length == 0) { + this.$message.error('该设备没有产量数据'); + return; + } + this.graphList.push(newEqlist[0]); + } + this.open = false; + } }, }; diff --git a/src/views/equipment/timing-diagram/status/index.vue b/src/views/equipment/timing-diagram/status/index.vue index 57eda27c..2aafc1c6 100644 --- a/src/views/equipment/timing-diagram/status/index.vue +++ b/src/views/equipment/timing-diagram/status/index.vue @@ -113,6 +113,27 @@

请添加设备

+ + + + + + + @@ -177,6 +198,8 @@ export default { recordTime: [], }, graphList: [], + open: false, + eqList: [], // demo: [ // [ // { @@ -203,6 +226,7 @@ export default { created() { this.initProductline(); this.initWorksection(); + this.initEquipment(); this.getList(); }, methods: { @@ -235,6 +259,22 @@ export default { } }, + /** 准备设备数据 */ + async initEquipment() { + const { code, data } = await this.$axios({ + url: '/base/equipment/listAll', + method: 'get', + }); + if (code == 0) { + this.eqList = data.map((item) => { + return { + name: item.name, + id: item.id, + }; + }); + } + }, + /** 准备产线数据 */ async initProductline() { const { code, data } = await this.$axios({ @@ -276,11 +316,28 @@ export default { this.queryParams.recordTime = payload.recordTime || null; this.getList(); break; - case 'compare': - this.$message.info('暂未实现该接口') - break; + case 'compare': + this.open = true; + break; } }, + + async submitForm() { + const { code, data } = await this.$axios({ + url: '/analysis/equipment-analysis/status', + method: 'get', + params: this.queryParams, + }); + if (code == 0) { + const newEqlist = this.objectToArray(data); + if (!newEqlist || newEqlist.length == 0) { + this.$message.error('该设备没有状态数据'); + return; + } + this.graphList.push(newEqlist[0]); + } + this.open = false; + }, }, };