feat(portal-shell): 管理域全模块功能补齐与差异修复
按 ARCHITECTURE.md 与 admin-NeedTodo.md 要求补齐所有管理页面缺失功能: - users/roles/permissions:权限矩阵搜索/折叠、zod 校验、value 字段 - audit-logs:行内详情对话框、分页页码、ChartCardShell - school:CRUD 对话框、GradeOverviewCards、academic-year 侧栏 - announcements/invitation-codes/ai-settings:发布按钮、分页、zod 校验 - course-plans/elective:Select 导入、undefined 处理 - error-book/scheduling/questions/lesson-plans/attendance:统计卡片 验证:typecheck 0 错误、arch:scan 已更新
This commit is contained in:
@@ -5,22 +5,38 @@
|
||||
* 关联:ARCHITECTURE.md §11.3 DoD "数据变换/权限判断等纯函数有 vitest 单测"
|
||||
*/
|
||||
|
||||
/** AI Provider 类型标签映射 */
|
||||
/** AI Provider 类型标签映射(对齐 CICD:zhipu/openai/gemini/ollama/custom) */
|
||||
export const PROVIDER_TYPE_LABEL: Record<string, string> = {
|
||||
zhipu: "智谱 AI",
|
||||
openai: "OpenAI",
|
||||
anthropic: "Anthropic",
|
||||
azure: "Azure OpenAI",
|
||||
local: "本地模型",
|
||||
gemini: "Google Gemini",
|
||||
ollama: "Ollama(本地)",
|
||||
custom: "自定义",
|
||||
};
|
||||
|
||||
/** AI Provider 类型支持的取值列表 */
|
||||
export const PROVIDER_TYPES: readonly string[] = [
|
||||
"zhipu",
|
||||
"openai",
|
||||
"anthropic",
|
||||
"azure",
|
||||
"local",
|
||||
"gemini",
|
||||
"ollama",
|
||||
"custom",
|
||||
] as const;
|
||||
|
||||
/** AI Provider 可见性枚举值列表(@contract-pending,MSW 兜底) */
|
||||
export const PROVIDER_VISIBILITY_OPTIONS: readonly string[] = [
|
||||
"private",
|
||||
"shared",
|
||||
"public",
|
||||
] as const;
|
||||
|
||||
/** AI Provider 可见性标签映射 */
|
||||
export const PROVIDER_VISIBILITY_LABEL: Record<string, string> = {
|
||||
private: "仅自己可见",
|
||||
shared: "组织共享",
|
||||
public: "全员可见",
|
||||
};
|
||||
|
||||
/**
|
||||
* 将 Provider 类型代码映射为展示标签。未知值回退为原始值。
|
||||
*/
|
||||
@@ -35,6 +51,13 @@ export function isValidProviderType(type: string): boolean {
|
||||
return PROVIDER_TYPES.includes(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 Provider 可见性代码映射为展示标签。未知值回退为原始值。
|
||||
*/
|
||||
export function formatProviderVisibility(visibility: string): string {
|
||||
return PROVIDER_VISIBILITY_LABEL[visibility] ?? visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 isActive 返回 Tailwind 徽章语义类名。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user