update realtimedata

This commit is contained in:
g7hoo 2022-08-22 16:59:23 +08:00
parent 9a22601f5b
commit 4297798d44

View File

@ -8,21 +8,20 @@
<template>
<div>
<div class="app-container">
<small-title :size="'md'">{{ $t('module.factory.realtime.equipment.name') }}</small-title>
<!-- <small-title :size="'md'">{{ $t('module.factory.realtime.equipment.name') }}</small-title> -->
<small-title :size="'md'">设备生产实时数据</small-title>
<base-table
v-if="tableReady"
:table-config="tableProps"
:table-data="tableData.length ? tableData : []"
v-if="loadTable"
:table-head-configs="tableProps"
:data="tableData.length ? tableData : []"
:span-method="spanMethod"
:is-loading="listLoading"
:index-config="{ align: 'left', fixed: 'left' }"
/>
</div>
</div>
</template>
<script>
// import BaseTable from '@/components/BaseTable/index-compound'
import BaseTable from '@/components/base-table'
import SmallTitle from '@/components/small-title'
import moment from 'moment'
// import fetchList from '@/api/factory-manage/realtimeData'
@ -35,7 +34,7 @@ export default {
components: { BaseTable, SmallTitle },
data() {
return {
tableReady: false,
loadTable: false,
tableProps: [{ label: 'default', prop: 'default' }],
stepOneArray: [],
tableData: [],
@ -48,9 +47,6 @@ export default {
}
},
created() {
// this.clearData()
// this.testData = testData
// this.handleData()
this.clearData()
fetchList('equipment').then(res => {
this.testData = res
@ -59,7 +55,7 @@ export default {
this.intervalId = setInterval(() => {
this.$message({
message: this.$t('module.factory.realtime.equipment.refresh'),
// message: this.$t('module.factory.realtime.equipment.refresh'),
type: 'warning',
duration: 1500,
onClose: () => {
@ -83,15 +79,20 @@ export default {
this.dynamicPropSet = false
this.rowNum = 0
this.testData = null
this.tableReady = false
this.loadTable = false
this.equipmentCount = {}
this.setStaticTableProps()
},
handleData() {
this.expandDataStepOne()
this.expandDataStepTwo()
// console.log('span data: ', this.equipmentCount)
this.tableReady = true
this.loadTable = true
},
fetchList() {
},
expandDataStepOne() {
@ -148,13 +149,13 @@ export default {
this.tableProps.push({
label: moment(obj.recordTime).format('YYYY-MM-DD HH:mm:ss'),
children: [
{ prop: obj.recordTime + '-inputNum', label: i18n.t('module.factory.realtime.equipment.input') },
{ prop: obj.recordTime + '-outputNum', label: i18n.t('module.factory.realtime.equipment.output') },
{ prop: obj.recordTime + '-scrapNum', label: i18n.t('module.factory.realtime.equipment.scrapNum') },
{
prop: obj.recordTime + '-scrapRate',
label: i18n.t('module.factory.realtime.equipment.scrapRate')
}
// { prop: obj.recordTime + '-inputNum', label: i18n.t('module.factory.realtime.equipment.input') },
// { prop: obj.recordTime + '-outputNum', label: i18n.t('module.factory.realtime.equipment.output') },
// { prop: obj.recordTime + '-scrapNum', label: i18n.t('module.factory.realtime.equipment.scrapNum') },
// {
// prop: obj.recordTime + '-scrapRate',
// label: i18n.t('module.factory.realtime.equipment.scrapRate')
// }
]
})
}
@ -199,11 +200,11 @@ export default {
setStaticTableProps() {
// Step1: table props
const staticTableProps = [
{ prop: 'lineName', label: i18n.t('module.factory.realtime.equipment.pl'), fixed: true },
{ prop: 'orderName', label: i18n.t('module.factory.realtime.equipment.currOrder'), fixed: true },
{ prop: 'productSize', label: i18n.t('module.factory.realtime.equipment.pSpecs'), fixed: true },
{ prop: 'equName', label: i18n.t('module.factory.realtime.equipment.eqName'), fixed: true },
{ prop: 'totalProduction', label: i18n.t('module.factory.realtime.equipment.produceTotal'), fixed: true }
// { prop: 'lineName', label: i18n.t('module.factory.realtime.equipment.pl'), fixed: true },
// { prop: 'orderName', label: i18n.t('module.factory.realtime.equipment.currOrder'), fixed: true },
// { prop: 'productSize', label: i18n.t('module.factory.realtime.equipment.pSpecs'), fixed: true },
// { prop: 'equName', label: i18n.t('module.factory.realtime.equipment.eqName'), fixed: true },
// { prop: 'totalProduction', label: i18n.t('module.factory.realtime.equipment.produceTotal'), fixed: true }
]
this.tableProps = staticTableProps
},