@bpmn-nova/studio 0.4.0 → 0.4.1
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/flow-tree.d.ts +4 -0
- package/dist/flow-tree.js +14 -0
- package/dist/modules/flow-tree/controller.js +364 -0
- package/dist/modules/flow-tree/index.d.ts +248 -0
- package/dist/modules/flow-tree/index.js +5 -0
- package/dist/modules/flow-tree/operations.js +484 -0
- package/dist/modules/flow-tree/sample.js +445 -0
- package/dist/modules/flow-tree/schema.js +588 -0
- package/dist/modules/flow-tree/validate.js +125 -0
- package/dist/modules/flow-tree-bpmn/compiler.js +547 -0
- package/dist/modules/flow-tree-bpmn/decompiler.js +524 -0
- package/dist/modules/flow-tree-bpmn/expression.js +135 -0
- package/dist/modules/flow-tree-bpmn/index.d.ts +53 -0
- package/dist/modules/flow-tree-bpmn/index.js +14 -0
- package/dist/modules/flow-tree-renderer/canvas.js +1003 -0
- package/dist/modules/flow-tree-renderer/export-svg.js +325 -0
- package/dist/modules/flow-tree-renderer/index.d.ts +143 -0
- package/dist/modules/flow-tree-renderer/index.js +3 -0
- package/dist/modules/flow-tree-renderer/shell.js +970 -0
- package/dist/modules/i18n/locales/en-US.js +399 -0
- package/dist/modules/i18n/locales/zh-CN.js +399 -0
- package/dist/modules/icons/index.js +23 -0
- package/dist/modules/properties-flow-tree/index.d.ts +56 -0
- package/dist/modules/properties-flow-tree/index.js +2 -0
- package/dist/modules/properties-flow-tree/panel.js +1136 -0
- package/dist/modules/properties-flow-tree/widgets.js +625 -0
- package/dist/modules/viewer/index.js +10 -2
- package/dist/styles.css +2368 -0
- package/llms-full.txt +353 -9
- package/llms.txt +3 -2
- package/package.json +6 -1
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { resolveI18n } from '../i18n/index.js';
|
|
2
|
+
import {
|
|
3
|
+
createEmptyConditionGroup,
|
|
4
|
+
createEmptyConditionRule,
|
|
5
|
+
createFlowTreeBranch,
|
|
6
|
+
createFlowTreeNode,
|
|
7
|
+
createFlowTreeRoute,
|
|
8
|
+
normalizeFlowTreeDocument,
|
|
9
|
+
} from './schema.js';
|
|
10
|
+
|
|
11
|
+
export function createEmptyFlowTree(engine = 'flowable', options = null) {
|
|
12
|
+
const i18n = resolveI18n(options);
|
|
13
|
+
return normalizeFlowTreeDocument({
|
|
14
|
+
id: 'Process_Approval_1',
|
|
15
|
+
name: i18n.t('flowTree.defaultProcessName'),
|
|
16
|
+
engine,
|
|
17
|
+
starter: { id: 'Starter_1', name: i18n.t('flowTree.defaultStarterName') },
|
|
18
|
+
steps: [],
|
|
19
|
+
end: { id: 'End_1', name: i18n.t('flowTree.defaultEndName') },
|
|
20
|
+
}, { ...options, i18n });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function createSampleFlowTree(engine = 'flowable', options = null) {
|
|
24
|
+
const i18n = resolveI18n(options);
|
|
25
|
+
const isEn = i18n.resolvedLocale === 'en-US';
|
|
26
|
+
const starter = createFlowTreeNode('starter', {
|
|
27
|
+
id: 'Starter_Purchase',
|
|
28
|
+
name: isEn ? 'Purchase Initiator' : '采购申请人',
|
|
29
|
+
config: {
|
|
30
|
+
starterScope: 'all',
|
|
31
|
+
allowResubmit: true,
|
|
32
|
+
formPermissions: {
|
|
33
|
+
title: 'editable',
|
|
34
|
+
amount: 'editable',
|
|
35
|
+
department: 'editable',
|
|
36
|
+
urgency: 'editable',
|
|
37
|
+
vendorNote: 'editable',
|
|
38
|
+
financeCode: 'hidden',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}, { i18n });
|
|
42
|
+
|
|
43
|
+
const deptManager = createFlowTreeNode('approver', {
|
|
44
|
+
id: 'Approver_DeptManager',
|
|
45
|
+
name: isEn ? 'Direct Manager' : '直属主管审批',
|
|
46
|
+
config: {
|
|
47
|
+
assigneeType: 'supervisor',
|
|
48
|
+
supervisorLevel: 1,
|
|
49
|
+
approvalMode: 'or',
|
|
50
|
+
emptyStrategy: 'toAdmin',
|
|
51
|
+
sameAsInitiatorStrategy: 'autoPass',
|
|
52
|
+
buttons: {
|
|
53
|
+
approve: true,
|
|
54
|
+
reject: true,
|
|
55
|
+
returnEnabled: true,
|
|
56
|
+
returnMode: 'starter',
|
|
57
|
+
transfer: true,
|
|
58
|
+
addSign: true,
|
|
59
|
+
delegate: false,
|
|
60
|
+
commentRequiredOnReject: true,
|
|
61
|
+
},
|
|
62
|
+
formPermissions: {
|
|
63
|
+
title: 'readonly',
|
|
64
|
+
amount: 'readonly',
|
|
65
|
+
department: 'readonly',
|
|
66
|
+
urgency: 'readonly',
|
|
67
|
+
vendorNote: 'editable',
|
|
68
|
+
financeCode: 'hidden',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}, { i18n });
|
|
72
|
+
|
|
73
|
+
const vpApproval = createFlowTreeNode('approver', {
|
|
74
|
+
id: 'Approver_VP',
|
|
75
|
+
name: isEn ? 'VP Countersign' : '分管副总会签',
|
|
76
|
+
config: {
|
|
77
|
+
assigneeType: 'roles',
|
|
78
|
+
targets: {
|
|
79
|
+
users: [],
|
|
80
|
+
roles: [{ id: 'role_vp', name: isEn ? 'Vice President' : '分管副总' }],
|
|
81
|
+
departments: [],
|
|
82
|
+
},
|
|
83
|
+
approvalMode: 'and',
|
|
84
|
+
emptyStrategy: 'toAdmin',
|
|
85
|
+
timeout: { enabled: true, duration: 24, unit: 'hour', action: 'remind' },
|
|
86
|
+
formPermissions: {
|
|
87
|
+
title: 'readonly',
|
|
88
|
+
amount: 'readonly',
|
|
89
|
+
department: 'readonly',
|
|
90
|
+
urgency: 'readonly',
|
|
91
|
+
vendorNote: 'readonly',
|
|
92
|
+
financeCode: 'readonly',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}, { i18n });
|
|
96
|
+
|
|
97
|
+
const legalReview = createFlowTreeNode('approver', {
|
|
98
|
+
id: 'Approver_Legal',
|
|
99
|
+
name: isEn ? 'Legal Review' : '法务合规审核',
|
|
100
|
+
config: {
|
|
101
|
+
assigneeType: 'users',
|
|
102
|
+
targets: {
|
|
103
|
+
users: [{ id: 'chen_legal', name: isEn ? 'Lin Chen' : '陈琳(法务)' }],
|
|
104
|
+
roles: [],
|
|
105
|
+
departments: [],
|
|
106
|
+
},
|
|
107
|
+
approvalMode: 'or',
|
|
108
|
+
},
|
|
109
|
+
}, { i18n });
|
|
110
|
+
|
|
111
|
+
const financeHandler = createFlowTreeNode('handler', {
|
|
112
|
+
id: 'Handler_FinanceCode',
|
|
113
|
+
name: isEn ? 'Finance Cost Coding' : '财务填写预算编码',
|
|
114
|
+
config: {
|
|
115
|
+
assigneeType: 'roles',
|
|
116
|
+
targets: {
|
|
117
|
+
users: [],
|
|
118
|
+
roles: [{ id: 'role_finance', name: isEn ? 'Finance Ops' : '财务专员' }],
|
|
119
|
+
departments: [],
|
|
120
|
+
},
|
|
121
|
+
completionMode: 'or',
|
|
122
|
+
formPermissions: {
|
|
123
|
+
title: 'readonly',
|
|
124
|
+
amount: 'readonly',
|
|
125
|
+
department: 'readonly',
|
|
126
|
+
urgency: 'readonly',
|
|
127
|
+
vendorNote: 'readonly',
|
|
128
|
+
financeCode: 'editable',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}, { i18n });
|
|
132
|
+
|
|
133
|
+
const parallelReview = createFlowTreeRoute('parallelRoute', {
|
|
134
|
+
id: 'ParallelRoute_HighValue',
|
|
135
|
+
name: isEn ? 'Compliance & Finance Parallel' : '法务与财务并行复核',
|
|
136
|
+
branches: [
|
|
137
|
+
createFlowTreeBranch('parallelRoute', {
|
|
138
|
+
id: 'ParallelBranch_Legal',
|
|
139
|
+
name: isEn ? 'Legal Track' : '法务审核线',
|
|
140
|
+
priority: 1,
|
|
141
|
+
steps: [legalReview],
|
|
142
|
+
}, { i18n }),
|
|
143
|
+
createFlowTreeBranch('parallelRoute', {
|
|
144
|
+
id: 'ParallelBranch_Finance',
|
|
145
|
+
name: isEn ? 'Finance Track' : '财务核价线',
|
|
146
|
+
priority: 2,
|
|
147
|
+
steps: [financeHandler],
|
|
148
|
+
}, { i18n }),
|
|
149
|
+
],
|
|
150
|
+
}, { i18n });
|
|
151
|
+
|
|
152
|
+
const financeApprover = createFlowTreeNode('approver', {
|
|
153
|
+
id: 'Approver_FinanceLead',
|
|
154
|
+
name: isEn ? 'Finance Lead' : '财务负责人审批',
|
|
155
|
+
config: {
|
|
156
|
+
assigneeType: 'users',
|
|
157
|
+
targets: {
|
|
158
|
+
users: [{ id: 'zhou_fin', name: isEn ? 'Min Zhou' : '周敏(财务)' }],
|
|
159
|
+
roles: [],
|
|
160
|
+
departments: [],
|
|
161
|
+
},
|
|
162
|
+
approvalMode: 'or',
|
|
163
|
+
},
|
|
164
|
+
}, { i18n });
|
|
165
|
+
|
|
166
|
+
const amountCondition = createFlowTreeRoute('conditionRoute', {
|
|
167
|
+
id: 'ConditionRoute_Amount',
|
|
168
|
+
name: isEn ? 'Amount Routing' : '采购金额分流',
|
|
169
|
+
branches: [
|
|
170
|
+
createFlowTreeBranch('conditionRoute', {
|
|
171
|
+
id: 'Branch_HighAmount',
|
|
172
|
+
name: isEn ? 'Amount >= 50,000' : '金额 ≥ 50,000',
|
|
173
|
+
priority: 1,
|
|
174
|
+
isDefault: false,
|
|
175
|
+
config: {
|
|
176
|
+
mode: 'visual',
|
|
177
|
+
conditionGroups: [
|
|
178
|
+
createEmptyConditionGroup({
|
|
179
|
+
id: 'Group_HighAmount',
|
|
180
|
+
logic: 'AND',
|
|
181
|
+
rules: [
|
|
182
|
+
createEmptyConditionRule({
|
|
183
|
+
id: 'Rule_HighAmount',
|
|
184
|
+
field: 'amount',
|
|
185
|
+
fieldLabel: isEn ? 'Amount' : '采购金额',
|
|
186
|
+
fieldType: 'number',
|
|
187
|
+
operator: 'gte',
|
|
188
|
+
value: '50000',
|
|
189
|
+
}),
|
|
190
|
+
],
|
|
191
|
+
}),
|
|
192
|
+
],
|
|
193
|
+
expression: '',
|
|
194
|
+
},
|
|
195
|
+
steps: [vpApproval, parallelReview],
|
|
196
|
+
}, { i18n }),
|
|
197
|
+
createFlowTreeBranch('conditionRoute', {
|
|
198
|
+
id: 'Branch_MediumAmount',
|
|
199
|
+
name: isEn ? '10,000 - 50,000' : '10,000 ≤ 金额 < 50,000',
|
|
200
|
+
priority: 2,
|
|
201
|
+
isDefault: false,
|
|
202
|
+
config: {
|
|
203
|
+
mode: 'visual',
|
|
204
|
+
conditionGroups: [
|
|
205
|
+
createEmptyConditionGroup({
|
|
206
|
+
id: 'Group_MediumAmount',
|
|
207
|
+
logic: 'AND',
|
|
208
|
+
rules: [
|
|
209
|
+
createEmptyConditionRule({
|
|
210
|
+
id: 'Rule_MediumAmount',
|
|
211
|
+
field: 'amount',
|
|
212
|
+
fieldLabel: isEn ? 'Amount' : '采购金额',
|
|
213
|
+
fieldType: 'number',
|
|
214
|
+
operator: 'between',
|
|
215
|
+
value: '10000',
|
|
216
|
+
valueMax: '49999',
|
|
217
|
+
}),
|
|
218
|
+
],
|
|
219
|
+
}),
|
|
220
|
+
],
|
|
221
|
+
expression: '',
|
|
222
|
+
},
|
|
223
|
+
steps: [financeApprover],
|
|
224
|
+
}, { i18n }),
|
|
225
|
+
createFlowTreeBranch('conditionRoute', {
|
|
226
|
+
id: 'Branch_Default',
|
|
227
|
+
name: isEn ? 'Other (< 10,000)' : '其他情况(< 10,000)',
|
|
228
|
+
priority: 3,
|
|
229
|
+
isDefault: true,
|
|
230
|
+
steps: [],
|
|
231
|
+
}, { i18n }),
|
|
232
|
+
],
|
|
233
|
+
}, { i18n });
|
|
234
|
+
|
|
235
|
+
const ccProcurement = createFlowTreeNode('cc', {
|
|
236
|
+
id: 'Cc_Procurement',
|
|
237
|
+
name: isEn ? 'CC Procurement' : '抄送采购归档组',
|
|
238
|
+
config: {
|
|
239
|
+
assigneeType: 'users',
|
|
240
|
+
targets: {
|
|
241
|
+
users: [
|
|
242
|
+
{ id: 'wang_ops', name: isEn ? 'Lei Wang' : '王磊(采购)' },
|
|
243
|
+
{ id: 'li_admin', name: isEn ? 'Fang Li' : '李芳(行政)' },
|
|
244
|
+
],
|
|
245
|
+
roles: [],
|
|
246
|
+
departments: [],
|
|
247
|
+
},
|
|
248
|
+
allowStarterSelfSelect: true,
|
|
249
|
+
delegateExpression: '${novaCcDelegate}',
|
|
250
|
+
},
|
|
251
|
+
}, { i18n });
|
|
252
|
+
|
|
253
|
+
const erpTrigger = createFlowTreeNode('trigger', {
|
|
254
|
+
id: 'Trigger_ErpSync',
|
|
255
|
+
name: isEn ? 'Sync ERP Order' : '同步 ERP 生成采购单',
|
|
256
|
+
config: {
|
|
257
|
+
triggerType: 'webhook',
|
|
258
|
+
method: 'POST',
|
|
259
|
+
url: 'https://erp.example.com/api/purchase-orders',
|
|
260
|
+
resultVariable: 'erpOrderId',
|
|
261
|
+
async: true,
|
|
262
|
+
retryCycle: 'R3/PT5M',
|
|
263
|
+
},
|
|
264
|
+
}, { i18n });
|
|
265
|
+
|
|
266
|
+
return normalizeFlowTreeDocument({
|
|
267
|
+
id: 'Process_PurchaseFlowTree',
|
|
268
|
+
name: isEn ? 'Enterprise Purchase Approval' : '企业采购审批流程',
|
|
269
|
+
engine,
|
|
270
|
+
description: isEn
|
|
271
|
+
? 'Structured DingTalk/Feishu-style approval workflow compiled to executable BPMN 2.0 XML.'
|
|
272
|
+
: '钉钉 / 飞书风格结构化审批流,可直接编译为 Flowable / Activiti 可执行 BPMN 2.0 XML。',
|
|
273
|
+
starter,
|
|
274
|
+
steps: [deptManager, amountCondition, ccProcurement, erpTrigger],
|
|
275
|
+
end: { id: 'End_Purchase', name: i18n.t('flowTree.defaultEndName') },
|
|
276
|
+
}, { i18n });
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function createSampleFlowTreeRuntime(doc = null, options = null) {
|
|
280
|
+
const i18n = resolveI18n(options);
|
|
281
|
+
const isEn = i18n.resolvedLocale === 'en-US';
|
|
282
|
+
const starterId = doc?.starter?.id || 'Starter_Purchase';
|
|
283
|
+
return {
|
|
284
|
+
instanceId: 'INST-2026-08421',
|
|
285
|
+
processKey: doc?.id || 'Process_PurchaseFlowTree',
|
|
286
|
+
status: 'running',
|
|
287
|
+
startTime: '2026-12-05T09:12:00+08:00',
|
|
288
|
+
activities: [
|
|
289
|
+
{
|
|
290
|
+
id: 'act_starter_1',
|
|
291
|
+
elementId: starterId,
|
|
292
|
+
status: 'completed',
|
|
293
|
+
outcome: 'submitted',
|
|
294
|
+
participant: { id: 'zhang_req', name: isEn ? 'Wei Zhang' : '张伟' },
|
|
295
|
+
startTime: '2026-12-05T09:12:00+08:00',
|
|
296
|
+
endTime: '2026-12-05T09:12:18+08:00',
|
|
297
|
+
comment: isEn ? 'Submitted server cluster procurement request (¥86,000).' : '提交服务器集群采购申请(预算 ¥86,000)。',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: 'act_dept_1',
|
|
301
|
+
elementId: 'Approver_DeptManager',
|
|
302
|
+
status: 'completed',
|
|
303
|
+
outcome: 'approved',
|
|
304
|
+
participant: { id: 'liu_mgr', name: isEn ? 'Yang Liu' : '刘洋' },
|
|
305
|
+
startTime: '2026-12-05T09:12:20+08:00',
|
|
306
|
+
endTime: '2026-12-05T09:28:40+08:00',
|
|
307
|
+
comment: isEn ? 'Budget confirmed for Q4 capacity expansion.' : '同意,已纳入 Q4 扩容预算。',
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: 'act_vp_1',
|
|
311
|
+
elementId: 'Approver_VP',
|
|
312
|
+
visitId: 'visit_vp_1',
|
|
313
|
+
multiInstanceId: 'mi_vp_1',
|
|
314
|
+
approvalMode: 'all',
|
|
315
|
+
status: 'completed',
|
|
316
|
+
outcome: 'approved',
|
|
317
|
+
participant: { id: 'zhao_vp', name: isEn ? 'Jun Zhao' : '赵军(副总)' },
|
|
318
|
+
startTime: '2026-12-05T09:29:00+08:00',
|
|
319
|
+
endTime: '2026-12-05T10:05:12+08:00',
|
|
320
|
+
comment: isEn ? 'Approved. Ensure legal review covers SLA clause.' : '同意采购,请法务重点核查维保 SLA 条款。',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: 'act_legal_1',
|
|
324
|
+
elementId: 'Approver_Legal',
|
|
325
|
+
status: 'completed',
|
|
326
|
+
outcome: 'approved',
|
|
327
|
+
participant: { id: 'chen_legal', name: isEn ? 'Lin Chen' : '陈琳(法务)' },
|
|
328
|
+
startTime: '2026-12-05T10:05:20+08:00',
|
|
329
|
+
endTime: '2026-12-05T10:18:45+08:00',
|
|
330
|
+
comment: isEn ? 'Contract template reviewed without risk.' : '合同条款审核通过,无合规风险。',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: 'act_finance_1',
|
|
334
|
+
elementId: 'Handler_FinanceCode',
|
|
335
|
+
status: 'active',
|
|
336
|
+
outcome: 'pending',
|
|
337
|
+
participant: { id: 'zhou_fin', name: isEn ? 'Min Zhou' : '周敏(财务)' },
|
|
338
|
+
startTime: '2026-12-05T10:05:20+08:00',
|
|
339
|
+
},
|
|
340
|
+
],
|
|
341
|
+
actions: [
|
|
342
|
+
{
|
|
343
|
+
id: 'action_1',
|
|
344
|
+
type: 'submit',
|
|
345
|
+
elementId: starterId,
|
|
346
|
+
activityId: 'act_starter_1',
|
|
347
|
+
actor: { id: 'zhang_req', name: isEn ? 'Wei Zhang' : '张伟' },
|
|
348
|
+
occurredAt: '2026-12-05T09:12:18+08:00',
|
|
349
|
+
content: { plainText: isEn ? 'Submitted server cluster procurement request (¥86,000).' : '提交服务器集群采购申请(预算 ¥86,000)。' },
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: 'action_2',
|
|
353
|
+
type: 'approve',
|
|
354
|
+
elementId: 'Approver_DeptManager',
|
|
355
|
+
activityId: 'act_dept_1',
|
|
356
|
+
actor: { id: 'liu_mgr', name: isEn ? 'Yang Liu' : '刘洋' },
|
|
357
|
+
occurredAt: '2026-12-05T09:28:40+08:00',
|
|
358
|
+
content: { plainText: isEn ? 'Budget confirmed for Q4 capacity expansion.' : '同意,已纳入 Q4 扩容预算。' },
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: 'action_3',
|
|
362
|
+
type: 'approve',
|
|
363
|
+
elementId: 'Approver_VP',
|
|
364
|
+
activityId: 'act_vp_1',
|
|
365
|
+
visitId: 'visit_vp_1',
|
|
366
|
+
actor: { id: 'zhao_vp', name: isEn ? 'Jun Zhao' : '赵军(副总)' },
|
|
367
|
+
occurredAt: '2026-12-05T10:05:12+08:00',
|
|
368
|
+
content: { plainText: isEn ? 'Approved. Ensure legal review covers SLA clause.' : '同意采购,请法务重点核查维保 SLA 条款。' },
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
id: 'action_4',
|
|
372
|
+
type: 'approve',
|
|
373
|
+
elementId: 'Approver_Legal',
|
|
374
|
+
activityId: 'act_legal_1',
|
|
375
|
+
actor: { id: 'chen_legal', name: isEn ? 'Lin Chen' : '陈琳(法务)' },
|
|
376
|
+
occurredAt: '2026-12-05T10:18:45+08:00',
|
|
377
|
+
content: { plainText: isEn ? 'Contract template reviewed without risk.' : '合同条款审核通过,无合规风险。' },
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
activeElements: ['Handler_FinanceCode'],
|
|
381
|
+
completedElements: [starterId, 'Approver_DeptManager', 'Approver_VP', 'Approver_Legal'],
|
|
382
|
+
skippedElements: ['Approver_FinanceLead'],
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function createSampleFlowTreeDataProviders(options = null) {
|
|
387
|
+
const i18n = resolveI18n(options);
|
|
388
|
+
const isEn = i18n.resolvedLocale === 'en-US';
|
|
389
|
+
const users = [
|
|
390
|
+
{ id: 'liu_mgr', name: isEn ? 'Yang Liu (Engineering)' : '刘洋(研发部)' },
|
|
391
|
+
{ id: 'zhao_vp', name: isEn ? 'Jun Zhao (VP)' : '赵军(副总)' },
|
|
392
|
+
{ id: 'chen_legal', name: isEn ? 'Lin Chen (Legal)' : '陈琳(法务)' },
|
|
393
|
+
{ id: 'zhou_fin', name: isEn ? 'Min Zhou (Finance)' : '周敏(财务)' },
|
|
394
|
+
{ id: 'wang_ops', name: isEn ? 'Lei Wang (Procurement)' : '王磊(采购)' },
|
|
395
|
+
{ id: 'li_admin', name: isEn ? 'Fang Li (Admin)' : '李芳(行政)' },
|
|
396
|
+
];
|
|
397
|
+
const roles = [
|
|
398
|
+
{ id: 'role_dept_head', name: isEn ? 'Department Head' : '部门负责人' },
|
|
399
|
+
{ id: 'role_vp', name: isEn ? 'Vice President' : '分管副总' },
|
|
400
|
+
{ id: 'role_finance', name: isEn ? 'Finance Ops' : '财务专员' },
|
|
401
|
+
{ id: 'role_cfo', name: isEn ? 'CFO' : '财务总监' },
|
|
402
|
+
{ id: 'role_legal', name: isEn ? 'Legal Counsel' : '法务合规' },
|
|
403
|
+
];
|
|
404
|
+
const departments = [
|
|
405
|
+
{ id: 'dept_rd', name: isEn ? 'R&D Center' : '研发中心' },
|
|
406
|
+
{ id: 'dept_fin', name: isEn ? 'Finance Dept' : '财务部' },
|
|
407
|
+
{ id: 'dept_ops', name: isEn ? 'Procurement & Ops' : '采购行政部' },
|
|
408
|
+
{ id: 'dept_sales', name: isEn ? 'Enterprise Sales' : '企业销售部' },
|
|
409
|
+
];
|
|
410
|
+
const formFields = [
|
|
411
|
+
{ key: 'title', label: isEn ? 'Request Title' : '采购主题', type: 'string' },
|
|
412
|
+
{ key: 'amount', label: isEn ? 'Amount' : '采购金额', type: 'number' },
|
|
413
|
+
{ key: 'department', label: isEn ? 'Department' : '申请部门', type: 'department' },
|
|
414
|
+
{
|
|
415
|
+
key: 'urgency',
|
|
416
|
+
label: isEn ? 'Priority' : '紧急程度',
|
|
417
|
+
type: 'select',
|
|
418
|
+
options: [
|
|
419
|
+
{ value: 'normal', label: isEn ? 'Normal' : '普通' },
|
|
420
|
+
{ value: 'urgent', label: isEn ? 'Urgent' : '紧急' },
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
{ key: 'vendorNote', label: isEn ? 'Vendor Note' : '供应商说明', type: 'string' },
|
|
424
|
+
{ key: 'financeCode', label: isEn ? 'Budget Code' : '预算科目编码', type: 'string' },
|
|
425
|
+
];
|
|
426
|
+
const subProcesses = [
|
|
427
|
+
{ id: 'Process_VendorOnboarding', name: isEn ? 'Vendor Onboarding' : '供应商准入子流程' },
|
|
428
|
+
{ id: 'Process_ContractSeal', name: isEn ? 'Contract Seal Approval' : '合同用印子流程' },
|
|
429
|
+
{ id: 'Process_PaymentSettlement', name: isEn ? 'Payment Settlement' : '付款结算子流程' },
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
const filterList = (list, query = '') => {
|
|
433
|
+
const keyword = String(query || '').trim().toLowerCase();
|
|
434
|
+
if (!keyword) return list;
|
|
435
|
+
return list.filter((item) => item.name.toLowerCase().includes(keyword) || item.id.toLowerCase().includes(keyword));
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
return {
|
|
439
|
+
users: { search: (query) => filterList(users, query) },
|
|
440
|
+
roles: { list: (query) => filterList(roles, query) },
|
|
441
|
+
departments: { list: (query) => filterList(departments, query) },
|
|
442
|
+
formFields: { list: () => formFields },
|
|
443
|
+
subProcesses: { list: (query) => filterList(subProcesses, query) },
|
|
444
|
+
};
|
|
445
|
+
}
|