feat: 新增预算后端服务与差旅风险规则库

后端新增预算模型、端点和服务模块,支持预算 CRUD 和余额
查询,清理旧生成规则文件并替换为按严重等级分类的差旅风
险规则库,优化认证权限和报销单访问策略,新增财务规则目
录和演示数据构建脚本,前端预算中心增加对话框交互,完善
审计页面运行时模型和元数据展示,补充单元测试。
This commit is contained in:
caoxiaozhu
2026-05-26 17:29:35 +08:00
parent e1e515ecae
commit e7bef0883d
85 changed files with 6443 additions and 1497 deletions

View File

@@ -5,6 +5,7 @@ import {
BUDGET_EXPENSE_TYPE_OPTIONS,
BUDGET_ONTOLOGY_FIELDS,
BUDGET_QUARTER_OPTIONS,
BUDGET_VISIBLE_EXPENSE_TYPE_OPTIONS,
BUDGET_YEAR_OPTIONS,
buildBudgetOntologyContext
} from '../src/utils/budgetOntology.js'
@@ -44,7 +45,7 @@ test('budget ontology context maps dialog fields to ontology payload', () => {
],
rows: [
{
budgetSubject: '差旅',
budgetSubject: '差旅',
budgetSubjectCode: 'travel',
budgetAmount: '600,000.00',
warningThreshold: '80%',
@@ -63,7 +64,7 @@ test('budget ontology context maps dialog fields to ontology payload', () => {
assert.equal(context.budget_header.cost_center, 'CC-4100')
assert.equal(context.budget_details[0].budget_subject_code, 'travel')
assert.equal(context.budget_details[0].expense_type, 'travel')
assert.equal(context.budget_details[0].expense_type_label, '差旅')
assert.equal(context.budget_details[0].expense_type_label, '差旅')
assert.equal(context.budget_details[0].warning_threshold, '80%')
})
@@ -85,6 +86,12 @@ test('budget expense type options expose real expense type codes', () => {
])
})
test('budget center visible expense type options only expose current supported budget subjects', () => {
const optionLabels = BUDGET_VISIBLE_EXPENSE_TYPE_OPTIONS.map((item) => item.label)
assert.deepEqual(optionLabels, ['差旅', '通信', '招待费', '办公用品'])
})
test('budget center exposes separate year and quarter dimensions', () => {
assert.deepEqual(BUDGET_YEAR_OPTIONS, ['2026', '2027', '2028'])
assert.deepEqual(BUDGET_QUARTER_OPTIONS, ['Q1', 'Q2', 'Q3', 'Q4'])