fix(ui): 修复登录和并发请求并统一页面展示

调整登录流程和请求处理,统一各中心的表格交互、主题样式和页面展示。
This commit is contained in:
zhanjunhao
2026-11-19 18:58:46 +08:00
parent 9b6eb1c7c4
commit 7908ed53a3
128 changed files with 4672 additions and 5391 deletions
+17 -8
View File
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { formatIdReference } from '../../helpers/safeDisplay';
import {
RefreshCw as ActionRefreshCw,
Plus as ActionPlus,
@@ -106,10 +107,14 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
if (!orgId) return;
setLoading(true);
try {
const options = {
headers: getOrgHeaders(orgId),
requestGroup: new AbortController(),
};
const [b, d, p] = await Promise.all([
API.get('/api/org/budget', { headers: getOrgHeaders(orgId) }),
API.get('/api/org/dept', { headers: getOrgHeaders(orgId) }),
API.get('/api/org/project', { headers: getOrgHeaders(orgId) }),
API.get('/api/org/budget', options),
API.get('/api/org/dept', options),
API.get('/api/org/project', options),
]);
if (b.data.success) {
// 新后端返回 {items, enforcement_enabled, engine_enabled};兼容旧后端直接返回数组。
@@ -122,7 +127,7 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
if (d.data.success) setDepts(d.data.data || []);
if (p.data.success) setProjects(p.data.data || []);
} catch (err) {
showError(err.message);
if (!err?.isAxiosError) showError(err);
} finally {
setLoading(false);
}
@@ -139,7 +144,7 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
const st = r.subject_type;
if (r.subject_exists !== undefined) {
return {
name: r.subject_name || `#${r.subject_id}`,
name: r.subject_name || formatIdReference(r.subject_id),
exists: !!r.subject_exists,
disabled: r.subject_status === 2,
};
@@ -147,7 +152,7 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
if (st === 'department') {
const d = depts.find((x) => x.id === r.subject_id);
return {
name: d?.name || `#${r.subject_id}`,
name: d?.name || formatIdReference(r.subject_id),
exists: !!d,
disabled: d?.status === 2,
};
@@ -155,13 +160,17 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
if (st === 'project') {
const p = projects.find((x) => x.id === r.subject_id);
return {
name: p?.name || `#${r.subject_id}`,
name: p?.name || formatIdReference(r.subject_id),
exists: !!p,
disabled: p?.status === 2,
};
}
// 旧后端下成员/密钥无从解析,按存在处理,避免误标「已删除」
return { name: `#${r.subject_id}`, exists: true, disabled: false };
return {
name: formatIdReference(r.subject_id),
exists: true,
disabled: false,
};
},
[depts, projects],
);