Commit a11d4b4a authored by 张伯涛's avatar 张伯涛

首页定时任务等第一个定时响应玩再调用第二个定时

parent d065bbd4
......@@ -714,7 +714,9 @@ export default {
}
},
created() {
this.getStaTable()
this.intercal = setInterval(_ => {
this.getStaTable()
}, 2000)
},
mounted() {
},
......@@ -853,40 +855,45 @@ export default {
},
// 获取表数据
getStaTable() {
clearInterval(this.intercal)
const params = {}
this.intercal = setInterval(_ => {
getTableData(params).then(res => {
this.monitoringData = res.data
for (let i = 0, l = this.monitoringData.length; i < l; i++) {
const row = {
label: 'total',
prop: 'total',
width: '60px'
getTableData(params).then(res => {
this.monitoringData = res.data
for (let i = 0, l = this.monitoringData.length; i < l; i++) {
const row = {
label: 'total',
prop: 'total',
width: '60px'
}
const newList = JSON.stringify(this.monitoringData[i].column)
const value = JSON.parse(newList)
value.pop() // 删除最后一个 (repair)
value.shift() // 删除第一个 (产线号)
value.shift() // 再删除第一个 (线别号)
value.shift() // 再删除第一个 (开工时间)
this.monitoringData[i].column.splice(3, 0, row) // 在列表数组第四个位置插入total
for (let a = 0, b = this.monitoringData[i].tableData.length; a < b; a++) {
let sum = 0
for (let c = 0, d = value.length; c < d; c++) {
sum += this.monitoringData[i].tableData[a][value[c].prop]
}
const newList = JSON.stringify(this.monitoringData[i].column)
const value = JSON.parse(newList)
value.pop() // 删除最后一个 (repair)
value.shift() // 删除第一个 (产线号)
value.shift() // 再删除第一个 (线别号)
value.shift() // 再删除第一个 (开工时间)
this.monitoringData[i].column.splice(3, 0, row) // 在列表数组第四个位置插入total
for (let a = 0, b = this.monitoringData[i].tableData.length; a < b; a++) {
let sum = 0
for (let c = 0, d = value.length; c < d; c++) {
sum += this.monitoringData[i].tableData[a][value[c].prop]
}
this.monitoringData[i].tableData[a].total = sum
if (this.monitoringData[i].tableData[a].total === 0) {
this.monitoringData[i].tableData[a].total = '0'
}
this.monitoringData[i].tableData[a].total = sum
if (this.monitoringData[i].tableData[a].total === 0) {
this.monitoringData[i].tableData[a].total = '0'
}
// this.monitoringData[i].tableData.push(row)
}
console.log('this.monitoringData', this.monitoringData)
}).catch(_ => {
})
}, 2000)
// this.monitoringData[i].tableData.push(row)
}
this.intercal = setInterval(_ => {
this.getStaTable()
}, 2000)
console.log('this.monitoringData', this.monitoringData)
}).catch(_ => {
this.intercal = setInterval(_ => {
this.getStaTable()
}, 2000)
})
},
openModel(row, item, data) {
if (item.label === 'Scan0') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment