@steedos/standard-process-approval 2.5.0-beta.9 → 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.
@@ -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
  }
@@ -18,7 +18,8 @@
18
18
  "name": "${event.data.record.name}",
19
19
  "record": "${event.data.record}",
20
20
  "recordLoaded": true
21
- }
21
+ },
22
+ "expression": "${event.data.objectName == \"process_instance_history\"}"
22
23
  },
23
24
  {
24
25
  "actionType": "reload",
@@ -27,7 +28,8 @@
27
28
  "name": "${event.data.record.name}",
28
29
  "record": "${event.data.record}",
29
30
  "recordLoaded": true
30
- }
31
+ },
32
+ "expression": "${event.data.objectName == \"process_instance_history\"}"
31
33
  }
32
34
  ]
33
35
  }
@@ -51,7 +53,7 @@
51
53
  "id": "u:d1f14744310b",
52
54
  "label": "对象表单",
53
55
  "recordId": "${target_object.ids[0]}",
54
- "visableOn": "${!!target_object}",
56
+ "visibleOn": "${!!target_object}",
55
57
  "className": "antd-Form antd-Form--normal steedos-amis-form bg-white",
56
58
  "mode": "read"
57
59
  }
@@ -83,7 +85,7 @@
83
85
  "label": "所有相关表",
84
86
  "recordId": "${target_object.ids[0]}",
85
87
  "objectApiName": "${target_object.o}",
86
- "visableOn": "${!!target_object}"
88
+ "visibleOn": "${!!target_object}"
87
89
  }
88
90
  ]
89
91
  }
@@ -145,4 +147,4 @@
145
147
  "id": "page_process_instance_history_record_detail",
146
148
  "name": "page_process_instance_history_record_detail",
147
149
  "bodyClassName": ""
148
- }
150
+ }
@@ -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.9",
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.9"
13
+ "@steedos/process": "2.5.0"
14
14
  },
15
15
  "description": "steedos package",
16
16
  "repository": {},
17
17
  "license": "MIT",
18
- "gitHead": "a2623b433dd42632dc54d23c51b718bd4d1a2fdc"
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
- }