feat(P25-2/P25-3/P26-2/P28-1/P24-2/P29-3): 落地内部OA够用版前端入口与运营页面
关联 Issue: P25-2, P25-3, P25-4, P26-2, P26-4, P28-1, P28-2, P28-3, P28-4, P24-2, P29-3
这个提交包含在:
@@ -0,0 +1,46 @@
|
||||
import type { PrecheckDecision, PrecheckResponse } from "../api/feeControl";
|
||||
|
||||
function decisionLabel(decision: PrecheckDecision) {
|
||||
if (decision === "pass") return "通过";
|
||||
if (decision === "warn") return "预警";
|
||||
if (decision === "manual_review") return "需人工复核";
|
||||
return "阻断";
|
||||
}
|
||||
|
||||
export function buildPrecheckDialogMessage(precheck: PrecheckResponse) {
|
||||
const lines = [`提交前校验结果:${decisionLabel(precheck.decision)}`];
|
||||
|
||||
if (precheck.matchedBudgetControlRule) {
|
||||
lines.push(`命中规则:${precheck.matchedBudgetControlRule.name}(${precheck.matchedBudgetControlRule.controlMode})`);
|
||||
}
|
||||
|
||||
if (precheck.blockingReasons.length) {
|
||||
lines.push("", "阻断原因:");
|
||||
precheck.blockingReasons.forEach((item, index) => {
|
||||
lines.push(`${index + 1}. ${item.title}${item.detail ? `:${item.detail}` : ""}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (precheck.warnings.length) {
|
||||
lines.push("", "预警信息:");
|
||||
precheck.warnings.forEach((item, index) => {
|
||||
lines.push(`${index + 1}. ${item.title}${item.detail ? `:${item.detail}` : ""}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (precheck.riskFlags.length) {
|
||||
lines.push("", "风险项:");
|
||||
precheck.riskFlags.forEach((item, index) => {
|
||||
lines.push(`${index + 1}. [${item.level}] ${item.title}${item.detail ? `:${item.detail}` : ""}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (precheck.nextActions.length) {
|
||||
lines.push("", "下一步建议:");
|
||||
precheck.nextActions.forEach((item, index) => {
|
||||
lines.push(`${index + 1}. ${item}`);
|
||||
});
|
||||
}
|
||||
|
||||
return lines.join("\n");
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export const RECENT_VISITS_STORAGE_KEY = "hyb_oa_recent_visits";
|
||||
|
||||
export type RecentVisit = {
|
||||
path: string;
|
||||
title: string;
|
||||
visitedAt: string;
|
||||
};
|
||||
|
||||
function isWindowAvailable() {
|
||||
return typeof window !== "undefined" && typeof window.localStorage !== "undefined";
|
||||
}
|
||||
|
||||
export function readRecentVisits(): RecentVisit[] {
|
||||
if (!isWindowAvailable()) return [];
|
||||
try {
|
||||
const raw = window.localStorage.getItem(RECENT_VISITS_STORAGE_KEY);
|
||||
if (!raw) return [];
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed.filter((item) => item && typeof item.path === "string") : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export function writeRecentVisit(path: string, title: string) {
|
||||
if (!isWindowAvailable()) return;
|
||||
const current = readRecentVisits().filter((item) => item.path !== path);
|
||||
current.unshift({ path, title, visitedAt: new Date().toISOString() });
|
||||
window.localStorage.setItem(RECENT_VISITS_STORAGE_KEY, JSON.stringify(current.slice(0, 10)));
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户