优化结果总览模型卡片加载反馈

This commit is contained in:
wkc
2026-03-20 14:19:48 +08:00
parent f70f228c21
commit 16dbad3194
3 changed files with 54 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
# 结果总览模型卡片 loading 与筛选标签样式修复记录
## 本次改动
- 在 [`RiskModelSection.vue`](/Users/wkc/Desktop/ccdi/ccdi/ruoyi-ui/src/views/ccdiProject/components/detail/RiskModelSection.vue) 调整模型卡片点击联动逻辑,点击选中或取消模型时,向人员列表请求附带 `syncCardLoading` 开关,让“模型预警次数统计”卡片区在联动查询期间显示 loading。
- 在 [`RiskModelSection.vue`](/Users/wkc/Desktop/ccdi/ccdi/ruoyi-ui/src/views/ccdiProject/components/detail/RiskModelSection.vue) 将 `fetchPeopleList` 改为支持可选参数,保证只有模型卡片切换场景会联动卡片 loading普通查询、分页和部门筛选仍只影响下方表格 loading。
- 新增 [`preliminary-check-model-loading-and-label.test.js`](/Users/wkc/Desktop/ccdi/ccdi/ruoyi-ui/tests/unit/preliminary-check-model-loading-and-label.test.js),校验模型卡片联动 loading 代码路径和“员工姓名或工号”标签单行样式已落地。
## 处理说明
- 保持现有接口和父子组件数据流不变,只在模型区组件内部补充交互反馈,避免引入额外状态同步。
- 卡片区 loading 与表格 loading 同步开始,但只在模型卡片点击触发时打开,符合“选择模型后对统计卡片添加 loading”的需求边界。
- “员工姓名或工号”标签通过 `white-space: nowrap``flex-shrink: 0` 保持单行显示,不影响筛选栏其余控件布局。
## 验证情况
- 已执行如下验证:
```bash
npx mocha ruoyi-ui/tests/unit/preliminary-check-model-loading-and-label.test.js ruoyi-ui/tests/unit/preliminary-check-model-linkage-flow.test.js ruoyi-ui/tests/unit/preliminary-check-model-filters.test.js
npm --prefix ruoyi-ui run build:prod
```
- 结果说明:
- 定向单测已通过。
- 前端生产构建已执行,结果以本次命令输出为准。

View File

@@ -251,7 +251,7 @@ export default {
this.selectedModelCodes = [...this.selectedModelCodes, modelCode];
}
this.pageNum = 1;
this.fetchPeopleList();
this.fetchPeopleList({ syncCardLoading: true });
},
handleMatchModeChange() {
this.pageNum = 1;
@@ -312,13 +312,17 @@ export default {
this.deptLoading = false;
}
},
async fetchPeopleList() {
async fetchPeopleList(options = {}) {
if (!this.projectId) {
this.peopleList = [];
this.total = 0;
return;
}
const { syncCardLoading = false } = options;
if (syncCardLoading) {
this.cardLoading = true;
}
this.tableLoading = true;
try {
const response = await getOverviewRiskModelPeople(this.buildPeopleParams());
@@ -331,6 +335,9 @@ export default {
console.error("加载风险模型命中人员失败", error);
} finally {
this.tableLoading = false;
if (syncCardLoading) {
this.cardLoading = false;
}
}
},
},
@@ -456,6 +463,8 @@ export default {
.summary-label {
font-size: 12px;
color: #64748b;
flex-shrink: 0;
white-space: nowrap;
}
.filter-summary {

View File

@@ -0,0 +1,17 @@
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const source = fs.readFileSync(
path.resolve(
__dirname,
"../../src/views/ccdiProject/components/detail/RiskModelSection.vue"
),
"utf8"
);
[
"this.cardLoading = true",
"this.cardLoading = false",
"white-space: nowrap",
].forEach((token) => assert(source.includes(token), token));