Skip to content

Commit cc2d18d

Browse files
authored
Merge pull request #55 from codingapi/dev
Dev
2 parents 3defb6d + b8f2902 commit cc2d18d

4 files changed

Lines changed: 198 additions & 9 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import React from "react";
2+
import {Table} from "@flow-engine/flow-pc-ui";
3+
import {Button, Space } from "antd";
4+
import { PlusOutlined } from "@ant-design/icons";
5+
6+
/**
7+
* TODO 尚未完成
8+
* @constructor
9+
*/
10+
export const ConditionGroup = () => {
11+
return (
12+
<div style={{
13+
backgroundColor: '#fff',
14+
color: 'rgba(0,0,0,0.88)',
15+
minHeight: '60px',
16+
}}>
17+
<Table
18+
toolBarRender={()=>{
19+
return [
20+
<Button icon={<PlusOutlined />}>添加条件</Button>
21+
]
22+
}}
23+
columns={[
24+
{
25+
key:'id',
26+
title:'id',
27+
hidden:true,
28+
dataIndex: 'id',
29+
},
30+
{
31+
key:'left',
32+
title:'左侧参数',
33+
dataIndex:'left',
34+
},
35+
{
36+
key:'type',
37+
title:'条件关系',
38+
dataIndex:'type',
39+
},
40+
{
41+
key:'right',
42+
title:'右侧参数',
43+
dataIndex: 'right',
44+
},
45+
{
46+
key:'option',
47+
title:'操作',
48+
render: (text, record) => {
49+
return (
50+
<Space>
51+
<a>交换</a>
52+
<a>删除</a>
53+
</Space>
54+
)
55+
}
56+
},
57+
]}
58+
dataSource={[
59+
{
60+
id:1,
61+
left:'用户编号',
62+
type:'等于',
63+
right:'1'
64+
}
65+
]}
66+
pagination={false}
67+
/>
68+
69+
</div>
70+
)
71+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import {PlusCircleOutlined} from "@ant-design/icons";
2+
import {Dropdown, MenuProps} from "antd";
3+
import React from "react";
4+
5+
/**
6+
* TODO 尚未完成
7+
* @constructor
8+
*/
9+
export const ConditionRelation = () => {
10+
11+
const items: MenuProps['items'] = [
12+
{
13+
key: '1',
14+
label: (
15+
<a>
16+
括号
17+
</a>
18+
),
19+
},
20+
{
21+
key: '2',
22+
label: (
23+
<a>
24+
并且
25+
</a>
26+
),
27+
},
28+
{
29+
key: '3',
30+
label: (
31+
<a>
32+
或者
33+
</a>
34+
),
35+
},
36+
{
37+
key: '4',
38+
label: '条件',
39+
children: [
40+
{
41+
key: '3-1',
42+
label: '分组1',
43+
},
44+
{
45+
key: '3-2',
46+
label: '分组2',
47+
},
48+
],
49+
},
50+
{
51+
key: '5',
52+
label: (
53+
<a>
54+
删除
55+
</a>
56+
),
57+
danger:true
58+
},
59+
];
60+
61+
return (
62+
<div style={{
63+
padding: '4px 11px',
64+
border: '1px solid #d9d9d9',
65+
borderRadius: '6px',
66+
backgroundColor: '#fff',
67+
color: 'rgba(0,0,0,0.88)',
68+
minHeight: '60px',
69+
}}>
70+
71+
72+
<Dropdown menu={{ items }}>
73+
<PlusCircleOutlined style={{
74+
cursor: 'pointer',
75+
}}/>
76+
</Dropdown>
77+
78+
</div>
79+
)
80+
}

frontend/packages/flow-pc/flow-pc-design/src/components/script/components/groovy-script-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const GroovyScriptPreview: React.FC<GroovyScriptPreviewProps> = (props) =
2121
minHeight: '45px',
2222
padding: '4px 11px',
2323
border: '1px solid #d9d9d9',
24-
borderRadius: '6px 0 0 6px',
24+
borderRadius: '6px',
2525
backgroundColor: value ? '#fff' : '#fafafa',
2626
color: value ? 'rgba(0,0,0,0.88)' : 'rgba(0,0,0,0.25)',
2727
}}
Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import React from "react";
22
import {ConditionViewPlugin, VIEW_KEY} from "@/components/script/plugins/condition-view-type";
33
import {ViewBindPlugin} from "@flow-engine/flow-types";
4-
import {AdvancedScriptEditor} from "@/components/script/components/advanced-script-editor";
54
import {SCRIPT_DEFAULT_CONDITION} from "@/components/script/default-script";
5+
import {GroovyScriptConvertorUtil} from "@/components/script/utils/convertor";
6+
import {Button, Space} from "antd";
7+
import {CodeOutlined, ReloadOutlined} from "@ant-design/icons";
8+
import {GroovyScriptPreview} from "@/components/script/components/groovy-script-preview";
9+
import {ConditionRelation} from "@/components/script/components/condition/condition-relation";
10+
import {ConditionGroup} from "@/components/script/components/condition/condition-group";
611

712
/**
813
* TODO 条件控制界面
@@ -17,13 +22,46 @@ export const ConditionPluginView: React.FC<ConditionViewPlugin> = (props) => {
1722
);
1823
}
1924

20-
2125
return (
22-
<AdvancedScriptEditor
23-
{...props}
24-
resetScript={()=>{
25-
return SCRIPT_DEFAULT_CONDITION;
26-
}}
27-
/>
26+
<div>
27+
<div>
28+
预览
29+
<GroovyScriptPreview
30+
script={props.script}
31+
multiline={true}
32+
/>
33+
</div>
34+
<div>
35+
关系
36+
<ConditionRelation/>
37+
</div>
38+
<div>
39+
条件
40+
<ConditionGroup/>
41+
</div>
42+
<Space
43+
style={{
44+
marginTop: 8
45+
}}
46+
>
47+
<Button
48+
icon={<CodeOutlined/>}
49+
onClick={() => {
50+
props.onChange(GroovyScriptConvertorUtil.toCustomScript(props.script));
51+
}}
52+
>
53+
高级配置
54+
</Button>
55+
<Button
56+
icon={<ReloadOutlined/>}
57+
danger={true}
58+
onClick={() => {
59+
props.onChange(SCRIPT_DEFAULT_CONDITION);
60+
}}
61+
>
62+
重置脚本
63+
</Button>
64+
</Space>
65+
</div>
2866
);
2967
}

0 commit comments

Comments
 (0)