weaver-work-cli 0.1.50 → 0.1.53
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/README.md +1 -1
- package/dist/chunks/{attachment-content-EJYIOJPH.js → attachment-content-W3TSJC3Y.js} +3 -3
- package/dist/chunks/{chunk-BFKLQLBK.js → chunk-2J3XY4ED.js} +7 -7
- package/dist/chunks/{chunk-K67FODVC.js → chunk-6GCXWKG6.js} +1 -1
- package/dist/chunks/{chunk-WNJUGI2F.js → chunk-76PRVYH4.js} +1 -1
- package/dist/chunks/{chunk-RYFRGTUV.js → chunk-DEHJ7PMA.js} +4 -4
- package/dist/chunks/{chunk-3NCFFHB2.js → chunk-IF33CG4V.js} +1 -1
- package/dist/chunks/{chunk-YB3AJYPY.js → chunk-PE334WL3.js} +4 -4
- package/dist/chunks/{chunk-MCZG6HPM.js → chunk-QQXMHM3J.js} +2 -2
- package/dist/chunks/{chunk-7ECB22G3.js → chunk-U7ROML5E.js} +23 -23
- package/dist/chunks/{chunk-7AYQJSFY.js → chunk-WTLQGS6D.js} +2 -2
- package/dist/chunks/{chunk-6T53BSWZ.js → chunk-XPQN4E5O.js} +50 -19
- package/dist/chunks/{chunk-HARQF5IP.js → chunk-Z4G7LLDD.js} +25 -25
- package/dist/chunks/{conflict-C4UDHCWV.js → conflict-57WDJWL7.js} +2 -2
- package/dist/chunks/{contract-VUC6JOPG.js → contract-LJRAXVZU.js} +8587 -1421
- package/dist/chunks/{create-flow-6OG2LYBD.js → create-flow-3FMMZBCA.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-WP57TF2S.js → env-JYZE3BZB.js} +2 -2
- package/dist/chunks/{factory-VUXI7N5C.js → factory-66SCIKW3.js} +1 -1
- package/dist/chunks/{group-chat-UQRGXILK.js → group-chat-MNRYMLNG.js} +3 -3
- package/dist/chunks/{invoice-E7GOITEU.js → invoice-V7ZTITUO.js} +725 -205
- package/dist/chunks/{meeting-4BBLVAWM.js → meeting-IIY4UAJL.js} +10 -10
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-V4CHRQDI.js → registry-CJOVECZD.js} +1 -1
- package/dist/chunks/{registry-5CRCN2TV.js → registry-METZ2LWE.js} +10 -10
- package/dist/chunks/{room-recommend-AYR3UG7R.js → room-recommend-YFY7HTOF.js} +4 -4
- package/dist/chunks/{schedule-JZEFIXUS.js → schedule-6I63TERA.js} +4 -4
- package/dist/chunks/smart-extract-FOUYNIG3.js +2882 -0
- package/dist/chunks/{workflow-3ZAF2J5E.js → workflow-YHXFIU63.js} +1 -1
- package/dist/index.js +11 -6
- package/dist/shortcuts/contract/manifest.js +251 -0
- package/dist/shortcuts/contract/ooxml/docx-table.js +233 -0
- package/dist/shortcuts/contract/operations/card-action.js +1165 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +571 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/card.js +6 -5
- package/dist/shortcuts/contract/operations/docx-fillfromquote.js +532 -0
- package/dist/shortcuts/contract/operations/docx-verify.js +258 -0
- package/dist/shortcuts/contract/operations/elements-build.js +761 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +588 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/ledger.js +438 -0
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +104 -3
- package/dist/shortcuts/contract/operations/quote.js +131 -25
- package/dist/shortcuts/contract/operations/quotescreen.js +529 -0
- package/dist/shortcuts/contract/operations/registry.js +30 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/triage.js +1100 -0
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +200 -49
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +492 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +454 -0
- package/dist/shortcuts/workflow/operations/form.js +68 -33
- package/dist/shortcuts/workflow/operations/read.js +19 -1
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +3 -0
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +14 -1
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +16 -1
- package/skill-template/domains/qiyecheng.md +2 -0
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +223 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +47 -481
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +11 -11
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +32 -16
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +478 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +39 -61
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +18 -13
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -6
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -4
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +263 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +525 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +36 -0
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +80 -54
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +110 -14
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +19 -21
- package/skills/weaver-e10-jinchengda/references/orchestration.md +12 -12
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1 -6
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +2 -1
- package/skills/weaver-e10-qiyecheng/SKILL.md +37 -0
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +25 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +34 -27
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -42
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +180 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +106 -0
- package/skills/weaver-e10-workflow/references/workflow-create.md +6 -5
- package/skills/weaver-e10-workflow/references/workflow-edit.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +46 -33
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +12 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +91 -2
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +12 -12
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +136 -91
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +109 -23
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +0 -265
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +0 -588
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +0 -118
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 范文库(「合同范文管理」EB 表单)查询。
|
|
3
|
+
*
|
|
4
|
+
* 术语约定:今承达技能内「模板」等同于「范文」(模板 == 范文),
|
|
5
|
+
* 因此本文件服务的是**范文库**,与合同模板库(`contract.template.*` → `/api/ebd/contract/tplinfo/**`)
|
|
6
|
+
* 是两个互不相通的对象,取数链路与字段都不同,禁止互相代替。
|
|
7
|
+
*/
|
|
8
|
+
const MODEL_TEXT_OBJ_ID = '1290191829260230657';
|
|
9
|
+
const MODEL_TEXT_LIST_ID = '1290191833571975256';
|
|
10
|
+
const LIST_DATAS_PATH = '/api/ebuilder/form/list/getListDatas';
|
|
11
|
+
function dataOf(value) {
|
|
12
|
+
return value?.data ?? {};
|
|
13
|
+
}
|
|
14
|
+
/** 列表接口在不同环境下会把行放在 data / rows / records / list,按出现顺序取第一个数组。 */
|
|
15
|
+
function rowsOf(value) {
|
|
16
|
+
const data = dataOf(value);
|
|
17
|
+
for (const candidate of [data.data, data.rows, data.records, data.list]) {
|
|
18
|
+
if (Array.isArray(candidate))
|
|
19
|
+
return candidate;
|
|
20
|
+
}
|
|
21
|
+
return Array.isArray(data) ? data : [];
|
|
22
|
+
}
|
|
23
|
+
/** 真实总数:部分接口把总数放在 pagination.mainRecordTotal,total 恒为 0 时以它为准。 */
|
|
24
|
+
function totalOf(value, rows) {
|
|
25
|
+
const data = dataOf(value);
|
|
26
|
+
const candidates = [
|
|
27
|
+
data.total,
|
|
28
|
+
data.count,
|
|
29
|
+
data.pagination?.mainRecordTotal,
|
|
30
|
+
data.pagination?.total,
|
|
31
|
+
];
|
|
32
|
+
for (const candidate of candidates) {
|
|
33
|
+
const parsed = Number(candidate);
|
|
34
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
37
|
+
return rows.length;
|
|
38
|
+
}
|
|
39
|
+
const PERSON_NAME_KEYS = ['name', 'label', 'text', 'showName', 'userName', 'username'];
|
|
40
|
+
/** creator / updater 是 JSON 数组字符串([{id,name}]),偶发是纯名称;只输出姓名,绝不透出人员 ID。 */
|
|
41
|
+
function personName(value) {
|
|
42
|
+
if (typeof value !== 'string' || !value)
|
|
43
|
+
return undefined;
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(value);
|
|
46
|
+
if (Array.isArray(parsed) && parsed.length) {
|
|
47
|
+
const first = parsed[0];
|
|
48
|
+
if (typeof first === 'string' && first && !/^\d+$/.test(first))
|
|
49
|
+
return first;
|
|
50
|
+
if (first && typeof first === 'object') {
|
|
51
|
+
for (const key of PERSON_NAME_KEYS) {
|
|
52
|
+
const candidate = first[key];
|
|
53
|
+
if (typeof candidate === 'string' && candidate && !/^\d+$/.test(candidate))
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// 非 JSON 时按纯名称处理
|
|
61
|
+
}
|
|
62
|
+
return /^\d+$/.test(value) ? undefined : value;
|
|
63
|
+
}
|
|
64
|
+
async function listModelText(host, pageNo, pageSize, tableuid) {
|
|
65
|
+
const value = await host.contractRequest({
|
|
66
|
+
method: 'POST',
|
|
67
|
+
path: LIST_DATAS_PATH,
|
|
68
|
+
// ebbusinessid 与 listId 同值,缺它接口取不到该视图的业务上下文。
|
|
69
|
+
headers: { ebbusinessid: MODEL_TEXT_LIST_ID },
|
|
70
|
+
query: { passid: MODEL_TEXT_OBJ_ID, cid: MODEL_TEXT_OBJ_ID },
|
|
71
|
+
body: {
|
|
72
|
+
current: pageNo,
|
|
73
|
+
requiredMatch: 1,
|
|
74
|
+
tableuid: tableuid ?? '',
|
|
75
|
+
mapResult: '1',
|
|
76
|
+
recheckQuery: '1',
|
|
77
|
+
terminal: 'PC',
|
|
78
|
+
searchParamData: {
|
|
79
|
+
type: 'and',
|
|
80
|
+
searchType: '2',
|
|
81
|
+
commonSearchFields: {},
|
|
82
|
+
groupFields: {},
|
|
83
|
+
},
|
|
84
|
+
listId: MODEL_TEXT_LIST_ID,
|
|
85
|
+
isFollow: 0,
|
|
86
|
+
isShareToMe: 0,
|
|
87
|
+
filterCondition: {},
|
|
88
|
+
browser: 'Chrome',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
const rows = rowsOf(value);
|
|
92
|
+
return { rows, total: totalOf(value, rows) };
|
|
93
|
+
}
|
|
94
|
+
/** 范文库列表;本技能内「模板」=「范文」,查模板即查范文。 */
|
|
95
|
+
export const contractModelTextListOperation = {
|
|
96
|
+
name: 'contract.modeltext.list',
|
|
97
|
+
async execute(input, { host }) {
|
|
98
|
+
const pageNo = typeof input.pageNo === 'number' && input.pageNo >= 1 ? input.pageNo : 1;
|
|
99
|
+
const pageSize = typeof input.pageSize === 'number' && input.pageSize >= 1
|
|
100
|
+
? Math.min(input.pageSize, 200)
|
|
101
|
+
: 50;
|
|
102
|
+
const tableuid = typeof input.tableuid === 'string' && input.tableuid.trim()
|
|
103
|
+
? input.tableuid.trim()
|
|
104
|
+
: undefined;
|
|
105
|
+
const { rows, total } = await listModelText(host, pageNo, pageSize, tableuid);
|
|
106
|
+
const session = await host.getSession();
|
|
107
|
+
return {
|
|
108
|
+
status: 'COMPLETE',
|
|
109
|
+
data: {
|
|
110
|
+
path: LIST_DATAS_PATH,
|
|
111
|
+
listUrl: `${session.baseUrl}/sp/ebdfpage/list/${MODEL_TEXT_LIST_ID}`,
|
|
112
|
+
total,
|
|
113
|
+
pageNo,
|
|
114
|
+
pageSize,
|
|
115
|
+
returned: rows.length,
|
|
116
|
+
modelTexts: rows.map((row) => ({
|
|
117
|
+
id: row.id ?? row.rowKey ?? row.form_data_id,
|
|
118
|
+
fileName: row.file_name,
|
|
119
|
+
classification: row.classification_id,
|
|
120
|
+
createTime: row.create_time,
|
|
121
|
+
updateTime: row.update_time,
|
|
122
|
+
creator: personName(row.creator),
|
|
123
|
+
updater: personName(row.updater),
|
|
124
|
+
})),
|
|
125
|
+
hint: '本命令读的是范文库(「合同范文管理」);本技能内「模板」== 「范文」,不要与合同模板库 contract.template.list 混用',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
export const contractModelTextOperations = [
|
|
131
|
+
contractModelTextListOperation,
|
|
132
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* operation 解析器中转(避免 registry ↔ 编排层循环依赖)。
|
|
3
|
+
*
|
|
4
|
+
* 背景:编排层需要在**进程内**调用其它 operation(省掉子进程启动开销),
|
|
5
|
+
* 但直接 `import { getContractOperation } from './registry.js'` 会与 registry
|
|
6
|
+
* 形成循环依赖:registry 加载时导入编排层,编排层又反向导入 registry。
|
|
7
|
+
* 虽然函数声明会被提升、实际调用发生在 execute 阶段,但依赖加载顺序在打包
|
|
8
|
+
* 与不同运行时下并不完全等价,属于不该赌的隐性风险。
|
|
9
|
+
*
|
|
10
|
+
* 因此这里只放一个可变引用:registry 完成构建后注入解析器,编排层通过
|
|
11
|
+
* `resolveOperation` 取用。本文件不导入 registry,循环即被切断。
|
|
12
|
+
*/
|
|
13
|
+
let resolver = null;
|
|
14
|
+
export function setOperationResolver(fn) {
|
|
15
|
+
resolver = fn;
|
|
16
|
+
}
|
|
17
|
+
export function resolveOperation(name) {
|
|
18
|
+
if (!resolver) {
|
|
19
|
+
throw new Error(`contract operation resolver 尚未注入:${name}`);
|
|
20
|
+
}
|
|
21
|
+
return resolver(name);
|
|
22
|
+
}
|
|
@@ -24,6 +24,58 @@ const EBDF_LIST_PAGE_IDS = {
|
|
|
24
24
|
'渠道订单-商务': '881211329321197671',
|
|
25
25
|
};
|
|
26
26
|
const NULL_OPS = new Set(['isNull', 'isNotNull']);
|
|
27
|
+
/**
|
|
28
|
+
* 台账页(`@weapp/contract` 的 LedgerPage)标签映射(2026-11-13 用户确认)。
|
|
29
|
+
*
|
|
30
|
+
* 只有这四个菜单在台账页有对应标签;「合同收款」「项目验收」没有标签,继续用 ebdf 列表卡。
|
|
31
|
+
* 渠道订单默认落 e-teams(etOrder),用户可在页面自行切到 e-office。
|
|
32
|
+
*/
|
|
33
|
+
const LEDGER_VIEW_KEYS = {
|
|
34
|
+
'直销合同': 'ecology',
|
|
35
|
+
'直销业绩': 'directPerf',
|
|
36
|
+
'渠道订单': 'etOrder',
|
|
37
|
+
'渠道订单-商务': 'agree',
|
|
38
|
+
};
|
|
39
|
+
/** catalog 字段中文名 → 台账 filters 键(来源:组件说明「默认筛选」)。 */
|
|
40
|
+
const LEDGER_FILTER_LABELS = {
|
|
41
|
+
ecology: {
|
|
42
|
+
'客户名称': 'khmc',
|
|
43
|
+
'合同编号': 'hth',
|
|
44
|
+
'合同号': 'hth',
|
|
45
|
+
'合同名称': 'htmc',
|
|
46
|
+
'签订时间': 'qdrq',
|
|
47
|
+
'合同总金额': 'htzje',
|
|
48
|
+
'销售类型': 'xslx',
|
|
49
|
+
'销售经理': 'xsjl2',
|
|
50
|
+
'大区': 'qy2',
|
|
51
|
+
'核算机构': 'hsjg',
|
|
52
|
+
},
|
|
53
|
+
directPerf: {
|
|
54
|
+
'合同号': 'hth',
|
|
55
|
+
'合同编号': 'hth',
|
|
56
|
+
'客户名称': 'khmc',
|
|
57
|
+
'核算业绩年月': 'yjny',
|
|
58
|
+
'销售经理': 'xsjl',
|
|
59
|
+
'团队负责人': 'tdfzr',
|
|
60
|
+
'机构负责人': 'jgfzr',
|
|
61
|
+
},
|
|
62
|
+
agree: {
|
|
63
|
+
'代理商名称': 'dls',
|
|
64
|
+
'协议编号': 'xyh',
|
|
65
|
+
'签约日期': 'qdrq',
|
|
66
|
+
'合同总金额': 'htzje',
|
|
67
|
+
'代理结束日期': 'sqjsrq',
|
|
68
|
+
},
|
|
69
|
+
etOrder: {
|
|
70
|
+
'客户名称': 'khmc',
|
|
71
|
+
'合同类型': 'htzl',
|
|
72
|
+
'区域': 'qy3',
|
|
73
|
+
'签订日期': 'qdrq',
|
|
74
|
+
'合同总金额': 'htzje',
|
|
75
|
+
'事业合伙人': 'syhhr',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const LEDGER_ROUTE = '/sp/contract/ledger';
|
|
27
79
|
function catalog() {
|
|
28
80
|
return PERFORMANCE_CATALOG;
|
|
29
81
|
}
|
|
@@ -202,20 +254,69 @@ function buildQuery(menu, conditions, origin) {
|
|
|
202
254
|
if (!listPageId) {
|
|
203
255
|
throw contractValidationError('list_page_missing', `catalog 未记录「${menu.name}」的 ebdf 列表 pageId,无法组件化打开。`);
|
|
204
256
|
}
|
|
257
|
+
const viewKey = LEDGER_VIEW_KEYS[menu.name];
|
|
205
258
|
return {
|
|
206
259
|
menu: menu.name,
|
|
207
260
|
url,
|
|
208
261
|
filters,
|
|
209
262
|
needs_ui: needsUi,
|
|
210
263
|
warnings,
|
|
211
|
-
card:
|
|
264
|
+
card: viewKey
|
|
265
|
+
? buildLedgerCard(menu, origin, viewKey, filters)
|
|
266
|
+
: buildEbdfListCard(menu, origin, listPageId, filters),
|
|
212
267
|
page_verified: false,
|
|
213
268
|
execution: needsUi.length ? 'manual-page-filter' : 'filtered-link',
|
|
214
269
|
};
|
|
215
270
|
}
|
|
216
271
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
272
|
+
* 台账页组件卡:fill_form + e10 + @weapp/contract 的 LedgerPage。
|
|
273
|
+
* viewKey 决定第一次打开的标签;filters 第一层 key 就是 viewKey。
|
|
274
|
+
* 只映射台账页白名单内的字段,其余条件已进 needs_ui 交用户补填。
|
|
275
|
+
*/
|
|
276
|
+
function buildLedgerCard(menu, origin, viewKey, filters) {
|
|
277
|
+
const labelMap = LEDGER_FILTER_LABELS[viewKey] ?? {};
|
|
278
|
+
const inner = {};
|
|
279
|
+
for (const f of filters) {
|
|
280
|
+
const label = typeof f.field === 'string' ? f.field : '';
|
|
281
|
+
const key = labelMap[label];
|
|
282
|
+
if (!key)
|
|
283
|
+
continue;
|
|
284
|
+
const value = f.value;
|
|
285
|
+
if (Array.isArray(value)) {
|
|
286
|
+
if (value.length !== 2 || value.some((item) => typeof item !== 'string'))
|
|
287
|
+
continue;
|
|
288
|
+
inner[key] = [value[0], value[1]];
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (typeof value === 'string' && value !== '')
|
|
292
|
+
inner[key] = value;
|
|
293
|
+
}
|
|
294
|
+
const now = new Date();
|
|
295
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
296
|
+
const callId = `ledger-${menu.name}-${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}-01`;
|
|
297
|
+
return {
|
|
298
|
+
version: 1,
|
|
299
|
+
callId,
|
|
300
|
+
toolId: 'fill_form',
|
|
301
|
+
arguments: {
|
|
302
|
+
type: 'e10',
|
|
303
|
+
title: menu.name,
|
|
304
|
+
src: `${origin}${LEDGER_ROUTE}`,
|
|
305
|
+
width: 1300,
|
|
306
|
+
sdkRenderType: 'inline',
|
|
307
|
+
sdkOptions: {
|
|
308
|
+
compName: 'ui.CorsComponent',
|
|
309
|
+
routerType: 'MemoryRouter',
|
|
310
|
+
routerProps_pc: { initialEntries: [LEDGER_ROUTE] },
|
|
311
|
+
params_pc: { app: '@weapp/contract', compName: 'LedgerPage' },
|
|
312
|
+
params: { viewKey, filters: { [viewKey]: inner } },
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* 台账页没有标签的两个菜单(合同收款、项目验收)继续用 ebdf 列表页组件卡打开
|
|
319
|
+
* (fill_form + e10 + sdkOptions)。
|
|
219
320
|
* comParams 键必须是 field_<字段id>,值必须是字符串;无法序列化的条件留在 needs_ui 交用户补填。
|
|
220
321
|
*/
|
|
221
322
|
function buildEbdfListCard(menu, origin, listPageId, filters) {
|
|
@@ -117,6 +117,88 @@ function fmtNum(v) {
|
|
|
117
117
|
return String(v);
|
|
118
118
|
return f === Math.trunc(f) ? f.toLocaleString('en-US') : f.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
119
119
|
}
|
|
120
|
+
const META_FIELDS = [
|
|
121
|
+
{
|
|
122
|
+
key: 'customer',
|
|
123
|
+
labels: ['客户名称', '客户全称', '客户单位', '用户名称', '甲方名称', '采购方', '购买方', '订购方', '最终用户', '客户', '甲方', '需方'],
|
|
124
|
+
valid: (v) => v.length >= 2 && v.length <= 80 && /[\u4e00-\u9fa5A-Za-z]/u.test(v),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: 'quote_date',
|
|
128
|
+
labels: ['报价日期', '报价时间', '报价日'],
|
|
129
|
+
valid: (v) => /\d{4}/u.test(v),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: 'sales',
|
|
133
|
+
labels: ['客户经理', '销售经理', '销售代表', '报价人', '商务经理'],
|
|
134
|
+
valid: (v) => v.length >= 1 && v.length <= 30 && !/^\d+$/u.test(v),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'phone',
|
|
138
|
+
labels: ['联系电话', '联系方式', '客户电话', '手机号码', '手机'],
|
|
139
|
+
valid: (v) => /^[\d\-+() ]{6,}$/u.test(v.replace(/\s+/gu, '')),
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
function escapeRe(s) {
|
|
143
|
+
return s.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
144
|
+
}
|
|
145
|
+
/** 值本身是另一个字段的标签(如「客户经理:」)时不能当值用。 */
|
|
146
|
+
function isLabelLike(v) {
|
|
147
|
+
const bare = v.trim().replace(/[::]$/u, '').trim();
|
|
148
|
+
if (!bare)
|
|
149
|
+
return true;
|
|
150
|
+
return META_FIELDS.some((f) => f.labels.includes(bare));
|
|
151
|
+
}
|
|
152
|
+
function cleanMetaValue(v) {
|
|
153
|
+
return v.replace(/^[\s::\-—_]+/u, '').replace(/[\s::]+$/u, '').trim();
|
|
154
|
+
}
|
|
155
|
+
function extractQuoteMeta(rows) {
|
|
156
|
+
const meta = { customer: '', quote_date: '', sales: '', phone: '' };
|
|
157
|
+
const bestScore = {};
|
|
158
|
+
const consider = (field, raw, score) => {
|
|
159
|
+
const v = cleanMetaValue(raw);
|
|
160
|
+
if (!v || isLabelLike(v) || !field.valid(v))
|
|
161
|
+
return;
|
|
162
|
+
if (score > (bestScore[field.key] ?? 0)) {
|
|
163
|
+
meta[field.key] = v;
|
|
164
|
+
bestScore[field.key] = score;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
for (let r = 0; r < rows.length; r++) {
|
|
168
|
+
const row = rows[r] ?? [];
|
|
169
|
+
for (let c = 0; c < row.length; c++) {
|
|
170
|
+
const cell = cleanMetaValue(row[c] ?? '');
|
|
171
|
+
if (!cell)
|
|
172
|
+
continue;
|
|
173
|
+
for (const field of META_FIELDS) {
|
|
174
|
+
for (const label of field.labels) {
|
|
175
|
+
// ① 同格内联:标签在本格开头,冒号后即值
|
|
176
|
+
const inline = new RegExp(`^${escapeRe(label)}\\s*[::]\\s*(.+)$`, 'u').exec(cell);
|
|
177
|
+
if (inline && inline[1]) {
|
|
178
|
+
consider(field, inline[1], 100);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// 标签独占一格(可带冒号)→ 右邻格 / 下邻格
|
|
182
|
+
if (cell.replace(/[::]$/u, '').trim() !== label)
|
|
183
|
+
continue;
|
|
184
|
+
for (let j = c + 1; j < row.length; j++) {
|
|
185
|
+
const v = cleanMetaValue(row[j] ?? '');
|
|
186
|
+
if (!v)
|
|
187
|
+
continue;
|
|
188
|
+
if (isLabelLike(v))
|
|
189
|
+
break; // 撞到下一个标签,说明本字段确实没值
|
|
190
|
+
consider(field, v, 95);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
const below = cleanMetaValue(rows[r + 1]?.[c] ?? '');
|
|
194
|
+
if (below && !isLabelLike(below))
|
|
195
|
+
consider(field, below, 80);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return meta;
|
|
201
|
+
}
|
|
120
202
|
export function parseQuote(buffer, sheetName, keepRemark = false, includeZero = false) {
|
|
121
203
|
const names = listSheetNames(buffer);
|
|
122
204
|
if (names.length === 0)
|
|
@@ -166,25 +248,8 @@ export function parseQuote(buffer, sheetName, keepRemark = false, includeZero =
|
|
|
166
248
|
return i;
|
|
167
249
|
return null;
|
|
168
250
|
};
|
|
169
|
-
// ----
|
|
170
|
-
const meta =
|
|
171
|
-
for (const row of rows) {
|
|
172
|
-
const joined = row.join('');
|
|
173
|
-
for (const [label, key] of [['客户名称', 'customer'], ['报价日期', 'quote_date'], ['客户经理', 'sales'], ['联系电话', 'phone']]) {
|
|
174
|
-
if (!joined.includes(label) || meta[key])
|
|
175
|
-
continue;
|
|
176
|
-
const i = firstIdx(row, [label + ':', label + ':', label]);
|
|
177
|
-
if (i === null)
|
|
178
|
-
continue;
|
|
179
|
-
for (let j = i + 1; j < row.length; j++) {
|
|
180
|
-
const v = row[j];
|
|
181
|
-
if (v && v.replace(/[::]$/u, '') !== label && !['报价日期', '客户经理', '联系电话'].some((x) => v.startsWith(x))) {
|
|
182
|
-
meta[key] = v.replace(/[::]$/u, '');
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
251
|
+
// ---- 元信息:同格内联 / 分列 / 竖排 / 同行多字段,统一走 extractQuoteMeta
|
|
252
|
+
const meta = extractQuoteMeta(rows);
|
|
188
253
|
// ---- 项目总价区
|
|
189
254
|
const totals = {};
|
|
190
255
|
for (const row of rows) {
|
|
@@ -298,8 +363,12 @@ export function parseQuote(buffer, sheetName, keepRemark = false, includeZero =
|
|
|
298
363
|
if (final !== undefined && standard !== undefined && final !== standard) {
|
|
299
364
|
warnings.push(`存在折扣:标准价 ${standard} → 最终优惠报价 ${final},合同金额应以最终优惠报价为准`);
|
|
300
365
|
}
|
|
301
|
-
|
|
302
|
-
|
|
366
|
+
// 2026-11-12:已覆盖同格内联、分列、竖排三种形态;仍取不到才告警,
|
|
367
|
+
// 且只报「未能自动定位」——不得断言「未填写」,也不得据此向用户索要。
|
|
368
|
+
if (!meta.customer) {
|
|
369
|
+
warnings.push('未能自动定位『客户名称』(已尝试标签同格内联、右邻格、下邻格三种形态)。' +
|
|
370
|
+
'这不代表文件未填写:请用 contract.quote.extract 取原始网格行,由模型在网格中确认客户全称后再交用户核对。');
|
|
371
|
+
}
|
|
303
372
|
return { source_sheet: sheet, available_sheets: names, meta, totals, sections, checks, warnings };
|
|
304
373
|
}
|
|
305
374
|
// ---------------------------------------------------------------- docx 报价书解析
|
|
@@ -490,8 +559,10 @@ export function normalizeParsedQuote(input) {
|
|
|
490
559
|
if (t)
|
|
491
560
|
meta[k] = t;
|
|
492
561
|
}
|
|
493
|
-
if (!meta.customer)
|
|
494
|
-
warnings.push('
|
|
562
|
+
if (!meta.customer) {
|
|
563
|
+
warnings.push('未从报价书中识别到客户名称(可能写法非常规)。这不代表文件未填写:'
|
|
564
|
+
+ '请由模型从原文确认客户全称后再交用户核对。');
|
|
565
|
+
}
|
|
495
566
|
return {
|
|
496
567
|
source_sheet: 'docx',
|
|
497
568
|
available_sheets: ['正文'],
|
|
@@ -681,14 +752,49 @@ export const contractQuoteOperations = [
|
|
|
681
752
|
type: 'object',
|
|
682
753
|
additionalProperties: false,
|
|
683
754
|
properties: {
|
|
684
|
-
path: { type: 'string', description: '.docx 报价书路径' },
|
|
755
|
+
path: { type: 'string', description: '.docx / .xlsx 报价书路径' },
|
|
756
|
+
sheet: { type: 'string', description: '.xlsx 工作表名(可选,默认第一个)' },
|
|
685
757
|
},
|
|
686
758
|
required: ['path'],
|
|
687
759
|
},
|
|
688
760
|
async execute(input) {
|
|
689
761
|
const path = resolve(String(input.path));
|
|
762
|
+
// 2026-11-11:xlsx 也必须能无损提取。xlsx 是 ZIP 内的 XML,模型无法直读,
|
|
763
|
+
// 所以「解包 + 单元格还原成文本」这层必须由代码完成;
|
|
764
|
+
// 但语义判定(客户名在哪、哪张表是汇总、税率)一律交模型。
|
|
765
|
+
if (/\.xlsx$/iu.test(path)) {
|
|
766
|
+
const buf = readFileSync(path);
|
|
767
|
+
const sheets = listSheetNames(buf);
|
|
768
|
+
const wanted = input.sheet ? String(input.sheet) : '';
|
|
769
|
+
const idx = wanted ? Math.max(0, sheets.indexOf(wanted)) : 0;
|
|
770
|
+
const grid = readGrid(buf, idx);
|
|
771
|
+
const rows = [];
|
|
772
|
+
for (let r = 1; r <= grid.maxRow; r++) {
|
|
773
|
+
const line = [];
|
|
774
|
+
const rowMap = grid.values.get(r);
|
|
775
|
+
for (let c = 1; c <= grid.maxCol; c++) {
|
|
776
|
+
line.push(rowMap?.get(c)?.text ?? '');
|
|
777
|
+
}
|
|
778
|
+
rows.push(line);
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
status: 'DONE',
|
|
782
|
+
data: {
|
|
783
|
+
kind: 'xlsx',
|
|
784
|
+
sheet: sheets[idx] ?? null,
|
|
785
|
+
sheets,
|
|
786
|
+
rows,
|
|
787
|
+
counts: {
|
|
788
|
+
rows: rows.length,
|
|
789
|
+
cols: rows.reduce((m, r) => Math.max(m, r.length), 0),
|
|
790
|
+
},
|
|
791
|
+
note: '零语义判断:只还原单元格文本。请模型读 rows 判定 meta(客户全称/日期/税率等)、'
|
|
792
|
+
+ '哪张表是汇总表(is_summary=true),产出 JSON 后交 contract.quote.normalize 校验金额。',
|
|
793
|
+
},
|
|
794
|
+
};
|
|
795
|
+
}
|
|
690
796
|
if (!/\.docx$/iu.test(path)) {
|
|
691
|
-
throw contractValidationError('file_type_unsupported', '
|
|
797
|
+
throw contractValidationError('file_type_unsupported', '无损提取支持 .xlsx / .docx;.xls / .doc 老格式请先另存为新格式。');
|
|
692
798
|
}
|
|
693
799
|
const extracted = extractQuoteDocx(readFileSync(path));
|
|
694
800
|
return { status: 'DONE', data: extracted };
|