@steedos/service-core-objects 3.0.0-beta.98 → 3.0.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/README.md +3 -3
- package/main/default/applications/.gitkeep +0 -0
- package/main/default/applications/admin.app.yml +179 -0
- package/main/default/client/socket.client.js +1 -1
- package/main/default/objectTranslations/announcements.en/announcements.en.objectTranslation.yml +37 -0
- package/main/default/objectTranslations/announcements.zh-CN/announcements.zh-CN.objectTranslation.yml +37 -0
- package/main/default/objectTranslations/audit_records.en/audit_records.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/company.en/company.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/logs.en/logs.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +3 -3
- package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/object_functions.en/object_functions.en.objectTranslation.yml +1 -5
- package/main/default/objectTranslations/object_functions.zh-CN/object_functions.zh-CN.objectTranslation.yml +1 -5
- package/main/default/objectTranslations/objects.en/objects.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/operation_logs.en/operation_logs.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/organizations.en/organizations.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/process_delegation_rules.en/process_delegation_rules.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/reports.en/reports.en.objectTranslation.yml +7 -1
- package/main/default/objectTranslations/reports.zh-CN/reports.zh-CN.objectTranslation.yml +7 -1
- package/main/default/objectTranslations/sessions.en/sessions.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/settings.en/settings.en.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/space_users.en/space_users.en.objectTranslation.yml +1 -1
- package/main/default/objects/_base/base.client.js +113 -114
- package/main/default/objects/_base/base.object.js +225 -217
- package/main/default/objects/_base/base.recordFieldAudit.trigger.js +3 -0
- package/main/default/objects/_base/base.trigger.js +7 -144
- package/main/default/objects/audit_records.object.yml +1 -1
- package/main/default/objects/cms_files/cms_files.object.yml +1 -1
- package/main/default/objects/company/company.object.yml +1 -1
- package/main/default/objects/license.object.yml +13 -33
- package/main/default/objects/logs/logs.object.yml +1 -1
- package/main/default/objects/notifications/fields/related_to.field.yml +12 -4
- package/main/default/objects/object_fields/fields/description.field.yml +11 -2
- package/main/default/objects/object_fields/fields/required.field.yml +1 -1
- package/main/default/objects/object_fields/listviews/all.listview.yml +1 -1
- package/main/default/objects/object_functions/buttons/open_api.button.yml +1 -3
- package/main/default/objects/object_functions/fields/script.field.yml +3 -2
- package/main/default/objects/object_functions/listviews/all.listview.yml +0 -1
- package/main/default/objects/object_functions/listviews/customize.listview.yml +0 -1
- package/main/default/objects/object_functions/object_functions.object.yml +1 -1
- package/main/default/objects/object_listviews/fields/extra_columns.field.yml +1 -1
- package/main/default/objects/object_triggers/fields/handler.field.yml +3 -2
- package/main/default/objects/object_webhooks/object_webhooks.object.yml +1 -1
- package/main/default/objects/objects/buttons/show_object.button.js +1 -1
- package/main/default/objects/permission_set/buttons/copy.button.yml +114 -0
- package/main/default/objects/permission_set/buttons/set_permission_tabs.button.yml +166 -0
- package/main/default/objects/{permission_set.object.yml → permission_set/permission_set.object.yml} +1 -1
- package/main/default/objects/reports.object.yml +125 -258
- package/main/default/objects/roles.object.yml +1 -0
- package/main/default/objects/sessions.object.yml +1 -1
- package/main/default/objects/space_users/buttons/clear_login_tokens.button.yml +1 -1
- package/main/default/objects/space_users/buttons/setPassword.button.js +12 -12
- package/main/default/objects/space_users/fields/password_expired.field.yml +1 -1
- package/main/default/pages/about.page.amis.json +21 -4
- package/main/default/pages/apps_form.page.amis.json +2 -1
- package/main/default/pages/cfs_files_record_preview.page.amis.json +8 -8
- package/main/default/pages/cms_files_preview.page.amis.json +7 -7
- package/main/default/pages/object_detail.page.amis.json +1 -1
- package/main/default/pages/space_users_list.page.amis.json +5 -2
- package/main/default/routes/amis_button_design.router.js +2 -12
- package/main/default/routes/amis_listview_design.router.js +2 -11
- package/main/default/routes/object_fields_design.ejs +2 -1
- package/main/default/routes/object_fields_design.router.js +1 -14
- package/main/default/services/spaces.service.js +1 -1
- package/main/default/services/users.service.js +5 -2
- package/main/default/tabs/admin_bull_dashboard.tab.yml +2 -1
- package/main/default/tabs/admin_object_functions.tab.yml +21 -0
- package/main/default/tabs/admin_swagger.tab.yml +22 -0
- package/main/default/translations/en.translation.yml +2 -2
- package/main/default/triggers/space_users.trigger.js +3 -3
- package/package.json +3 -4
- package/public/platform.css +5 -0
- package/main/default/objectTranslations/forms.en/forms.en.objectTranslation.yml +0 -191
- package/main/default/objectTranslations/forms.zh-CN/forms.zh-CN.objectTranslation.yml +0 -194
- package/main/default/objectTranslations/instances.en/instances.en.objectTranslation.yml +0 -211
- package/main/default/objectTranslations/instances.zh-CN/instances.zh-CN.objectTranslation.yml +0 -208
- package/main/default/objects/object_functions/fields/is_rest.field.yml +0 -5
- package/main/default/objects/spaces/buttons/upgrade.button.js +0 -12
- package/main/default/objects/spaces/buttons/upgrade.button.yml +0 -4
|
@@ -1,142 +1,6 @@
|
|
|
1
1
|
const objectql = require('@steedos/objectql');
|
|
2
|
-
const auth = require('@steedos/auth');
|
|
3
2
|
const _ = require('underscore');
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* 校验记录的 company 是否在指定授权范围内
|
|
7
|
-
* @param {*} object_name
|
|
8
|
-
* @param {*} userId
|
|
9
|
-
* @param {*} doc
|
|
10
|
-
*/
|
|
11
|
-
const checkCompany = async (object_name, userId, doc) => {
|
|
12
|
-
const userSession = await auth.getSessionByUserId(userId, doc.space);
|
|
13
|
-
|
|
14
|
-
if (!userSession || userSession.is_space_admin) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let userObjectPermission = null;
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
userObjectPermission = await objectql.getObject(object_name).getUserObjectPermission(userSession);
|
|
22
|
-
} catch (error) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (userObjectPermission.modifyAllRecords) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let allowCompanyIds = [];
|
|
31
|
-
|
|
32
|
-
//与client端保持一致,始终授权用户所属分部
|
|
33
|
-
if (!_.isEmpty(userSession.company_ids)) {
|
|
34
|
-
allowCompanyIds.push(...userSession.company_ids);
|
|
35
|
-
}
|
|
36
|
-
if (!_.isEmpty(userObjectPermission.modifyAssignCompanysRecords)) {
|
|
37
|
-
allowCompanyIds.push(...userObjectPermission.modifyAssignCompanysRecords);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (_.has(doc, "company_id")) {
|
|
41
|
-
if (!_.include(allowCompanyIds, doc.company_id)) {
|
|
42
|
-
throw new Error(`未获得分部授权`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (_.has(doc, "company_ids")) {
|
|
47
|
-
if (_.difference(doc.company_ids, allowCompanyIds).length > 0) {
|
|
48
|
-
throw new Error(`未获得分部授权`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const beforeInsertBase = async function () {
|
|
54
|
-
const { doc, userId } = this;
|
|
55
|
-
// 迁移到insert函数中提前执行了
|
|
56
|
-
// doc.created = new Date();
|
|
57
|
-
// doc.modified = new Date();
|
|
58
|
-
// if (userId) {
|
|
59
|
-
// if (!doc.owner) {
|
|
60
|
-
// doc.owner = userId;
|
|
61
|
-
// }
|
|
62
|
-
// if (doc.owner === '{userId}') {
|
|
63
|
-
// doc.owner = userId;
|
|
64
|
-
// }
|
|
65
|
-
// doc.created_by = userId;
|
|
66
|
-
// doc.modified_by = userId;
|
|
67
|
-
// }
|
|
68
|
-
var extras = ["spaces", "company", "organizations", "users", "space_users"];
|
|
69
|
-
if (extras.indexOf(this.object_name) < 0 && doc.space) {
|
|
70
|
-
/* company_ids/company_id默认值逻辑*/
|
|
71
|
-
if (!doc.company_id || !doc.company_ids) {
|
|
72
|
-
var su;
|
|
73
|
-
if (userId) {
|
|
74
|
-
const spaceUsers = await objectql.getObject("space_users").find({ filters: [['space', '=', doc.space], ['user', '=', userId]], fields: ['company_id'] });
|
|
75
|
-
su = spaceUsers.length > 0 ? spaceUsers[0] : null
|
|
76
|
-
}
|
|
77
|
-
if (!doc.company_id) {
|
|
78
|
-
if (doc.company_ids && doc.company_ids.length) {
|
|
79
|
-
/* 如果用户在界面上指定了company_ids,则取第一个值 */
|
|
80
|
-
doc.company_id = doc.company_ids[0];
|
|
81
|
-
}
|
|
82
|
-
else if (su && su.company_id) {
|
|
83
|
-
doc.company_id = su.company_id;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (!doc.company_ids) {
|
|
87
|
-
if (doc.company_id) {
|
|
88
|
-
/* 如果用户在界面上指定了company_id,则取其值输入 */
|
|
89
|
-
doc.company_ids = [doc.company_id];
|
|
90
|
-
}
|
|
91
|
-
else if (su && su.company_id) {
|
|
92
|
-
doc.company_ids = [su.company_id];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
await checkCompany(this.object_name, userId, doc);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const beforeUpdateBase = async function () {
|
|
100
|
-
const { doc, userId } = this;
|
|
101
|
-
if (!doc) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
// 迁移到update函数中提前执行了
|
|
105
|
-
// doc.modified = new Date();
|
|
106
|
-
// if (userId) {
|
|
107
|
-
// doc.modified_by = userId;
|
|
108
|
-
// }
|
|
109
|
-
var extras = ["spaces", "company", "organizations", "users", "space_users"];
|
|
110
|
-
if (extras.indexOf(this.object_name) < 0) {
|
|
111
|
-
/* company_ids/company_id级联修改逻辑*/
|
|
112
|
-
if (_.has(doc, "company_ids")) {
|
|
113
|
-
/*
|
|
114
|
-
原则上应该将 company_ids 设置为可编辑,company_id 设置为只读。
|
|
115
|
-
当 company_ids 可编辑时,修改 company_ids 同时更新 company_id = company_ids[0]
|
|
116
|
-
*/
|
|
117
|
-
var firstCompanyId = doc.company_ids ? doc.company_ids[0] : null;
|
|
118
|
-
if (firstCompanyId) {
|
|
119
|
-
doc.company_id = firstCompanyId;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
doc.company_id = null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else if (_.has(doc, "company_id")) {
|
|
126
|
-
/*
|
|
127
|
-
考虑到兼容老项目,允许将 company_id 设置为可编辑,此时 company_ids 必须只读。
|
|
128
|
-
当 company_id 可编辑时,修改 company_id 同时更新 company_ids = [company_id]
|
|
129
|
-
*/
|
|
130
|
-
if (doc.company_id) {
|
|
131
|
-
doc.company_ids = [doc.company_id];
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
doc.company_ids = null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
await checkCompany(this.object_name, userId, doc);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
4
|
const afterDeleteBase = async function () {
|
|
141
5
|
const { object_name, previousDoc } = this;
|
|
142
6
|
if (!previousDoc) {
|
|
@@ -148,22 +12,21 @@ const afterDeleteBase = async function () {
|
|
|
148
12
|
const fields = objectConfig.fields;
|
|
149
13
|
const fieldsName = _.keys(previousDoc);
|
|
150
14
|
|
|
151
|
-
|
|
15
|
+
for (const fieldName of fieldsName) {
|
|
152
16
|
const fieldProps = fields[fieldName];
|
|
153
17
|
const indexOfType = fieldProps && ['file', 'image'].indexOf(fieldProps.type);
|
|
154
18
|
if (indexOfType > -1 && previousDoc[fieldName] && previousDoc[fieldName].length) {
|
|
155
|
-
const collection = [
|
|
19
|
+
const collection = ['cfs_files_filerecord', 'cfs_images_filerecord'][indexOfType];
|
|
156
20
|
let ids = previousDoc[fieldName]
|
|
157
21
|
if (typeof ids === 'string') {
|
|
158
22
|
ids = [ids]
|
|
159
23
|
}
|
|
160
|
-
|
|
161
|
-
collection.
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
})
|
|
24
|
+
for (const id of ids) {
|
|
25
|
+
await objectql.getObject(collection).delete(id)
|
|
26
|
+
}
|
|
165
27
|
}
|
|
166
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
167
30
|
if ("cms_files" != object_name) {
|
|
168
31
|
// 删除附件
|
|
169
32
|
const cmsFilesObj = objectql.getObject('cms_files')
|
|
@@ -183,7 +183,7 @@ actions:
|
|
|
183
183
|
"method": "post",
|
|
184
184
|
"messages": {},
|
|
185
185
|
"dataType": "form-data",
|
|
186
|
-
"requestAdaptor": "
|
|
186
|
+
"requestAdaptor": "const superData = (typeof context != 'undefined') ? context : api.body; api.data.append('record_id', superData._master.record._id);api.data.append('parent', superData._master.record._id);api.data.append('object_name', superData._master.objectName); api.data.append('space', superData.global.spaceId);api.data.append('owner', superData.global.userId);api.data.append('owner_name', superData.context.user.user.name);return api;",
|
|
187
187
|
"adaptor": "if(payload.errors && payload.errors.length > 0){payload = {status: 500,msg: payload.errors[0].errorMessage}};return payload;"
|
|
188
188
|
},
|
|
189
189
|
"onEvent": {
|
|
@@ -4,16 +4,6 @@ icon: webcart
|
|
|
4
4
|
hidden: true
|
|
5
5
|
enable_audit: false
|
|
6
6
|
fields:
|
|
7
|
-
edition:
|
|
8
|
-
type: text
|
|
9
|
-
label: Edition
|
|
10
|
-
hidden: true
|
|
11
|
-
edition_label:
|
|
12
|
-
type: text
|
|
13
|
-
label: Edition
|
|
14
|
-
is_name: true
|
|
15
|
-
filterable: true
|
|
16
|
-
searchable: true
|
|
17
7
|
license:
|
|
18
8
|
type: textarea
|
|
19
9
|
rows: 8
|
|
@@ -26,13 +16,22 @@ fields:
|
|
|
26
16
|
hidden: true
|
|
27
17
|
product:
|
|
28
18
|
type: text
|
|
29
|
-
label: Product
|
|
30
|
-
hidden: true
|
|
19
|
+
label: Product ID
|
|
31
20
|
product_label:
|
|
32
21
|
type: text
|
|
33
22
|
label: Product
|
|
34
23
|
filterable: true
|
|
35
24
|
searchable: true
|
|
25
|
+
edition:
|
|
26
|
+
type: text
|
|
27
|
+
label: Edition
|
|
28
|
+
hidden: true
|
|
29
|
+
edition_label:
|
|
30
|
+
type: text
|
|
31
|
+
label: Edition
|
|
32
|
+
is_name: true
|
|
33
|
+
filterable: true
|
|
34
|
+
searchable: true
|
|
36
35
|
is_trial:
|
|
37
36
|
type: boolean
|
|
38
37
|
label: Trial
|
|
@@ -75,34 +74,15 @@ fields:
|
|
|
75
74
|
is_local:
|
|
76
75
|
type: boolean
|
|
77
76
|
hidden: true
|
|
78
|
-
actions:
|
|
79
|
-
apply:
|
|
80
|
-
label: Apply
|
|
81
|
-
on: list
|
|
82
|
-
visible: false
|
|
83
|
-
changeSpaceLicense:
|
|
84
|
-
label: 更新许可证
|
|
85
|
-
on: list
|
|
86
|
-
visible: true
|
|
87
|
-
copySpaceId:
|
|
88
|
-
label: Copy space id
|
|
89
|
-
on: list
|
|
90
|
-
visible: false
|
|
91
|
-
upgrade:
|
|
92
|
-
label: Upgrade
|
|
93
|
-
on: list
|
|
94
|
-
visible: true
|
|
95
77
|
list_views:
|
|
96
78
|
all:
|
|
97
|
-
label:
|
|
79
|
+
label: All
|
|
98
80
|
columns:
|
|
99
|
-
- edition_label
|
|
100
81
|
- product_label
|
|
82
|
+
- product
|
|
101
83
|
- user_number
|
|
102
84
|
- verify_status
|
|
103
85
|
- end_date
|
|
104
|
-
filters:
|
|
105
|
-
- [['lid', '<>', 'None'], ['invalid','!=',true]]
|
|
106
86
|
permission_set:
|
|
107
87
|
user:
|
|
108
88
|
allowCreate: false
|
|
@@ -6,11 +6,19 @@ reference_to: !<tag:yaml.org,2002:js/function> |-
|
|
|
6
6
|
function anonymous(
|
|
7
7
|
) {
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
try{
|
|
10
|
+
let objects = [];
|
|
11
|
+
var queryResult = Steedos.authRequest(`/graphql`, {
|
|
12
|
+
type: 'POST', async: false,
|
|
13
|
+
data: JSON.stringify({
|
|
14
|
+
query: `{ objects{ name } }`
|
|
15
|
+
})
|
|
12
16
|
});
|
|
13
|
-
|
|
17
|
+
objects = queryResult && queryResult.data && queryResult.data.objects;
|
|
18
|
+
return _.map(objects, 'name') ;
|
|
19
|
+
}catch(e){
|
|
20
|
+
return []
|
|
21
|
+
}
|
|
14
22
|
|
|
15
23
|
}
|
|
16
24
|
filterable: true
|
|
@@ -2,6 +2,15 @@ name: description
|
|
|
2
2
|
hidden: false
|
|
3
3
|
is_wide: true
|
|
4
4
|
label: Description
|
|
5
|
-
sort_no:
|
|
5
|
+
sort_no: 380
|
|
6
6
|
type: textarea
|
|
7
|
-
inlineHelpText: 在字段下方增加解释说明
|
|
7
|
+
inlineHelpText: 在字段下方增加解释说明
|
|
8
|
+
amis:
|
|
9
|
+
type: input-rich-text
|
|
10
|
+
name: rich
|
|
11
|
+
options:
|
|
12
|
+
menubar: false
|
|
13
|
+
height: 200
|
|
14
|
+
plugins:
|
|
15
|
+
- lists
|
|
16
|
+
toolbar: undo redo | formatselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat
|
|
@@ -6,9 +6,7 @@ amis_schema: >-
|
|
|
6
6
|
objectApiName__expand{\n name\n }\n }\n}\n
|
|
7
7
|
`\n}","adaptor":"","messages":{}}},{"ignoreError":false,"actionType":"custom","script":"const
|
|
8
8
|
record =
|
|
9
|
-
event.data.object_function;\nwindow.open(`/api/
|
|
10
|
-
==
|
|
11
|
-
true}"}],"data":{"context":{},"dataComponentId":"","record_id":"","record":{},"permissions":{}},"bodyClassName":"p-0","id":"u:05f888280584","dsType":"api"}
|
|
9
|
+
event.data.object_function;\nwindow.open(`/api/v6/functions/${record.object.name}/${record.name}`)\n"}]}},"hidden":false,"visibleOn":"${true}"}],"data":{"context":{},"dataComponentId":"","record_id":"","record":{},"permissions":{}},"bodyClassName":"p-0","id":"u:05f888280584","dsType":"api"}
|
|
12
10
|
is_enable: true
|
|
13
11
|
label: 请求API
|
|
14
12
|
locked: false
|
|
@@ -5,9 +5,10 @@ language: javascript
|
|
|
5
5
|
is_wide: true
|
|
6
6
|
required: true
|
|
7
7
|
defaultValue: |-
|
|
8
|
-
// global: {_:lodash, moment, validator, filters, axios, formData, mongodb, sequelize}
|
|
9
|
-
// objects
|
|
10
8
|
// ctx: {input, params, broker, getObject, getUser}
|
|
9
|
+
// objects: all steedos objects
|
|
10
|
+
// db: mongodb client instance
|
|
11
|
+
// npm: {_, moment, validator, filters, axios, formData, mongodb, sequelize}
|
|
11
12
|
editorDidMount: >-
|
|
12
13
|
if(window._registerCompletionItemProviderFunction){
|
|
13
14
|
return ;
|
|
@@ -5,10 +5,11 @@ language: javascript
|
|
|
5
5
|
is_wide: true
|
|
6
6
|
required: true
|
|
7
7
|
defaultValue: |-
|
|
8
|
-
// global: {_:lodash, moment, validator, filters, axios, formData, mongodb, sequelize}
|
|
9
8
|
// ctx
|
|
10
|
-
// objects
|
|
9
|
+
// objects: all steedos objects
|
|
10
|
+
// db: mongodb client instance
|
|
11
11
|
// services
|
|
12
|
+
// npm: {_, moment, validator, filters, axios, formData, mongodb, sequelize}
|
|
12
13
|
editorDidMount: >-
|
|
13
14
|
if(window._registerCompletionItemProviderTrigger){
|
|
14
15
|
return ;
|
|
@@ -13,7 +13,7 @@ module.exports = {
|
|
|
13
13
|
return toastr.warning("请先启动对象");
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
window.open(Steedos.getRelativeUrl("/app
|
|
16
|
+
window.open(Steedos.getRelativeUrl("/app/-/" + (record.name || this.record.name)));
|
|
17
17
|
},
|
|
18
18
|
show_objectVisible: function(object_name, record_id, record_permissions, data) {
|
|
19
19
|
var record = data && data.record;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
name: copy
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "${'permission_set.copy.copy' | t}",
|
|
9
|
+
"id": "u:copy",
|
|
10
|
+
"onEvent": {
|
|
11
|
+
"click": {
|
|
12
|
+
"weight": 0,
|
|
13
|
+
"actions": [
|
|
14
|
+
{
|
|
15
|
+
"dialog": {
|
|
16
|
+
"type": "dialog",
|
|
17
|
+
"title": "${'permission_set.copy.copy_record' | t}",
|
|
18
|
+
"body": [
|
|
19
|
+
{
|
|
20
|
+
"type": "form",
|
|
21
|
+
"title": "表单",
|
|
22
|
+
"body": [
|
|
23
|
+
{
|
|
24
|
+
"label": "${'permission_set.copy.display_name' | t}",
|
|
25
|
+
"type": "input-text",
|
|
26
|
+
"value": "${'permission_set.copy.copy_of_record' | t:${record.label}}",
|
|
27
|
+
"name": "label_input",
|
|
28
|
+
"id": "u:24e89a11d437",
|
|
29
|
+
"required": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "input-text",
|
|
33
|
+
"name": "name_input",
|
|
34
|
+
"value": "${record.name}_copy",
|
|
35
|
+
"label": "${'permission_set.copy.api_name' | t}",
|
|
36
|
+
"id": "u:27bd7cfe3e12",
|
|
37
|
+
"required": true
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"api": {
|
|
41
|
+
"url": "${context.rootUrl}/api/permission/permission_set/copy",
|
|
42
|
+
"method": "post",
|
|
43
|
+
"messages": {
|
|
44
|
+
"success": "复制成功"
|
|
45
|
+
},
|
|
46
|
+
"requestAdaptor": "delete api.body.label_input;\ndelete api.body.name_input;",
|
|
47
|
+
"data": {
|
|
48
|
+
"&": "$$",
|
|
49
|
+
"label": "${label_input}",
|
|
50
|
+
"name": "${name_input}",
|
|
51
|
+
"originalPermissionSetId": "${record._id}"
|
|
52
|
+
},
|
|
53
|
+
"headers": {
|
|
54
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"onEvent": {
|
|
58
|
+
"submitSucc": {
|
|
59
|
+
"weight": 0,
|
|
60
|
+
"actions": [
|
|
61
|
+
{
|
|
62
|
+
"args": {
|
|
63
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/view/${result.data.recordId}",
|
|
64
|
+
"blank": false
|
|
65
|
+
},
|
|
66
|
+
"actionType": "url"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"id": "u:818f7b68417b",
|
|
72
|
+
"mode": "normal"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"showCloseButton": true,
|
|
76
|
+
"showErrorMsg": true,
|
|
77
|
+
"showLoading": true,
|
|
78
|
+
"id": "u:9f9b042404a1",
|
|
79
|
+
"closeOnEsc": false,
|
|
80
|
+
"dataMapSwitch": false,
|
|
81
|
+
"size": "md"
|
|
82
|
+
},
|
|
83
|
+
"actionType": "dialog"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"regions": [
|
|
91
|
+
"body"
|
|
92
|
+
],
|
|
93
|
+
"data": {
|
|
94
|
+
"context": {},
|
|
95
|
+
"app_id": "",
|
|
96
|
+
"tab_id": "",
|
|
97
|
+
"object_name": "",
|
|
98
|
+
"dataComponentId": "",
|
|
99
|
+
"record_id": "",
|
|
100
|
+
"record": {},
|
|
101
|
+
"permissions": {}
|
|
102
|
+
},
|
|
103
|
+
"bodyClassName": "p-0",
|
|
104
|
+
"id": "u:4b81eda72f12"
|
|
105
|
+
}
|
|
106
|
+
is_enable: true
|
|
107
|
+
label: 复制
|
|
108
|
+
'on': record_only
|
|
109
|
+
type: amis_button
|
|
110
|
+
visible: !!js/function |
|
|
111
|
+
function (object_name, record_id, record_permissions, record) {
|
|
112
|
+
|
|
113
|
+
return record.record.type == 'profile';
|
|
114
|
+
}
|