fzq
kohteeseen develop
1 vuosi sitten
@@ -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 | |||
--> | |||
<template> | |||
<!-- 数字代表多级表头最小列宽 --> | |||
<!-- :width="opt.width || null" --> | |||
<!-- :width="flexColumnWidth(opt.prop || null)" --> | |||
<!-- header-align="center" align="center" --> | |||
<!-- :min-width="opt.minWidth || null" --> | |||
<el-table-column | |||
:label="opt.label ? opt.label : opt.name" | |||
:prop="opt.prop || null" | |||
:min-width="opt.minWidth || null" | |||
:min-width="[$route.fullPath == '/monitoring-realtimeQualityInspection' ? 170 : (opt.minWidth || null)]" | |||
:fixed="opt.fixed || null" | |||
:show-overflow-tooltip="opt.showOverflowTooltip || false" | |||
filter-placement="top" | |||
@@ -56,6 +56,7 @@ | |||
v-bind="head.more"></el-table-column> | |||
<!-- 普通的表头 --> | |||
<!-- :align="head.align || null" 表头居中 --> | |||
<!-- :min-width="head.minWidth || null" --> | |||
<el-table-column | |||
v-else | |||
:key="idx + 'else'" | |||
@@ -78,7 +79,7 @@ | |||
<!-- 多级表头 --> | |||
<template v-if="!head.prop && head.children"> | |||
<TableHead v-for="(subhead, subindex) in head.children" :key="'subhead-' + idx + '-subindex-' + subindex" :opt="subhead" fixed/> | |||
<TableHead v-for="(subhead, subindex) in head.children" :key="'subhead-' + idx + '-subindex-' + subindex" :opt="subhead"/> | |||
</template> | |||
</el-table-column> | |||
</template> | |||
@@ -175,7 +176,7 @@ export default { | |||
}, | |||
created() { | |||
// console.log(this.selectedBox) | |||
console.log(this.tableHeadConfigs) | |||
// console.log(this.tableHeadConfigs) | |||
}, | |||
methods: { | |||
handleSubEmitData(payload) { | |||
@@ -21,7 +21,7 @@ | |||
</el-form> | |||
<!-- <base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> --> | |||
<base-table v-for="i in (0,dataLength)" :key="i.name" :data="dataList[i]" :table-head-configs="tableConfigs[i]" :max-height="calcMaxHeight(8)" /> | |||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" /> | |||
<!-- <base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" /> --> | |||
</div> | |||
</template> | |||
@@ -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 | |||
}) | |||
} | |||
} | |||
} | |||
} | |||
@@ -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: 设备生产实时数据 | |||
--> | |||
<template> | |||
<div> | |||
<div class="app-container"> | |||
<small-title :size="'md'">{{ $t('realtime.eq') }}</small-title> | |||
<base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []" :span-method="spanMethod" align= "center"/> | |||
<base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []" :span-method="spanMethod"/> | |||
</div> | |||
</div> | |||
</template> | |||
@@ -59,7 +59,7 @@ export default { | |||
} | |||
}) | |||
}, 1000 * 60 * 5) | |||
console.log(this.tableProps) | |||
// console.log(this.tableProps) | |||
}, | |||
// beforeDestroy() { | |||
// console.log('before destroyed...') | |||
@@ -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: 产线生产实时数据 | |||
--> | |||
<template> | |||
@@ -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' | |||
@@ -3,7 +3,7 @@ | |||
<div class="app-container"> | |||
<small-title :size="'md'">{{ $t('realtime.inspect') }}</small-title> | |||
<!-- fixed --> | |||
<base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []"/> | |||
<base-table v-if="loadTable" fixed: true :table-head-configs="tableProps" :data="tableData.length ? tableData : []"/> | |||
</div> | |||
</div> | |||
</template> | |||
@@ -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] | |||
} | |||
} | |||
} | |||