weaver-work-cli 0.1.60 → 0.1.62
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.
- package/dist/chunks/{archive-4SQAVTIB.js → archive-S2VKZWQ3.js} +2 -2
- package/dist/chunks/{archive-oa-W2UEJ67L.js → archive-oa-HEDSIUUY.js} +2 -2
- package/dist/chunks/{asset-EGZEABBI.js → asset-HYH4W357.js} +2 -2
- package/dist/chunks/{asset-idle-EBUZBB6M.js → asset-idle-N7REBNGL.js} +2 -2
- package/dist/chunks/{attachment-content-I6WHKGR2.js → attachment-content-VYYA75FR.js} +3 -3
- package/dist/chunks/{blog-2YKMWOWI.js → blog-SLMZZICV.js} +2 -2
- package/dist/chunks/{caizhilian-5NM4X5HG.js → caizhilian-RV43KKBT.js} +4 -4
- package/dist/chunks/{calendar-H4QTJCUY.js → calendar-DMVZ4OLY.js} +2 -2
- package/dist/chunks/{chunk-VLL6JOB4.js → chunk-6XSSAUNW.js} +4 -4
- package/dist/chunks/{chunk-VQWPQTEY.js → chunk-BIA2NKUG.js} +4 -4
- package/dist/chunks/{chunk-VMCCRWFO.js → chunk-BQYX2UX5.js} +2 -2
- package/dist/chunks/{chunk-XF7S6FQW.js → chunk-DTCQFTHW.js} +1 -1
- package/dist/chunks/{chunk-CPG6NLN4.js → chunk-E5YD5JWR.js} +1 -1
- package/dist/chunks/{chunk-PH7N4UFT.js → chunk-EGANE35F.js} +1 -1
- package/dist/chunks/{chunk-Z4IPY5GV.js → chunk-H6YOMI3U.js} +2 -2
- package/dist/chunks/{chunk-HHH4K3YY.js → chunk-ILALC2N6.js} +1 -1
- package/dist/chunks/{chunk-WINR2Q6K.js → chunk-KXJA42EA.js} +86 -19
- package/dist/chunks/{chunk-CQ4OVCKG.js → chunk-KY3R42RS.js} +2 -2
- package/dist/chunks/{chunk-WVH5ESDA.js → chunk-NRYDJN4J.js} +1 -1
- package/dist/chunks/{chunk-TGM7BWEH.js → chunk-P6TXQK75.js} +2 -2
- package/dist/chunks/{chunk-6YWHRXEQ.js → chunk-QBDXJS2W.js} +119 -9
- package/dist/chunks/{chunk-2IGZUMNG.js → chunk-SHX7XBYR.js} +180 -18
- package/dist/chunks/{chunk-P7RXQDCA.js → chunk-T2KVJFWJ.js} +4 -4
- package/dist/chunks/{chunk-FMNCSYIG.js → chunk-TEZHIB6T.js} +2 -2
- package/dist/chunks/{chunk-HMIIVM2L.js → chunk-UBGWIXU3.js} +97 -45
- package/dist/chunks/{chunk-5N222HK6.js → chunk-UBRWONP4.js} +2 -2
- package/dist/chunks/{chunk-7U5YHCW7.js → chunk-UQFPF4EX.js} +2 -2
- package/dist/chunks/{chunk-4GG72JAT.js → chunk-V2LASYKO.js} +2 -2
- package/dist/chunks/{chunk-BDBTZVYA.js → chunk-VBFBMM7G.js} +55 -55
- package/dist/chunks/{chunk-YHSOCGKO.js → chunk-VNYOUAWV.js} +11 -11
- package/dist/chunks/{chunk-SFM3M2L3.js → chunk-WIWDVETN.js} +19 -3
- package/dist/chunks/{chunk-44KJ7WFA.js → chunk-XT77MP54.js} +2 -2
- package/dist/chunks/{chunk-JFKMPRZB.js → chunk-YI2YMW5N.js} +50 -3
- package/dist/chunks/{conflict-QMDLS2EW.js → conflict-GFJRS6I7.js} +2 -2
- package/dist/chunks/{contract-LLRKMLQQ.js → contract-U3ZGNRWB.js} +2 -2
- package/dist/chunks/{cowork-2RDFBZWB.js → cowork-EX7PKIDK.js} +2 -2
- package/dist/chunks/{create-flow-5ODJ7WJO.js → create-flow-EJZD434E.js} +6 -6
- package/dist/chunks/{data-LVDFIRNG.js → data-FOODGAMF.js} +278 -121
- package/dist/chunks/{ebuilder-form-7WA6X6ZI.js → ebuilder-form-I2EOKODG.js} +3 -3
- package/dist/chunks/{ehr-52GBKNJR.js → ehr-TE4RFNID.js} +2 -2
- package/dist/chunks/{entry-mode-73BJML22.js → entry-mode-ZOLSXEGX.js} +9 -5
- package/dist/chunks/{env-OHFS76HV.js → env-TID5NFR6.js} +2 -2
- package/dist/chunks/{esb-HJSXCEOM.js → esb-7L6MHYLB.js} +4 -4
- package/dist/chunks/{factory-FRTA2LP4.js → factory-OG7BPMH5.js} +1 -1
- package/dist/chunks/{fna-OBACRT3J.js → fna-6V2ENR3Y.js} +2 -2
- package/dist/chunks/{group-chat-KBFRPCR2.js → group-chat-5DKPWIHL.js} +3 -3
- package/dist/chunks/{host-TTSGY5NZ.js → host-3DLYA54R.js} +3 -3
- package/dist/chunks/{host-KJT3G5D2.js → host-GOJHHTPY.js} +3 -3
- package/dist/chunks/{host-KOWUMNAY.js → host-OGBHL75G.js} +3 -3
- package/dist/chunks/{host-MFXRA2MY.js → host-ONZC6AE7.js} +3 -3
- package/dist/chunks/{host-W4JCNRFS.js → host-TJ5VVHM7.js} +3 -3
- package/dist/chunks/{host-2BKMPWDH.js → host-VTPAWDZV.js} +3 -3
- package/dist/chunks/{hrm-AK3WGBMN.js → hrm-2N7NFQDZ.js} +3 -3
- package/dist/chunks/{im-JZSBPO4Z.js → im-XCH47ZBN.js} +3 -3
- package/dist/chunks/{invoice-6XDMPCWB.js → invoice-5KJ7T774.js} +198 -331
- package/dist/chunks/{jiuchuanhui-K4EQU6GK.js → jiuchuanhui-PL6DRPBM.js} +2 -2
- package/dist/chunks/{lazy-dispatch-GCA6HDOB.js → lazy-dispatch-UATEN7H7.js} +5 -5
- package/dist/chunks/{mail-IKVCQCVZ.js → mail-Q7Z4CQ4D.js} +2 -2
- package/dist/chunks/{meeting-ARHVWK7G.js → meeting-5E3BNARL.js} +13 -13
- package/dist/chunks/{minute-doc-547KSYKR.js → minute-doc-NXRE5C77.js} +4 -4
- package/dist/chunks/{okr-KV43FPPX.js → okr-3O3XNYOK.js} +2 -2
- package/dist/chunks/{operations-6NXJ7RTE.js → operations-EZWG72FH.js} +4 -4
- package/dist/chunks/performance-Y7CPNSOR.js +1295 -0
- package/dist/chunks/{plan-WOYR4WEG.js → plan-BLGPZF5M.js} +2 -2
- package/dist/chunks/{project-CQJKBUIL.js → project-6MZMLJMP.js} +2 -2
- package/dist/chunks/{reception-MPBU3JXC.js → reception-F2VT2X52.js} +2 -2
- package/dist/chunks/{recruit-stage-USTTRHOX.js → recruit-stage-4ETIBMIW.js} +2 -2
- package/dist/chunks/{registry-GURQG4ZV.js → registry-3FYSWV3U.js} +3 -3
- package/dist/chunks/{registry-SS5J2FZQ.js → registry-7RS74TCK.js} +4 -4
- package/dist/chunks/{registry-H5HQ5QNH.js → registry-I4DVPDMU.js} +11 -11
- package/dist/chunks/{room-recommend-3UBROMZE.js → room-recommend-GWCVKCXW.js} +4 -4
- package/dist/chunks/{schedule-FTUQML6O.js → schedule-6AN63MJQ.js} +4 -4
- package/dist/chunks/{smart-extract-APX2PNIN.js → smart-extract-SR4SJJKN.js} +3 -3
- package/dist/chunks/{workflow-WMPW3WSB.js → workflow-KF7FA2UQ.js} +7 -7
- package/dist/cmd/refs/index.js +124 -4
- package/dist/core/output.js +199 -26
- package/dist/core/refs.js +36 -0
- package/dist/index.js +38 -33
- package/dist/internal/e10/auth/xiaoe.js +25 -3
- package/dist/shortcuts/caizhilian/operations/files.js +86 -15
- package/dist/shortcuts/data/index.js +12 -2
- package/dist/shortcuts/data/manifest.js +4 -2
- package/dist/shortcuts/data/operations/attribution.js +229 -0
- package/dist/shortcuts/data/operations/ds.js +87 -90
- package/dist/shortcuts/data/operations/index.js +3 -1
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/manifest.js +30 -62
- package/dist/shortcuts/invoice/operations/registry.js +2 -2
- package/dist/shortcuts/invoice/operations/reim-customer.js +111 -0
- package/dist/shortcuts/invoice/operations/shared.js +0 -204
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +84 -16
- package/dist/shortcuts/meeting/operations/eb/entry-mode.js +61 -7
- package/dist/shortcuts/performance/continuation.js +74 -0
- package/dist/shortcuts/performance/errors.js +65 -0
- package/dist/shortcuts/performance/host.js +105 -0
- package/dist/shortcuts/performance/index.js +109 -0
- package/dist/shortcuts/performance/manifest.js +30 -0
- package/dist/shortcuts/performance/operations/hrm-resolve.js +114 -0
- package/dist/shortcuts/performance/operations/registry.js +44 -0
- package/dist/shortcuts/performance/operations/scheme-detail.js +70 -0
- package/dist/shortcuts/performance/operations/scheme-draft.js +116 -0
- package/dist/shortcuts/performance/operations/scheme-publish.js +158 -0
- package/dist/shortcuts/performance/operations/types.js +32 -0
- package/dist/shortcuts/performance/scheme-validate.js +307 -0
- package/dist/shortcuts/performance/shared.js +158 -0
- package/docs/agent-invoice.md +1 -1
- package/docs/agent-io-channel-design.md +67 -3
- package/docs/data.md +2 -1
- package/docs/invoice.md +0 -2
- package/package.json +1 -1
- package/scripts/xiaoe_env.py +6 -1
- package/skill-template/business-info.json +19 -0
- package/skill-template/domains/performance.md +18 -0
- package/skill-template/domains/yepiaotong.md +0 -1
- package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
- package/skills/weaver-e10-data/references/datasource.md +2 -1
- package/skills/weaver-e10-meeting/SKILL.md +5 -3
- package/skills/weaver-e10-performance/SKILL.md +202 -0
- package/skills/weaver-e10-performance/agents/openai.yaml +74 -0
- package/skills/weaver-e10-performance/references/default-assembly.md +108 -0
- package/skills/weaver-e10-performance/references/entity-resolution.md +69 -0
- package/skills/weaver-e10-performance/references/enums-and-normalization.md +80 -0
- package/skills/weaver-e10-performance/references/examples.md +146 -0
- package/skills/weaver-e10-performance/references/extraction-guide.md +144 -0
- package/skills/weaver-e10-performance/references/scheme-edit-req-fields.md +185 -0
- package/skills/weaver-e10-performance/references/scheme-setting-page.md +62 -0
- package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +483 -0
- package/skills/weaver-e10-shared/references/json-output-contract.md +5 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +16 -9
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +9 -7
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +15 -11
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +29 -25
- package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +89 -0
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +35 -37
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +66 -63
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +50 -71
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +34 -95
- package/dist/shortcuts/invoice/operations/browse-field.js +0 -17
- package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +0 -204
|
@@ -1,69 +1,48 @@
|
|
|
1
1
|
import { needArg } from '../host.js';
|
|
2
|
-
import { dataValidationError } from '../errors.js';
|
|
2
|
+
import { dataApiError, dataValidationError } from '../errors.js';
|
|
3
3
|
import { applyAppId, baseDto, parseOrder, parseStat, parseWhereArg, readListArg, renderTable, scanTips, tipsLines, } from './shared.js';
|
|
4
4
|
// ---------------------------------------------------------------- 分组清单
|
|
5
5
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[39, '薪酬', 'weaver-hrm-salary', 'hrmsalary'],
|
|
47
|
-
[40, '系统安全', 'weaver-security-framework-service', 'security'],
|
|
48
|
-
[41, '公文交换中心', 'weaver-odocexchange-service', 'odocexchange'],
|
|
49
|
-
[42, '招聘管理', 'weaver-recruit-service', 'recruit'],
|
|
50
|
-
[43, '微搜', 'weaver-esearch-search-service', null],
|
|
51
|
-
[44, '统一审批中心', 'weaver-intunifytodo-server-config-service', 'intunifytodos'],
|
|
52
|
-
[45, '公共数据源', 'weaver-component-web-service', 'common'],
|
|
53
|
-
[46, '数据分析', 'weaver-analyze-service', 'analyze'],
|
|
54
|
-
[47, '财务模块', 'weaver-fna-expense-servicefexs', 'fna'],
|
|
55
|
-
[48, 'ESB连接器', 'weaver-esb-setting-serviceesbConnect', 'esb'],
|
|
56
|
-
[49, 'AI连接器', 'weaver-ai-application-service', 'ai'],
|
|
57
|
-
[50, '外部流程', 'weaver-workflow-core-serviceworkflowCoreOuterwf', 'workflow'],
|
|
58
|
-
[51, '绩效考核', 'weaver-wr-performance-eb-service', 'ebuilder'],
|
|
59
|
-
[52, '问题定位平台', 'weaver-tissot-service', 'tissot'],
|
|
60
|
-
[53, '工作流基础效率', 'weaver-workflow-report-serviceworkflowEffReport', 'workflow'],
|
|
61
|
-
[54, '工作流操作者效率', 'weaver-workflow-report-serviceworkflowEffOperateReport', 'workflow'],
|
|
62
|
-
[55, '工作流节点效率', 'weaver-workflow-report-serviceworkflowEffNodeReport', 'workflow'],
|
|
63
|
-
[56, '规则引擎', 'weaver-logicflow-service', 'logicflow'],
|
|
64
|
-
[57, '工作流表单', 'weaver-workflow-report-serviceworkflowFormReport', 'workflow'],
|
|
65
|
-
[58, '统一认证中心', 'weaver-intunifyauth-server-base-service', null],
|
|
66
|
-
];
|
|
6
|
+
// 分组一律以 `/api/dw/ds/group` 的实时返回为准(sourceType 固定 LOGIC),
|
|
7
|
+
// 本文件不再内置任何分组常量:接口返回什么就是什么,随环境增减。
|
|
8
|
+
// `DS_CORE_GROUPS` / `DS_FIND_SEMANTIC_RULES` 只是「扫描优先级偏好」,
|
|
9
|
+
// 使用前必须与实时分组取交集,不得据此扩大扫描范围。
|
|
10
|
+
const DS_GROUPS_PATH = '/api/dw/ds/group';
|
|
11
|
+
/** 后端大小写敏感(传 `logic` ⇒ code=400),且不接受空串(⇒ code=500)。 */
|
|
12
|
+
const DS_GROUPS_SOURCE_TYPE = 'LOGIC';
|
|
13
|
+
/** 接口的 serviceMark 可能是 `""` 或直接缺字段 ⇒ 统一归一为 null。 */
|
|
14
|
+
function normalizeServiceMark(raw) {
|
|
15
|
+
return typeof raw === 'string' && raw.trim() !== '' ? raw : null;
|
|
16
|
+
}
|
|
17
|
+
function groupIndex(groups) {
|
|
18
|
+
return new Map(groups.map((group) => [group.groupId, group]));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 实时分组清单。单次命令内只取一次、由调用方把结果下传;不做模块级缓存
|
|
22
|
+
* (分组随环境变动,宁可贵一次也不留陈旧数据)。
|
|
23
|
+
*/
|
|
24
|
+
async function fetchGroups(host) {
|
|
25
|
+
const response = await host.request({
|
|
26
|
+
method: 'GET',
|
|
27
|
+
path: DS_GROUPS_PATH,
|
|
28
|
+
query: { sourceType: DS_GROUPS_SOURCE_TYPE },
|
|
29
|
+
operation: 'ds.groups',
|
|
30
|
+
});
|
|
31
|
+
const rows = response?.data;
|
|
32
|
+
if (response?.code !== undefined && response.code !== 200) {
|
|
33
|
+
throw dataApiError('groups_failed', `分组清单接口返回失败:${response?.msg || `code=${response.code}`}`, { code: response.code, details: { sourceType: DS_GROUPS_SOURCE_TYPE } });
|
|
34
|
+
}
|
|
35
|
+
if (!Array.isArray(rows)) {
|
|
36
|
+
throw dataApiError('groups_failed', `分组清单接口异常:${response?.msg || '未返回 data 数组'}`, { code: response?.code, details: { sourceType: DS_GROUPS_SOURCE_TYPE } });
|
|
37
|
+
}
|
|
38
|
+
return rows
|
|
39
|
+
.filter((row) => row && typeof row.id === 'string' && row.id !== '')
|
|
40
|
+
.map((row) => ({
|
|
41
|
+
groupId: row.id,
|
|
42
|
+
label: String(row.name ?? ''),
|
|
43
|
+
serviceMark: normalizeServiceMark(row.serviceMark),
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
67
46
|
const DS_CORE_GROUPS = [
|
|
68
47
|
'weaver-formreport-service',
|
|
69
48
|
'weaver-ebuilder-form-service',
|
|
@@ -82,13 +61,11 @@ const DS_FIND_SEMANTIC_RULES = [
|
|
|
82
61
|
{ tag: '邮件/公文', re: /邮件|收件箱|公文|发文|档案|借阅/, groups: ['weaver-mail-base-service', 'weaver-odoc-service'] },
|
|
83
62
|
{ tag: '资产/日志', re: /资产|台账|日志|动作流|自动化/, groups: ['weaver-elog-service', 'weaver-esb-setting-serviceesbCustom'] },
|
|
84
63
|
];
|
|
85
|
-
function groupLabel(groupId) {
|
|
86
|
-
|
|
87
|
-
return hit ? hit[1] : null;
|
|
64
|
+
function groupLabel(index, groupId) {
|
|
65
|
+
return index?.get(groupId)?.label ?? null;
|
|
88
66
|
}
|
|
89
|
-
function groupMark(groupId) {
|
|
90
|
-
|
|
91
|
-
return hit ? hit[3] : null;
|
|
67
|
+
function groupMark(index, groupId) {
|
|
68
|
+
return index?.get(groupId)?.serviceMark ?? null;
|
|
92
69
|
}
|
|
93
70
|
function explicitAppId(input) {
|
|
94
71
|
const appId = input.app_id;
|
|
@@ -134,19 +111,28 @@ function renderFields(response) {
|
|
|
134
111
|
return lines.length ? lines.join('\n') : '(空:未返回字段)';
|
|
135
112
|
}
|
|
136
113
|
// ---------------------------------------------------------------- 命令
|
|
137
|
-
export async function dsGroups(input) {
|
|
114
|
+
export async function dsGroups(input, host) {
|
|
138
115
|
const pattern = input.pattern ? String(input.pattern) : null;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
.
|
|
116
|
+
const live = await fetchGroups(host);
|
|
117
|
+
const groups = live.filter((item) => !pattern
|
|
118
|
+
|| item.groupId.includes(pattern)
|
|
119
|
+
|| item.label.includes(pattern));
|
|
120
|
+
const liveIds = new Set(live.map((item) => item.groupId));
|
|
142
121
|
const data = {
|
|
143
122
|
count: groups.length,
|
|
144
123
|
groups,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
124
|
+
sourceType: DS_GROUPS_SOURCE_TYPE,
|
|
125
|
+
coreGroups: DS_CORE_GROUPS.filter((groupId) => liveIds.has(groupId)),
|
|
126
|
+
semanticRules: DS_FIND_SEMANTIC_RULES
|
|
127
|
+
.map((rule) => ({ tag: rule.tag, groups: rule.groups.filter((groupId) => liveIds.has(groupId)) }))
|
|
128
|
+
.filter((rule) => rule.groups.length > 0),
|
|
129
|
+
note: `分组清单来自 ${DS_GROUPS_PATH} 实时返回(sourceType=${DS_GROUPS_SOURCE_TYPE}),接口返回什么就是什么、随环境增减;`
|
|
130
|
+
+ 'ds find 的默认扫描候选同样只取实时分组,需缩小范围时用 --groups 显式指定',
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
data,
|
|
134
|
+
text: renderTable(`分组清单 ${groups.length} 个(实时)`, groups, ['groupId', 'label', 'serviceMark']),
|
|
148
135
|
};
|
|
149
|
-
return { data, text: renderTable(`内置分组清单 ${groups.length} 个`, groups, ['groupId', 'label', 'serviceMark']) };
|
|
150
136
|
}
|
|
151
137
|
export async function dsTables(input, host) {
|
|
152
138
|
const groupId = needArg(input, 'group');
|
|
@@ -271,16 +257,17 @@ export async function dsCount(input, host) {
|
|
|
271
257
|
};
|
|
272
258
|
}
|
|
273
259
|
// ---------------------------------------------------------------- find / describe
|
|
274
|
-
function pickFindGroups(input, keyword) {
|
|
260
|
+
function pickFindGroups(input, keyword, live) {
|
|
275
261
|
if (input.groups) {
|
|
276
262
|
return { mode: 'explicit', groups: String(input.groups).split(',').map((item) => item.trim()).filter(Boolean) };
|
|
277
263
|
}
|
|
278
264
|
if (input.all_groups)
|
|
279
|
-
return { mode: 'all', groups:
|
|
265
|
+
return { mode: 'all', groups: live.map((item) => item.groupId) };
|
|
280
266
|
const max = Math.max(Number(input.max_groups || '6') || 6, DS_CORE_GROUPS.length);
|
|
267
|
+
const liveIds = new Set(live.map((item) => item.groupId));
|
|
281
268
|
const picked = [];
|
|
282
269
|
const push = (groupId) => {
|
|
283
|
-
if (groupId && !picked.includes(groupId))
|
|
270
|
+
if (groupId && liveIds.has(groupId) && !picked.includes(groupId))
|
|
284
271
|
picked.push(groupId);
|
|
285
272
|
};
|
|
286
273
|
for (const groupId of DS_CORE_GROUPS)
|
|
@@ -306,12 +293,12 @@ async function mapLimit(items, limit, fn) {
|
|
|
306
293
|
await Promise.all(workers);
|
|
307
294
|
return out;
|
|
308
295
|
}
|
|
309
|
-
async function scanGroups(host, groupIds, keyword, sourceType, pageSize, concurrency, appId, pages) {
|
|
296
|
+
async function scanGroups(host, index, groupIds, keyword, sourceType, pageSize, concurrency, appId, pages) {
|
|
310
297
|
return mapLimit(groupIds, concurrency, async (groupId) => {
|
|
311
298
|
const result = {
|
|
312
299
|
groupId,
|
|
313
|
-
label: groupLabel(groupId),
|
|
314
|
-
serviceMark: groupMark(groupId),
|
|
300
|
+
label: groupLabel(index, groupId),
|
|
301
|
+
serviceMark: groupMark(index, groupId),
|
|
315
302
|
records: [],
|
|
316
303
|
error: null,
|
|
317
304
|
total: null,
|
|
@@ -415,7 +402,7 @@ function routeHint(candidates) {
|
|
|
415
402
|
return { channel: 'BLOG_DAILY', desc: 'BLOG_DAILY 模块配置通道(日报)', reason: '命中日报分组' };
|
|
416
403
|
if (has((c) => c.serviceMark === 'document'))
|
|
417
404
|
return { channel: 'DOCUMENT', desc: 'DOCUMENT 模块配置通道(文档)', reason: '命中文档分组' };
|
|
418
|
-
if (has((c) => c.serviceMark === 'customer' || c.serviceMark === 'scrm')) {
|
|
405
|
+
if (has((c) => c.serviceMark === 'customer' || c.serviceMark === 'crm' || c.serviceMark === 'scrm')) {
|
|
419
406
|
return { channel: 'CRM', desc: 'CRM 模块配置通道(客户/商机/线索)', reason: '命中 CRM 分组' };
|
|
420
407
|
}
|
|
421
408
|
if (has((c) => c.serviceMark === 'esb'))
|
|
@@ -431,9 +418,11 @@ export async function dsFind(input, host) {
|
|
|
431
418
|
const pages = Math.min(Math.max(Number(input.pages || '1') || 1, 1), 50);
|
|
432
419
|
const concurrency = Math.max(1, Number(input.concurrency || '10') || 10);
|
|
433
420
|
const appId = explicitAppId(input);
|
|
434
|
-
const
|
|
421
|
+
const live = await fetchGroups(host);
|
|
422
|
+
const index = groupIndex(live);
|
|
423
|
+
const picked = pickFindGroups(input, keyword, live);
|
|
435
424
|
const startedAt = Date.now();
|
|
436
|
-
let scan = await scanGroups(host, picked.groups, keyword, sourceType, pageSize, concurrency, appId, pages);
|
|
425
|
+
let scan = await scanGroups(host, index, picked.groups, keyword, sourceType, pageSize, concurrency, appId, pages);
|
|
437
426
|
const keywordNorm = keyword.replace(/\s+/g, '').toLowerCase();
|
|
438
427
|
const looseSample = [];
|
|
439
428
|
let looseDropped = 0;
|
|
@@ -462,8 +451,8 @@ export async function dsFind(input, host) {
|
|
|
462
451
|
if (!scan.some((result) => result.records.length) && picked.mode === 'core' && !input.no_escalate && escalateOk) {
|
|
463
452
|
escalated = true;
|
|
464
453
|
const seen = new Set(picked.groups);
|
|
465
|
-
const extra =
|
|
466
|
-
scan = scan.concat(applyStrict(await scanGroups(host, extra, keyword, sourceType, pageSize, concurrency, appId, pages)));
|
|
454
|
+
const extra = live.map((item) => item.groupId).filter((groupId) => !seen.has(groupId));
|
|
455
|
+
scan = scan.concat(applyStrict(await scanGroups(host, index, extra, keyword, sourceType, pageSize, concurrency, appId, pages)));
|
|
467
456
|
}
|
|
468
457
|
const elapsedMs = Date.now() - startedAt;
|
|
469
458
|
const okScan = scan.filter((result) => !result.error);
|
|
@@ -596,6 +585,14 @@ export async function dsDescribe(input, host) {
|
|
|
596
585
|
const tableId = String(needArg(input, 'table'));
|
|
597
586
|
const sourceType = String(input.source_type || 'LOGIC');
|
|
598
587
|
const startedAt = Date.now();
|
|
588
|
+
// 分组名 / serviceMark 仅用于输出提示:取不到时降级为 null,不影响 describe 主流程。
|
|
589
|
+
let index = null;
|
|
590
|
+
try {
|
|
591
|
+
index = groupIndex(await fetchGroups(host));
|
|
592
|
+
}
|
|
593
|
+
catch {
|
|
594
|
+
index = null;
|
|
595
|
+
}
|
|
599
596
|
const branches = await Promise.all([
|
|
600
597
|
(async () => {
|
|
601
598
|
try {
|
|
@@ -651,7 +648,7 @@ export async function dsDescribe(input, host) {
|
|
|
651
648
|
}
|
|
652
649
|
})(),
|
|
653
650
|
]);
|
|
654
|
-
const data = { groupId, groupLabel: groupLabel(groupId), tableId, sourceType, branches: branches.length };
|
|
651
|
+
const data = { groupId, groupLabel: groupLabel(index, groupId), tableId, sourceType, branches: branches.length };
|
|
655
652
|
const errors = [];
|
|
656
653
|
for (const branch of branches) {
|
|
657
654
|
if (branch.error) {
|
|
@@ -663,7 +660,7 @@ export async function dsDescribe(input, host) {
|
|
|
663
660
|
}
|
|
664
661
|
}
|
|
665
662
|
data.relatedFields = relatedHint(groupId, data.fields?.detailCount || 0);
|
|
666
|
-
data.channelHint = routeHint([{ groupId, serviceMark: groupMark(groupId) }]);
|
|
663
|
+
data.channelHint = routeHint([{ groupId, serviceMark: groupMark(index, groupId) }]);
|
|
667
664
|
data.permissionNote = groupId === 'weaver-ebuilder-form-service'
|
|
668
665
|
? '该分组是 EB 建模表单:取数不再做权限前置校验,--app-id 直接取 ebdf_obj.app_id(obj_id = ebdf_obj.id = 数据源 tableId)'
|
|
669
666
|
: '非 EB 分组,数据源通道无需 appId';
|
|
@@ -681,4 +678,4 @@ export async function dsDescribe(input, host) {
|
|
|
681
678
|
lines.push(`权限: ${data.permissionNote}`);
|
|
682
679
|
return { data, text: lines.join('\n') };
|
|
683
680
|
}
|
|
684
|
-
export {
|
|
681
|
+
export { groupLabel, groupMark };
|
|
@@ -4,12 +4,13 @@ import { dsChart, dsCount, dsDescribe, dsFields, dsFieldsDsl, dsFind, dsGroups,
|
|
|
4
4
|
import { attendStatis } from './attend.js';
|
|
5
5
|
import { fieldName2id, fieldOptions } from './field.js';
|
|
6
6
|
import { nounList, nounScope } from './noun.js';
|
|
7
|
+
import { attributionMetric } from './attribution.js';
|
|
7
8
|
import { confAdd, confAddFile, confBatch, confBatchFile, confDelete, confGet, confGroup, confGroupFile, confResolve, confResolveFile, confUpdate, } from './conf.js';
|
|
8
9
|
import { moduleCall } from './module.js';
|
|
9
10
|
import { sceneGroups, sceneItems, sceneSearch } from './scene.js';
|
|
10
11
|
const DEFINITIONS = [
|
|
11
12
|
{ name: 'data.dsl.query', summary: '直接执行 DSL 查询(executeQueryDsl;与 ds list/chart/stat/count 为独立通道)', capability: 'dsl', handler: executeQuery, command: 'query' },
|
|
12
|
-
{ name: 'data.ds.groups', summary: '
|
|
13
|
+
{ name: 'data.ds.groups', summary: '数据源分组清单(实时 /api/dw/ds/group,sourceType=LOGIC)', capability: 'discovery', handler: dsGroups, command: 'ds groups' },
|
|
13
14
|
{ name: 'data.ds.find', summary: '按关键词跨分组找表(进程内并发扇出 + 本地过滤 + 路由建议)', capability: 'discovery', handler: dsFind, command: 'ds find' },
|
|
14
15
|
{ name: 'data.ds.describe', summary: '一次并发取回字段元数据 + 词库,并给出关联字段/通道提示', capability: 'discovery', handler: dsDescribe, command: 'ds describe' },
|
|
15
16
|
{ name: 'data.ds.tables', summary: '列某个分组下的数据集(表)清单', capability: 'metadata', handler: dsTables, command: 'ds tables' },
|
|
@@ -21,6 +22,7 @@ const DEFINITIONS = [
|
|
|
21
22
|
{ name: 'data.ds.count', summary: '计数(getCountData)', capability: 'fetch', handler: dsCount, command: 'ds count' },
|
|
22
23
|
{ name: 'data.noun.list', summary: '按 skill 取词库(ChatBI 名词解释)', capability: 'lexicon', handler: nounList, command: 'noun list' },
|
|
23
24
|
{ name: 'data.noun.scope', summary: '按数据集生效范围批量取词库(getChatBiDocByScopeId)', capability: 'lexicon', handler: nounScope, command: 'noun scope' },
|
|
25
|
+
{ name: 'data.attribution.metric', summary: '按生效范围批量取归因分析设置(getAttributionMetricByScopeId;分组级 / 条目级绑定)', capability: 'attribution', handler: attributionMetric, command: 'attribution metric' },
|
|
24
26
|
{ name: 'data.field.name2id', summary: '名称 → 字段值 id 候选(浏览按钮类字段)', capability: 'field', handler: fieldName2id, command: 'field name2id' },
|
|
25
27
|
{ name: 'data.field.options', summary: 'Select/Radio/Checkbox 选项值字典(id↔name)', capability: 'field', handler: fieldOptions, command: 'field options' },
|
|
26
28
|
{ name: 'data.conf.get', summary: '按 confKey 取单条配置(confType 由前缀推导或 --type 指定)', capability: 'config', handler: confGet, command: 'conf get' },
|
package/dist/shortcuts/index.js
CHANGED
|
@@ -40,6 +40,11 @@ export const builtinShortcuts = [
|
|
|
40
40
|
description: '泛微E10招聘助手(JD生成/简历建档/AI面试邀约)CLI',
|
|
41
41
|
load: async () => (await import('./recruit-stage/index.js')).recruitStageShortcut,
|
|
42
42
|
}),
|
|
43
|
+
lazyShortcut({
|
|
44
|
+
name: 'performance',
|
|
45
|
+
description: '泛微E10绩效方案(文档导入/实体解析/落草稿/确认发布)CLI',
|
|
46
|
+
load: async () => (await import('./performance/index.js')).performanceShortcut,
|
|
47
|
+
}),
|
|
43
48
|
lazyShortcut({
|
|
44
49
|
name: 'cowork',
|
|
45
50
|
description: '泛微E10协作区(协作事项/讨论/审批/共享权限)CLI',
|
|
@@ -199,46 +199,6 @@ const uploadSchema = objectSchema({
|
|
|
199
199
|
ocrMap: { type: 'string' },
|
|
200
200
|
fail: { const: false },
|
|
201
201
|
}, ['id', 'ids', 'fileType', 'totalPages', 'hasFanWei', 'fail']);
|
|
202
|
-
const browseFieldItemSchema = objectSchema({
|
|
203
|
-
optionId: { type: 'string' },
|
|
204
|
-
id: { type: 'string' },
|
|
205
|
-
fid: { type: 'string' },
|
|
206
|
-
type: { type: 'integer' },
|
|
207
|
-
typeName: { type: 'string' },
|
|
208
|
-
number: { type: 'string' },
|
|
209
|
-
code: { type: 'string' },
|
|
210
|
-
content: { type: 'string' },
|
|
211
|
-
name: { type: 'string' },
|
|
212
|
-
total: { type: 'string' },
|
|
213
|
-
ttax: { type: 'string' },
|
|
214
|
-
seller: { type: 'string' },
|
|
215
|
-
sellerId: { type: 'string' },
|
|
216
|
-
buyer: { type: 'string' },
|
|
217
|
-
buyerId: { type: 'string' },
|
|
218
|
-
incDate: { type: 'string' },
|
|
219
|
-
incDateTimestamp: { type: 'integer' },
|
|
220
|
-
validStatus: { type: 'string' },
|
|
221
|
-
source: { type: 'string' },
|
|
222
|
-
invoiceStatus: { type: 'integer' },
|
|
223
|
-
del: { type: 'integer' },
|
|
224
|
-
currency: { type: 'string' },
|
|
225
|
-
currencyName: { type: 'string' },
|
|
226
|
-
taxRate: { type: 'string' },
|
|
227
|
-
consumeContent: { type: 'string' },
|
|
228
|
-
fylx: { type: 'string' },
|
|
229
|
-
inputDate: { type: 'string' },
|
|
230
|
-
incTotal: { type: 'number' },
|
|
231
|
-
reimingMoney: { type: 'string' },
|
|
232
|
-
reimedMoney: { type: 'string' },
|
|
233
|
-
notReimMoney: { type: 'string' },
|
|
234
|
-
reimDate: { type: 'string' },
|
|
235
|
-
reimProcess: { type: 'string' },
|
|
236
|
-
}, ['optionId', 'id', 'fid', 'type', 'typeName', 'number', 'content', 'name', 'total']);
|
|
237
|
-
const browseFieldErrorSchema = objectSchema({
|
|
238
|
-
fid: { type: 'string' },
|
|
239
|
-
ret: { type: 'integer' },
|
|
240
|
-
message: { type: 'string' },
|
|
241
|
-
}, ['ret', 'message']);
|
|
242
202
|
const continuationSchema = { type: 'string', minLength: 1 };
|
|
243
203
|
const continuationPreviewOutput = (previewSchema, extra = {}) => objectSchema({
|
|
244
204
|
preview: previewSchema,
|
|
@@ -850,26 +810,6 @@ export const invoiceOperations = [
|
|
|
850
810
|
},
|
|
851
811
|
outputSchema: deleteApplyOutputSchema,
|
|
852
812
|
},
|
|
853
|
-
{
|
|
854
|
-
name: 'invoice.browse-field.data',
|
|
855
|
-
risk: 'read',
|
|
856
|
-
fixed: { source: 'POST /api/inc/get', mask: 0, userFlag: '1', isDelFlag: '1' },
|
|
857
|
-
inputSchema: {
|
|
858
|
-
type: 'object',
|
|
859
|
-
additionalProperties: false,
|
|
860
|
-
properties: {
|
|
861
|
-
fid: positiveId,
|
|
862
|
-
fids: positiveIdArray,
|
|
863
|
-
detail: { type: 'object' },
|
|
864
|
-
},
|
|
865
|
-
oneOf: [{ required: ['fid'] }, { required: ['fids'] }, { required: ['detail'] }],
|
|
866
|
-
},
|
|
867
|
-
outputSchema: objectSchema({
|
|
868
|
-
items: arrayOf(browseFieldItemSchema),
|
|
869
|
-
errors: arrayOf(browseFieldErrorSchema),
|
|
870
|
-
workflow: workflowSchema,
|
|
871
|
-
}, ['items', 'errors', 'workflow']),
|
|
872
|
-
},
|
|
873
813
|
{
|
|
874
814
|
name: 'invoice.reim.file-ocr.preview',
|
|
875
815
|
risk: 'read-with-upload',
|
|
@@ -980,6 +920,34 @@ export const invoiceOperations = [
|
|
|
980
920
|
workflow: workflowSchema,
|
|
981
921
|
}, ['result', 'data', 'keywords', 'match', 'items', 'workflow']),
|
|
982
922
|
},
|
|
923
|
+
{
|
|
924
|
+
name: 'invoice.reim.customer.search',
|
|
925
|
+
risk: 'read',
|
|
926
|
+
fixed: {
|
|
927
|
+
path: '/api/ebuilder/coms/nlist/getData',
|
|
928
|
+
method: 'POST',
|
|
929
|
+
headers: { ebbusinessid: '1218181956452048911', langtype: 'zh_CN', pragma: 'no-cache', priority: 'u=1, i', timezoneoffset: '-480', Accept: '*/*' },
|
|
930
|
+
compId: 'c39b9e14c0034336adf9e9bc39aeed75',
|
|
931
|
+
pageId: '1218181956452048911',
|
|
932
|
+
pageNo: '1',
|
|
933
|
+
tableuid: 'd26c94cc9c234d7da9bc2d399339a439',
|
|
934
|
+
filter: '客户表「名称」字段 field_1173221220888062665 模糊匹配 keywords;其他筛选参数固定',
|
|
935
|
+
},
|
|
936
|
+
inputSchema: objectSchema({
|
|
937
|
+
keywords: { type: 'string', minLength: 1, description: '用户输入的客户名称,支持模糊名称;不需要报销表单或字段 ID' },
|
|
938
|
+
}, ['keywords']),
|
|
939
|
+
outputSchema: objectSchema({
|
|
940
|
+
list: arrayOf(objectSchema({
|
|
941
|
+
id: { type: 'string', description: '相关客户 ID' },
|
|
942
|
+
'1173221220888062665': { type: 'string', description: '相关客户名称' },
|
|
943
|
+
'1173221220888062667': arrayOf(objectSchema({
|
|
944
|
+
name: { type: 'string', description: '承担主体名称' },
|
|
945
|
+
id: { type: 'string', description: '承担主体 ID' },
|
|
946
|
+
type: { type: 'string' },
|
|
947
|
+
}, ['name', 'id', 'type'])),
|
|
948
|
+
}, ['id', '1173221220888062665', '1173221220888062667'])),
|
|
949
|
+
}, ['list']),
|
|
950
|
+
},
|
|
983
951
|
{
|
|
984
952
|
name: 'invoice.reim.relation.search',
|
|
985
953
|
risk: 'read',
|
|
@@ -1205,12 +1173,12 @@ export const invoiceRetiredOperations = [
|
|
|
1205
1173
|
},
|
|
1206
1174
|
{
|
|
1207
1175
|
name: 'invoice.reim.row-info',
|
|
1208
|
-
replacement: '
|
|
1176
|
+
replacement: '明细行不再预填:每行只写「相关发票」(直接使用已选发票的 id/name 引用对象),其余列由联动带出',
|
|
1209
1177
|
reference: REIM_REFERENCE,
|
|
1210
1178
|
},
|
|
1211
1179
|
{
|
|
1212
1180
|
name: 'invoice.reim.row-info-batch',
|
|
1213
|
-
replacement: '
|
|
1181
|
+
replacement: '明细行不再预填:每行只写「相关发票」(直接使用已选发票的 id/name 引用对象),其余列由联动带出',
|
|
1214
1182
|
reference: REIM_REFERENCE,
|
|
1215
1183
|
},
|
|
1216
1184
|
{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { invoiceValidationError } from '../errors.js';
|
|
2
2
|
import { invoiceOperations, invoiceRetiredOperations } from '../manifest.js';
|
|
3
3
|
import { InvoiceAddApplyOperation, InvoiceAddPrepareOperation } from './add.js';
|
|
4
|
-
import { InvoiceBrowseFieldDataOperation } from './browse-field.js';
|
|
5
4
|
import { InvoiceDeleteApplyOperation, InvoiceDeletePrepareOperation } from './delete.js';
|
|
6
5
|
import { InvoiceDownloadOperation } from './download.js';
|
|
7
6
|
import { InvoiceGetOperation } from './get.js';
|
|
@@ -12,6 +11,7 @@ import { InvoiceListOperation } from './list.js';
|
|
|
12
11
|
import { InvoiceOcrPreviewOperation } from './ocr-preview.js';
|
|
13
12
|
import { InvoiceReimEmployeeSuperiorsOperation, InvoiceReimFieldSearchOperation, InvoiceReimFileOcrPreviewOperation, InvoiceReimRequestsListOperation, InvoiceReimWorkflowResolveOperation, } from './reim.js';
|
|
14
13
|
import { InvoiceReimCandidatesListOperation } from './reim-auto.js';
|
|
14
|
+
import { InvoiceReimCustomerSearchOperation } from './reim-customer.js';
|
|
15
15
|
import { InvoiceReimRelationListOperation, InvoiceReimRelationSaveOperation, InvoiceReimRelationSearchOperation, } from './reim-relation.js';
|
|
16
16
|
import { InvoiceReimSubsidySubmitOperation } from './reim-subsidy.js';
|
|
17
17
|
import { InvoiceUpdateApplyOperation, InvoiceUpdatePrepareOperation } from './update.js';
|
|
@@ -35,13 +35,13 @@ function buildRegistry() {
|
|
|
35
35
|
new InvoiceDownloadOperation(),
|
|
36
36
|
new InvoiceDeletePrepareOperation(),
|
|
37
37
|
new InvoiceDeleteApplyOperation(),
|
|
38
|
-
new InvoiceBrowseFieldDataOperation(),
|
|
39
38
|
new InvoiceReimFileOcrPreviewOperation(),
|
|
40
39
|
new InvoiceReimRequestsListOperation(),
|
|
41
40
|
new InvoiceReimWorkflowResolveOperation(),
|
|
42
41
|
new InvoiceReimCandidatesListOperation(),
|
|
43
42
|
new InvoiceReimEmployeeSuperiorsOperation(),
|
|
44
43
|
new InvoiceReimFieldSearchOperation(),
|
|
44
|
+
new InvoiceReimCustomerSearchOperation(),
|
|
45
45
|
new InvoiceReimRelationSearchOperation(),
|
|
46
46
|
new InvoiceReimRelationSaveOperation(),
|
|
47
47
|
new InvoiceReimRelationListOperation(),
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { InvoiceCliError, invoiceValidationError } from '../errors.js';
|
|
2
|
+
import { asNonEmptyString, assertBusinessSuccess } from './shared.js';
|
|
3
|
+
const CUSTOMER_PAGE_ID = '1218181956452048911';
|
|
4
|
+
const CUSTOMER_COMP_ID = 'c39b9e14c0034336adf9e9bc39aeed75';
|
|
5
|
+
const CUSTOMER_OBJECT_ID = '1173221220888059964';
|
|
6
|
+
const CUSTOMER_NAME_FIELD = '1173221220888062665';
|
|
7
|
+
const CUSTOMER_BEARER_FIELD = '1173221220888062667';
|
|
8
|
+
function customerFilter(keywords) {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
conditionType: 'or',
|
|
12
|
+
dataType: 'field',
|
|
13
|
+
id: 'f9bf956948e54ed58ac32988ff8a84c8',
|
|
14
|
+
conditionComId: `${CUSTOMER_COMP_ID}_quick_EXCLUDECACHE`,
|
|
15
|
+
filterFields: [{
|
|
16
|
+
compId: CUSTOMER_COMP_ID,
|
|
17
|
+
compType: 'Text',
|
|
18
|
+
dataset: {
|
|
19
|
+
isPhysical: true,
|
|
20
|
+
ebuilderDataConfig: { dataSetup: {}, type: 'FORM' },
|
|
21
|
+
detailTable: false,
|
|
22
|
+
groupId: 'weaver-ebuilder-form-service',
|
|
23
|
+
usage: 'all',
|
|
24
|
+
appId: '980180677416657173',
|
|
25
|
+
id: CUSTOMER_OBJECT_ID,
|
|
26
|
+
text: '客户',
|
|
27
|
+
type: 'LOGIC',
|
|
28
|
+
objType: 'physical',
|
|
29
|
+
},
|
|
30
|
+
fieldName: `field_${CUSTOMER_NAME_FIELD}`,
|
|
31
|
+
id: CUSTOMER_NAME_FIELD,
|
|
32
|
+
objId: CUSTOMER_OBJECT_ID,
|
|
33
|
+
type: 'String',
|
|
34
|
+
text: '名称',
|
|
35
|
+
}],
|
|
36
|
+
value: keywords,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
conditionComId: `${CUSTOMER_COMP_ID}_filter_EXCLUDECACHE`,
|
|
40
|
+
conditionType: 'and',
|
|
41
|
+
dataType: 'classification',
|
|
42
|
+
useConfig: true,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
function invalidResponse() {
|
|
47
|
+
throw new InvoiceCliError('api', 'reim_customer_search_invalid', '客户查询返回的数据格式不正确,无法确认相关客户和承担主体', { exitCode: 1 });
|
|
48
|
+
}
|
|
49
|
+
function record(value) {
|
|
50
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
51
|
+
return invalidResponse();
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function responseString(value) {
|
|
55
|
+
if (typeof value !== 'string' || !value.trim())
|
|
56
|
+
return invalidResponse();
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
function projectCustomer(value) {
|
|
60
|
+
const row = record(value);
|
|
61
|
+
const bearers = row[CUSTOMER_BEARER_FIELD] ?? [];
|
|
62
|
+
if (!Array.isArray(bearers))
|
|
63
|
+
return invalidResponse();
|
|
64
|
+
return {
|
|
65
|
+
id: responseString(row.id),
|
|
66
|
+
[CUSTOMER_NAME_FIELD]: responseString(row[CUSTOMER_NAME_FIELD]),
|
|
67
|
+
[CUSTOMER_BEARER_FIELD]: bearers.map((value) => {
|
|
68
|
+
const bearer = record(value);
|
|
69
|
+
return {
|
|
70
|
+
name: responseString(bearer.name),
|
|
71
|
+
id: responseString(bearer.id),
|
|
72
|
+
type: responseString(bearer.type),
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** 普通 / 差旅报销查客户时,同时取得该客户带出的承担主体。 */
|
|
78
|
+
export class InvoiceReimCustomerSearchOperation {
|
|
79
|
+
name = 'invoice.reim.customer.search';
|
|
80
|
+
async execute(input, { host }) {
|
|
81
|
+
if (Object.keys(input).some((key) => key !== 'keywords')) {
|
|
82
|
+
throw invoiceValidationError('input_invalid', '客户查询只接受 keywords,其他查询参数固定');
|
|
83
|
+
}
|
|
84
|
+
const keywords = asNonEmptyString(input.keywords, 'keywords');
|
|
85
|
+
const result = await host.invoiceMultipartRequest({
|
|
86
|
+
path: '/api/ebuilder/coms/nlist/getData',
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: {
|
|
89
|
+
ebbusinessid: CUSTOMER_PAGE_ID,
|
|
90
|
+
langtype: 'zh_CN',
|
|
91
|
+
pragma: 'no-cache',
|
|
92
|
+
priority: 'u=1, i',
|
|
93
|
+
timezoneoffset: '-480',
|
|
94
|
+
Accept: '*/*',
|
|
95
|
+
},
|
|
96
|
+
fields: {
|
|
97
|
+
filter: customerFilter(keywords),
|
|
98
|
+
compId: CUSTOMER_COMP_ID,
|
|
99
|
+
pageId: CUSTOMER_PAGE_ID,
|
|
100
|
+
pageNo: '1',
|
|
101
|
+
tableuid: 'd26c94cc9c234d7da9bc2d399339a439',
|
|
102
|
+
},
|
|
103
|
+
operation: this.name,
|
|
104
|
+
});
|
|
105
|
+
assertBusinessSuccess(result, 'reim_customer_search_failed', '搜索相关客户失败');
|
|
106
|
+
const list = record(record(result).data).list;
|
|
107
|
+
if (!Array.isArray(list))
|
|
108
|
+
return invalidResponse();
|
|
109
|
+
return { status: 'COMPLETE', data: { list: list.map(projectCustomer) } };
|
|
110
|
+
}
|
|
111
|
+
}
|