fix: 部门统计未分配部门改为显示"公务车",排序放最后
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-03-28 19:51:21 +08:00
parent 3e3546f6ac
commit cab26a207a

View File

@@ -685,7 +685,7 @@ app.get('/dept-stats', async (c) => {
const deptMap = new Map<string, Map<string, Vehicle[]>>(); const deptMap = new Map<string, Map<string, Vehicle[]>>();
for (const v of withManager) { for (const v of withManager) {
const dept = v.departmentName || '未分配'; const dept = v.departmentName || '公务车';
const mgr = v.customerManager || '未分配'; const mgr = v.customerManager || '未分配';
if (!deptMap.has(dept)) deptMap.set(dept, new Map()); if (!deptMap.has(dept)) deptMap.set(dept, new Map());
const mgrMap = deptMap.get(dept)!; const mgrMap = deptMap.get(dept)!;
@@ -733,6 +733,7 @@ app.get('/dept-stats', async (c) => {
// 按部门名中的数字排序(业务一部=1, 业务二部=2, ... // 按部门名中的数字排序(业务一部=1, 业务二部=2, ...
const numMap: Record<string, number> = { '一': 1, '二': 2, '三': 3, '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9, '十': 10 }; const numMap: Record<string, number> = { '一': 1, '二': 2, '三': 3, '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9, '十': 10 };
const getNum = (name: string) => { const getNum = (name: string) => {
if (name === '公务车') return 100;
const m = name.match(/[一二三四五六七八九十]/); const m = name.match(/[一二三四五六七八九十]/);
return m ? (numMap[m[0]] || 99) : 99; return m ? (numMap[m[0]] || 99) : 99;
}; };