|
|
@@ -10,23 +10,7 @@ |
|
|
|
<div class="app-container"> |
|
|
|
<!-- <small-title :size="'md'">{{ $t('module.factory.realtime.equipment.name') }}</small-title> --> |
|
|
|
<small-title :size="'md'">设备生产实时数据</small-title> |
|
|
|
<!-- <base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []" :span-method="spanMethod" /> --> |
|
|
|
<base-table |
|
|
|
v-if="loadTable" |
|
|
|
:table-head-configs="[ |
|
|
|
{ type: 'index', label: '序号' }, |
|
|
|
{ prop: 'name', label: '名称' }, |
|
|
|
{ prop: 'code', label: '编码' }, |
|
|
|
{ prop: 'brand', label: '品牌' } |
|
|
|
]" |
|
|
|
:data="[ |
|
|
|
{ name: '汽车', code: 'Car', brand: 'Benz' }, |
|
|
|
{ name: '汽车', code: 'Car2', brand: 'Audi' }, |
|
|
|
{ name: '汽车', code: 'Car3', brand: 'Maclaren' }, |
|
|
|
{ name: '火车', code: 'Train', brand: 'Harmony' } |
|
|
|
]" |
|
|
|
:span-method="testSpan" |
|
|
|
/> |
|
|
|
<base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []" :span-method="spanMethod" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
@@ -58,11 +42,11 @@ export default { |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.clearData() |
|
|
|
// fetchList('equipment').then(res => { |
|
|
|
// this.testData = res |
|
|
|
// this.handleData() |
|
|
|
// }) |
|
|
|
this.loadTable = true |
|
|
|
this.fetchList('equipment').then(({data: res}) => { |
|
|
|
this.testData = res.data.filter(item => !!item.equDet) |
|
|
|
this.handleData() |
|
|
|
}) |
|
|
|
// this.loadTable = true |
|
|
|
// this.intervalId = setInterval(() => { |
|
|
|
// this.$message({ |
|
|
|
// // message: this.$t('module.factory.realtime.equipment.refresh'), |
|
|
@@ -103,10 +87,13 @@ export default { |
|
|
|
|
|
|
|
fetchList() { |
|
|
|
// 获取设备实时数据 |
|
|
|
return this.$http({ |
|
|
|
url: this.$http.adornUrl('/monitoring/productionMonitoring/equipmentProductionRealTimeData'), |
|
|
|
method: 'post' |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
testSpan({ row, column, rowIndex, columnIndex }) { |
|
|
|
console.log('rowIndex', rowIndex) |
|
|
|
if (columnIndex === 1 && rowIndex % 2 === 0) { |
|
|
|
return [2, 1] |
|
|
|
} |
|
|
@@ -116,14 +103,17 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
expandDataStepOne() { |
|
|
|
this.stepOneArray = this.testData.data.map(item => { |
|
|
|
if (item.equDet) { |
|
|
|
item.equDet.forEach((equipment, index) => { |
|
|
|
equipment.lineName = item.lineName |
|
|
|
}) |
|
|
|
} |
|
|
|
return item.equDet |
|
|
|
}) |
|
|
|
console.log('testdata: ', this.testData) |
|
|
|
// this.stepOneArray = this.testData.data |
|
|
|
// .filter(item => item.equDet) |
|
|
|
// .map(item => { |
|
|
|
// if (item.equDet) { |
|
|
|
// item.equDet.forEach((equipment, index) => { |
|
|
|
// equipment.lineName = item.lineName |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// return item.equDet |
|
|
|
// }) |
|
|
|
}, |
|
|
|
|
|
|
|
expandDataStepTwo() { |
|
|
|