@steedos-labs/plugin-workflow 3.0.51 → 3.0.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/designer/dist/amis-renderer/amis-renderer.js +1 -1
- package/designer/dist/assets/{index-CeMQUt8Y.js → index-3PKde6SC.js} +150 -148
- package/designer/dist/assets/{index-Bs9qBPga.css → index-xR8ApdWL.css} +1 -1
- package/designer/dist/index.html +2 -2
- package/main/default/manager/handlers_manager.js +6 -4
- package/main/default/manager/import.js +3 -3
- package/main/default/manager/uuflow_manager.js +21 -1
- package/main/default/routes/am.router.js +24 -18
- package/main/default/routes/api_workflow_ai_form_design.router.js +25 -1
- package/main/default/routes/api_workflow_ai_form_design_stream.router.js +16 -3
- package/main/default/routes/api_workflow_next_step.router.js +1 -1
- package/main/default/routes/flow_form_design.ejs +2 -2
- package/main/default/test/FORMULA_SCAN_GUIDE.md +3 -0
- package/main/default/test/reports/formula-scan/SCAN_HISTORY.md +57 -0
- package/main/default/test/reports/formula-scan/scan-result-v10-20260327.json +31543 -0
- package/main/default/test/reports/formula-scan/scan-result-v9-20260327.json +31723 -0
- package/main/default/test/scan_production_formulas.js +25 -5
- package/main/default/triggers/amis_form_design.trigger.js +18 -17
- package/package.json +1 -1
- package/public/amis-renderer/amis-renderer.js +1 -1
|
@@ -139,7 +139,7 @@ function extractAggregationFieldRefs(formula) {
|
|
|
139
139
|
* @returns {{ issues: object[], convertedResult: string|null }}
|
|
140
140
|
*/
|
|
141
141
|
function checkFormula({ formula, tableFieldMap, formId, formName, formVersionType,
|
|
142
|
-
field, fieldLocation, formulaSource, siblingCodes }) {
|
|
142
|
+
field, fieldLocation, formulaSource, siblingCodes, inSection }) {
|
|
143
143
|
|
|
144
144
|
const fieldCode = field.code || '';
|
|
145
145
|
const fieldType = field.type || '';
|
|
@@ -236,6 +236,21 @@ function checkFormula({ formula, tableFieldMap, formId, formName, formVersionTyp
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
// E6: 设计器 section 嵌套兼容性 — 检测设计器对 section 子字段传递 true 而非 tableFieldMap 的问题
|
|
240
|
+
if (inSection && convertedResult && tableFieldMap && Object.keys(tableFieldMap).length > 0) {
|
|
241
|
+
const designerResult = mapFormula(formula, true);
|
|
242
|
+
if (designerResult !== convertedResult) {
|
|
243
|
+
issues.push({
|
|
244
|
+
level: 'ERROR',
|
|
245
|
+
ruleId: 'E6',
|
|
246
|
+
...baseInfo,
|
|
247
|
+
convertedResult,
|
|
248
|
+
errorDetail: `设计器兼容性: section 子字段公式转换结果与引擎不一致。引擎正确结果="${convertedResult}", 设计器结果="${designerResult}"。原因: flow_form_design.ejs 对 section 子字段传递 true 而非 tableFieldMap`,
|
|
249
|
+
siblingFields: siblingCodes,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
239
254
|
// W1: 除零风险(含除法且除数是字段引用)
|
|
240
255
|
if (/\/\s*\{[^{}]+\}/.test(formula)) {
|
|
241
256
|
issues.push({
|
|
@@ -278,9 +293,10 @@ function detectSafeCodeConflicts(codes) {
|
|
|
278
293
|
* @param {object[]} fields
|
|
279
294
|
* @param {object} tableFieldMap 顶层 getTableFieldMap 结果
|
|
280
295
|
* @param {string} locationPrefix "top" 或 "table:{tableCode}"
|
|
281
|
-
* @
|
|
296
|
+
* @param {boolean} inSection 是否嵌套在 section 内部
|
|
297
|
+
* @returns {object[]} 每项包含 field, formula, source, location, siblingCodes, inSection
|
|
282
298
|
*/
|
|
283
|
-
function collectFormulaFields(fields, tableFieldMap, locationPrefix) {
|
|
299
|
+
function collectFormulaFields(fields, tableFieldMap, locationPrefix, inSection = false) {
|
|
284
300
|
if (!Array.isArray(fields)) return [];
|
|
285
301
|
const results = [];
|
|
286
302
|
|
|
@@ -293,7 +309,8 @@ function collectFormulaFields(fields, tableFieldMap, locationPrefix) {
|
|
|
293
309
|
const childLocation = field.type === 'table'
|
|
294
310
|
? `table:${field.code}`
|
|
295
311
|
: locationPrefix;
|
|
296
|
-
|
|
312
|
+
const childInSection = field.type === 'section' || inSection;
|
|
313
|
+
results.push(...collectFormulaFields(field.fields, tableFieldMap, childLocation, childInSection));
|
|
297
314
|
}
|
|
298
315
|
|
|
299
316
|
// formula 属性
|
|
@@ -304,6 +321,7 @@ function collectFormulaFields(fields, tableFieldMap, locationPrefix) {
|
|
|
304
321
|
source: 'formula',
|
|
305
322
|
location: locationPrefix,
|
|
306
323
|
siblingCodes: siblingCodes.filter(c => c !== field.code),
|
|
324
|
+
inSection,
|
|
307
325
|
});
|
|
308
326
|
}
|
|
309
327
|
|
|
@@ -317,6 +335,7 @@ function collectFormulaFields(fields, tableFieldMap, locationPrefix) {
|
|
|
317
335
|
source: 'default_value',
|
|
318
336
|
location: locationPrefix,
|
|
319
337
|
siblingCodes: siblingCodes.filter(c => c !== field.code),
|
|
338
|
+
inSection,
|
|
320
339
|
});
|
|
321
340
|
}
|
|
322
341
|
}
|
|
@@ -352,7 +371,7 @@ function scanForm(form) {
|
|
|
352
371
|
const tableFieldMap = getTableFieldMap(fields);
|
|
353
372
|
const formulaFields = collectFormulaFields(fields, tableFieldMap, 'top');
|
|
354
373
|
|
|
355
|
-
for (const { field, formula, source, location, siblingCodes } of formulaFields) {
|
|
374
|
+
for (const { field, formula, source, location, siblingCodes, inSection } of formulaFields) {
|
|
356
375
|
const dedupeKey = JSON.stringify({ code: field.code, location, source, formula });
|
|
357
376
|
|
|
358
377
|
// current 版本直接处理,history 版本若 current 已有则跳过
|
|
@@ -369,6 +388,7 @@ function scanForm(form) {
|
|
|
369
388
|
fieldLocation: location,
|
|
370
389
|
formulaSource: source,
|
|
371
390
|
siblingCodes,
|
|
391
|
+
inSection,
|
|
372
392
|
});
|
|
373
393
|
|
|
374
394
|
const status = fieldIssues.length > 0
|
|
@@ -568,24 +568,25 @@ module.exports = {
|
|
|
568
568
|
let spaceId = this.spaceId || this.doc?.space;
|
|
569
569
|
|
|
570
570
|
let userSession = await auth.getSessionByUserId(userId, spaceId)
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
571
|
+
if(userSession){
|
|
572
|
+
let roles = userSession.roles;
|
|
573
|
+
// 执行者的身份校验
|
|
574
|
+
await desingerManager.checkSpaceUserBeforeUpdate(spaceId, userId, roles);
|
|
575
|
+
// 更新表单
|
|
576
|
+
await desingerManager.updateForm(this.id, form, updatedForms, updatedFlows, userId);
|
|
577
|
+
|
|
578
|
+
const flows = await objectql.getObject('flows').directFind({
|
|
579
|
+
filters: ['form', '=', this.id],
|
|
580
|
+
fields: ['_id']
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
for (const flow of flows) {
|
|
584
|
+
await objectql.getObject('flows').directUpdate(flow._id, {
|
|
585
|
+
modified: new Date(),
|
|
586
|
+
modified_by: userId
|
|
587
|
+
})
|
|
588
|
+
}
|
|
587
589
|
}
|
|
588
|
-
|
|
589
590
|
}
|
|
590
591
|
|
|
591
592
|
},
|