@steedos/standard-process-approval 2.5.0-beta.8 → 2.5.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.
@@ -1,26 +1,26 @@
1
1
  name: process_instance_history
2
- label: 批准历史
3
- description:
2
+ label: 批准步骤
3
+ description:
4
4
  fields:
5
5
  name:
6
6
  label: 步骤名称
7
- help:
8
- description:
7
+ help:
8
+ description:
9
9
  created_by:
10
10
  label: 提交人
11
- help:
12
- description:
11
+ help:
12
+ description:
13
13
  process_instance:
14
- label:
15
- help:
16
- description:
14
+ label:
15
+ help:
16
+ description:
17
17
  process_instance_node:
18
- label:
19
- help:
20
- description:
18
+ label:
19
+ help:
20
+ description:
21
21
  step_status:
22
22
  label: 状态
23
- help:
23
+ help:
24
24
  options:
25
25
  - label: 已批准
26
26
  value: approved
@@ -40,47 +40,47 @@ fields:
40
40
  value: removed
41
41
  - label: 已提交
42
42
  value: started
43
- description:
43
+ description:
44
44
  original_actor:
45
45
  label: 被分配人
46
- help:
47
- description:
46
+ help:
47
+ description:
48
48
  actor:
49
49
  label: 实际审批人
50
- help:
51
- description:
50
+ help:
51
+ description:
52
52
  target_object:
53
53
  label: 审批细节
54
- help:
55
- description:
54
+ help:
55
+ description:
56
56
  comments:
57
57
  label: 意见
58
- help:
59
- description:
58
+ help:
59
+ description:
60
60
  step_node:
61
- label:
62
- help:
63
- description:
61
+ label:
62
+ help:
63
+ description:
64
64
  elapsed_time_in_days:
65
- label:
66
- help:
67
- description:
65
+ label:
66
+ help:
67
+ description:
68
68
  elapsed_time_in_hours:
69
- label:
70
- help:
71
- description:
69
+ label:
70
+ help:
71
+ description:
72
72
  elapsed_time_in_minutes:
73
- label:
74
- help:
75
- description:
73
+ label:
74
+ help:
75
+ description:
76
76
  modified:
77
77
  label: 修改时间
78
- help:
79
- description:
78
+ help:
79
+ description:
80
80
  modified_by:
81
81
  label: 修改人
82
- help:
83
- description:
82
+ help:
83
+ description:
84
84
  listviews:
85
85
  all:
86
86
  label: 所有
@@ -59,8 +59,14 @@ amis_schema: |-
59
59
  "weight": 0,
60
60
  "actions": [
61
61
  {
62
- "actionType": "custom",
63
- "script": "const id = SteedosUI.getRef(event.data.scopeId).getComponents()[0].props.id;doAction({'actionType': 'reload','componentId': id,});"
62
+ "actionType": "broadcast",
63
+ "args": {
64
+ "eventName": "@data.changed.process_instance_history"
65
+ },
66
+ "data": {
67
+ "objectName": "process_instance_history",
68
+ "displayAs": "${displayAs}"
69
+ }
64
70
  }
65
71
  ]
66
72
  }
@@ -57,10 +57,16 @@ amis_schema: |-
57
57
  "submitSucc": {
58
58
  "weight": 0,
59
59
  "actions": [
60
- {
61
- "actionType": "custom",
62
- "script": "const id = SteedosUI.getRef(event.data.scopeId).getComponents()[0].props.id;doAction({'actionType': 'reload','componentId': id,});"
63
- }
60
+ {
61
+ "actionType": "broadcast",
62
+ "args": {
63
+ "eventName": "@data.changed.process_instance_history"
64
+ },
65
+ "data": {
66
+ "objectName": "process_instance_history",
67
+ "displayAs": "${displayAs}"
68
+ }
69
+ }
64
70
  ]
65
71
  }
66
72
  }
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- recallVisible: function(){
3
- return Steedos.ProcessManager.allowRecall(Session.get("object_name"), Session.get("record_id"))
4
- }
5
- }
2
+ recallVisible: function (object_name, record_id, record_permissions, props) {
3
+ return Steedos.ProcessManager.allowRecall(props.record.target_object.o, props.record.target_object.ids[0])
4
+ },
5
+ }
@@ -32,7 +32,7 @@ amis_schema: |-
32
32
  "mode": "normal",
33
33
  "api": {
34
34
  "method": "post",
35
- "url": "${context.rootUrl}/api/v4/process/recall/${objectName}/${recordId}",
35
+ "url": "${context.rootUrl}/api/v4/process/recall/${record.target_object.o}/${record.target_object.ids[0]}",
36
36
  "data": {
37
37
  "&": "$$"
38
38
  },
@@ -50,10 +50,16 @@ amis_schema: |-
50
50
  "submitSucc": {
51
51
  "weight": 0,
52
52
  "actions": [
53
- {
54
- "actionType": "custom",
55
- "script": "const id = SteedosUI.getRef(event.data.scopeId).getComponents()[0].props.id;doAction({'actionType': 'reload','componentId': id,});"
56
- }
53
+ {
54
+ "actionType": "broadcast",
55
+ "args": {
56
+ "eventName": "@data.changed.process_instance_history"
57
+ },
58
+ "data": {
59
+ "objectName": "process_instance_history",
60
+ "displayAs": "${displayAs}"
61
+ }
62
+ }
57
63
  ]
58
64
  }
59
65
  }
@@ -50,10 +50,16 @@ amis_schema: |-
50
50
  "submitSucc": {
51
51
  "weight": 0,
52
52
  "actions": [
53
- {
54
- "actionType": "custom",
55
- "script": "const id = SteedosUI.getRef(event.data.scopeId).getComponents()[0].props.id;doAction({'actionType': 'reload','componentId': id,});"
56
- }
53
+ {
54
+ "actionType": "broadcast",
55
+ "args": {
56
+ "eventName": "@data.changed.process_instance_history"
57
+ },
58
+ "data": {
59
+ "objectName": "process_instance_history",
60
+ "displayAs": "${displayAs}"
61
+ }
62
+ }
57
63
  ]
58
64
  }
59
65
  }
@@ -0,0 +1,150 @@
1
+ {
2
+ "type": "page",
3
+ "body": [
4
+ {
5
+ "type": "service",
6
+ "body": [
7
+ {
8
+ "type": "steedos-record-detail-header",
9
+ "label": "标题面板",
10
+ "objectApiName": "${objectName}",
11
+ "recordId": "${recordId}",
12
+ "onEvent": {
13
+ "recordLoaded": {
14
+ "actions": [
15
+ {
16
+ "actionType": "reload",
17
+ "data": {
18
+ "name": "${event.data.record.name}",
19
+ "record": "${event.data.record}",
20
+ "recordLoaded": true
21
+ },
22
+ "expression": "${event.data.objectName == \"process_instance_history\"}"
23
+ },
24
+ {
25
+ "actionType": "reload",
26
+ "componentId": "page_readonly_process_instance_history_header",
27
+ "data": {
28
+ "name": "${event.data.record.name}",
29
+ "record": "${event.data.record}",
30
+ "recordLoaded": true
31
+ },
32
+ "expression": "${event.data.objectName == \"process_instance_history\"}"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ "id": "u:3142da7da301"
38
+ },
39
+ {
40
+ "type": "tabs",
41
+ "id": "u:ab1b39f4011e",
42
+ "tabs": [
43
+ {
44
+ "title": "详情",
45
+ "body": [
46
+ {
47
+ "id": "u:731d4077557a",
48
+ "type": "group",
49
+ "body": [
50
+ {
51
+ "objectApiName": "${target_object.o}",
52
+ "type": "steedos-object-form",
53
+ "id": "u:d1f14744310b",
54
+ "label": "对象表单",
55
+ "recordId": "${target_object.ids[0]}",
56
+ "visibleOn": "${!!target_object}",
57
+ "className": "antd-Form antd-Form--normal steedos-amis-form bg-white",
58
+ "mode": "read"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "type": "steedos-object-form",
64
+ "id": "u:d1f14744310b",
65
+ "className": "antd-Form antd-Form--normal steedos-amis-form bg-white hidden",
66
+ "label": "对象表单",
67
+ "objectApiName": "${objectName}",
68
+ "recordId": "${recordId}"
69
+ }
70
+ ],
71
+ "id": "u:78283d8a88a6",
72
+ "className": "px-0"
73
+ },
74
+ {
75
+ "title": "相关表",
76
+ "body": [
77
+ {
78
+ "type": "group",
79
+ "id": "u:731d4077557a",
80
+ "className": "px-0",
81
+ "body": [
82
+ {
83
+ "type": "steedos-object-related-lists",
84
+ "id": "u:f3101a683d9e",
85
+ "label": "所有相关表",
86
+ "recordId": "${target_object.ids[0]}",
87
+ "objectApiName": "${target_object.o}",
88
+ "visibleOn": "${!!target_object}"
89
+ }
90
+ ]
91
+ }
92
+ ],
93
+ "id": "u:2828559659a3"
94
+ },
95
+ {
96
+ "title": "当前记录",
97
+ "body": [
98
+ {
99
+ "type": "steedos-object-form",
100
+ "id": "u:d1f14744310b",
101
+ "className": "antd-Form antd-Form--normal steedos-amis-form bg-white",
102
+ "label": "对象表单",
103
+ "objectApiName": "${objectName}",
104
+ "recordId": "${recordId}"
105
+ }
106
+ ],
107
+ "id": "u:f3d64f216153",
108
+ "className": "px-0"
109
+ }
110
+ ],
111
+ "className": "antd-Tabs antd-Tabs--line bg-white border-slate-300 p-4 sm:border sm:mt-3 sm:rounded sm:shadow",
112
+ "toolbarClassName": "",
113
+ "contentClassName": ""
114
+ }
115
+ ],
116
+ "data": {
117
+ "_master.objectName": "${objectName}",
118
+ "_master.recordId": "${recordId}"
119
+ },
120
+ "onEvent": {
121
+ "recordLoaded": {
122
+ "actions": [
123
+ {
124
+ "actionType": "reload",
125
+ "data": {
126
+ "name": "${record.name}",
127
+ "_master.record": "${record}",
128
+ "_master.objectName": "${objectName}",
129
+ "_master.recordId": "${recordId}"
130
+ }
131
+ }
132
+ ]
133
+ }
134
+ },
135
+ "id": "u:be317b257920",
136
+ "messages": {}
137
+ }
138
+ ],
139
+ "regions": [
140
+ "body"
141
+ ],
142
+ "data": {
143
+ "objectName": "process_instance_history",
144
+ "recordId": "oaPathAspPZbjjjpm",
145
+ "context": {}
146
+ },
147
+ "id": "page_process_instance_history_record_detail",
148
+ "name": "page_process_instance_history_record_detail",
149
+ "bodyClassName": ""
150
+ }
@@ -0,0 +1,12 @@
1
+ name: process_instance_detail
2
+ is_active: true
3
+ label: 批准过程记录详情页
4
+ object_name: process_instance_history
5
+ pageAssignments:
6
+ - type: orgDefault
7
+ page: process_instance_detail
8
+ desktop: true
9
+ mobile: true
10
+ render_engine: amis
11
+ type: record
12
+ widgets: []
@@ -53,7 +53,7 @@ fields:
53
53
  var options = [];
54
54
  if(object){
55
55
  var userFields = _.filter(object.fields, function(field){
56
- return (field.type === 'lookup' || field.type === 'master_detail') && field.omit != true && field.reference_to === 'users'
56
+ return (field.type === 'lookup' || field.type === 'master_detail') && field.omit != true && (field.reference_to === 'users' || ('space_users' === field.reference_to && 'user' === field.reference_to_field))
57
57
  });
58
58
  _.each(userFields, function(field){
59
59
  options.push({label:field.label, value:field.name});
@@ -100,6 +100,18 @@ const getProcessNodeObjectName = async function(processId){
100
100
  }
101
101
  }
102
102
 
103
+
104
+ const getSourceApprovalProcessNodes = ()=>{
105
+ const nodes = [];
106
+ _.each(objectql.getSourceApprovalProcesses(), (item)=>{
107
+ _.each(item.process_nodes, (pNode)=>{
108
+ nodes.push(Object.assign({}, pNode, {process_definition: item._id, _id: `${item.name}.${pNode.name}`}))
109
+ })
110
+
111
+ })
112
+ return nodes;
113
+ }
114
+
103
115
  module.exports = {
104
116
  beforeInsert: async function () {
105
117
 
@@ -170,62 +182,26 @@ module.exports = {
170
182
  await reviseRecordOrder(this.previousDoc.process_definition);
171
183
  },
172
184
  afterFind: async function(){
173
- let filters = InternalData.parserFilters(this.query.filters)
174
- let processNodes = [];
175
- if(filters.process_definition){
176
- approvalProcess = objectql.getSourceApprovalProcess(filters.process_definition);
177
- if(approvalProcess){
178
- processNodes = approvalProcess.process_nodes
179
- }
180
- delete filters.process_definition
185
+ let spaceId = this.spaceId;
186
+ let sourceData = getSourceApprovalProcessNodes();
187
+ this.data.values = this.data.values.concat(sourceData);
188
+ const values = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
189
+ for(let node of values){
190
+ setSpaceAndOwner(node, this);
181
191
  }
192
+ this.data.values = values
182
193
 
183
- if(processNodes){
184
- for(let node of processNodes){
185
- setSpaceAndOwner(node, this);
186
- }
187
- this.data.values = this.data.values.concat(processNodes)
188
- }
189
- },
190
- afterAggregate: async function(){
191
- let filters = InternalData.parserFilters(this.query.filters)
192
- let processNodes = [];
193
- if(filters.process_definition){
194
- approvalProcess = objectql.getSourceApprovalProcess(filters.process_definition);
195
- if(approvalProcess){
196
- processNodes = approvalProcess.process_nodes
197
- }
198
- delete filters.process_definition
199
- }
200
-
201
- if(processNodes){
202
- this.data.values = this.data.values.concat(processNodes)
203
- }
204
194
  },
205
195
  afterCount: async function(){
206
- let filters = InternalData.parserFilters(this.query.filters)
207
- let processNodes = [];
208
- if(filters.process_definition){
209
- approvalProcess = objectql.getSourceApprovalProcess(filters.process_definition);
210
- if(approvalProcess){
211
- processNodes = approvalProcess.process_nodes
212
- }
213
- delete filters.process_definition
214
- }
215
-
216
- if(processNodes){
217
- this.data.values = this.data.values + processNodes.length
218
- }
196
+ let spaceId = this.spaceId;
197
+ this.data.values = this.data.values + objectql.getSteedosSchema().metadataDriver.count(getSourceApprovalProcessNodes(), this.query, spaceId);
219
198
  },
220
199
  afterFindOne: async function(){
200
+ let spaceId = this.spaceId;
221
201
  if(_.isEmpty(this.data.values)){
222
- let id = this.id
223
- let objectName = id.substr(0, id.indexOf("."));
224
- if(objectName){
225
- let processNode = objectql.getSourceProcessNode(objectName, id.substr(id.indexOf(".")+1));
226
- if(processNode){
227
- this.data.values = processNode;
228
- }
202
+ const records = objectql.getSteedosSchema().metadataDriver.find(getSourceApprovalProcessNodes(), {filters: ['_id', '=', this.id]}, spaceId);
203
+ if(records.length > 0){
204
+ this.data.values = records[0]
229
205
  }
230
206
  }
231
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-process-approval",
3
- "version": "2.5.0-beta.8",
3
+ "version": "2.5.0",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -10,10 +10,10 @@
10
10
  "steedos"
11
11
  ],
12
12
  "dependencies": {
13
- "@steedos/process": "2.5.0-beta.8"
13
+ "@steedos/process": "2.5.0"
14
14
  },
15
15
  "description": "steedos package",
16
16
  "repository": {},
17
17
  "license": "MIT",
18
- "gitHead": "537101194e8c7c61a4eed846d28382126d947775"
18
+ "gitHead": "c4b366d1366ab52eb53da1a3ff4a80b16fd73cc0"
19
19
  }
@@ -1,26 +0,0 @@
1
- module.exports = {
2
- approveVisible: function(object_name, record_id, record_permissions){
3
- return Steedos.ProcessManager.allowApprover(object_name, record_id)
4
- },
5
- approve: function(object_name, record_id, fields){
6
- Steedos.ProcessManager.approve(object_name, record_id);
7
- },
8
- rejectVisible: function(object_name, record_id, record_permissions){
9
- return Steedos.ProcessManager.allowApprover(object_name, record_id)
10
- },
11
- reject: function(object_name, record_id, fields){
12
- Steedos.ProcessManager.reject(object_name, record_id);
13
- },
14
- reassignVisible: function(object_name, record_id, record_permissions){
15
- return Steedos.ProcessManager.allowApprover(object_name, record_id)
16
- },
17
- reassign: function(object_name, record_id, fields){
18
- Steedos.ProcessManager.reassign(object_name, record_id);
19
- },
20
- recallVisible: function(){
21
- return Steedos.ProcessManager.allowRecall(Session.get("object_name"), Session.get("record_id"))
22
- },
23
- recall: function(object_name, record_id, fields){
24
- Steedos.ProcessManager.recall(object_name, record_id);
25
- }
26
- }