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; + }, }, };