@jiangood/admin-spring-boot-starter 0.2.0
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/config/dist/config.js +45 -0
- package/config/dist/index.js +19 -0
- package/config/dist/plugins/form-plugin.js +51 -0
- package/config/dist/plugins/route-plugin.js +72 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +9 -0
- package/src/framework/components/system/ButtonList.jsx +35 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +49 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +60 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +68 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- package/src/framework/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +15 -0
- package/src/framework/pages/LoginPage.jsx +132 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +35 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/MessageUtils.tsx +145 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +412 -0
- package/src/framework/utils/TreeUtils.ts +251 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +153 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/flowable/design/contextPad.js +50 -0
- package/src/pages/flowable/design/customTranslate/customTranslate.js +16 -0
- package/src/pages/flowable/design/customTranslate/translations-properties-panel.js +10 -0
- package/src/pages/flowable/design/customTranslate/translations.js +144 -0
- package/src/pages/flowable/design/descriptors/flowable.json +1109 -0
- package/src/pages/flowable/design/index.css +7 -0
- package/src/pages/flowable/design/index.jsx +171 -0
- package/src/pages/flowable/design/provider/FlowablePropertiesProvider.js +75 -0
- package/src/pages/flowable/design/provider/index.js +6 -0
- package/src/pages/flowable/design/provider/properties/ConditionDesign.jsx +175 -0
- package/src/pages/flowable/design/provider/properties/ConditionProps.jsx +76 -0
- package/src/pages/flowable/design/provider/properties/DelegateExpressionProps.js +54 -0
- package/src/pages/flowable/design/provider/properties/FormProps.js +55 -0
- package/src/pages/flowable/design/provider/properties/MultiInstanceProps.js +100 -0
- package/src/pages/flowable/design/provider/properties/UserTaskForm.jsx +48 -0
- package/src/pages/flowable/design/provider/properties/utils.jsx +35 -0
- package/src/pages/flowable/index.jsx +87 -0
- package/src/pages/flowable/monitor/definition.jsx +87 -0
- package/src/pages/flowable/monitor/instance/index.jsx +177 -0
- package/src/pages/flowable/monitor/instance/view.jsx +102 -0
- package/src/pages/flowable/monitor/task.jsx +98 -0
- package/src/pages/flowable/task/form.jsx +186 -0
- package/src/pages/flowable/task/index.jsx +184 -0
- package/src/pages/flowable/task/instance/view.jsx +85 -0
- package/src/pages/flowable/test/index.jsx +57 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/config/index.jsx +136 -0
- package/src/pages/system/dict/Dict.jsx +72 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +22 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Button, Card, message, Modal, Space, Splitter} from "antd";
|
|
3
|
+
|
|
4
|
+
import 'bpmn-js/dist/assets/diagram-js.css'
|
|
5
|
+
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
|
|
6
|
+
import BpmnModeler from 'bpmn-js/lib/Modeler'
|
|
7
|
+
|
|
8
|
+
import './index.css'
|
|
9
|
+
import customTranslate from "./customTranslate/customTranslate";
|
|
10
|
+
import contextPad from "./contextPad";
|
|
11
|
+
import {CloudUploadOutlined, SaveOutlined} from "@ant-design/icons";
|
|
12
|
+
import {HttpUtils, MessageUtils, PageUtils, ProTable} from "../../../framework";
|
|
13
|
+
import 'bpmn-js/dist/assets/bpmn-js.css';
|
|
14
|
+
import '@bpmn-io/properties-panel/assets/properties-panel.css';
|
|
15
|
+
import {BpmnPropertiesPanelModule, BpmnPropertiesProviderModule} from 'bpmn-js-properties-panel';
|
|
16
|
+
|
|
17
|
+
import flowablePropertiesProviderModule from './provider';
|
|
18
|
+
import flowableJson from './descriptors/flowable';
|
|
19
|
+
import Loading from "../../../loading";
|
|
20
|
+
|
|
21
|
+
export default class extends React.Component {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
state = {
|
|
25
|
+
id: null,
|
|
26
|
+
model: null,
|
|
27
|
+
|
|
28
|
+
deployedModal: false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
bpmRef = React.createRef()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
async componentDidMount() {
|
|
35
|
+
let params = PageUtils.currentParams()
|
|
36
|
+
this.state.id = params.id
|
|
37
|
+
const rs = await HttpUtils.get('admin/flowable/model/detail', {id: this.state.id})
|
|
38
|
+
this.setState({model: rs}, this.initBpmn)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
initBpmn = () => {
|
|
42
|
+
let container = this.bpmRef.current;
|
|
43
|
+
let xml = this.state.model.content;
|
|
44
|
+
|
|
45
|
+
this.bpmnModeler = new BpmnModeler({
|
|
46
|
+
container: container,
|
|
47
|
+
propertiesPanel: {parent: '#js-properties-panel',},
|
|
48
|
+
additionalModules: [
|
|
49
|
+
{translate: ['value', customTranslate]},
|
|
50
|
+
contextPad,
|
|
51
|
+
BpmnPropertiesPanelModule,
|
|
52
|
+
BpmnPropertiesProviderModule,
|
|
53
|
+
flowablePropertiesProviderModule
|
|
54
|
+
],
|
|
55
|
+
moddleExtensions: {
|
|
56
|
+
flowable: flowableJson
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
console.log('导入的xml内容如下')
|
|
61
|
+
console.log(xml)
|
|
62
|
+
this.bpmnModeler.importXML(xml)
|
|
63
|
+
this.bpmnModeler.on('element.contextmenu', e => e.preventDefault()) // 关闭右键,影响操作
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
showXML = () => {
|
|
68
|
+
this.bpmnModeler.saveXML({format: true}).then(res => {
|
|
69
|
+
MessageUtils.alert(<pre style={{overflowX: "auto", height: '64vh'}}>{res.xml}</pre>, {width: 1024})
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
handleSave = async () => {
|
|
75
|
+
let id = this.state.id;
|
|
76
|
+
const hide = MessageUtils.loading('正在保存...')
|
|
77
|
+
try {
|
|
78
|
+
const res = await this.bpmnModeler.saveXML();
|
|
79
|
+
await HttpUtils.post('admin/flowable/model/saveContent', {id, content: res.xml});
|
|
80
|
+
} finally {
|
|
81
|
+
hide()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
handleDeploy = async () => {
|
|
86
|
+
let id = this.state.id;
|
|
87
|
+
const hide = MessageUtils.loading('正在部署...')
|
|
88
|
+
try {
|
|
89
|
+
const res = await this.bpmnModeler.saveXML();
|
|
90
|
+
await HttpUtils.post('admin/flowable/model/deploy', {id, content: res.xml});
|
|
91
|
+
} finally {
|
|
92
|
+
hide()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
if (this.state.model == null) {
|
|
99
|
+
return <Loading/>
|
|
100
|
+
}
|
|
101
|
+
return <Card title={'流程设计 ' + this.state.model?.name}
|
|
102
|
+
extra={<Space>
|
|
103
|
+
<Button type='primary' icon={<SaveOutlined/>} onClick={this.handleSave}>暂存</Button>
|
|
104
|
+
<Button type='primary' danger icon={<CloudUploadOutlined/>}
|
|
105
|
+
onClick={this.handleDeploy}>部署</Button>
|
|
106
|
+
<Button onClick={this.showXML}>XML</Button>
|
|
107
|
+
<Button
|
|
108
|
+
onClick={() => PageUtils.open('/flowable/test?id=' + this.state.id, "流程测试")}> 测试 </Button>
|
|
109
|
+
|
|
110
|
+
<Button title='查看已部署的历史版本' onClick={() => {
|
|
111
|
+
this.setState({deployedModal: true})
|
|
112
|
+
}}>历史版本</Button>
|
|
113
|
+
</Space>}>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<Splitter style={{minHeight: 'calc(100vh - 200px)'}}>
|
|
117
|
+
<Splitter.Panel>
|
|
118
|
+
<div ref={this.bpmRef} style={{width: '100%', height: '100%'}}></div>
|
|
119
|
+
</Splitter.Panel>
|
|
120
|
+
|
|
121
|
+
<Splitter.Panel defaultSize={300}>
|
|
122
|
+
<div id={'js-properties-panel'}></div>
|
|
123
|
+
</Splitter.Panel>
|
|
124
|
+
</Splitter>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
<Modal title='已部署版本' width={800} footer={null}
|
|
128
|
+
open={this.state.deployedModal}
|
|
129
|
+
destroyOnHidden
|
|
130
|
+
onCancel={() => this.setState({deployedModal: false})}>
|
|
131
|
+
|
|
132
|
+
<ProTable
|
|
133
|
+
columns={[
|
|
134
|
+
{
|
|
135
|
+
dataIndex: 'key',
|
|
136
|
+
title: '编码'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
dataIndex: 'name',
|
|
140
|
+
title: '名称'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
dataIndex: 'version',
|
|
144
|
+
title: '版本号'
|
|
145
|
+
}, {
|
|
146
|
+
title: '操作',
|
|
147
|
+
dataIndex:'id',
|
|
148
|
+
render:(id)=> {
|
|
149
|
+
return <Button type='primary' onClick={()=>{
|
|
150
|
+
HttpUtils.get('admin/flowable/model/getDefinitionContent',{id}).then(xml=>{
|
|
151
|
+
this.bpmnModeler.importXML(xml)
|
|
152
|
+
this.setState({deployedModal:false})
|
|
153
|
+
})
|
|
154
|
+
}}>加载</Button>
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]}
|
|
158
|
+
request={params => {
|
|
159
|
+
params.key = this.state.model.key
|
|
160
|
+
return HttpUtils.get('admin/flowable/model/definitionPage', params)
|
|
161
|
+
}}>
|
|
162
|
+
|
|
163
|
+
</ProTable>
|
|
164
|
+
|
|
165
|
+
</Modal>
|
|
166
|
+
|
|
167
|
+
</Card>
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {is} from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
+
import {DelegateExpressionProps} from "./properties/DelegateExpressionProps";
|
|
3
|
+
import {FormProps} from "./properties/FormProps";
|
|
4
|
+
import {PreactUserTaskForm, renderReact, UserTaskForm} from "./properties/UserTaskForm";
|
|
5
|
+
import {isTextFieldEntryEdited} from "@bpmn-io/properties-panel";
|
|
6
|
+
import {ConditionProps} from "./properties/ConditionProps";
|
|
7
|
+
import {MultiInstanceProps} from "./properties/MultiInstanceProps";
|
|
8
|
+
|
|
9
|
+
const LOW_PRIORITY = 500;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default function FlowablePropertiesProvider(propertiesPanel) {
|
|
13
|
+
|
|
14
|
+
this.getGroups = function (element) {
|
|
15
|
+
return function (groups) {
|
|
16
|
+
if (is(element, 'bpmn:ServiceTask')) {
|
|
17
|
+
groups.push({
|
|
18
|
+
id: 'processBean',
|
|
19
|
+
label: "处理器",
|
|
20
|
+
entries: DelegateExpressionProps(element),
|
|
21
|
+
shouldOpen: true
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (is(element, 'bpmn:UserTask')) {
|
|
26
|
+
groups.push({
|
|
27
|
+
id: 'user',
|
|
28
|
+
label: "用户",
|
|
29
|
+
entries: [
|
|
30
|
+
{
|
|
31
|
+
id: 'user',
|
|
32
|
+
component: PreactUserTaskForm,
|
|
33
|
+
isEdited: isTextFieldEntryEdited,
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
shouldOpen: true
|
|
37
|
+
})
|
|
38
|
+
groups.push({
|
|
39
|
+
id: 'form',
|
|
40
|
+
label: "表单",
|
|
41
|
+
entries: FormProps(element),
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
if (is(element, 'bpmn:SequenceFlow')) {
|
|
45
|
+
groups.push({
|
|
46
|
+
id: 'condition',
|
|
47
|
+
label: "条件",
|
|
48
|
+
entries: ConditionProps(element),
|
|
49
|
+
shouldOpen: true
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let group = {
|
|
54
|
+
label: '多实例(集合设置)',
|
|
55
|
+
id: 'multiInstanceCollection',
|
|
56
|
+
entries: MultiInstanceProps({element}),
|
|
57
|
+
shouldOpen: true
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if(group.entries.length){
|
|
61
|
+
groups.push(group)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
return groups;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
propertiesPanel.registerProvider(LOW_PRIORITY, this);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
FlowablePropertiesProvider.$inject = ['propertiesPanel'];
|
|
74
|
+
|
|
75
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {Button, Input, InputNumber, Modal, Select} from "antd";
|
|
2
|
+
import React, {Component} from "react";
|
|
3
|
+
import {FieldBoolean, FieldTable, HttpUtils, StringUtils, ThemeUtils} from "../../../../../framework";
|
|
4
|
+
|
|
5
|
+
const metaInfo = {
|
|
6
|
+
STRING: {
|
|
7
|
+
ops: {
|
|
8
|
+
'==': '等于',
|
|
9
|
+
'!=': '不等于',
|
|
10
|
+
contains: '包含',
|
|
11
|
+
'!contains': '不包含',
|
|
12
|
+
startWith: '开头等于',
|
|
13
|
+
endWith: '结尾等于',
|
|
14
|
+
},
|
|
15
|
+
render() {
|
|
16
|
+
return <Input/>;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
NUMBER: {
|
|
20
|
+
ops: {
|
|
21
|
+
'==': '等于',
|
|
22
|
+
'!=': '不等于',
|
|
23
|
+
'>': '大于',
|
|
24
|
+
'<': '小于',
|
|
25
|
+
'>=': '大于等于',
|
|
26
|
+
'<=': '小于等于',
|
|
27
|
+
between: '介于',
|
|
28
|
+
},
|
|
29
|
+
render(op) {
|
|
30
|
+
if (op !== 'between') return <InputNumber/>;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Input.Group>
|
|
34
|
+
<InputNumber placeholder="最小值"></InputNumber>
|
|
35
|
+
<InputNumber placeholder="最大值"></InputNumber>
|
|
36
|
+
</Input.Group>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
BOOLEAN: {
|
|
41
|
+
ops: {
|
|
42
|
+
'==': '等于',
|
|
43
|
+
},
|
|
44
|
+
render() {
|
|
45
|
+
return <FieldBoolean/>;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export class ConditionDesignButton extends Component {
|
|
51
|
+
|
|
52
|
+
state = {
|
|
53
|
+
open: false,
|
|
54
|
+
varList: [],
|
|
55
|
+
varOptions: []
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
componentDidMount() {
|
|
59
|
+
const {processId} = this.props;
|
|
60
|
+
console.log('流程id', processId)
|
|
61
|
+
|
|
62
|
+
HttpUtils.get('admin/flowable/model/varList', {code: processId}).then(rs => {
|
|
63
|
+
|
|
64
|
+
const options = rs.map(r => {
|
|
65
|
+
return {
|
|
66
|
+
label: r.label,
|
|
67
|
+
value: r.name
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
this.setState({varList: rs, varOptions: options})
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onChange = arr => {
|
|
75
|
+
const str = this.convertArrToStr(arr)
|
|
76
|
+
this.props.setValue(str, this.props.element, this.props.modeling, this.props.bpmnFactory)
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
columns = [
|
|
80
|
+
{
|
|
81
|
+
dataIndex: 'key', title: '变量名称',
|
|
82
|
+
render: () => {
|
|
83
|
+
return <Select options={this.state.varOptions} style={{width: 200}}></Select>
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
dataIndex: 'op', title: '操作符', render: (v, record) => {
|
|
88
|
+
let options = []
|
|
89
|
+
let {varList} = this.state;
|
|
90
|
+
let varItem = varList.find(t => t.name === record.key)
|
|
91
|
+
|
|
92
|
+
if (varItem) {
|
|
93
|
+
const {valueType} = varItem;
|
|
94
|
+
const ops = metaInfo[valueType].ops;
|
|
95
|
+
options = Object.keys(ops).map(key => {
|
|
96
|
+
return {
|
|
97
|
+
label: ops[key],
|
|
98
|
+
value: key
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return <Select options={options} style={{width: 100}}></Select>
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{dataIndex: 'value', title: '值'},
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
let value = this.props.getValue(this.props.element);
|
|
111
|
+
let arrValue = this.convertStrToArr(value);
|
|
112
|
+
|
|
113
|
+
return <div style={{display: 'flex', justifyContent: 'right', padding: 8}}>
|
|
114
|
+
<Button type='primary' size='small'
|
|
115
|
+
styles={{
|
|
116
|
+
root: {backgroundColor: ThemeUtils.getColor('primary-color')}
|
|
117
|
+
}}
|
|
118
|
+
onClick={() => this.setState({open: true})}
|
|
119
|
+
>条件编辑器</Button>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
<Modal title='条件编辑器 (复杂表达式暂不支持)' open={this.state.open}
|
|
123
|
+
onCancel={() => this.setState({open: false})}
|
|
124
|
+
footer={null}
|
|
125
|
+
mask={{blur: false}}
|
|
126
|
+
destroyOnHidden
|
|
127
|
+
>
|
|
128
|
+
<FieldTable columns={this.columns}
|
|
129
|
+
value={arrValue}
|
|
130
|
+
onChange={this.onChange}
|
|
131
|
+
></FieldTable>
|
|
132
|
+
</Modal>
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
convertStrToArr(value) {
|
|
138
|
+
|
|
139
|
+
let arrValue = []
|
|
140
|
+
if (value) {
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
value = StringUtils.removePrefix(value, "${")
|
|
144
|
+
value = StringUtils.removeSuffix(value, "}")
|
|
145
|
+
const strArr = StringUtils.split(value, '&&');
|
|
146
|
+
|
|
147
|
+
const regex = /(\w+)([<>=!]+)(\w+)/;
|
|
148
|
+
|
|
149
|
+
strArr.forEach(expression => {
|
|
150
|
+
const parts = expression.match(regex);
|
|
151
|
+
// parts[0] 是整个匹配的字符串
|
|
152
|
+
// parts[1] 是第一个捕获组 (左操作数)
|
|
153
|
+
// parts[2] 是第二个捕获组 (操作符)
|
|
154
|
+
// parts[3] 是第三个捕获组 (右操作数)
|
|
155
|
+
arrValue.push({
|
|
156
|
+
key: parts[1],
|
|
157
|
+
op: parts[2],
|
|
158
|
+
value: parts[3],
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
return arrValue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
convertArrToStr = arrValue => {
|
|
166
|
+
const str = arrValue.map(i => {
|
|
167
|
+
const {key, op, value} = i;
|
|
168
|
+
return `${key}${op}${value}`
|
|
169
|
+
}).join('&&')
|
|
170
|
+
|
|
171
|
+
return "${" + str + "}"
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {isTextFieldEntryEdited, TextFieldEntry} from '@bpmn-io/properties-panel';
|
|
2
|
+
import {useService} from 'bpmn-js-properties-panel';
|
|
3
|
+
import {renderReact} from "./utils";
|
|
4
|
+
import {ConditionDesignButton} from "./ConditionDesign";
|
|
5
|
+
|
|
6
|
+
function PreactConditionDesign(props) {
|
|
7
|
+
return renderReact(props, ConditionDesignButton, {getValue,setValue})
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const getValue = (element) => {
|
|
12
|
+
const condition = element.businessObject.conditionExpression;
|
|
13
|
+
return condition ? condition.body : '';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const setValue =( value, element, modeling,moddle) => {
|
|
17
|
+
const businessObject = element.businessObject;
|
|
18
|
+
let conditionExpression = businessObject.conditionExpression;
|
|
19
|
+
|
|
20
|
+
if (!value) {
|
|
21
|
+
// 移除条件表达式
|
|
22
|
+
modeling.updateProperties(element, {
|
|
23
|
+
conditionExpression: undefined
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!conditionExpression) {
|
|
29
|
+
conditionExpression = moddle.create('bpmn:FormalExpression');
|
|
30
|
+
modeling.updateProperties(element, {
|
|
31
|
+
conditionExpression: conditionExpression
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 更新表达式主体
|
|
36
|
+
modeling.updateModdleProperties(element, conditionExpression, {
|
|
37
|
+
body: value
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export function ConditionProps() {
|
|
41
|
+
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
id: 'expression',
|
|
45
|
+
component: Component,
|
|
46
|
+
isEdited: isTextFieldEntryEdited,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'expressionDesign',
|
|
50
|
+
component: PreactConditionDesign,
|
|
51
|
+
isEdited: isTextFieldEntryEdited,
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Component(props) {
|
|
57
|
+
const {element, id} = props;
|
|
58
|
+
|
|
59
|
+
const modeling = useService('modeling');
|
|
60
|
+
const debounce = useService('debounceInput');
|
|
61
|
+
const moddle = useService('moddle');
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
return TextFieldEntry({
|
|
65
|
+
element,
|
|
66
|
+
id: id,
|
|
67
|
+
label: '条件表达式',
|
|
68
|
+
getValue,
|
|
69
|
+
setValue: value=>setValue(value,element,modeling,moddle),
|
|
70
|
+
debounce,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {isTextFieldEntryEdited, SelectEntry} from '@bpmn-io/properties-panel';
|
|
2
|
+
import { useService } from 'bpmn-js-properties-panel';
|
|
3
|
+
import { useEffect, useState } from '@bpmn-io/properties-panel/preact/hooks';
|
|
4
|
+
import {HttpUtils} from "../../../../../framework";
|
|
5
|
+
export function DelegateExpressionProps () {
|
|
6
|
+
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
id: 'delegateExpression',
|
|
10
|
+
component: Component,
|
|
11
|
+
isEdited: isTextFieldEntryEdited,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Component(props) {
|
|
18
|
+
const { element, id } = props;
|
|
19
|
+
|
|
20
|
+
const modeling = useService('modeling');
|
|
21
|
+
const debounce = useService('debounceInput');
|
|
22
|
+
|
|
23
|
+
const getValue = (element) => {
|
|
24
|
+
return element.businessObject.delegateExpression || '';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const setValue = value => {
|
|
28
|
+
return modeling.updateProperties(element, {
|
|
29
|
+
delegateExpression: value
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const [ options, setOptions ] = useState([]);
|
|
34
|
+
|
|
35
|
+
useEffect(async () => {
|
|
36
|
+
const rs = await HttpUtils.get('admin/flowable/model/javaDelegateOptions')
|
|
37
|
+
setOptions(rs)
|
|
38
|
+
}, [ setOptions ]);
|
|
39
|
+
|
|
40
|
+
return SelectEntry({
|
|
41
|
+
element,
|
|
42
|
+
id: id,
|
|
43
|
+
label: 'delegateExpression',
|
|
44
|
+
description: '实现JavaDelegate接口的Bean名称, 如 ${demoDelegate}',
|
|
45
|
+
getValue,
|
|
46
|
+
setValue,
|
|
47
|
+
debounce,
|
|
48
|
+
|
|
49
|
+
getOptions: () => {
|
|
50
|
+
return options
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {isTextFieldEntryEdited, SelectEntry} from '@bpmn-io/properties-panel';
|
|
2
|
+
import { useService } from 'bpmn-js-properties-panel';
|
|
3
|
+
import { useEffect, useState } from '@bpmn-io/properties-panel/preact/hooks';
|
|
4
|
+
import {HttpUtils} from "../../../../../framework";
|
|
5
|
+
export function FormProps () {
|
|
6
|
+
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
id: 'form',
|
|
10
|
+
component: Component,
|
|
11
|
+
isEdited: isTextFieldEntryEdited,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Component(props) {
|
|
18
|
+
const { element, id } = props;
|
|
19
|
+
|
|
20
|
+
const modeling = useService('modeling');
|
|
21
|
+
const debounce = useService('debounceInput');
|
|
22
|
+
const canvas = useService('canvas');
|
|
23
|
+
const rootElement = canvas.getRootElement();
|
|
24
|
+
const processId = rootElement.id;
|
|
25
|
+
const getValue = (element) => {
|
|
26
|
+
return element.businessObject.formKey || '';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const setValue = value => {
|
|
30
|
+
return modeling.updateProperties(element, {
|
|
31
|
+
formKey: value
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const [ options, setOptions ] = useState([]);
|
|
36
|
+
|
|
37
|
+
useEffect(async () => {
|
|
38
|
+
const rs = await HttpUtils.get('admin/flowable/model/formOptions',{code:processId})
|
|
39
|
+
setOptions(rs)
|
|
40
|
+
}, [ setOptions ]);
|
|
41
|
+
|
|
42
|
+
return SelectEntry({
|
|
43
|
+
element,
|
|
44
|
+
id: id,
|
|
45
|
+
label: '选择表单',
|
|
46
|
+
getValue,
|
|
47
|
+
setValue,
|
|
48
|
+
debounce,
|
|
49
|
+
|
|
50
|
+
getOptions: () => {
|
|
51
|
+
return [{ value: '', label: '<留空>'},...options]
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
}
|