feat: 增强规则资产管理与审计页面运行时调试
后端新增规则资产版本管理和规则文件 CRUD 接口,优化风险 规则生成模板执行和员工数据模型字段,知识库 RAG 增强本 地回退和文档提取能力,清理旧风险规则文件统一由生成引擎 管理,前端审计页面增加运行时调试面板和规则资产编辑交互, 补充单元测试覆盖。
This commit is contained in:
28
web/src/components/shared/riskRuleTestDialogUtils.js
Normal file
28
web/src/components/shared/riskRuleTestDialogUtils.js
Normal file
@@ -0,0 +1,28 @@
|
||||
export function createId() {
|
||||
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
||||
return crypto.randomUUID()
|
||||
}
|
||||
return `${Date.now()}-${Math.random().toString(16).slice(2)}`
|
||||
}
|
||||
|
||||
export function formatFileSize(size) {
|
||||
const value = Number(size || 0)
|
||||
if (value < 1024) return `${value}B`
|
||||
if (value < 1024 * 1024) return `${(value / 1024).toFixed(1)}KB`
|
||||
return `${(value / 1024 / 1024).toFixed(1)}MB`
|
||||
}
|
||||
|
||||
export function formatTestError(error, fallback) {
|
||||
const message = String(error?.message || '').trim()
|
||||
if (/not\s*found/i.test(message)) {
|
||||
return '测试接口暂未加载或规则详情已失效,请刷新规则详情后再试。'
|
||||
}
|
||||
return message || fallback
|
||||
}
|
||||
|
||||
export function formatTime() {
|
||||
return new Intl.DateTimeFormat('zh-CN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
}).format(new Date())
|
||||
}
|
||||
Reference in New Issue
Block a user