From 41e680b55de12789a5592a064983b73b28b862df Mon Sep 17 00:00:00 2001 From: Fanzink <460995166@qq.com> Date: Thu, 9 Feb 2023 10:31:00 +0800 Subject: [PATCH] 'update'' --- .../base-table/components/table-head.vue | 5 +- src/components/base-table/index.vue | 5 +- .../equipmentHistoricalParameters.vue | 56 +++++++++---------- .../modules/monitoring/realtimeEquipment.vue | 6 +- .../monitoring/realtimeProductLine.vue | 43 +++++++------- .../monitoring/realtimeQualityInspection.vue | 8 +-- 6 files changed, 61 insertions(+), 62 deletions(-) diff --git a/src/components/base-table/components/table-head.vue b/src/components/base-table/components/table-head.vue index eb93613..90e214e 100644 --- a/src/components/base-table/components/table-head.vue +++ b/src/components/base-table/components/table-head.vue @@ -4,17 +4,18 @@ * @Author: fzq * @Date: 2022-11-25 09:51:46 * @LastEditors: fzq - * @LastEditTime: 2023-02-08 17:16:47 + * @LastEditTime: 2023-02-09 10:17:22 --> + + - + @@ -175,7 +176,7 @@ export default { }, created() { // console.log(this.selectedBox) - console.log(this.tableHeadConfigs) + // console.log(this.tableHeadConfigs) }, methods: { handleSubEmitData(payload) { diff --git a/src/views/modules/monitoring/equipmentHistoricalParameters.vue b/src/views/modules/monitoring/equipmentHistoricalParameters.vue index 5f6df63..b13deec 100644 --- a/src/views/modules/monitoring/equipmentHistoricalParameters.vue +++ b/src/views/modules/monitoring/equipmentHistoricalParameters.vue @@ -21,7 +21,7 @@ - + @@ -75,53 +75,48 @@ export default { url: this.$http.adornUrl(`/monitoring/equipmentValueMonitor/runLog/${this.$route.params.id}`), method: 'get' }).then(({ data: res }) => { - // console.log('res', res) + console.log('/monitoring/equipmentValueMonitor/runLog/', res) this.equipmentName = res.data[0].data[0].equName this.equipmentCode = res.data[0].data[0].equCode this.dataLength = res.data.length - for (let i = 0; i < this.dataLength; i++) { if ( res && res.code === 0 && res.data && res.data.length > 0 && - res.data[i].nameData && - res.data[i].nameData.length > 0 && - res.data[i].data && - res.data[i].data.length > 0 + res.data[0].nameData && + res.data[0].nameData.length > 0 && + res.data[0].data && + res.data[0].data.length > 0 ) { // console.log(this.equipmentName) - this.setTableProps(res.data[i].nameData) - this.setTableData(res.data[i].data) + this.setTableProps(res.data[0].nameData) + this.setTableData(res.data[0].data) } else { - this.dataList[i] = [] + this.dataList = [] } this.dataListLoading = false - } }) }, setTableProps(nameData) { - for (let i = 0; i < this.dataLength; i++) { - this.tableConfigs[i] = [ - { - type: 'index', - name: i18n.t('index') - }, - { prop: 'time', name: this.$t('ti'), filter: timeFilter }, - { prop: 'plcCode', name: this.$t('plcCode') }, - // { prop: 'equName', name: this.$t('equName') }, - // { prop: 'equCode', name: this.$t('equCode') }, - // ...['数值1', '数值2', '数值3'].map(name => { - // return { prop: name, name } - // }) - ...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name })) - ] - console.log(this.tableConfigs[i]); - } + this.tableConfigs = [ + { + type: 'index', + name: i18n.t('index') + }, + { prop: 'time', name: this.$t('ti'), filter: timeFilter }, + { prop: 'plcCode', name: this.$t('plcCode') }, + // { prop: 'equName', name: this.$t('equName') }, + // { prop: 'equCode', name: this.$t('equCode') }, + // ...['数值1', '数值2', '数值3'].map(name => { + // return { prop: name, name } + // }) + ...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name })) + ] + // console.log(this.tableConfigs[i]); }, setTableData(data) { - for (let i = 0; i < this.dataLength; i++) { - this.dataList[i] = data.map((item) => { + this.dataList = data.map((item) => { const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) if (item.data && item.data.length > 0) { item.data.forEach((param) => { @@ -130,7 +125,6 @@ export default { } return rowItem }) - } } } } diff --git a/src/views/modules/monitoring/realtimeEquipment.vue b/src/views/modules/monitoring/realtimeEquipment.vue index e387edb..91c4af1 100644 --- a/src/views/modules/monitoring/realtimeEquipment.vue +++ b/src/views/modules/monitoring/realtimeEquipment.vue @@ -2,14 +2,14 @@ * @Author: lb * @Date: 2022-06-22 14:00:17 * @LastEditors: fzq - * @LastEditTime: 2023-02-08 16:50:05 + * @LastEditTime: 2023-02-09 09:36:38 * @Description: 设备生产实时数据 --> {{ $t('realtime.eq') }} - + @@ -59,7 +59,7 @@ export default { } }) }, 1000 * 60 * 5) - console.log(this.tableProps) + // console.log(this.tableProps) }, // beforeDestroy() { // console.log('before destroyed...') diff --git a/src/views/modules/monitoring/realtimeProductLine.vue b/src/views/modules/monitoring/realtimeProductLine.vue index 58a9f0e..b64559f 100644 --- a/src/views/modules/monitoring/realtimeProductLine.vue +++ b/src/views/modules/monitoring/realtimeProductLine.vue @@ -2,7 +2,7 @@ * @Author: lb * @Date: 2022-06-22 14:00:17 * @LastEditors: fzq - * @LastEditTime: 2023-02-07 16:23:23 + * @LastEditTime: 2023-02-09 09:53:57 * @Description: 产线生产实时数据 --> @@ -38,20 +38,26 @@ export default { }, mounted() { - console.log('this.$route', this.$route) + // console.log('this.$route', this.$route) this.clearData() - // this.fetchList().then(({ data: res }) => { - // // console.log('fetchlist:', res) - // this.testData = res - // this.handleData() - // if (res.code === 200 || this.$route.fullPath !== '/monitoring-realtimeProductLine') { - // // 获取数据显示成功后,关闭loading - // loading.close() - // } else { - // this.$message.error(this.$t('err')) - // } - // }) - + this.fetchList().then(({ data: res }) => { + this.testData = res + this.handleData() + console.log('res', res) + let loading = this.$loading({ + lock: true, //lock的修改符--默认是false + text: this.$t('loading'), //显示在加载图标下方的加载文案 + background: 'rgba(0,0,0,0.8)', //遮罩层颜色 + spinner: 'el-icon-loading' //自定义加载图标类名 + }) + console.log('testData:', this.testData) + if (this.testData || this.$route.fullPath !== '/monitoring-realtimeProductLine') { + // 获取数据显示成功后,关闭loading + loading.close() + } else { + this.$message.error(this.$t('err')) + } + }) this.intervalId = setInterval(() => { this.$message({ message: this.$t('realtime.refresh'), @@ -70,15 +76,12 @@ export default { deactivated() { if (this.intervalId) clearInterval(this.intervalId) }, + created() { + // console.log('this.tableData', this.tableData) + }, methods: { fetchList() { - // let loading = this.$loading({ - // lock: true, //lock的修改符--默认是false - // text: this.$t('loading'), //显示在加载图标下方的加载文案 - // background: 'rgba(0,0,0,0.8)', //遮罩层颜色 - // spinner: 'el-icon-loading' //自定义加载图标类名 - // }) return this.$http({ url: this.$http.adornUrl('/monitoring/productionMonitoring/lineProductionRealTimeData'), method: 'post' diff --git a/src/views/modules/monitoring/realtimeQualityInspection.vue b/src/views/modules/monitoring/realtimeQualityInspection.vue index 4a4b233..f80119b 100644 --- a/src/views/modules/monitoring/realtimeQualityInspection.vue +++ b/src/views/modules/monitoring/realtimeQualityInspection.vue @@ -3,7 +3,7 @@ {{ $t('realtime.inspect') }} - + @@ -83,7 +83,7 @@ export default { this.initProps() // console.log('props ===> ', this.tableProps) this.initData() - // console.log('datas ===> ', this.tableData) + console.log('datas ===> ', this.tableData) this.loadTable = true }, @@ -145,8 +145,8 @@ export default { } dynamicPropNames.push(prop) } - - return [{ prop: 'checkType', label: i18n.t('inspect.det'), isFixed: true }, ...dynamicPropNames] + // isFixed: true + return [{ prop: 'checkType', label: i18n.t('inspect.det'), fixed: true }, ...dynamicPropNames] } } }