feat: 数字员工财务报告体系与定时提醒及看板快照调度
- 新增数字员工财务报告生成、邮件投递与渲染调度器 - 引入员工画像扫描调度与定时提醒任务 - 完善财务看板快照、排行口径与部门人员占比计算 - 优化数字员工工作看板仪表盘与技能目录 - 增强前端总览页图表、工作台摘要与顶部导航栏交互 - 新增差旅申请规划推动提醒与报销创建会话状态管理 - 补充财务报告、看板调度、数字员工工作记录测试覆盖
This commit is contained in:
80
web/tests/workbench-summary.test.mjs
Normal file
80
web/tests/workbench-summary.test.mjs
Normal file
@@ -0,0 +1,80 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import {
|
||||
buildAdjacentProgressSteps,
|
||||
buildWorkbenchSummary
|
||||
} from '../src/utils/workbenchSummary.js'
|
||||
|
||||
const currentUser = { name: '张三', username: 'zhangsan' }
|
||||
|
||||
function buildStep(label, index, currentIndex) {
|
||||
return {
|
||||
label,
|
||||
done: index < currentIndex,
|
||||
active: index <= currentIndex,
|
||||
current: index === currentIndex,
|
||||
time: index === currentIndex ? '进行中' : '待处理'
|
||||
}
|
||||
}
|
||||
|
||||
test('workbench expense progress keeps only nearby four expense steps', () => {
|
||||
const steps = ['创建单据', '待提交', '直属领导审批', '财务审批', '待付款', '归档入账']
|
||||
.map((label, index) => buildStep(label, index, 3))
|
||||
|
||||
const visibleSteps = buildAdjacentProgressSteps(steps, 4)
|
||||
|
||||
assert.deepEqual(
|
||||
visibleSteps.map((step) => step.label),
|
||||
['直属领导审批', '财务审批', '待付款', '归档入账']
|
||||
)
|
||||
assert.equal(visibleSteps[1].current, true)
|
||||
})
|
||||
|
||||
test('workbench summary builds real user notifications and progress from requests', () => {
|
||||
const summary = buildWorkbenchSummary(
|
||||
[
|
||||
{
|
||||
id: 'BX-001',
|
||||
claimId: 'claim-1',
|
||||
claimNo: 'BX-001',
|
||||
person: '张三',
|
||||
title: '差旅报销',
|
||||
approvalKey: 'draft',
|
||||
approvalStatus: '草稿',
|
||||
status: 'draft',
|
||||
amount: 1280,
|
||||
createdAt: '2026-06-01T10:00:00+08:00',
|
||||
updatedAt: '2026-06-01T10:10:00+08:00',
|
||||
progressSteps: [
|
||||
buildStep('创建单据', 0, 1),
|
||||
buildStep('待提交', 1, 1),
|
||||
buildStep('直属领导审批', 2, 1),
|
||||
buildStep('财务审批', 3, 1),
|
||||
buildStep('待付款', 4, 1)
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'BX-002',
|
||||
claimId: 'claim-2',
|
||||
claimNo: 'BX-002',
|
||||
person: '李四',
|
||||
title: '他人单据',
|
||||
approvalKey: 'draft',
|
||||
amount: 800,
|
||||
progressSteps: []
|
||||
}
|
||||
],
|
||||
currentUser
|
||||
)
|
||||
|
||||
assert.equal(summary.todoItems.length, 1)
|
||||
assert.equal(summary.todoItems[0].target.id, 'claim-1')
|
||||
assert.equal(summary.progressItems.length, 1)
|
||||
assert.deepEqual(
|
||||
summary.progressItems[0].steps.map((step) => step.label),
|
||||
['创建单据', '待提交', '直属领导审批', '财务审批']
|
||||
)
|
||||
assert.equal(summary.notifications.length, 1)
|
||||
assert.equal(summary.unreadNotificationCount, 1)
|
||||
})
|
||||
Reference in New Issue
Block a user