- {{ title }} {{ $t('add') }}
+
+ {{ title }}
+ @clickTopBtn="clickTopBtn"
+ @operate-event="handleOperations" />
+ layout="total, sizes, prev, pager, next, jumper">
-
+
-
+
@@ -43,7 +44,7 @@
-
+
{{ $t('cancel') }}
{{ $t('save') }}
@@ -56,6 +57,12 @@ import i18n from '@/i18n'
import BaseTable from '@/components/base-table'
import { pick } from 'lodash/object'
import { calcMaxHeight } from '@/utils'
+const topBtnConfig = [
+ {
+ type: 'add',
+ btnName: i18n.t('add')
+ }
+]
export default {
name: 'AttrForm',
components: { BaseTable },
@@ -96,6 +103,7 @@ export default {
data() {
return {
calcMaxHeight,
+ topBtnConfig,
showAddAttr: false,
dataList: [],
pageIndex: 1,
@@ -107,9 +115,9 @@ export default {
},
computed: {
attrFormFields() {
- const _ = this.tableConfigs.filter(item => item.formField)
+ const _ = this.tableConfigs.filter((item) => item.formField)
/** 顺带配置 AttrForm */
- _.forEach(item => {
+ _.forEach((item) => {
this.$set(this.AttrForm, [item.prop], '')
})
@@ -126,11 +134,17 @@ export default {
}
}
},
+ // 加个created,来实现不能在topBtnConfig组件直接使用的? : 判别
+ created() {
+ // if(!(!this.isDetail && !this.showAddAttr)) {
+ // this.topBtnConfig = []
+ // }
+ },
methods: {
filterTableConfigs() {
if (this.isDetail) {
/** 如果是查看详情,就屏蔽操作列 */
- return this.tableConfigs.filter(opt => opt.prop !== 'operations')
+ return this.tableConfigs.filter((opt) => opt.prop !== 'operations')
}
return this.tableConfigs
},
@@ -182,7 +196,7 @@ export default {
this.$nextTick(() => {
this.$http.get(this.$http.adornUrl(`${this.url}/${id}`)).then(({ data: res }) => {
if (res && res.code === 0 && res.data) {
- const neededFields = [...this.attrFormFields.map(item => item.prop), 'id']
+ const neededFields = [...this.attrFormFields.map((item) => item.prop), 'id']
const filtered = pick(res.data, neededFields)
for (let field of neededFields) {
this.AttrForm[field] = filtered[field]
@@ -231,7 +245,7 @@ export default {
},
handleSaveAttrForm() {
- this.$refs['AttrForm'].validate(valid => {
+ this.$refs['AttrForm'].validate((valid) => {
if (valid) {
this.$http({
// url: this.$http.adornUrl(`${this.url}/${!this.AttrForm.id ? '' : this.AttrForm.id}`),
@@ -271,6 +285,9 @@ export default {
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
+ },
+ clickTopBtn() {
+ this.showAddAttr = true
}
}
}
diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue
index 3d5058b..37a79db 100644
--- a/src/components/base-dialog/addOrUpdate/index.vue
+++ b/src/components/base-dialog/addOrUpdate/index.vue
@@ -126,7 +126,7 @@ const title = {
// 或者也可以改造成自定义颜色:
const btnType = {
add: '#0b58ff',
- save: '#000',
+ save: '#0b58ff',
update: '#0b58ff',
reset: ''
// cancel: 'text'
diff --git a/src/views/modules/home.vue b/src/views/modules/home.vue
index 868e03b..024ce7b 100644
--- a/src/views/modules/home.vue
+++ b/src/views/modules/home.vue
@@ -1,23 +1,18 @@
-
-
-
-
-
-
-
-
-
{{ item.name }}
-
-
-
+
+
+
+
+
+
+
{{ item.name }}
+
+
+
\ No newline at end of file
diff --git a/src/views/modules/monitoring/equipmentHistoricalParameters.vue b/src/views/modules/monitoring/equipmentHistoricalParameters.vue
index b13deec..79f8348 100644
--- a/src/views/modules/monitoring/equipmentHistoricalParameters.vue
+++ b/src/views/modules/monitoring/equipmentHistoricalParameters.vue
@@ -21,7 +21,16 @@
-
+
+
+
+
+
+
+
+
+
+
@@ -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" />
@@ -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'),