Skip to content

Commit 8649a29

Browse files
committed
fix user select
1 parent 4574df7 commit 8649a29

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

admin-ui/src/components/Flow/panel/NodePanel.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,11 @@ const NodePanel: React.FC<NodePanelProps> = (props) => {
279279
visible={userSelectVisible}
280280
setVisible={setUserSelectVisible}
281281
userSelectType={"users"}
282-
specifyUserIds={[]}
282+
specifyUserIds={GroovyScript.getOperatorUsers(props.form.getFieldValue("operatorMatcher"))}
283283
mode={"multiple"}
284-
onFinish={(values)=>{
285-
const operatorMatcher = props.form.getFieldValue("operatorMatcher");
286-
const script = operatorMatcher.replaceAll("%s", values.map((item:any)=>item.id).join(","));
287-
console.log(script);
284+
onFinish={(values) => {
285+
setUserSelectVisible(false);
286+
const script = GroovyScript.specifyOperatorMatcher.replaceAll("%s", values.map((item: any) => item.id).join(","));
288287
props.form.setFieldsValue({
289288
operatorMatcher: script
290289
});

admin-ui/src/components/Flow/utils/script.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ class GroovyScript {
2020
}
2121
}
2222

23+
24+
static getOperatorUsers(script:string) {
25+
if(script) {
26+
const match = script.match(/\[([\d,\s]+)\]/);
27+
if (match && match[1]) {
28+
return match[1]
29+
.split(',')
30+
.map(num => parseInt(num.trim(), 10));
31+
}
32+
}
33+
return [];
34+
}
35+
2336
static errTriggerType(errTrigger: string) {
2437
if (errTrigger === GroovyScript.defaultOutTrigger) {
2538
return "default";

0 commit comments

Comments
 (0)