@steedos-labs/content-compliance 1.0.8 → 1.0.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.
- package/dist/index.js +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/index.js.map +1 -1
- package/lib/actions/retryContentHubPush.d.ts +9 -0
- package/lib/actions/retryContentHubPush.js +43 -0
- package/lib/actions/retryContentHubPush.js.map +1 -0
- package/lib/methods/__tests__/contentHubPush.test.js +258 -5
- package/lib/methods/__tests__/contentHubPush.test.js.map +1 -1
- package/lib/methods/__tests__/contentHubSyncRule.test.js +9 -0
- package/lib/methods/__tests__/contentHubSyncRule.test.js.map +1 -1
- package/lib/methods/approval_engine.js +20 -6
- package/lib/methods/approval_engine.js.map +1 -1
- package/lib/methods/content_hub.d.ts +6 -0
- package/lib/methods/content_hub.js +183 -90
- package/lib/methods/content_hub.js.map +1 -1
- package/lib/methods/content_hub_sync_rule.d.ts +1 -0
- package/lib/methods/content_hub_sync_rule.js +31 -4
- package/lib/methods/content_hub_sync_rule.js.map +1 -1
- package/main/default/objectTranslations/space_users.zh-CN/space_users.zh-CN.objectTranslation.yml +4 -0
- package/main/default/objects/pepesio_ch__c/buttons/retry_content_hub_push.button.yml +70 -0
- package/main/default/objects/pepesio_ch__c/fields/pepsico_material.field.yml +7 -0
- package/main/default/objects/pepesio_ch__c/listviews/all.listview.yml +1 -0
- package/main/default/objects/pepsico_ch_material_group_rule/listviews/all.listview.yml +2 -3
- package/main/default/objects/pepsico_ch_sync_rule/fields/kol_classification.field.yml +7 -2
- package/main/default/objects/pepsico_ch_sync_rule/fields/spot_check.field.yml +4 -4
- package/main/default/objects/pepsico_ch_sync_rule/listviews/all.listview.yml +2 -7
- package/main/default/objects/pepsico_material_approval/fields/available_channels.field.yml +24 -3
- package/main/default/objects/pepsico_material_approval/fields/classification.field.yml +24 -3
- package/main/default/objects/pepsico_material_approval/fields/content_rule.field.yml +24 -3
- package/main/default/objects/pepsico_material_approval/fields/kol_classification.field.yml +24 -3
- package/main/default/objects/pepsico_material_approval/fields/material_editable.field.yml +26 -5
- package/main/default/objects/pepsico_material_approval/fields/material_type.field.yml +24 -3
- package/main/default/objects/pepsico_material_approval/fields/product.field.yml +24 -4
- package/main/default/objects/pepsico_material_approval/fields/social_media.field.yml +24 -3
- package/main/default/objects/space_users/fields/agency_contract_expiry_date.field.yml +3 -3
- package/main/default/objects/space_users/fields/agency_pepsico_contact.field.yml +3 -3
- package/main/default/objects/space_users/fields/avatar.field.yml +1 -1
- package/main/default/objects/space_users/fields/created.field.yml +1 -1
- package/main/default/objects/space_users/fields/email_notification.field.yml +1 -1
- package/main/default/objects/space_users/fields/is_collaborator.field.yml +2 -1
- package/main/default/objects/space_users/fields/last_logon.field.yml +3 -3
- package/main/default/objects/space_users/fields/login_expired.field.yml +3 -3
- package/main/default/objects/space_users/fields/modified.field.yml +1 -1
- package/main/default/objects/space_users/fields/modified_by.field.yml +1 -1
- package/main/default/objects/space_users/fields/password_expired.field.yml +1 -1
- package/package.json +1 -1
- package/public/dynamic.css +73 -10
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: retry_content_hub_push
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "重新推送",
|
|
9
|
+
"id": "u:retry_content_hub_push",
|
|
10
|
+
"editorState": "default",
|
|
11
|
+
"confirmText": "确认要重新推送该文件到 Content Hub 吗?",
|
|
12
|
+
"onEvent": {
|
|
13
|
+
"click": {
|
|
14
|
+
"weight": 0,
|
|
15
|
+
"actions": [
|
|
16
|
+
{
|
|
17
|
+
"ignoreError": false,
|
|
18
|
+
"actionType": "ajax",
|
|
19
|
+
"outputVar": "responseResult",
|
|
20
|
+
"options": {},
|
|
21
|
+
"api": {
|
|
22
|
+
"url": "/api/pepsico-content/content-hub/push-record/retry",
|
|
23
|
+
"method": "post",
|
|
24
|
+
"requestAdaptor": "\napi.data = {\n id: context._id\n}\n\nreturn api;",
|
|
25
|
+
"adaptor": "",
|
|
26
|
+
"messages": {
|
|
27
|
+
"success": "重新推送成功",
|
|
28
|
+
"failed": "重新推送失败"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"actionType": "broadcast",
|
|
34
|
+
"args": {
|
|
35
|
+
"eventName": "@data.changed.pepesio_ch__c"
|
|
36
|
+
},
|
|
37
|
+
"data": {
|
|
38
|
+
"objectName": "pepesio_ch__c"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"visibleOn": "${push_status == 'failed' && global.user.is_space_admin}"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"regions": [
|
|
48
|
+
"body"
|
|
49
|
+
],
|
|
50
|
+
"data": {
|
|
51
|
+
"context": {},
|
|
52
|
+
"dataComponentId": "",
|
|
53
|
+
"record_id": "",
|
|
54
|
+
"record": {},
|
|
55
|
+
"permissions": {}
|
|
56
|
+
},
|
|
57
|
+
"bodyClassName": "p-0",
|
|
58
|
+
"id": "u:retry_content_hub_push_service",
|
|
59
|
+
"dsType": "api",
|
|
60
|
+
"asideResizor": false,
|
|
61
|
+
"editorState": "default",
|
|
62
|
+
"pullRefresh": {
|
|
63
|
+
"disabled": true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
is_enable: true
|
|
67
|
+
label: 重新推送
|
|
68
|
+
'on': record
|
|
69
|
+
type: amis_button
|
|
70
|
+
visible: true
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
name: all
|
|
2
2
|
columns:
|
|
3
|
-
- field: priority
|
|
4
3
|
- field: name
|
|
5
4
|
wrap: true
|
|
6
5
|
- field: orgs
|
|
7
|
-
|
|
8
|
-
- field: classification
|
|
6
|
+
width: '300'
|
|
9
7
|
wrap: true
|
|
10
8
|
- field: query_mode
|
|
9
|
+
- field: priority
|
|
11
10
|
- field: active
|
|
12
11
|
filter_scope: space
|
|
13
12
|
filters: []
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
name: kol_classification
|
|
2
2
|
amis:
|
|
3
|
+
# 分类里选了 KOL's Post(MD-SC1-SC13 / SLS-SC2-SC23)时必填; 分类值可能是字符串或 {value} 对象
|
|
4
|
+
requiredOn: >-
|
|
5
|
+
[].concat(classification || []).some(function (c) {
|
|
6
|
+
var v = c && c.value || c;
|
|
7
|
+
return v === 'MD-SC1-SC13' || v === 'SLS-SC2-SC23';
|
|
8
|
+
})
|
|
3
9
|
type: tree-select
|
|
4
10
|
multiple: true
|
|
5
11
|
joinValues: false
|
|
@@ -57,9 +63,8 @@ amis:
|
|
|
57
63
|
messages: {}
|
|
58
64
|
cache: 86400000
|
|
59
65
|
data_type: text
|
|
60
|
-
description: 审批单的 KOL 分类(粉丝量级)是所选项之一时命中;
|
|
66
|
+
description: 审批单的 KOL 分类(粉丝量级)是所选项之一时命中; 不填表示不限。分类包含 KOL's Post 时必填。只有 KOL 类分类的审批单有 KOL 分类, 其他审批单不看这个条件
|
|
61
67
|
group: 匹配条件
|
|
62
|
-
is_wide: true
|
|
63
68
|
label: KOL 分类
|
|
64
69
|
multiple: true
|
|
65
70
|
required: false
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
name: spot_check
|
|
2
|
-
description: 「抽查核准」匹配靠素材抽查核准后推送的单据(跳过审核的 KOL 尾部等);
|
|
2
|
+
description: 「抽查核准」匹配靠素材抽查核准后推送的单据(跳过审核的 KOL 尾部等); 「审核通过」匹配确认上线时推送的单据; 不填表示两种都匹配。只影响填单时带出的默认值; 申请单上勾了同步但没有命中任何同步规则时, 按「审核通过」推送
|
|
3
3
|
group: 匹配条件
|
|
4
|
-
label:
|
|
4
|
+
label: 推送节点
|
|
5
5
|
options:
|
|
6
6
|
- label: 抽查核准
|
|
7
7
|
value: approved
|
|
8
|
-
- label:
|
|
8
|
+
- label: 审核通过
|
|
9
9
|
value: none
|
|
10
10
|
required: false
|
|
11
|
-
sort_no:
|
|
11
|
+
sort_no: 225
|
|
12
12
|
type: select
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
name: all
|
|
2
2
|
columns:
|
|
3
|
-
- field: priority
|
|
4
3
|
- field: name
|
|
5
4
|
wrap: true
|
|
6
|
-
- field: need_sync
|
|
7
5
|
- field: orgs
|
|
6
|
+
width: '300'
|
|
8
7
|
wrap: true
|
|
9
|
-
- field: classification
|
|
10
|
-
wrap: true
|
|
11
|
-
- field: product
|
|
12
|
-
wrap: true
|
|
13
|
-
- field: kol_classification
|
|
14
8
|
- field: spot_check
|
|
9
|
+
- field: priority
|
|
15
10
|
- field: active
|
|
16
11
|
filter_scope: space
|
|
17
12
|
filters: []
|
|
@@ -21,17 +21,38 @@ amis:
|
|
|
21
21
|
url: /graphql
|
|
22
22
|
method: post
|
|
23
23
|
requestAdaptor: |-
|
|
24
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
25
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
26
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.available_channels) || []), (v) => {
|
|
27
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
28
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
29
|
+
}).map((s) => s.trim())));
|
|
30
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
24
31
|
api.data = { query:`
|
|
25
32
|
query{
|
|
26
33
|
picklists(filters: [["code", "=", "223321001114944"]]){
|
|
27
|
-
options: _related_picklist_options_picklist(
|
|
28
|
-
label: name, value, , parent: parent__expand{ value }
|
|
34
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
35
|
+
label: name, value, enable, parent: parent__expand{ value }
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
`}
|
|
33
40
|
adaptor: |+
|
|
34
|
-
const
|
|
41
|
+
const allOptions = payload.data.picklists[0].options;
|
|
42
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
43
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
44
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
45
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
46
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
47
|
+
_.forEach(keepIds, (id) => {
|
|
48
|
+
const op = _.find(allOptions, { value: id });
|
|
49
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
50
|
+
});
|
|
51
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
52
|
+
if (op.enable !== false) return op;
|
|
53
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
54
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
55
|
+
}));
|
|
35
56
|
let depth = 0;
|
|
36
57
|
function getChildren(value) {
|
|
37
58
|
depth++;
|
|
@@ -22,18 +22,39 @@ amis:
|
|
|
22
22
|
url: /graphql
|
|
23
23
|
method: post
|
|
24
24
|
requestAdaptor: |-
|
|
25
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
26
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
27
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.classification) || []), (v) => {
|
|
28
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
29
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
30
|
+
}).map((s) => s.trim())));
|
|
31
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
25
32
|
api.data = {
|
|
26
33
|
query: `
|
|
27
34
|
query{
|
|
28
35
|
picklists(filters: [["code", "=", "classification"]]){
|
|
29
|
-
options: _related_picklist_options_picklist(
|
|
30
|
-
label: name, value, , parent: parent__expand{value}
|
|
36
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
37
|
+
label: name, value, enable, parent: parent__expand{value}
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
`}
|
|
35
42
|
adaptor: |+
|
|
36
|
-
const
|
|
43
|
+
const allOptions = payload.data.picklists[0].options;
|
|
44
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
45
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
46
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
47
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
48
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
49
|
+
_.forEach(keepIds, (id) => {
|
|
50
|
+
const op = _.find(allOptions, { value: id });
|
|
51
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
52
|
+
});
|
|
53
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
54
|
+
if (op.enable !== false) return op;
|
|
55
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
56
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
57
|
+
}));
|
|
37
58
|
let depth = 0;
|
|
38
59
|
function getChildren(value) {
|
|
39
60
|
depth++;
|
|
@@ -18,17 +18,38 @@ amis:
|
|
|
18
18
|
url: /graphql
|
|
19
19
|
method: post
|
|
20
20
|
requestAdaptor: |-
|
|
21
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
22
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
23
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.content_rule) || []), (v) => {
|
|
24
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
25
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
26
|
+
}).map((s) => s.trim())));
|
|
27
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
21
28
|
api.data = { query:`
|
|
22
29
|
query{
|
|
23
30
|
picklists(filters: [["code", "=", "223321022150011"]]){
|
|
24
|
-
options: _related_picklist_options_picklist(
|
|
25
|
-
label: name, value, , parent: parent__expand{ value }
|
|
31
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
32
|
+
label: name, value, enable, parent: parent__expand{ value }
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
`}
|
|
30
37
|
adaptor: |+
|
|
31
|
-
const
|
|
38
|
+
const allOptions = payload.data.picklists[0].options;
|
|
39
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
40
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
41
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
42
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
43
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
44
|
+
_.forEach(keepIds, (id) => {
|
|
45
|
+
const op = _.find(allOptions, { value: id });
|
|
46
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
47
|
+
});
|
|
48
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
49
|
+
if (op.enable !== false) return op;
|
|
50
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
51
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
52
|
+
}));
|
|
32
53
|
let depth = 0;
|
|
33
54
|
function getChildren(value) {
|
|
34
55
|
depth++;
|
|
@@ -20,18 +20,39 @@ amis:
|
|
|
20
20
|
url: /graphql
|
|
21
21
|
method: post
|
|
22
22
|
requestAdaptor: |-
|
|
23
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
24
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
25
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.kol_classification) || []), (v) => {
|
|
26
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
27
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
28
|
+
}).map((s) => s.trim())));
|
|
29
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
23
30
|
api.data = {
|
|
24
31
|
query: `
|
|
25
32
|
query{
|
|
26
33
|
picklists(filters: [["code", "=", "kol_classification"]]){
|
|
27
|
-
options: _related_picklist_options_picklist(
|
|
28
|
-
label: name, value, , parent: parent__expand{value}
|
|
34
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
35
|
+
label: name, value, enable, parent: parent__expand{value}
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
`}
|
|
33
40
|
adaptor: |+
|
|
34
|
-
const
|
|
41
|
+
const allOptions = payload.data.picklists[0].options;
|
|
42
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
43
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
44
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
45
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
46
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
47
|
+
_.forEach(keepIds, (id) => {
|
|
48
|
+
const op = _.find(allOptions, { value: id });
|
|
49
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
50
|
+
});
|
|
51
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
52
|
+
if (op.enable !== false) return op;
|
|
53
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
54
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
55
|
+
}));
|
|
35
56
|
let depth = 0;
|
|
36
57
|
function getChildren(value) {
|
|
37
58
|
depth++;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: material_editable
|
|
2
|
-
# 选项与素材授权规则(content_rule)相同, 动态读取 picklist 223321022150011
|
|
2
|
+
# 选项与素材授权规则(content_rule)相同, 动态读取 picklist 223321022150011 的选项(停用的只在搜索框和当前值里显示)
|
|
3
3
|
amis:
|
|
4
4
|
id: 'u:material_editable'
|
|
5
5
|
# 与「有无BGM」一样用按钮点选; 选项仍动态读取公共选项集的末级启用选项
|
|
@@ -10,18 +10,39 @@ amis:
|
|
|
10
10
|
url: /graphql
|
|
11
11
|
method: post
|
|
12
12
|
requestAdaptor: |-
|
|
13
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
14
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
15
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.material_editable) || []), (v) => {
|
|
16
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
17
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
18
|
+
}).map((s) => s.trim())));
|
|
19
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
13
20
|
api.data = { query:`
|
|
14
21
|
query{
|
|
15
22
|
picklists(filters: [["code", "=", "223321022150011"]]){
|
|
16
|
-
options: _related_picklist_options_picklist(
|
|
17
|
-
label: name, value, , parent: parent__expand{ value }
|
|
23
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
24
|
+
label: name, value, enable, parent: parent__expand{ value }
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
`}
|
|
22
29
|
adaptor: |+
|
|
23
30
|
// 只取末级选项作为按钮; 值沿用原树形下拉的节点路径(各级 value 用 - 连接), 存量单据和推送 Content Hub 不受影响
|
|
24
|
-
const
|
|
31
|
+
const allOptions = payload.data.picklists[0].options;
|
|
32
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
33
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
34
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
35
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
36
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
37
|
+
_.forEach(keepIds, (id) => {
|
|
38
|
+
const op = _.find(allOptions, { value: id });
|
|
39
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
40
|
+
});
|
|
41
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
42
|
+
if (op.enable !== false) return op;
|
|
43
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
44
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
45
|
+
}));
|
|
25
46
|
const options = [];
|
|
26
47
|
let depth = 0;
|
|
27
48
|
function walk(parentValue, path) {
|
|
@@ -42,7 +63,7 @@ amis:
|
|
|
42
63
|
if (hasChildren) {
|
|
43
64
|
walk(item.value, itemPath);
|
|
44
65
|
} else {
|
|
45
|
-
options.push({ label: item.label, value: itemPath.join('-') });
|
|
66
|
+
options.push({ label: item.label, value: itemPath.join('-'), disabled: item.disabled });
|
|
46
67
|
}
|
|
47
68
|
});
|
|
48
69
|
}
|
|
@@ -16,18 +16,39 @@ amis:
|
|
|
16
16
|
url: /graphql
|
|
17
17
|
method: post
|
|
18
18
|
requestAdaptor: |-
|
|
19
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
20
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
21
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.material_type) || []), (v) => {
|
|
22
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
23
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
24
|
+
}).map((s) => s.trim())));
|
|
25
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
19
26
|
api.data = {
|
|
20
27
|
query: `
|
|
21
28
|
query{
|
|
22
29
|
picklists(filters: [["code", "=", "223321001114222"]]){
|
|
23
|
-
options: _related_picklist_options_picklist(
|
|
24
|
-
label: name, value, , parent: parent__expand{value}
|
|
30
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
31
|
+
label: name, value, enable, parent: parent__expand{value}
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
`}
|
|
29
36
|
adaptor: |+
|
|
30
|
-
const
|
|
37
|
+
const allOptions = payload.data.picklists[0].options;
|
|
38
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
39
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
40
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
41
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
42
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
43
|
+
_.forEach(keepIds, (id) => {
|
|
44
|
+
const op = _.find(allOptions, { value: id });
|
|
45
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
46
|
+
});
|
|
47
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
48
|
+
if (op.enable !== false) return op;
|
|
49
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
50
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
51
|
+
}));
|
|
31
52
|
let depth = 0;
|
|
32
53
|
function getChildren(value) {
|
|
33
54
|
depth++;
|
|
@@ -23,13 +23,19 @@ amis:
|
|
|
23
23
|
// 搜索框的数据上有 filterFormSearchableFields; 只认自身属性, 不认从列表页继承下来的
|
|
24
24
|
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
25
25
|
const codes = isSearch ? ['223321001114213', '223321001114213-v3'] : [context && context.form_version === 'v3' ? '223321001114213-v3' : '223321001114213'];
|
|
26
|
-
|
|
26
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 当前值放进 url, 缓存才会按单据区分
|
|
27
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.product) || []), (v) => {
|
|
28
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
29
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
30
|
+
}).map((s) => s.trim())));
|
|
31
|
+
api.url = api.url.split('?')[0] + '?product_picklist=' + (isSearch ? 'all' : codes[0])
|
|
32
|
+
+ '&tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
27
33
|
api.data = { query:`
|
|
28
34
|
query{
|
|
29
35
|
picklists(filters: [["code", "in", ${JSON.stringify(codes)}]]){
|
|
30
36
|
code,
|
|
31
|
-
options: _related_picklist_options_picklist(
|
|
32
|
-
label: name, value, , parent: parent__expand{value}
|
|
37
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
38
|
+
label: name, value, enable, parent: parent__expand{value}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -38,9 +44,23 @@ amis:
|
|
|
38
44
|
adaptor: |+
|
|
39
45
|
// 选项集还没建好时下拉为空, 不报错。两套一起列出时(搜索框), 新选项集的顶级品牌标「[新]」
|
|
40
46
|
const picklists = (payload.data && payload.data.picklists) || [];
|
|
41
|
-
const
|
|
47
|
+
const allOptions = _.flatMap(picklists, (picklist) => picklists.length > 1 && picklist.code === '223321001114213-v3'
|
|
42
48
|
? _.map(picklist.options, (op) => op.parent == null ? { ...op, label: '[新] ' + op.label } : op)
|
|
43
49
|
: picklist.options);
|
|
50
|
+
// 停用的选项: 搜索框全部列出并标「已停用」, 用来筛选历史单据(原选项集冻结后旧品牌都停用了也要能搜);
|
|
51
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
52
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
53
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
54
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
55
|
+
_.forEach(keepIds, (id) => {
|
|
56
|
+
const op = _.find(allOptions, { value: id });
|
|
57
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
58
|
+
});
|
|
59
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
60
|
+
if (op.enable !== false) return op;
|
|
61
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
62
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
63
|
+
}));
|
|
44
64
|
let depth = 0;
|
|
45
65
|
function getChildren(value) {
|
|
46
66
|
depth++;
|
|
@@ -16,17 +16,38 @@ amis:
|
|
|
16
16
|
url: /graphql
|
|
17
17
|
method: post
|
|
18
18
|
requestAdaptor: |-
|
|
19
|
+
// 停用的选项也查出来, 怎么显示由 adaptor 决定; 模式和当前值放进 url, 缓存才会按搜索框 / 单据区分
|
|
20
|
+
const isSearch = !!context && Object.prototype.hasOwnProperty.call(context, 'filterFormSearchableFields');
|
|
21
|
+
const keepIds = isSearch ? [] : _.uniq(_.compact(_.flatMap(_.castArray((context && context.social_media) || []), (v) => {
|
|
22
|
+
const s = _.isString(v) ? v : String((v && v.value) || '');
|
|
23
|
+
return _.flatMap(s.split(/[,、]/), (p) => [p].concat(p.split('-')));
|
|
24
|
+
}).map((s) => s.trim())));
|
|
25
|
+
api.url = api.url.split('?')[0] + '?tag_options=' + (isSearch ? 'all' : encodeURIComponent(keepIds.join(',')));
|
|
19
26
|
api.data = { query:`
|
|
20
27
|
query{
|
|
21
28
|
picklists(filters: [["code", "=", "social_media"]]){
|
|
22
|
-
options: _related_picklist_options_picklist(
|
|
23
|
-
label: name, value, , parent: parent__expand{value}
|
|
29
|
+
options: _related_picklist_options_picklist(sort: "sort_no desc"){
|
|
30
|
+
label: name, value, enable, parent: parent__expand{value}
|
|
24
31
|
}
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
`}
|
|
28
35
|
adaptor: |+
|
|
29
|
-
const
|
|
36
|
+
const allOptions = payload.data.picklists[0].options;
|
|
37
|
+
// 停用的选项: 列表搜索框全部列出并标「已停用」, 用来筛选历史单据;
|
|
38
|
+
// 表单 / 详情页只留当前值用到的(置灰, 不能再选), 否则停用后只显示一串 ID; 其余停用选项不显示
|
|
39
|
+
const tagOptions = new URLSearchParams(((api && api.url) || '').split('?')[1] || '').get('tag_options') || '';
|
|
40
|
+
const keepIds = tagOptions === 'all' ? null : tagOptions.split(',');
|
|
41
|
+
// 值里只存了末级 ID 时, 停用的上级也要带出来, 否则挂不到树上
|
|
42
|
+
_.forEach(keepIds, (id) => {
|
|
43
|
+
const op = _.find(allOptions, { value: id });
|
|
44
|
+
if (op && op.parent && !_.includes(keepIds, op.parent.value)) keepIds.push(op.parent.value);
|
|
45
|
+
});
|
|
46
|
+
const pOptions = _.compact(_.map(allOptions, (op) => {
|
|
47
|
+
if (op.enable !== false) return op;
|
|
48
|
+
if (keepIds == null) return { ...op, label: op.label + '(已停用)' };
|
|
49
|
+
return _.includes(keepIds, op.value) ? { ...op, disabled: true } : null;
|
|
50
|
+
}));
|
|
30
51
|
let depth = 0;
|
|
31
52
|
function getChildren(value) {
|
|
32
53
|
depth++;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
name: agency_contract_expiry_date
|
|
2
2
|
amis:
|
|
3
3
|
id: 'u:agency_contract_expiry_date'
|
|
4
|
-
group:
|
|
4
|
+
group: 个人信息
|
|
5
5
|
label: Agency合同截止日期
|
|
6
6
|
required: false
|
|
7
|
-
sort_no:
|
|
7
|
+
sort_no: 10000
|
|
8
8
|
type: date
|
|
9
|
-
visible_on: '{{global.user.is_space_admin}}'
|
|
9
|
+
visible_on: '{{global.user.is_space_admin === true && formData.is_collaborator === true}}'
|
|
@@ -2,13 +2,13 @@ name: agency_pepsico_contact
|
|
|
2
2
|
amis:
|
|
3
3
|
id: 'u:agency_pepsico_contact'
|
|
4
4
|
filters: []
|
|
5
|
-
group:
|
|
5
|
+
group: 个人信息
|
|
6
6
|
is_wide: false
|
|
7
7
|
label: Agency百事内部对接人
|
|
8
8
|
multiple: false
|
|
9
9
|
reference_to: space_users
|
|
10
10
|
reference_to_field: user
|
|
11
11
|
required: false
|
|
12
|
-
sort_no:
|
|
12
|
+
sort_no: 10010
|
|
13
13
|
type: lookup
|
|
14
|
-
visible_on: '{{global.user.is_space_admin}}'
|
|
14
|
+
visible_on: '{{global.user.is_space_admin === true && formData.is_collaborator === true}}'
|
|
@@ -5,11 +5,11 @@ description: ''
|
|
|
5
5
|
enable_thousands: true
|
|
6
6
|
group: 系统信息
|
|
7
7
|
inlineHelpText: ''
|
|
8
|
-
label:
|
|
8
|
+
label: 最近登录
|
|
9
9
|
sort_no: 1700
|
|
10
10
|
type: date
|
|
11
|
-
visible_on: '{{global.user.is_space_admin}}'
|
|
11
|
+
visible_on: '{{global.user.is_space_admin === true && global.mode === "read"}}'
|
|
12
12
|
hidden: false
|
|
13
13
|
omit: false
|
|
14
14
|
static: true
|
|
15
|
-
is_wide: false
|
|
15
|
+
is_wide: false
|
|
@@ -9,7 +9,7 @@ hidden: false
|
|
|
9
9
|
inlineHelpText: ''
|
|
10
10
|
label: 超90天未登录
|
|
11
11
|
omit: false
|
|
12
|
-
sort_no:
|
|
12
|
+
sort_no: 1900
|
|
13
13
|
type: boolean
|
|
14
|
-
visible_on: '{{global.user.is_space_admin}}'
|
|
15
|
-
static: true
|
|
14
|
+
visible_on: '{{global.user.is_space_admin === true && global.mode === "read"}}'
|
|
15
|
+
static: true
|