fix(acid/actual-performance): 优化工艺曲线加载逻辑并添加加载状态
1. 添加了加载遮罩来提示用户正在获取工艺曲线数据 2. 将openQualityReport改为异步方法,并行获取多个接口数据 3. 统一处理异常情况并提示用户加载失败 4. 优化了数据获取和复用逻辑,减少不必要的接口请求
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-loading="qualityLoading" element-loading-text="正在获取工艺曲线数据…">
|
||||
<div class="actual-container">
|
||||
<!-- 顶部实绩列表 (PLTCM_PDO_EXCOIL) -->
|
||||
<div class="top-section">
|
||||
@@ -396,7 +396,8 @@ export default {
|
||||
pagination: { page: 1, pageSize: 50, total: 0 },
|
||||
topTableHeight: 'calc(40vh - 80px)',
|
||||
chartInstances: [],
|
||||
resizeHandler: null
|
||||
resizeHandler: null,
|
||||
qualityLoading: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -1045,15 +1046,39 @@ export default {
|
||||
return items
|
||||
},
|
||||
|
||||
openQualityReport(row) {
|
||||
// If the clicked row is already the selected row, use in-memory data
|
||||
async openQualityReport(row) {
|
||||
const excoilId = row.EXCOILID || row.excoilid
|
||||
const isSame = this.selectedRow &&
|
||||
(row.EXCOILID || row.excoilid) === (this.selectedRow.EXCOILID || this.selectedRow.excoilid)
|
||||
const segData = isSame ? this.segData : null
|
||||
const gaugeRows = isSame ? this.gaugeRows : null
|
||||
const shapeRows = isSame ? this.shapeRows : null
|
||||
const presetData = isSame ? this.presetData : null
|
||||
this.$refs.qualityReport.open(row, segData, gaugeRows, shapeRows, presetData)
|
||||
excoilId === (this.selectedRow.EXCOILID || this.selectedRow.excoilid)
|
||||
|
||||
if (isSame) {
|
||||
this.$refs.qualityReport.open(row, this.segData, this.gaugeRows, this.shapeRows, this.presetData)
|
||||
return
|
||||
}
|
||||
|
||||
this.qualityLoading = true
|
||||
try {
|
||||
const encoilId = row.ENCOILID || row.encoilid
|
||||
const [segRes, presetRes, rtRes] = await Promise.all([
|
||||
encoilId ? getTimingSegByEncoilId(encoilId) : Promise.resolve({ data: { rows: [], series: null } }),
|
||||
encoilId ? getPresetSetupByCoilId(encoilId) : Promise.resolve({ data: { data: null } }),
|
||||
excoilId ? getTimingRealtimeData(excoilId) : Promise.resolve({ data: { gauge: { result: null }, shape: { result: null } } })
|
||||
])
|
||||
|
||||
const segRows = segRes?.data?.rows || []
|
||||
const segData = segRows.length ? (segRes?.data?.series || null) : null
|
||||
const presetData = presetRes?.data?.data || null
|
||||
const g = rtRes?.data?.gauge?.result
|
||||
const s = rtRes?.data?.shape?.result
|
||||
const gaugeRows = Array.isArray(g) ? g : null
|
||||
const shapeRows = Array.isArray(s) ? s : null
|
||||
|
||||
this.$refs.qualityReport.open(row, segData, gaugeRows, shapeRows, presetData)
|
||||
} catch (_) {
|
||||
this.$message.error('获取工艺曲线数据失败')
|
||||
} finally {
|
||||
this.qualityLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
calcLengthPerTon(row) {
|
||||
|
||||
Reference in New Issue
Block a user