@dreamor/atlas-cli 0.7.14 → 0.7.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,9 +151,9 @@ kind 说明:
151
151
 
152
152
  project 搜索有权限的项目列表(从 API 实时查询)
153
153
  department 搜索部门树中的部门名称(1500+ 部门节点)
154
- manpower-type 搜索人力类型(仅有: "斑马"、"智软" 两条,baseline --manpower-type 用)
155
- role 搜索人力基线角色(例: "开发"、"产品"、"测试"、"PM"、"设计" 等)
156
- area 搜索地域(仅有: "北上杭"、"合肥"、"武汉"、"西南" 四条)`)
154
+ manpower-type 搜索人力类型(例: "斑马"、"智软"baseline --manpower-type 用)
155
+ role 搜索人力基线角色(例: "开发"、"产品"、"测试"、"PM"、"设计" 等)
156
+ area 搜索地域(例: "北上杭"、"合肥"、"武汉"、"西南")`)
157
157
  .action(async (kind, query, opts) => {
158
158
  try {
159
159
  await findCmd(kind, query, opts);
@@ -26,15 +26,24 @@ function isMonthKey(v) {
26
26
  && typeof v.month === 'number'
27
27
  && Number.isFinite(v.month);
28
28
  }
29
+ /** mpType 值映射:0=斑马 1=智软 */
30
+ const MP_TYPE_MAP = { '0': '斑马', '1': '智软' };
31
+ function filterBaseline(details, opts) {
32
+ return details.filter(d => (!opts.department || (d.departmentName && d.departmentName.includes(opts.department)))
33
+ && (!opts.role || (d.role && d.role.includes(opts.role)))
34
+ && (!opts.area || (d.areaCode && d.areaCode.includes(opts.area)))
35
+ && (!opts.manpowerType || (d.mpType && MP_TYPE_MAP[d.mpType]?.includes(opts.manpowerType))));
36
+ }
29
37
  export async function monthCmd(opts) {
30
38
  const pid = getProjectId(opts);
31
39
  const months = opts.month ? [opts.month] : expandMonths(opts.from, opts.to);
32
40
  const allDetails = [];
33
41
  for (const m of months) {
34
42
  const data = await fetchBaselineMonth(pid, m);
35
- // data 是数组,每项含 linePlanMonthDetailList
36
43
  for (const item of (data ?? [])) {
37
44
  const details = (item.linePlanMonthDetailList ?? []);
45
+ const mpType = String(item.mpType ?? '');
46
+ const areaCode = item.areaCode;
38
47
  for (const d of details) {
39
48
  if (isMonthKey(d)) {
40
49
  allDetails.push({
@@ -42,14 +51,15 @@ export async function monthCmd(opts) {
42
51
  manpower: d.manpower ?? 0,
43
52
  role: item.role,
44
53
  departmentName: item.departmentName,
54
+ mpType,
55
+ areaCode,
45
56
  });
46
57
  }
47
58
  }
48
59
  }
49
60
  }
50
- // Apply --department / --role filter
51
- const filtered = allDetails.filter(d => (!opts.department || (d.departmentName && d.departmentName.includes(opts.department)))
52
- && (!opts.role || (d.role && d.role.includes(opts.role))));
61
+ // Apply filters
62
+ const filtered = filterBaseline(allDetails, opts);
53
63
  // 聚合
54
64
  const byMonth = new Map();
55
65
  for (const d of filtered) {
@@ -74,16 +84,17 @@ export async function summaryCmd(opts) {
74
84
  for (const m of months) {
75
85
  const data = await fetchBaselineMonth(pid, m);
76
86
  for (const item of (data ?? [])) {
87
+ const mpType = String(item.mpType ?? '');
88
+ const areaCode = item.areaCode;
77
89
  for (const d of (item.linePlanMonthDetailList ?? [])) {
78
90
  if (isMonthKey(d)) {
79
- allDetails.push({ month: monthTsToKey(d.month), manpower: d.manpower ?? 0, role: item.role, departmentName: item.departmentName });
91
+ allDetails.push({ month: monthTsToKey(d.month), manpower: d.manpower ?? 0, role: item.role, departmentName: item.departmentName, mpType, areaCode });
80
92
  }
81
93
  }
82
94
  }
83
95
  }
84
- // Apply --department / --role filter
85
- const filtered = allDetails.filter(d => (!opts.department || (d.departmentName && d.departmentName.includes(opts.department)))
86
- && (!opts.role || (d.role && d.role.includes(opts.role))));
96
+ // Apply filters
97
+ const filtered = filterBaseline(allDetails, opts);
87
98
  const axis = opts.by ?? 'month';
88
99
  const groups = new Map();
89
100
  for (const d of filtered) {
@@ -1 +1 @@
1
- export const ATLAS_VERSION = '0.7.14';
1
+ export const ATLAS_VERSION = '0.7.15';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamor/atlas-cli",
3
- "version": "0.7.14",
3
+ "version": "0.7.15",
4
4
  "description": "Atlas CLI - 斑马云图人力基线管理工具",
5
5
  "type": "module",
6
6
  "bin": {