1,2写入区分修正
This commit is contained in:
@@ -771,6 +771,16 @@ export default {
|
|||||||
isLoadingReturn: false,
|
isLoadingReturn: false,
|
||||||
returnError: '',
|
returnError: '',
|
||||||
furData: {},
|
furData: {},
|
||||||
|
|
||||||
|
// 计划队列刷新控制(防止WS高频触发导致接口风暴)
|
||||||
|
refreshPlanQueueInFlight: false,
|
||||||
|
planQueueRefreshTimer: null,
|
||||||
|
lastPlanQueueRefreshAt: 0,
|
||||||
|
|
||||||
|
// 页面数据刷新控制(防止matmap WS断开时 signal 高频触发 fetchData 导致接口风暴)
|
||||||
|
fetchDataInFlight: false,
|
||||||
|
fetchDataRefreshTimer: null,
|
||||||
|
lastFetchDataAt: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -838,12 +848,12 @@ export default {
|
|||||||
entrySectionMetrics() {
|
entrySectionMetrics() {
|
||||||
return this.buildSectionMetrics('ENTRY', [
|
return this.buildSectionMetrics('ENTRY', [
|
||||||
'stripSpeed', 'tensionPorBr1', 'tensionBr1Br2', 'tensionBr2Br3', 'celLength', 'celCapacity',
|
'stripSpeed', 'tensionPorBr1', 'tensionBr1Br2', 'tensionBr2Br3', 'celLength', 'celCapacity',
|
||||||
// 'celLengthMax', 'celLengthMin', 'cleaningCurrent', 'cleaningVoltage',
|
'celLengthMax', 'celLengthMin', 'cleaningCurrent', 'cleaningVoltage',
|
||||||
'stripLocation', 'rinseTemperature'])
|
'stripLocation', 'rinseTemperature'])
|
||||||
},
|
},
|
||||||
furnaceSectionMetrics() {
|
furnaceSectionMetrics() {
|
||||||
return this.buildSectionMetrics('FURNACE', [
|
return this.buildSectionMetrics('FURNACE', [
|
||||||
'cleaningVoltage', 'cleaningCurrent',
|
// 'cleaningVoltage', 'cleaningCurrent',
|
||||||
'phfExitStripTemp', 'rtfExitStripTemp', 'jcsExitStripTemp', 'scsExitStripTemp'
|
'phfExitStripTemp', 'rtfExitStripTemp', 'jcsExitStripTemp', 'scsExitStripTemp'
|
||||||
|
|
||||||
])
|
])
|
||||||
@@ -1154,7 +1164,7 @@ export default {
|
|||||||
// 检测到上线、生产中、生产完成等关键操作时,刷新生产计划队列 Refresh plan queue when detecting key operations
|
// 检测到上线、生产中、生产完成等关键操作时,刷新生产计划队列 Refresh plan queue when detecting key operations
|
||||||
if (['ONLINE', 'PRODUCING', 'PRODUCT'].includes(data.operation) ) {
|
if (['ONLINE', 'PRODUCING', 'PRODUCT'].includes(data.operation) ) {
|
||||||
console.log(`Detected ${operationText} operation, refreshing plan queue...`) // 检测到${operationText}操作,刷新生产计划队列...
|
console.log(`Detected ${operationText} operation, refreshing plan queue...`) // 检测到${operationText}操作,刷新生产计划队列...
|
||||||
this.refreshPlanQueue()
|
this.scheduleRefreshPlanQueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右上角通知(所有操作都显示) Top-right notification (display for all operations)
|
// 右上角通知(所有操作都显示) Top-right notification (display for all operations)
|
||||||
@@ -1185,7 +1195,7 @@ export default {
|
|||||||
|
|
||||||
// 如果物料映射 WebSocket 未连接,则刷新数据
|
// 如果物料映射 WebSocket 未连接,则刷新数据
|
||||||
if (!this.socketStatus.matmap) {
|
if (!this.socketStatus.matmap) {
|
||||||
this.fetchData()
|
this.scheduleFetchData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1313,8 +1323,30 @@ export default {
|
|||||||
|
|
||||||
// ============ API 方法 ============
|
// ============ API 方法 ============
|
||||||
|
|
||||||
|
// 调度刷新生产计划队列(防抖 + 最小刷新间隔)
|
||||||
|
scheduleRefreshPlanQueue() {
|
||||||
|
const MIN_REFRESH_INTERVAL = 2000
|
||||||
|
const now = Date.now()
|
||||||
|
|
||||||
|
if (now - this.lastPlanQueueRefreshAt < MIN_REFRESH_INTERVAL) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.planQueueRefreshTimer) {
|
||||||
|
clearTimeout(this.planQueueRefreshTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.planQueueRefreshTimer = setTimeout(() => {
|
||||||
|
this.lastPlanQueueRefreshAt = Date.now()
|
||||||
|
this.refreshPlanQueue()
|
||||||
|
this.planQueueRefreshTimer = null
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
|
||||||
// 刷新生产计划队列(独立方法,可被信号触发)
|
// 刷新生产计划队列(独立方法,可被信号触发)
|
||||||
async refreshPlanQueue() {
|
async refreshPlanQueue() {
|
||||||
|
if (this.refreshPlanQueueInFlight) return
|
||||||
|
this.refreshPlanQueueInFlight = true
|
||||||
try {
|
try {
|
||||||
// 只查询活动状态的计划,排除已完成和甩尾
|
// 只查询活动状态的计划,排除已完成和甩尾
|
||||||
const statuses = ['ONLINE', 'PRODUCING', 'READY', 'NEW']
|
const statuses = ['ONLINE', 'PRODUCING', 'READY', 'NEW']
|
||||||
@@ -1376,10 +1408,34 @@ export default {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to get production plan queue:', err) // 获取生产计划队列失败
|
console.error('Failed to get production plan queue:', err) // 获取生产计划队列失败
|
||||||
this.planQueue = this.generateMockPlanQueue()
|
this.planQueue = this.generateMockPlanQueue()
|
||||||
|
} finally {
|
||||||
|
this.refreshPlanQueueInFlight = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 调度刷新页面核心数据(防抖 + 最小刷新间隔)
|
||||||
|
scheduleFetchData() {
|
||||||
|
const MIN_REFRESH_INTERVAL = 2000
|
||||||
|
const now = Date.now()
|
||||||
|
|
||||||
|
if (now - this.lastFetchDataAt < MIN_REFRESH_INTERVAL) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fetchDataRefreshTimer) {
|
||||||
|
clearTimeout(this.fetchDataRefreshTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fetchDataRefreshTimer = setTimeout(() => {
|
||||||
|
this.lastFetchDataAt = Date.now()
|
||||||
|
this.fetchData()
|
||||||
|
this.fetchDataRefreshTimer = null
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
|
if (this.fetchDataInFlight) return
|
||||||
|
this.fetchDataInFlight = true
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const res = await getTrackMatPosition()
|
const res = await getTrackMatPosition()
|
||||||
@@ -1396,6 +1452,7 @@ export default {
|
|||||||
console.error('Failed to get coil data:', err) // 获取钢卷数据失败
|
console.error('Failed to get coil data:', err) // 获取钢卷数据失败
|
||||||
this.$message.error('Failed to get data, please retry') // 获取数据失败,请重试
|
this.$message.error('Failed to get data, please retry') // 获取数据失败,请重试
|
||||||
} finally {
|
} finally {
|
||||||
|
this.fetchDataInFlight = false
|
||||||
// 延迟关闭加载状态,确保界面渲染完成
|
// 延迟关闭加载状态,确保界面渲染完成
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
@@ -1704,7 +1761,7 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
adjustPosition(params).then(() => {
|
adjustPosition(params).then(() => {
|
||||||
this.$message.success('Adjustment successful') // 调整成功
|
this.$message.success('Adjustment successful') // 调整成功
|
||||||
this.fetchData()
|
this.scheduleFetchData()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('Adjustment failed:', err) // 调整失败
|
console.error('Adjustment failed:', err) // 调整失败
|
||||||
this.$message.error('Adjustment failed, please retry') // 调整失败,请重试
|
this.$message.error('Adjustment failed, please retry') // 调整失败,请重试
|
||||||
@@ -1740,7 +1797,7 @@ export default {
|
|||||||
operateMat(this.operateMatForm).then(() => {
|
operateMat(this.operateMatForm).then(() => {
|
||||||
this.$message.success('Operation successful') // 操作成功
|
this.$message.success('Operation successful') // 操作成功
|
||||||
this.operateMatStatus = false
|
this.operateMatStatus = false
|
||||||
this.fetchData()
|
this.scheduleFetchData()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('Operation failed:', err) // 操作失败
|
console.error('Operation failed:', err) // 操作失败
|
||||||
this.$message.error('Operation failed, please retry') // 操作失败,请重试
|
this.$message.error('Operation failed, please retry') // 操作失败,请重试
|
||||||
|
|||||||
Reference in New Issue
Block a user