fix: 移除 refreshBusinessStatus 死代码,消除 N+1 无效请求
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -157,7 +157,7 @@
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import SzSelectDept from '/@/components/Form/src/jeecg/components/SzSelectDept.vue';
|
||||
import SzDeptUserModal from '/@/components/semri/deptUserComponent/SzDeptUserModal.vue';
|
||||
import { startProcessSchedules, getBusinessStatus } from '/@/api/common/api';
|
||||
import { startProcessSchedules } from '/@/api/common/api';
|
||||
import { dateUtil } from '/@/utils/dateUtil';
|
||||
import FlowScheduleStartModal from './components/DqInspectTaskFlowScheduleStartModal.vue';
|
||||
import BusinessProcessListModal from '/src/components/semri/process/BusinessProcessListModal.vue';
|
||||
@@ -610,30 +610,8 @@
|
||||
reload();
|
||||
}
|
||||
|
||||
async function refreshBusinessStatus(records) {
|
||||
if (!records || records.length === 0) return;
|
||||
try {
|
||||
const results = await Promise.all(records.map((item) => getBusinessStatus({ businessId: item.id }).catch(() => null)));
|
||||
const statusMap: Record<string, string> = {};
|
||||
for (const item of results) {
|
||||
if (item?.businessId) {
|
||||
statusMap[item.businessId] = item.status_dictText || '';
|
||||
}
|
||||
}
|
||||
for (const item of records) {
|
||||
const status = statusMap[item.id];
|
||||
if (status !== undefined) {
|
||||
item.status_dictText = status;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// 静默处理查询异常
|
||||
}
|
||||
}
|
||||
|
||||
async function onFetchSuccess(result) {
|
||||
if (result?.items?.length > 0) {
|
||||
await refreshBusinessStatus(result.items);
|
||||
setTableData([...getDataSource()]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user