update 实时数据刷新

This commit is contained in:
g7hoo 2022-09-27 09:21:44 +08:00
parent 1554562933
commit 13df2016b9
5 changed files with 22 additions and 9 deletions

View File

@ -255,6 +255,7 @@ t.realtime.eqName = '设备名称'
t.realtime.eqCode = '设备编码'
t.realtime.productionSnapshotTime = '生产量记录时间'
t.realtime.statusSnapshotTime = '状态记录时间'
t.realtime.refresh = 'Refresh data...'
t.ws = {}

View File

@ -260,6 +260,7 @@ t.realtime.eqName = '设备名称'
t.realtime.eqCode = '设备编码'
t.realtime.productionSnapshotTime = '生产量记录时间'
t.realtime.statusSnapshotTime = '状态记录时间'
t.realtime.refresh = '刷新数据'
t.ws = {}

View File

@ -47,6 +47,7 @@ export default {
})
this.intervalId = setInterval(() => {
this.$message({
message: this.$t('realtime.refresh'),
type: 'warning',
duration: 1500,
onClose: () => {
@ -59,7 +60,11 @@ export default {
})
}, 1000 * 60 * 5)
},
beforeDestroy() {
// beforeDestroy() {
// console.log('before destroyed...')
// if (this.intervalId) clearInterval(this.intervalId)
// },
deactivated() {
if (this.intervalId) clearInterval(this.intervalId)
},
methods: {
@ -129,7 +134,7 @@ export default {
{ prop: obj.recordTime + '-inputNum', label: i18n.t('realtime.in') },
{ prop: obj.recordTime + '-outputNum', label: i18n.t('realtime.out') },
{ prop: obj.recordTime + '-scrapNum', label: i18n.t('realtime.data') },
{ prop: obj.recordTime + '-scrapRate', label: i18n.t('realtime.rate'), filter: val => val !== '-' ? `${val.toFixed(2)}%` : '-' }
{ prop: obj.recordTime + '-scrapRate', label: i18n.t('realtime.rate'), filter: val => (val !== '-' ? `${val.toFixed(2)}%` : '-') }
]
})
}

View File

@ -47,7 +47,7 @@ export default {
this.intervalId = setInterval(() => {
this.$message({
message: this.$t('module.factory.realtime.productLine.refresh'),
message: this.$t('realtime.refresh'),
type: 'warning',
onClose: () => {
this.clearData()
@ -60,7 +60,7 @@ export default {
}, 1000 * 60 * 5)
},
beforeDestroy() {
deactivated() {
if (this.intervalId) clearInterval(this.intervalId)
},

View File

@ -43,15 +43,21 @@ export default {
})
this.intervalId = setInterval(() => {
this.clearData()
this.fetchList().then(res => {
this.testData = res
this.handleData()
this.$message({
message: this.$t('realtime.refresh'),
type: 'warning',
onClose: () => {
this.clearData()
this.fetchList().then(res => {
this.testData = res
this.handleData()
})
}
})
}, 1000 * 60 * 5)
},
beforeDestroy() {
deactivated() {
if (this.intervalId) clearInterval(this.intervalId)
},