feat(invoice-check): 立账凭证检核增加收件人配置并迁移到chat页面

This commit is contained in:
sophie committed 2026-09-17 13:17:37 +08:00
1 parent 18e957545c
commit 7b80b4c395
72 files changed
+2705 -263

No files matched your search

@@ -0,0 +1,47 @@
/**
* shared/utils/userPicker.utils.test.ts
* 用途:锁定公共选人弹窗的部门分组与筛选规则。
*/
import { describe, expect, it } from 'vitest';
import {
USER_PICKER_ALL_DEPT,
USER_PICKER_NONE_DEPT,
type UserPickerPerson,
} from '@/shared/types/userPicker.types';
import {
filterUserPickerPeople,
listUserPickerDepartments,
userPickerLabel,
} from './userPicker.utils';
const people: UserPickerPerson[] = [
{ id: 1, username: 'a', real_name: '钟淑惠', employee_id: '0100004', department: '财务部' },
{ id: 2, username: 'b', real_name: '成秋兰', employee_id: '0203036', department: '关务部' },
{ id: 3, username: 'c', real_name: '刘江', employee_id: '07090745', department: ' ' },
];
describe('userPickerLabel', () => {
it('prefers real name and appends employee id', () => {
expect(userPickerLabel(people[0])).toBe('钟淑惠(0100004)');
expect(userPickerLabel(undefined, 9)).toBe('9');
});
});
describe('listUserPickerDepartments', () => {
it('puts all first, named departments next, and unnamed last', () => {
expect(listUserPickerDepartments(people)).toEqual([
{ key: USER_PICKER_ALL_DEPT, count: 3 },
{ key: '财务部', count: 1 },
{ key: '关务部', count: 1 },
{ key: USER_PICKER_NONE_DEPT, count: 1 },
]);
});
});
describe('filterUserPickerPeople', () => {
it('filters by department and keyword', () => {
expect(filterUserPickerPeople(people, { departmentKey: '财务部' }).map((row) => row.id)).toEqual([1]);
expect(filterUserPickerPeople(people, { query: '0203' }).map((row) => row.id)).toEqual([2]);
expect(filterUserPickerPeople(people, { departmentKey: USER_PICKER_NONE_DEPT }).map((row) => row.id)).toEqual([3]);
});
});