fix/workflow-inst (#1096)
Reviewed-on: daoyoucloud/tachybase#1096 Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
parent
78af8dae67
commit
dceee2ea0b
@ -1,7 +1,7 @@
|
|||||||
import { css } from '@tachybase/client';
|
import { css } from '@tachybase/client';
|
||||||
import { ArrayTable } from '@tachybase/components';
|
import { ArrayTable } from '@tachybase/components';
|
||||||
|
|
||||||
import { WorkflowVariableInput } from '../..';
|
import { VariableOption, WorkflowVariableInput } from '../..';
|
||||||
import { NAMESPACE_INSTRUCTION_JSON_PARSE } from '../../../common/constants';
|
import { NAMESPACE_INSTRUCTION_JSON_PARSE } from '../../../common/constants';
|
||||||
import { tval } from '../../locale';
|
import { tval } from '../../locale';
|
||||||
import { Instruction } from '../../nodes';
|
import { Instruction } from '../../nodes';
|
||||||
@ -36,6 +36,8 @@ export class JSONParseInstruction extends Instruction {
|
|||||||
description: tval(
|
description: tval(
|
||||||
'If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes.',
|
'If the type of query result is object or array of object, could map the properties which to be accessed in subsequent nodes.',
|
||||||
),
|
),
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
'x-component': 'ArrayTable',
|
||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
@ -126,4 +128,19 @@ export class JSONParseInstruction extends Instruction {
|
|||||||
ArrayTable,
|
ArrayTable,
|
||||||
WorkflowVariableInput,
|
WorkflowVariableInput,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useVariables(node, options): VariableOption {
|
||||||
|
const { key, title, config } = node;
|
||||||
|
const { types, fieldNames } = options;
|
||||||
|
const model = config.model || [];
|
||||||
|
const result = {
|
||||||
|
[fieldNames.label]: title,
|
||||||
|
[fieldNames.value]: key,
|
||||||
|
[fieldNames.children]: model.map((item) => ({
|
||||||
|
[fieldNames.label]: item.label,
|
||||||
|
[fieldNames.value]: item.alias || item.path,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user