@steedos-labs/content-compliance 0.7.11 → 0.7.12
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/methods/__tests__/urgent.test.d.ts +1 -0
- package/lib/methods/__tests__/urgent.test.js +121 -0
- package/lib/methods/__tests__/urgent.test.js.map +1 -0
- package/lib/methods/approval_engine.js +55 -21
- package/lib/methods/approval_engine.js.map +1 -1
- package/lib/methods/urgent.d.ts +1 -0
- package/lib/methods/urgent.js +43 -37
- package/lib/methods/urgent.js.map +1 -1
- package/main/default/objects/pepsico_material_approval/buttons/pepsico_postpone_review.button.yml +1 -1
- package/main/default/objects/pepsico_material_approval/buttons/pepsico_urgent_review.button.yml +3 -2
- package/main/default/objects/pepsico_material_approval/listviews/all.listview.yml +2 -2
- package/main/default/objects/pepsico_material_approval/listviews/collaboration.listview.yml +2 -2
- package/main/default/objects/pepsico_material_approval/listviews/handle.listview.yml +2 -2
- package/main/default/objects/pepsico_material_approval/listviews/handle_postpone.listview.yml +2 -2
- package/package.json +1 -1
package/lib/methods/urgent.js
CHANGED
|
@@ -17,6 +17,9 @@ var getUrgentQuota = function (ctx, userId, space) { return tslib_1.__awaiter(vo
|
|
|
17
17
|
})];
|
|
18
18
|
case 1:
|
|
19
19
|
quota = _a.sent();
|
|
20
|
+
if (!quota) {
|
|
21
|
+
return [2, { available: 0, used: 0, total: 0, year: year, half: half, configured: false }];
|
|
22
|
+
}
|
|
20
23
|
h1_used = (quota === null || quota === void 0 ? void 0 : quota.h1_used) || 0;
|
|
21
24
|
h2_used = (quota === null || quota === void 0 ? void 0 : quota.h2_used) || 0;
|
|
22
25
|
if (half === 1) {
|
|
@@ -30,13 +33,13 @@ var getUrgentQuota = function (ctx, userId, space) { return tslib_1.__awaiter(vo
|
|
|
30
33
|
used = h2_used;
|
|
31
34
|
available = Math.max(0, total - h2_used);
|
|
32
35
|
}
|
|
33
|
-
return [2, { available: available, used: used, total: total, year: year, half: half }];
|
|
36
|
+
return [2, { available: available, used: used, total: total, year: year, half: half, configured: true }];
|
|
34
37
|
}
|
|
35
38
|
});
|
|
36
39
|
}); };
|
|
37
40
|
exports.getUrgentQuota = getUrgentQuota;
|
|
38
41
|
var canUrgent = function (ctx, approvalId, userId) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
39
|
-
var approval, reviewSteps, postponedUsers, quota;
|
|
42
|
+
var approval, spaceUser, reviewSteps, postponedUsers, quota;
|
|
40
43
|
return tslib_1.__generator(this, function (_a) {
|
|
41
44
|
switch (_a.label) {
|
|
42
45
|
case 0: return [4, ctx.getObject('pepsico_material_approval').findOne(approvalId)];
|
|
@@ -51,6 +54,15 @@ var canUrgent = function (ctx, approvalId, userId) { return tslib_1.__awaiter(vo
|
|
|
51
54
|
if (approval.owner !== userId) {
|
|
52
55
|
return [2, { canUrgent: false, reason: '只有发起人可以加急' }];
|
|
53
56
|
}
|
|
57
|
+
return [4, ctx.getObject('space_users').findOne({
|
|
58
|
+
filters: [['user', '=', userId], ['space', '=', approval.space]],
|
|
59
|
+
fields: ['is_collaborator']
|
|
60
|
+
})];
|
|
61
|
+
case 2:
|
|
62
|
+
spaceUser = _a.sent();
|
|
63
|
+
if ((spaceUser === null || spaceUser === void 0 ? void 0 : spaceUser.is_collaborator) === true) {
|
|
64
|
+
return [2, { canUrgent: false, reason: '只有内部用户可以加急' }];
|
|
65
|
+
}
|
|
54
66
|
reviewSteps = [consts_1.Step.departmental_review, consts_1.Step.personnel_review];
|
|
55
67
|
if (!reviewSteps.includes(approval.current_step)) {
|
|
56
68
|
return [2, { canUrgent: false, reason: '当前步骤不支持加急' }];
|
|
@@ -60,8 +72,11 @@ var canUrgent = function (ctx, approvalId, userId) { return tslib_1.__awaiter(vo
|
|
|
60
72
|
return [2, { canUrgent: false, reason: '存在延后审核人,无法加急' }];
|
|
61
73
|
}
|
|
62
74
|
return [4, (0, exports.getUrgentQuota)(ctx, userId, approval.space)];
|
|
63
|
-
case
|
|
75
|
+
case 3:
|
|
64
76
|
quota = _a.sent();
|
|
77
|
+
if (!quota.configured) {
|
|
78
|
+
return [2, { canUrgent: false, reason: '未配置加急次数', quota: quota }];
|
|
79
|
+
}
|
|
65
80
|
if (quota.available <= 0) {
|
|
66
81
|
return [2, { canUrgent: false, reason: '暂无加急次数', quota: quota }];
|
|
67
82
|
}
|
|
@@ -173,30 +188,21 @@ var doUrgent = function (ctx, approvalId, userId) { return tslib_1.__awaiter(voi
|
|
|
173
188
|
})];
|
|
174
189
|
case 3:
|
|
175
190
|
existingQuota = _d.sent();
|
|
191
|
+
if (!existingQuota) {
|
|
192
|
+
throw new Error('未配置加急次数');
|
|
193
|
+
}
|
|
176
194
|
updateField = half === 1 ? 'h1_used' : 'h2_used';
|
|
177
|
-
if (!existingQuota) return [3, 5];
|
|
178
195
|
return [4, ctx.getObject('pepsico_urgent_quota').directUpdate(existingQuota._id, (_b = {},
|
|
179
196
|
_b[updateField] = (existingQuota[updateField] || 0) + 1,
|
|
180
197
|
_b))];
|
|
181
198
|
case 4:
|
|
182
199
|
_d.sent();
|
|
183
|
-
return [
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
h2_used: half === 2 ? 1 : 0
|
|
190
|
-
})];
|
|
191
|
-
case 6:
|
|
192
|
-
_d.sent();
|
|
193
|
-
_d.label = 7;
|
|
194
|
-
case 7: return [4, ctx.getObject('pepsico_material_approval').directUpdate(approvalId, {
|
|
195
|
-
is_urgent: true,
|
|
196
|
-
urgent_times: (approval.urgent_times || 0) + 1,
|
|
197
|
-
urgent_at: new Date()
|
|
198
|
-
})];
|
|
199
|
-
case 8:
|
|
200
|
+
return [4, ctx.getObject('pepsico_material_approval').directUpdate(approvalId, {
|
|
201
|
+
is_urgent: true,
|
|
202
|
+
urgent_times: (approval.urgent_times || 0) + 1,
|
|
203
|
+
urgent_at: new Date()
|
|
204
|
+
})];
|
|
205
|
+
case 5:
|
|
200
206
|
_d.sent();
|
|
201
207
|
return [4, ctx.getObject('pepsico_urgent_log').insert({
|
|
202
208
|
approval: approvalId,
|
|
@@ -206,38 +212,38 @@ var doUrgent = function (ctx, approvalId, userId) { return tslib_1.__awaiter(voi
|
|
|
206
212
|
year: year,
|
|
207
213
|
half: half
|
|
208
214
|
})];
|
|
209
|
-
case
|
|
215
|
+
case 6:
|
|
210
216
|
_d.sent();
|
|
211
217
|
pendingApprovers = Array.isArray(approval.person_pending_approve)
|
|
212
218
|
? approval.person_pending_approve
|
|
213
219
|
: [];
|
|
214
|
-
_d.label =
|
|
215
|
-
case
|
|
216
|
-
_d.trys.push([
|
|
220
|
+
_d.label = 7;
|
|
221
|
+
case 7:
|
|
222
|
+
_d.trys.push([7, 12, 13, 14]);
|
|
217
223
|
pendingApprovers_1 = tslib_1.__values(pendingApprovers), pendingApprovers_1_1 = pendingApprovers_1.next();
|
|
218
|
-
_d.label =
|
|
219
|
-
case
|
|
220
|
-
if (!!pendingApprovers_1_1.done) return [3,
|
|
224
|
+
_d.label = 8;
|
|
225
|
+
case 8:
|
|
226
|
+
if (!!pendingApprovers_1_1.done) return [3, 11];
|
|
221
227
|
approverId = pendingApprovers_1_1.value;
|
|
222
228
|
return [4, sendUrgentNotification(ctx, approval.space, approvalId, approval.name, userId, approverId)];
|
|
223
|
-
case
|
|
229
|
+
case 9:
|
|
224
230
|
_d.sent();
|
|
225
|
-
_d.label =
|
|
226
|
-
case
|
|
231
|
+
_d.label = 10;
|
|
232
|
+
case 10:
|
|
227
233
|
pendingApprovers_1_1 = pendingApprovers_1.next();
|
|
228
|
-
return [3,
|
|
229
|
-
case
|
|
230
|
-
case
|
|
234
|
+
return [3, 8];
|
|
235
|
+
case 11: return [3, 14];
|
|
236
|
+
case 12:
|
|
231
237
|
e_2_1 = _d.sent();
|
|
232
238
|
e_2 = { error: e_2_1 };
|
|
233
|
-
return [3,
|
|
234
|
-
case
|
|
239
|
+
return [3, 14];
|
|
240
|
+
case 13:
|
|
235
241
|
try {
|
|
236
242
|
if (pendingApprovers_1_1 && !pendingApprovers_1_1.done && (_c = pendingApprovers_1.return)) _c.call(pendingApprovers_1);
|
|
237
243
|
}
|
|
238
244
|
finally { if (e_2) throw e_2.error; }
|
|
239
245
|
return [7];
|
|
240
|
-
case
|
|
246
|
+
case 14:
|
|
241
247
|
newUsed = used + 1;
|
|
242
248
|
newAvailable = Math.max(0, total - newUsed);
|
|
243
249
|
return [2, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urgent.js","sourceRoot":"","sources":["../../src/methods/urgent.ts"],"names":[],"mappings":";;;;AAMA,mCAAkD;AAElD,IAAM,eAAe,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"urgent.js","sourceRoot":"","sources":["../../src/methods/urgent.ts"],"names":[],"mappings":";;;;AAMA,mCAAkD;AAElD,IAAM,eAAe,GAAG,CAAC,CAAC;AAcnB,IAAM,cAAc,GAAG,UAAO,GAAG,EAAE,MAAc,EAAE,KAAa;;;;;gBAC7D,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;gBACjB,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;gBACzB,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE1B,WAAM,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC;wBAC9D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;qBAC/E,CAAC,EAAA;;gBAFI,KAAK,GAAG,SAEZ;gBAEF,IAAI,CAAC,KAAK,EAAE;oBACR,WAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAA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;;;;gBAA9B,UAAU;gBACjB,WAAM,sBAAsB,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAA;;gBAAhG,SAAgG,CAAC;;;;;;;;;;;;;;;;;gBAI/F,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC;gBACnB,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;gBAElD,WAAO;wBACH,OAAO,EAAE,2DAAY,OAAO,uCAAS,YAAY,YAAI;wBACrD,IAAI,EAAE,OAAO;wBACb,SAAS,EAAE,YAAY;wBACvB,KAAK,OAAA;qBACR,EAAC;;;KACL,CAAC;AA/DW,QAAA,QAAQ,YA+DnB"}
|
package/main/default/objects/pepsico_material_approval/buttons/pepsico_postpone_review.button.yml
CHANGED
|
@@ -8,7 +8,7 @@ amis_schema: |-
|
|
|
8
8
|
"label": "延后审核",
|
|
9
9
|
"id": "u:pepsico_postpone_review",
|
|
10
10
|
"editorState": "default",
|
|
11
|
-
"visibleOn": "${(current_step == 'departmental_review' || current_step == 'personnel_review') && !ARRAYINCLUDES(person_pending_approve, context.user.user) && ARRAYINCLUDES(person_approved, context.user.user) && !ARRAYINCLUDES(postpone_marker_users, context.user.user) && !ARRAYINCLUDES(review_postponed_users, context.user.user) && !is_skip_approver && ((ARRAYINCLUDES(ns_reviewer, context.user.user) && ns_approval_status == false) || (ARRAYINCLUDES(legal_reviewer, context.user.user) && legal_approval_status == false) || (ARRAYINCLUDES(sra_reviewer, context.user.user) && sra_approval_status == false) || (ARRAYINCLUDES(ca_reviewer, context.user.user) && ca_approval_status == false) || (ARRAYINCLUDES(
|
|
11
|
+
"visibleOn": "${(current_step == 'departmental_review' || current_step == 'personnel_review' || current_step == 'submitter_revisions') && !is_urgent && !ARRAYINCLUDES(person_pending_approve, context.user.user) && ARRAYINCLUDES(person_approved, context.user.user) && !ARRAYINCLUDES(postpone_marker_users, context.user.user) && !ARRAYINCLUDES(review_postponed_users, context.user.user) && !is_skip_approver && ((ARRAYINCLUDES(ns_reviewer, context.user.user) && ns_approval_status == false) || (ARRAYINCLUDES(legal_reviewer, context.user.user) && legal_approval_status == false) || (ARRAYINCLUDES(sra_reviewer, context.user.user) && sra_approval_status == false) || (ARRAYINCLUDES(ca_reviewer, context.user.user) && ca_approval_status == false) || (ARRAYINCLUDES(reviewer, context.user.user) && approval_status == false) || (pre_ns_reviewer == context.user.user && pre_ns_approval_status == false) || (pre_legal_reviewer == context.user.user && pre_legal_approval_status == false) || (pre_sra_reviewer == context.user.user && pre_sra_approval_status == false) || (pre_ca_reviewer == context.user.user && pre_ca_approval_status == false) || (pre_reviewer == context.user.user && pre_approval_status == false)) && formFactor != 'SMALL'}",
|
|
12
12
|
"onEvent": {
|
|
13
13
|
"click": {
|
|
14
14
|
"weight": 0,
|
package/main/default/objects/pepsico_material_approval/buttons/pepsico_urgent_review.button.yml
CHANGED
|
@@ -16,7 +16,7 @@ amis_schema: |-
|
|
|
16
16
|
"editorState": "default",
|
|
17
17
|
"visibleOn": "${(current_step == 'departmental_review' || current_step == 'personnel_review') && !is_urgent && context.user.user == owner && ENDSWITH(context.user.email, '@pepsico.com') && formFactor != 'SMALL'}",
|
|
18
18
|
"disabledOn": "${quota && quota.available === 0}",
|
|
19
|
-
"disabledTip": "${quota && quota.available === 0 ? '暂无加急次数' : ''}",
|
|
19
|
+
"disabledTip": "${quota && quota.available === 0 ? (reason || '暂无加急次数') : ''}",
|
|
20
20
|
"onEvent": {
|
|
21
21
|
"click": {
|
|
22
22
|
"weight": 0,
|
|
@@ -35,11 +35,12 @@ amis_schema: |-
|
|
|
35
35
|
{
|
|
36
36
|
"ignoreError": false,
|
|
37
37
|
"actionType": "custom",
|
|
38
|
-
"script": "if (event.data.quotaResult && event.data.quotaResult.quota && event.data.quotaResult.quota.available === 0) { doAction({ actionType: 'toast', args: { msgType: 'warning', msg: '暂无加急次数' } }); return false; } if (event.data.quotaResult && !event.data.quotaResult.canUrgent) { doAction({ actionType: 'toast', args: { msgType: 'warning', msg: event.data.quotaResult.reason || '不满足加急条件' } }); return false; }"
|
|
38
|
+
"script": "if (event.data.quotaResult && event.data.quotaResult.quota && event.data.quotaResult.quota.available === 0) { doAction({ actionType: 'toast', args: { msgType: 'warning', msg: event.data.quotaResult.reason || '暂无加急次数' } }); event.stopPropagation(); event.preventDefault(); return false; } if (event.data.quotaResult && !event.data.quotaResult.canUrgent) { doAction({ actionType: 'toast', args: { msgType: 'warning', msg: event.data.quotaResult.reason || '不满足加急条件' } }); event.stopPropagation(); event.preventDefault(); return false; }"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"ignoreError": false,
|
|
42
42
|
"actionType": "dialog",
|
|
43
|
+
"expression": "${quotaResult && quotaResult.canUrgent}",
|
|
43
44
|
"dialog": {
|
|
44
45
|
"type": "dialog",
|
|
45
46
|
"title": "加急审核",
|
|
@@ -62,5 +62,5 @@ extra_columns:
|
|
|
62
62
|
- is_urgent
|
|
63
63
|
- review_postponed_users
|
|
64
64
|
crudDataFilter: |
|
|
65
|
-
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ''}";
|
|
66
|
-
return crud;
|
|
65
|
+
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ((review_postponed_users && review_postponed_users.length > 0 && (ARRAYINCLUDES(review_postponed_users, context.userId) || owner == context.userId || context.user.profile == 'admin')) ? 'color-priority-postponed' : '')}";
|
|
66
|
+
return crud;
|
|
@@ -77,5 +77,5 @@ extra_columns:
|
|
|
77
77
|
- is_urgent
|
|
78
78
|
- review_postponed_users
|
|
79
79
|
crudDataFilter: |
|
|
80
|
-
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ''}";
|
|
81
|
-
return crud;
|
|
80
|
+
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ((review_postponed_users && review_postponed_users.length > 0 && (ARRAYINCLUDES(review_postponed_users, context.userId) || owner == context.userId || context.user.profile == 'admin')) ? 'color-priority-postponed' : '')}";
|
|
81
|
+
return crud;
|
|
@@ -89,5 +89,5 @@ extra_columns:
|
|
|
89
89
|
- is_urgent
|
|
90
90
|
- review_postponed_users
|
|
91
91
|
crudDataFilter: |
|
|
92
|
-
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ''}";
|
|
93
|
-
return crud;
|
|
92
|
+
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ((review_postponed_users && review_postponed_users.length > 0 && (ARRAYINCLUDES(review_postponed_users, context.userId) || owner == context.userId || context.user.profile == 'admin')) ? 'color-priority-postponed' : '')}";
|
|
93
|
+
return crud;
|
package/main/default/objects/pepsico_material_approval/listviews/handle_postpone.listview.yml
CHANGED
|
@@ -89,5 +89,5 @@ extra_columns:
|
|
|
89
89
|
- is_urgent
|
|
90
90
|
- review_postponed_users
|
|
91
91
|
crudDataFilter: |
|
|
92
|
-
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ''}";
|
|
93
|
-
return crud;
|
|
92
|
+
crud.rowClassNameExpr = "${is_urgent ? 'color-priority-danger' : ((review_postponed_users && review_postponed_users.length > 0 && (ARRAYINCLUDES(review_postponed_users, context.userId) || owner == context.userId || context.user.profile == 'admin')) ? 'color-priority-postponed' : '')}";
|
|
93
|
+
return crud;
|