@steedos/standard-process-approval 2.3.4 → 2.4.0-beta.10

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.
@@ -74,7 +74,7 @@ Steedos.getDisplayObjects = function(filterFunction){
74
74
  if (filterFunction && _.isFunction(filterFunction)) {
75
75
  filterReturn = filterFunction(object);
76
76
  }
77
- if (filterReturn && !object.hidden && !_.include(['cfs_instances_filerecord'], object.name)) {
77
+ if (filterReturn && !object.hidden && !_.includes(['cfs_instances_filerecord'], object.name)) {
78
78
  objects.push(object)
79
79
  }
80
80
  })
@@ -38,7 +38,8 @@ Steedos.ProcessManager.allowSubmit = function(object_name, record_id){
38
38
  if(!object_name || !record_id){
39
39
  return false;
40
40
  }
41
- if(!Creator.getObject(object_name).enable_process){
41
+ const object = this.object || window.Creator?.getObject(object_name)
42
+ if(!object.enable_process){
42
43
  return false;
43
44
  }
44
45
  var result = Steedos.authRequest(`/api/v4/process/permission/submit/${object_name}/${record_id}`, {type: 'get', async: false});
@@ -0,0 +1,12 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2023-01-07 09:43:43
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-01-07 09:45:30
6
+ * @Description:
7
+ */
8
+ module.exports = {
9
+ approveVisible: function(object_name, record_id, record_permissions){
10
+ return Steedos.ProcessManager.allowApprover(object_name, record_id)
11
+ }
12
+ }
@@ -0,0 +1,105 @@
1
+ name: approve
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "批准",
9
+ "id": "u:standard_submit_for_approval",
10
+ "onEvent": {
11
+ "click": {
12
+ "actions": [
13
+ {
14
+ "actionType": "dialog",
15
+ "dialog": {
16
+ "type": "dialog",
17
+ "title": "批准",
18
+ "body": [
19
+ {
20
+ "type": "form",
21
+ "id": "u:1eb06e6962d8",
22
+ "title": "表单",
23
+ "body": [
24
+ {
25
+ "type": "steedos-field",
26
+ "id": "u:9f4486c22f52",
27
+ "field": "{\n \"label\": \"意见\",\n \"name\": \"comment\",\n \"type\": \"textarea\",\n \"rows\": 3,\n \"is_wide\": true\n}",
28
+ "name": "comment"
29
+ },
30
+ {
31
+ "type": "steedos-field",
32
+ "id": "u:9f4486c22f52",
33
+ "field": "{\n \"label\": \"选择下一位批准人\",\n \"name\": \"approver\",\n \"type\": \"lookup\",\n \"reference_to\": \"space_users\",\n \"reference_to_field\": \"user\",\n \"required\": true,\n \"is_wide\": true\n}",
34
+ "name": "approver",
35
+ "placeholder": "",
36
+ "visibleOn": "${showApprover === true}"
37
+ }
38
+ ],
39
+ "wrapWithPanel": false,
40
+ "mode": "normal",
41
+ "api": {
42
+ "method": "post",
43
+ "url": "${context.rootUrl}/api/v4/process/approve/${objectName}/${recordId}",
44
+ "data": {
45
+ "&": "$$"
46
+ },
47
+ "requestAdaptor": "console.log(\"api\", api)\n\napi.data = {\n comment: api.body.comment\n};\n\nif (api.body.approver) {\n api.data.approver = api.body.approver;\n}\n\nreturn api;",
48
+ "adaptor": "console.log(\"payload====>\", payload);\npayload.data = {};\npayload.data.showApprover = payload.error === 'process_approval_error_needToChooseApprover'\n\nif (payload.state === 'FAILURE') {\n if (payload.data.showApprover) {\n payload.msg = \"请选择下一位批准人\";\n } else { \n payload.msg = window.t(payload.error)\n }\n}\n\n\nreturn payload;",
49
+ "responseData": {
50
+ "&": "$$"
51
+ },
52
+ "headers": {
53
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
54
+ }
55
+ },
56
+ "debug": false,
57
+ "onEvent": {
58
+ "submitSucc": {
59
+ "weight": 0,
60
+ "actions": [
61
+ {
62
+ "actionType": "custom",
63
+ "script": "const id = SteedosUI.getRef(event.data.scopeId).getComponents()[0].props.id;doAction({'actionType': 'reload','componentId': id,});"
64
+ }
65
+ ]
66
+ }
67
+ }
68
+ }
69
+ ],
70
+ "id": "u:7a3f92e56805",
71
+ "closeOnEsc": false,
72
+ "closeOnOutside": false,
73
+ "showCloseButton": true,
74
+ "size": "md"
75
+ }
76
+ }
77
+ ],
78
+ "weight": 0
79
+ }
80
+ }
81
+ }
82
+ ],
83
+ "regions": [
84
+ "body"
85
+ ],
86
+ "data": {
87
+ "context": {
88
+ "rootUrl": "http://127.0.0.1:5300"
89
+ },
90
+ "app_id": "",
91
+ "tab_id": "",
92
+ "object_name": "",
93
+ "dataComponentId": "",
94
+ "record_id": "",
95
+ "record": {},
96
+ "permissions": {}
97
+ },
98
+ "bodyClassName": "p-0",
99
+ "id": "u:50444554a302"
100
+ }
101
+ is_enable: true
102
+ label: 核准
103
+ 'on': record_only
104
+ type: amis_button
105
+ visible: true
@@ -0,0 +1,12 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2023-01-07 09:44:02
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-01-07 09:45:48
6
+ * @Description:
7
+ */
8
+ module.exports = {
9
+ reassignVisible: function(object_name, record_id, record_permissions){
10
+ return Steedos.ProcessManager.allowApprover(object_name, record_id)
11
+ }
12
+ }
@@ -0,0 +1,104 @@
1
+ name: reassign
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "转签核",
9
+ "id": "u:standard_submit_for_approval",
10
+ "onEvent": {
11
+ "click": {
12
+ "actions": [
13
+ {
14
+ "actionType": "dialog",
15
+ "dialog": {
16
+ "type": "dialog",
17
+ "title": "转签核批准请求",
18
+ "body": [
19
+ {
20
+ "type": "form",
21
+ "id": "u:1eb06e6962d8",
22
+ "title": "表单",
23
+ "body": [
24
+ {
25
+ "type": "steedos-field",
26
+ "id": "u:9f4486c22f52",
27
+ "field": "{\n \"label\": \"转签核处理人\",\n \"name\": \"approver\",\n \"type\": \"lookup\",\n \"reference_to\": \"space_users\",\n \"reference_to_field\": \"user\",\n \"required\": true,\n \"is_wide\": true\n}",
28
+ "name": "approver",
29
+ "placeholder": ""
30
+ },
31
+ {
32
+ "type": "steedos-field",
33
+ "id": "u:9f4486c22f52",
34
+ "field": "{\n \"label\": \"意见\",\n \"name\": \"comment\",\n \"type\": \"textarea\",\n \"rows\": 3,\n \"is_wide\": true\n}",
35
+ "name": "comment"
36
+ }
37
+ ],
38
+ "wrapWithPanel": false,
39
+ "mode": "normal",
40
+ "api": {
41
+ "method": "post",
42
+ "url": "${context.rootUrl}/api/v4/process/reassign/${objectName}/${recordId}",
43
+ "data": {
44
+ "&": "$$"
45
+ },
46
+ "requestAdaptor": "console.log(\"api\", api)\n\napi.data = {\n comment: api.body.comment\n};\n\nif (api.body.approver) {\n api.data.approver = api.body.approver;\n}\n\nreturn api;",
47
+ "adaptor": "console.log(\"payload====>\", payload);\nif (payload.state === 'FAILURE') {\n payload.msg = window.t(payload.error)\n}\nreturn payload;",
48
+ "responseData": {
49
+ "&": "$$"
50
+ },
51
+ "headers": {
52
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
53
+ }
54
+ },
55
+ "debug": false,
56
+ "onEvent": {
57
+ "submitSucc": {
58
+ "weight": 0,
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
+ }
64
+ ]
65
+ }
66
+ }
67
+ }
68
+ ],
69
+ "id": "u:7a3f92e56805",
70
+ "closeOnEsc": false,
71
+ "closeOnOutside": false,
72
+ "showCloseButton": true,
73
+ "size": "md"
74
+ }
75
+ }
76
+ ],
77
+ "weight": 0
78
+ }
79
+ }
80
+ }
81
+ ],
82
+ "regions": [
83
+ "body"
84
+ ],
85
+ "data": {
86
+ "context": {
87
+ "rootUrl": "http://127.0.0.1:5300"
88
+ },
89
+ "app_id": "",
90
+ "tab_id": "",
91
+ "object_name": "",
92
+ "dataComponentId": "",
93
+ "record_id": "",
94
+ "record": {},
95
+ "permissions": {}
96
+ },
97
+ "bodyClassName": "p-0",
98
+ "id": "u:50444554a302"
99
+ }
100
+ is_enable: true
101
+ label: 转签核
102
+ 'on': record_only
103
+ type: amis_button
104
+ visible: true
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ recallVisible: function(){
3
+ return Steedos.ProcessManager.allowRecall(Session.get("object_name"), Session.get("record_id"))
4
+ }
5
+ }
@@ -0,0 +1,97 @@
1
+ name: recall
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "取消申请",
9
+ "id": "u:standard_submit_for_approval",
10
+ "onEvent": {
11
+ "click": {
12
+ "actions": [
13
+ {
14
+ "actionType": "dialog",
15
+ "dialog": {
16
+ "type": "dialog",
17
+ "title": "取消申请",
18
+ "body": [
19
+ {
20
+ "type": "form",
21
+ "id": "u:1eb06e6962d8",
22
+ "title": "表单",
23
+ "body": [
24
+ {
25
+ "type": "steedos-field",
26
+ "id": "u:9f4486c22f52",
27
+ "field": "{\n \"label\": \"意见\",\n \"name\": \"comment\",\n \"type\": \"textarea\",\n \"rows\": 3,\n \"is_wide\": true\n}",
28
+ "name": "comment"
29
+ }
30
+ ],
31
+ "wrapWithPanel": false,
32
+ "mode": "normal",
33
+ "api": {
34
+ "method": "post",
35
+ "url": "${context.rootUrl}/api/v4/process/recall/${objectName}/${recordId}",
36
+ "data": {
37
+ "&": "$$"
38
+ },
39
+ "requestAdaptor": "api.data = {\n comment: api.body.comment\n};\nreturn api;",
40
+ "adaptor": "console.log(\"payload====>\", payload);\nif (payload.state === 'FAILURE') {\n payload.msg = window.t(payload.error)\n}\n\nreturn payload;",
41
+ "responseData": {
42
+ "&": "$$"
43
+ },
44
+ "headers": {
45
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
46
+ }
47
+ },
48
+ "debug": false,
49
+ "onEvent": {
50
+ "submitSucc": {
51
+ "weight": 0,
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
+ }
57
+ ]
58
+ }
59
+ }
60
+ }
61
+ ],
62
+ "id": "u:7a3f92e56805",
63
+ "closeOnEsc": false,
64
+ "closeOnOutside": false,
65
+ "showCloseButton": true,
66
+ "size": "md"
67
+ }
68
+ }
69
+ ],
70
+ "weight": 0
71
+ }
72
+ }
73
+ }
74
+ ],
75
+ "regions": [
76
+ "body"
77
+ ],
78
+ "data": {
79
+ "context": {
80
+ "rootUrl": "http://127.0.0.1:5300"
81
+ },
82
+ "app_id": "",
83
+ "tab_id": "",
84
+ "object_name": "",
85
+ "dataComponentId": "",
86
+ "record_id": "",
87
+ "record": {},
88
+ "permissions": {}
89
+ },
90
+ "bodyClassName": "p-0",
91
+ "id": "u:50444554a302"
92
+ }
93
+ is_enable: true
94
+ label: 取消申请
95
+ 'on': record_only
96
+ type: amis_button
97
+ visible: true
@@ -0,0 +1,12 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2023-01-07 09:44:36
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-01-07 09:46:18
6
+ * @Description:
7
+ */
8
+ module.exports = {
9
+ rejectVisible: function(object_name, record_id, record_permissions){
10
+ return Steedos.ProcessManager.allowApprover(object_name, record_id)
11
+ }
12
+ }
@@ -0,0 +1,97 @@
1
+ name: reject
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "拒绝",
9
+ "id": "u:standard_submit_for_approval",
10
+ "onEvent": {
11
+ "click": {
12
+ "actions": [
13
+ {
14
+ "actionType": "dialog",
15
+ "dialog": {
16
+ "type": "dialog",
17
+ "title": "拒绝",
18
+ "body": [
19
+ {
20
+ "type": "form",
21
+ "id": "u:1eb06e6962d8",
22
+ "title": "表单",
23
+ "body": [
24
+ {
25
+ "type": "steedos-field",
26
+ "id": "u:9f4486c22f52",
27
+ "field": "{\n \"label\": \"意见\",\n \"name\": \"comment\",\n \"type\": \"textarea\",\n \"rows\": 3,\n \"is_wide\": true\n}",
28
+ "name": "comment"
29
+ }
30
+ ],
31
+ "wrapWithPanel": false,
32
+ "mode": "normal",
33
+ "api": {
34
+ "method": "post",
35
+ "url": "${context.rootUrl}/api/v4/process/reject/${objectName}/${recordId}",
36
+ "data": {
37
+ "&": "$$"
38
+ },
39
+ "requestAdaptor": "api.data = {\n comment: api.body.comment\n};\nreturn api;",
40
+ "adaptor": "console.log(\"payload====>\", payload);\nif (payload.state === 'FAILURE') {\n payload.msg = window.t(payload.error)\n}\n\nreturn payload;",
41
+ "responseData": {
42
+ "&": "$$"
43
+ },
44
+ "headers": {
45
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
46
+ }
47
+ },
48
+ "debug": false,
49
+ "onEvent": {
50
+ "submitSucc": {
51
+ "weight": 0,
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
+ }
57
+ ]
58
+ }
59
+ }
60
+ }
61
+ ],
62
+ "id": "u:7a3f92e56805",
63
+ "closeOnEsc": false,
64
+ "closeOnOutside": false,
65
+ "showCloseButton": true,
66
+ "size": "md"
67
+ }
68
+ }
69
+ ],
70
+ "weight": 0
71
+ }
72
+ }
73
+ }
74
+ ],
75
+ "regions": [
76
+ "body"
77
+ ],
78
+ "data": {
79
+ "context": {
80
+ "rootUrl": "http://127.0.0.1:5300"
81
+ },
82
+ "app_id": "",
83
+ "tab_id": "",
84
+ "object_name": "",
85
+ "dataComponentId": "",
86
+ "record_id": "",
87
+ "record": {},
88
+ "permissions": {}
89
+ },
90
+ "bodyClassName": "p-0",
91
+ "id": "u:50444554a302"
92
+ }
93
+ is_enable: true
94
+ label: 拒绝
95
+ 'on': record_only
96
+ type: amis_button
97
+ visible: true
@@ -3,7 +3,7 @@ label: Field Updates
3
3
  icon: record
4
4
  hidden: true
5
5
  enable_inline_edit: false
6
- # version: 2
6
+ version: 2
7
7
  enable_enhanced_lookup: true
8
8
  fields:
9
9
  name:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-process-approval",
3
- "version": "2.3.4",
3
+ "version": "2.4.0-beta.10",
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.3.4"
13
+ "@steedos/process": "2.4.0-beta.10"
14
14
  },
15
15
  "description": "steedos package",
16
16
  "repository": {},
17
17
  "license": "MIT",
18
- "gitHead": "adfbf2b14c15751d6702d8e127426ac1d9d813eb"
18
+ "gitHead": "7f75a50d8d5ac875eb577d586981ba654a5180ff"
19
19
  }
@@ -2,7 +2,7 @@
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-07-29 09:40:31
4
4
  * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2022-07-29 14:37:14
5
+ * @LastEditTime: 2022-12-09 13:41:05
6
6
  * @Description:
7
7
  */
8
8
  "use strict";
@@ -22,7 +22,8 @@ module.exports = {
22
22
  settings: {
23
23
  packageInfo: {
24
24
  path: __dirname,
25
- name: packageName
25
+ name: packageName,
26
+ isPackage: false
26
27
  }
27
28
  },
28
29