diff --git a/public/index.html b/public/index.html index 642ec0d..aeb0349 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ * @Author: fzq * @Date: 2022-11-25 09:51:46 * @LastEditors: fzq - * @LastEditTime: 2023-02-07 16:19:50 + * @LastEditTime: 2023-02-09 14:40:52 --> @@ -39,7 +39,8 @@ <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% } %> diff --git a/src/components/base-dialog/AttrForm/index.vue b/src/components/base-dialog/AttrForm/index.vue index df52b4b..7141f43 100644 --- a/src/components/base-dialog/AttrForm/index.vue +++ b/src/components/base-dialog/AttrForm/index.vue @@ -1,10 +1,12 @@ @@ -42,8 +51,26 @@ export default { equipmentName: null, equipmentCode: null, tableConfigs: [], + tableConfigs2: [], + tableConfigs3: [], + tableConfigs4: [], + tableConfigs5: [], + tableConfigs6: [], + tableConfigs7: [], + tableConfigs8: [], + tableConfigs9: [], + tableConfigs10: [], dataLength: null, dataList: [], + dataList2: [], + dataList3: [], + dataList4: [], + dataList5: [], + dataList6: [], + dataList7: [], + dataList8: [], + dataList9: [], + dataList10: [], dataListLoading: false, dataListSelections: [] } @@ -92,11 +119,135 @@ export default { // console.log(this.equipmentName) this.setTableProps(res.data[0].nameData) this.setTableData(res.data[0].data) - } else { - this.dataList = [] + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[1].nameData && + res.data[1].nameData.length > 0 && + res.data[1].data && + res.data[1].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps2(res.data[1].nameData) + this.setTableData2(res.data[1].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[2].nameData && + res.data[2].nameData.length > 0 && + res.data[2].data && + res.data[2].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps3(res.data[2].nameData) + this.setTableData3(res.data[2].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[3].nameData && + res.data[3].nameData.length > 0 && + res.data[3].data && + res.data[3].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps4(res.data[3].nameData) + this.setTableData4(res.data[3].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[4].nameData && + res.data[4].nameData.length > 0 && + res.data[4].data && + res.data[4].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps5(res.data[4].nameData) + this.setTableData5(res.data[4].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[5].nameData && + res.data[5].nameData.length > 0 && + res.data[5].data && + res.data[5].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps6(res.data[5].nameData) + this.setTableData6(res.data[5].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[6].nameData && + res.data[6].nameData.length > 0 && + res.data[6].data && + res.data[6].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps7(res.data[6].nameData) + this.setTableData7(res.data[6].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[7].nameData && + res.data[7].nameData.length > 0 && + res.data[7].data && + res.data[7].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps8(res.data[7].nameData) + this.setTableData8(res.data[7].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[8].nameData && + res.data[8].nameData.length > 0 && + res.data[8].data && + res.data[8].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps9(res.data[8].nameData) + this.setTableData9(res.data[8].data) + } + if ( + res && + res.code === 0 && + res.data && + res.data.length > 0 && + res.data[9].nameData && + res.data[9].nameData.length > 0 && + res.data[9].data && + res.data[9].data.length > 0 + ) { + // console.log(this.equipmentName) + this.setTableProps10(res.data[9].nameData) + this.setTableData10(res.data[9].data) } this.dataListLoading = false - }) + }).catch(()=>{}) //---去除无效报错--- }, setTableProps(nameData) { this.tableConfigs = [ @@ -115,6 +266,176 @@ export default { ] // console.log(this.tableConfigs[i]); }, + setTableProps2(nameData) { + this.tableConfigs2 = [ + { + 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]); + }, + setTableProps3(nameData) { + this.tableConfigs3 = [ + { + 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]); + }, + setTableProps3(nameData) { + this.tableConfigs3 = [ + { + 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]); + }, + setTableProps4(nameData) { + this.tableConfigs4 = [ + { + 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]); + }, + setTableProps5(nameData) { + this.tableConfigs5 = [ + { + 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]); + }, + setTableProps6(nameData) { + this.tableConfigs6 = [ + { + 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]); + }, + setTableProps7(nameData) { + this.tableConfigs7 = [ + { + 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]); + }, + setTableProps8(nameData) { + this.tableConfigs8 = [ + { + 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]); + }, + setTableProps9(nameData) { + this.tableConfigs9 = [ + { + 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]); + }, + setTableProps10(nameData) { + this.tableConfigs10 = [ + { + 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) { this.dataList = data.map((item) => { const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) @@ -125,6 +446,105 @@ export default { } return rowItem }) + }, + setTableData2(data) { + this.dataList2 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData3(data) { + this.dataList3 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData4(data) { + this.dataList4 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData5(data) { + this.dataList5 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData6(data) { + this.dataList6 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData7(data) { + this.dataList7 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData8(data) { + this.dataList8 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData9(data) { + this.dataList9 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) + }, + setTableData10(data) { + this.dataList10 = data.map((item) => { + const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) + if (item.data && item.data.length > 0) { + item.data.forEach((param) => { + rowItem[param.dynamicName] = param.dynamicValue + }) + } + return rowItem + }) } } } diff --git a/src/views/modules/monitoring/workshopSectionDialog.vue b/src/views/modules/monitoring/workshopSectionDialog.vue index 0064278..997125c 100644 --- a/src/views/modules/monitoring/workshopSectionDialog.vue +++ b/src/views/modules/monitoring/workshopSectionDialog.vue @@ -4,9 +4,8 @@ :title="isDetail ? $t('ws.detail') : !dataForm.id ? $t('add') : $t('edit')" :visible.sync="visible" :close-on-click-modal="false" - :destroy-on-close="true" - > -
+ :destroy-on-close="true"> +
+ @refreshDataList="getDataList" /> + layout="total, sizes, prev, pager, next, jumper" />
{{ $t('cancel') }} - {{ $t('update') }} - {{ $t('save') }} + {{ $t('update') }} + {{ $t('save') }} @@ -292,7 +305,7 @@ export default { } }, handleCreateOrUpdate() { - this.$refs['dataForm'].validate(valid => { + this.$refs['dataForm'].validate((valid) => { if (valid) { this.$http({ url: this.$http.adornUrl('/monitoring/workshopSection'),