@jiangood/open-admin-flowable 2.2.2 → 2.2.4

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/package.json CHANGED
@@ -34,5 +34,5 @@
34
34
  "scripts": {
35
35
  "dev": "umi dev"
36
36
  },
37
- "version": "2.2.2"
37
+ "version": "2.2.4"
38
38
  }
@@ -113,7 +113,7 @@ export default class extends React.Component {
113
113
  }
114
114
  return <Card title={'流程设计 ' + this.state.model?.name}
115
115
  extra={<Space>
116
- <Button type='primary' icon={<SaveOutlined/>} onClick={this.handleSave}>暂存</Button>
116
+ <Button type='primary' icon={<SaveOutlined/>} onClick={this.handleSave}>保存</Button>
117
117
  <Button type='primary' danger icon={<CloudUploadOutlined/>}
118
118
  onClick={this.handleDeploy}>部署</Button>
119
119
  <Button icon={<DownloadOutlined/>} onClick={this.handleExportXML}>导出XML</Button>
@@ -1,12 +1,98 @@
1
- import {Button, Popconfirm, Space} from 'antd';
1
+ import {Button, Card, Empty, Form, message, Modal, Popconfirm, Skeleton, Space, Table} from 'antd';
2
2
  import React from 'react';
3
- import {ButtonList, HttpUtils, Page, PageUtils, ProTable} from "@jiangood/open-admin";
3
+ import {ButtonList, FieldUserSelect, Gap, HttpUtils, Page, PageUtils, ProTable} from "@jiangood/open-admin";
4
4
 
5
- export default class extends React.Component {
5
+ class InstanceViewModal extends React.Component {
6
+ state = {
7
+ commentList: [],
8
+ id: null,
9
+ img: null,
10
+ loading: true,
11
+ errorMsg: null,
12
+ }
13
+
14
+ componentDidMount() {
15
+ const {id, businessKey} = this.props;
16
+ const reqParams = {id};
17
+ if (businessKey) reqParams.businessKey = businessKey;
18
+ HttpUtils.get('admin/flowable/user-task/getInstanceInfo', reqParams).then(rs => {
19
+ this.setState({
20
+ ...rs,
21
+ commentList: rs.commentList,
22
+ img: rs.img,
23
+ id: rs.id,
24
+ })
25
+ }).catch(e => {
26
+ this.setState({errorMsg: e})
27
+ }).finally(() => {
28
+ this.setState({loading: false})
29
+ })
30
+ }
31
+
32
+ getCommentColumns() {
33
+ return [
34
+ {dataIndex: 'content', title: '操作'},
35
+ {dataIndex: 'user', title: '处理人'},
36
+ {dataIndex: 'time', title: '处理时间'},
37
+ ];
38
+ }
39
+
40
+ render() {
41
+ if (this.state.errorMsg) {
42
+ return <Empty description={this.state.errorMsg}/>
43
+ }
44
+
45
+ const {commentList, img, loading, id} = this.state
46
+ if (loading) {
47
+ return <Skeleton/>
48
+ }
49
+
50
+ return <>
51
+ <Card title='流程图'>
52
+ <img src={img} style={{maxWidth: '100%'}}/>
53
+ </Card>
54
+ <Gap/>
55
+ <Card title='审批记录'>
56
+ <Table dataSource={commentList}
57
+ size='small'
58
+ pagination={false}
59
+ rowKey='id'
60
+ columns={this.getCommentColumns()}
61
+ />
62
+ </Card>
63
+ <Gap/>
64
+ {this.props.showVariables && (
65
+ <Card title='流程变量'>
66
+ <ProTable columns={[
67
+ {dataIndex: 'key', title: '变量名'},
68
+ {dataIndex: 'value', title: '变量值'},
69
+ ]}
70
+ rowKey='key'
71
+ request={() => HttpUtils.get('admin/flowable/monitor/instance/vars', {id})}
72
+ />
73
+ </Card>
74
+ )}
75
+ </>;
76
+ }
77
+ }
6
78
 
79
+ export default class extends React.Component {
7
80
 
8
81
  actionRef = React.createRef();
82
+ taskTableRef = React.createRef();
83
+ instanceTableRef = React.createRef();
84
+ definitionTableRef = React.createRef();
85
+ assigneeFormRef = React.createRef();
9
86
 
87
+ state = {
88
+ taskModalOpen: false,
89
+ instanceModalOpen: false,
90
+ definitionModalOpen: false,
91
+ viewModalOpen: false,
92
+ viewInstanceId: null,
93
+ assigneeFormOpen: false,
94
+ assigneeFormValues: {},
95
+ }
10
96
 
11
97
  columns = [
12
98
  {
@@ -17,8 +103,6 @@ export default class extends React.Component {
17
103
  title: '代码',
18
104
  dataIndex: 'key'
19
105
  },
20
-
21
-
22
106
  {
23
107
  title: '版本',
24
108
  dataIndex: 'version',
@@ -27,8 +111,6 @@ export default class extends React.Component {
27
111
  title: '更新时间',
28
112
  dataIndex: 'lastUpdateTime',
29
113
  },
30
-
31
-
32
114
  {
33
115
  title: '操作',
34
116
  dataIndex: 'option',
@@ -45,16 +127,162 @@ export default class extends React.Component {
45
127
  },
46
128
  ];
47
129
 
48
-
49
130
  handleDelete = row => {
50
131
  HttpUtils.post('admin/flowable/model/delete', {id: row.id}).then(rs => {
51
132
  this.actionRef.current.reload();
52
133
  })
53
134
  }
54
135
 
136
+ onClickSetAssignee = id => {
137
+ this.setState({assigneeFormOpen: true, assigneeFormValues: {taskId: id}})
138
+ };
55
139
 
56
- render() {
140
+ submitSetAssignee = values => {
141
+ HttpUtils.post('admin/flowable/monitor/setAssignee', values).then(() => {
142
+ this.setState({assigneeFormOpen: false})
143
+ this.taskTableRef.current.reload()
144
+ }).catch(e => {
145
+ message.error(e?.message || '指定处理人失败');
146
+ })
147
+ };
148
+
149
+ instanceColumns = [
150
+ {
151
+ title: 'ID',
152
+ dataIndex: 'id',
153
+ key: 'id',
154
+ },
155
+ {
156
+ title: '名称',
157
+ dataIndex: 'name',
158
+ key: 'name',
159
+ },
160
+ {
161
+ title: '流程定义名称',
162
+ dataIndex: 'processDefinitionName',
163
+ key: 'processDefinitionName',
164
+ },
165
+ {
166
+ title: '流程定义键',
167
+ dataIndex: 'processDefinitionKey',
168
+ key: 'processDefinitionKey',
169
+ },
170
+ {
171
+ title: '版本',
172
+ dataIndex: 'processDefinitionVersion',
173
+ key: 'processDefinitionVersion',
174
+ },
175
+ {
176
+ title: '业务键',
177
+ dataIndex: 'businessKey',
178
+ key: 'businessKey',
179
+ },
180
+ {
181
+ title: '状态',
182
+ dataIndex: 'suspended',
183
+ key: 'suspended',
184
+ render: (value) => value ? '已挂起' : '运行中',
185
+ },
186
+ {
187
+ title: '开始时间',
188
+ dataIndex: 'startTime',
189
+ key: 'startTime',
190
+ },
191
+ {
192
+ dataIndex: 'options',
193
+ title: '操作',
194
+ fixed: 'right',
195
+ render: (_, r) => {
196
+ return <Space>
197
+ <Button size='small' onClick={() => this.setState({viewModalOpen: true, viewInstanceId: r.id})}>查看</Button>
198
+ <Popconfirm title={'关闭流程'}
199
+ onConfirm={() => this.closeInstance(r.id)}>
200
+ <Button size='small'>终止</Button>
201
+ </Popconfirm>
202
+ </Space>
203
+ }
204
+ }
205
+ ]
206
+
207
+ closeInstance = (id) => {
208
+ HttpUtils.get('admin/flowable/monitor/processInstance/close', {id}).then((rs) => {
209
+ this.instanceTableRef.current.reload()
210
+ }).catch(e => {
211
+ message.error(e?.message || '关闭流程失败');
212
+ })
213
+ }
57
214
 
215
+ definitionColumns = [
216
+ {
217
+ title: 'ID',
218
+ dataIndex: 'id',
219
+ },
220
+ {
221
+ title: '分类',
222
+ dataIndex: 'category',
223
+ },
224
+ {
225
+ title: '名称',
226
+ dataIndex: 'name',
227
+ },
228
+ {
229
+ title: '键',
230
+ dataIndex: 'key',
231
+ },
232
+ {
233
+ title: '描述',
234
+ dataIndex: 'description',
235
+ },
236
+ {
237
+ title: '版本',
238
+ dataIndex: 'version',
239
+ },
240
+ {
241
+ title: '资源名称',
242
+ dataIndex: 'resourceName',
243
+ },
244
+ {
245
+ title: '部署ID',
246
+ dataIndex: 'deploymentId',
247
+ },
248
+ {
249
+ title: '图表资源名称',
250
+ dataIndex: 'diagramResourceName',
251
+ },
252
+ {
253
+ title: '是否有开始表单键',
254
+ dataIndex: 'hasStartFormKey',
255
+ render: (value) => value ? '是' : '否',
256
+ },
257
+ {
258
+ title: '是否有图形符号',
259
+ dataIndex: 'hasGraphicalNotation',
260
+ render: (value) => value ? '是' : '否',
261
+ },
262
+ {
263
+ title: '是否挂起',
264
+ dataIndex: 'suspended',
265
+ render: (value) => value ? '是' : '否',
266
+ },
267
+ {
268
+ title: '租户ID',
269
+ dataIndex: 'tenantId',
270
+ },
271
+ {
272
+ title: '派生自',
273
+ dataIndex: 'derivedFrom',
274
+ },
275
+ {
276
+ title: '根派生来源',
277
+ dataIndex: 'derivedFromRoot',
278
+ },
279
+ {
280
+ title: '派生版本',
281
+ dataIndex: 'derivedVersion',
282
+ },
283
+ ]
284
+
285
+ render() {
58
286
  return <Page padding>
59
287
  <ProTable
60
288
  actionRef={this.actionRef}
@@ -63,24 +291,124 @@ export default class extends React.Component {
63
291
  showToolbarSearch={true}
64
292
  toolBarRender={() => {
65
293
  return <ButtonList>
66
- <Button onClick={() => PageUtils.open('/flowable/monitor/task', "运行中的任务")}>
294
+ <Button onClick={() => this.setState({taskModalOpen: true})}>
67
295
  运行中的任务
68
296
  </Button>
69
- <Button onClick={() => PageUtils.open('/flowable/monitor/instance', "运行中的流程实例")}>
297
+ <Button onClick={() => this.setState({instanceModalOpen: true})}>
70
298
  运行中的流程实例
71
299
  </Button>
72
- <Button onClick={() => PageUtils.open('/flowable/monitor/definition', "已部署的流程定义")}>
300
+ <Button onClick={() => this.setState({definitionModalOpen: true})}>
73
301
  已部署的流程定义
74
302
  </Button>
75
303
  </ButtonList>
76
304
  }}
77
305
  />
78
306
 
307
+ <Modal title='运行中的任务' width={1200}
308
+ open={this.state.taskModalOpen}
309
+ onCancel={() => this.setState({taskModalOpen: false})}
310
+ footer={null} destroyOnClose
311
+ >
312
+ <ProTable
313
+ actionRef={this.taskTableRef}
314
+ columns={[
315
+ {
316
+ dataIndex: 'processInstanceName',
317
+ title: '实例名称'
318
+ },
319
+ {
320
+ dataIndex: 'name',
321
+ title: '任务名称',
322
+ },
323
+ {
324
+ dataIndex: 'assigneeLabel',
325
+ title: '处理人'
326
+ },
327
+ {
328
+ dataIndex: 'id',
329
+ title: '任务标识',
330
+ },
331
+ {
332
+ dataIndex: 'processDefinitionId',
333
+ title: '定义'
334
+ },
335
+ {
336
+ dataIndex: 'processInstanceId',
337
+ title: '实例'
338
+ },
339
+ {
340
+ dataIndex: 'startTime',
341
+ title: '开始时间'
342
+ },
343
+ {
344
+ dataIndex: 'tenantId',
345
+ title: '租户'
346
+ },
347
+ {
348
+ dataIndex: 'id',
349
+ render: (id) => {
350
+ return <Button size='small' onClick={() => this.onClickSetAssignee(id)}>指定处理人</Button>
351
+ }
352
+ }
353
+ ]}
354
+ request={(params) => HttpUtils.get('admin/flowable/monitor/task', params)}
355
+ >
356
+ <Form.Item label='受理人' name='assignee'>
357
+ <FieldUserSelect/>
358
+ </Form.Item>
359
+ </ProTable>
360
+ </Modal>
79
361
 
80
- </Page>
81
- }
362
+ <Modal title='指定处理人'
363
+ open={this.state.assigneeFormOpen}
364
+ onOk={() => this.assigneeFormRef.current.submit()}
365
+ onCancel={() => this.setState({assigneeFormOpen: false})}
366
+ destroyOnClose
367
+ >
368
+ <Form ref={this.assigneeFormRef} onFinish={this.submitSetAssignee}
369
+ initialValues={this.state.assigneeFormValues}>
370
+ <Form.Item name='taskId' noStyle>
371
+ </Form.Item>
372
+ <Form.Item name='assignee' label='用户'>
373
+ <FieldUserSelect/>
374
+ </Form.Item>
375
+ </Form>
376
+ </Modal>
82
377
 
378
+ <Modal title='运行中的流程实例' width={1200}
379
+ open={this.state.instanceModalOpen}
380
+ onCancel={() => this.setState({instanceModalOpen: false})}
381
+ footer={null} destroyOnClose
382
+ >
383
+ <ProTable
384
+ actionRef={this.instanceTableRef}
385
+ columns={this.instanceColumns}
386
+ request={(params) => HttpUtils.get('admin/flowable/monitor/instancePage', params)}
387
+ />
388
+ </Modal>
83
389
 
84
- }
85
-
390
+ <Modal title='实例详情' width={1000}
391
+ open={this.state.viewModalOpen}
392
+ onCancel={() => this.setState({viewModalOpen: false})}
393
+ footer={null} destroyOnClose
394
+ >
395
+ {this.state.viewInstanceId && (
396
+ <InstanceViewModal id={this.state.viewInstanceId} showVariables/>
397
+ )}
398
+ </Modal>
86
399
 
400
+ <Modal title='已部署的流程定义' width={1200}
401
+ open={this.state.definitionModalOpen}
402
+ onCancel={() => this.setState({definitionModalOpen: false})}
403
+ footer={null} destroyOnClose
404
+ >
405
+ <ProTable
406
+ actionRef={this.definitionTableRef}
407
+ search={false}
408
+ columns={this.definitionColumns}
409
+ request={(params) => HttpUtils.get('admin/flowable/monitor/definitionPage', params)}
410
+ />
411
+ </Modal>
412
+ </Page>
413
+ }
414
+ }