@steedos-labs/content-compliance 0.8.21 → 0.8.23
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/addBulkMaterials.d.ts +1 -9
- package/lib/actions/addBulkMaterials.js +56 -24
- package/lib/actions/addBulkMaterials.js.map +1 -1
- package/lib/methods/__tests__/materialSizeLimit.test.d.ts +1 -0
- package/lib/methods/__tests__/materialSizeLimit.test.js +146 -0
- package/lib/methods/__tests__/materialSizeLimit.test.js.map +1 -0
- package/lib/methods/__tests__/materialUploadValidation.test.d.ts +1 -0
- package/lib/methods/__tests__/materialUploadValidation.test.js +217 -0
- package/lib/methods/__tests__/materialUploadValidation.test.js.map +1 -0
- package/lib/methods/__tests__/qcParallelReview.test.js +10 -3
- package/lib/methods/__tests__/qcParallelReview.test.js.map +1 -1
- package/lib/methods/__tests__/resubmissionAutoApprove.test.d.ts +1 -0
- package/lib/methods/__tests__/resubmissionAutoApprove.test.js +195 -0
- package/lib/methods/__tests__/resubmissionAutoApprove.test.js.map +1 -0
- package/lib/methods/approval_engine.d.ts +1 -0
- package/lib/methods/approval_engine.js +324 -281
- package/lib/methods/approval_engine.js.map +1 -1
- package/lib/methods/material.d.ts +1 -0
- package/lib/methods/material.js +21 -2
- package/lib/methods/material.js.map +1 -1
- package/main/default/objects/pepsico_material/buttons/pepsico_upload_supplement.button.yml +1 -1
- package/main/default/objects/pepsico_material_approval/buttons/pepsico_material_upload.button.yml +2 -2
- package/main/default/objects/pepsico_material_approval/listviews/collaboration.listview.yml +5 -0
- package/main/default/pages/pepsico_content_review_detail.page.amis.json +15 -15
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b, _c;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.postponeReview = exports.getPostponeReviewDepartmentType = exports.hasReviewed = exports.submitContent = exports.submitPreReviewContent = exports.submitKidsContent = exports.rejectContent = exports.approvalContent = exports.postponeDeployment = exports.confirmDeployment = exports.terminate = exports.advanceApproval = exports.getDepartmentEffectiveStatuses = exports.areDepartmentReviewsComplete = exports.hasNonPreReviewDepartments = exports.getPreReviewStatuses = exports.needsPLSReReview = exports.needsQcReview = exports.getDeptEffectiveStatus = exports.isDeptReviewComplete = exports.hasAnyPreReviewer = exports.getApproverStepRule = exports.getDefApproverStepRule = void 0;
|
|
4
|
+
exports.postponeReview = exports.getPostponeReviewDepartmentType = exports.hasReviewed = exports.submitContent = exports.submitPreReviewContent = exports.submitKidsContent = exports.rejectContent = exports.approvalContent = exports.postponeDeployment = exports.confirmDeployment = exports.terminate = exports.advanceApproval = exports.getDepartmentEffectiveStatuses = exports.areDepartmentReviewsComplete = exports.hasNonPreReviewDepartments = exports.getPreReviewStatuses = exports.addFormalReviewerAfterPreApproval = exports.needsPLSReReview = exports.needsQcReview = exports.getDeptEffectiveStatus = exports.isDeptReviewComplete = exports.hasAnyPreReviewer = exports.getApproverStepRule = exports.getDefApproverStepRule = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var consts_1 = require("./consts");
|
|
7
7
|
var amis_formula_1 = require("amis-formula");
|
|
@@ -154,7 +154,8 @@ var needsQcReview = function (materialApproval) {
|
|
|
154
154
|
exports.needsQcReview = needsQcReview;
|
|
155
155
|
var needsPLSReReview = function (materialApproval) {
|
|
156
156
|
return !_.isEmpty(materialApproval.pls_km_files)
|
|
157
|
-
&& (materialApproval
|
|
157
|
+
&& ((0, exports.getDeptEffectiveStatus)(materialApproval, 'sra') === false
|
|
158
|
+
|| ((0, exports.needsQcReview)(materialApproval) && (0, exports.getDeptEffectiveStatus)(materialApproval, 'qc') === false));
|
|
158
159
|
};
|
|
159
160
|
exports.needsPLSReReview = needsPLSReReview;
|
|
160
161
|
var requiresPLS = function (materialApproval) {
|
|
@@ -843,6 +844,7 @@ var addFormalReviewerAfterPreApproval = function (ctx, recordId, approveField, m
|
|
|
843
844
|
return [4, (0, agent_1.getReviewerAgentsInfo)(ctx, materialApproval.space, userIds)];
|
|
844
845
|
case 1:
|
|
845
846
|
agents = _g.sent();
|
|
847
|
+
agents.userIds = (0, lodash_1.uniq)(agents.userIds);
|
|
846
848
|
user = ctx.meta.user;
|
|
847
849
|
_g.label = 2;
|
|
848
850
|
case 2:
|
|
@@ -897,7 +899,7 @@ var addFormalReviewerAfterPreApproval = function (ctx, recordId, approveField, m
|
|
|
897
899
|
case 12:
|
|
898
900
|
currentApproval = _g.sent();
|
|
899
901
|
pendingApprove = currentApproval.person_pending_approve || [];
|
|
900
|
-
newPending = (0, lodash_1.compact)((0, lodash_1.
|
|
902
|
+
newPending = (0, lodash_1.compact)((0, lodash_1.concat)(pendingApprove, agents.userIds));
|
|
901
903
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(materialApproval._id, (_e = {
|
|
902
904
|
person_pending_approve: newPending
|
|
903
905
|
},
|
|
@@ -916,6 +918,7 @@ var addFormalReviewerAfterPreApproval = function (ctx, recordId, approveField, m
|
|
|
916
918
|
}
|
|
917
919
|
});
|
|
918
920
|
}); };
|
|
921
|
+
exports.addFormalReviewerAfterPreApproval = addFormalReviewerAfterPreApproval;
|
|
919
922
|
var getPreReviewStatuses = function (materialApproval) {
|
|
920
923
|
var statuses = [];
|
|
921
924
|
if (materialApproval.pre_ns_reviewer) {
|
|
@@ -974,110 +977,129 @@ var getDepartmentEffectiveStatuses = function (materialApproval) {
|
|
|
974
977
|
};
|
|
975
978
|
exports.getDepartmentEffectiveStatuses = getDepartmentEffectiveStatuses;
|
|
976
979
|
var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
977
|
-
var actionLabel, user, record, nextStep, skipApprover, nextApprovers, _nextApprovers, nextApprovers_2, nextApprovers_2_1, reviewer, fieldName, status, e_7_1, nextApproversUserIds_1, nextApproversClientUserIds_1, setDoc, invalidated, nextApprovers_3, nextApprovers_3_1, nextApprover, e_8_1, setDoc_1, postponedUserIds_1, now, visibleAfter, pastPostponeRecords, postponedDepts, _loop_1, nextApprovers_4, nextApprovers_4_1, reviewer, e_9_1, currentRecord, currentPostponed, newPostponed, currentMarkerUsers, newMarkerUsers, notifyUserIds, initiator, materialOwner, error_1;
|
|
978
|
-
var e_7, _a, _b,
|
|
979
|
-
return tslib_1.__generator(this, function (
|
|
980
|
-
switch (
|
|
980
|
+
var actionLabel, user, record, nextStep, skipApprover, nextApprovers, _nextApprovers, autoApproveUpdates, nextApprovers_2, nextApprovers_2_1, reviewer, fieldName, status, preInfo, formalStatus, formalReviewerIds, formalUserIds, formalAgents, e_7_1, nextApproversUserIds_1, nextApproversClientUserIds_1, setDoc, invalidated, nextApprovers_3, nextApprovers_3_1, nextApprover, e_8_1, setDoc_1, postponedUserIds_1, now, visibleAfter, pastPostponeRecords, postponedDepts, _loop_1, nextApprovers_4, nextApprovers_4_1, reviewer, e_9_1, currentRecord, currentPostponed, newPostponed, currentMarkerUsers, newMarkerUsers, notifyUserIds, initiator, materialOwner, error_1;
|
|
981
|
+
var e_7, _a, _b, e_8, _c, e_9, _d;
|
|
982
|
+
return tslib_1.__generator(this, function (_e) {
|
|
983
|
+
switch (_e.label) {
|
|
981
984
|
case 0:
|
|
982
|
-
|
|
985
|
+
_e.trys.push([0, 110, , 111]);
|
|
983
986
|
actionLabel = '请查看';
|
|
984
987
|
user = ctx.meta.user;
|
|
985
988
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
986
989
|
case 1:
|
|
987
|
-
record =
|
|
990
|
+
record = _e.sent();
|
|
988
991
|
console.log('[advanceApproval]', record.current_step, record.person_pending_approve, user.userId);
|
|
989
992
|
return [4, canSubmit(record)];
|
|
990
993
|
case 2:
|
|
991
|
-
|
|
994
|
+
_e.sent();
|
|
992
995
|
return [4, getNextStep(ctx, record, currentStepApprovalStatus)];
|
|
993
996
|
case 3:
|
|
994
|
-
nextStep =
|
|
997
|
+
nextStep = _e.sent();
|
|
995
998
|
return [4, isSkipApprover(ctx, record)];
|
|
996
999
|
case 4:
|
|
997
|
-
skipApprover =
|
|
1000
|
+
skipApprover = _e.sent();
|
|
998
1001
|
if (!(nextStep === consts_1.Step.conclusion && skipApprover)) return [3, 8];
|
|
999
1002
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(record._id, {
|
|
1000
1003
|
is_skip_approver: true
|
|
1001
1004
|
})];
|
|
1002
1005
|
case 5:
|
|
1003
|
-
|
|
1006
|
+
_e.sent();
|
|
1004
1007
|
return [4, ctx.getObject('pepsico_material').directUpdateMany(['pepsico_material_approval', '=', record._id], {
|
|
1005
1008
|
is_skip_approver: true
|
|
1006
1009
|
})];
|
|
1007
1010
|
case 6:
|
|
1008
|
-
|
|
1011
|
+
_e.sent();
|
|
1009
1012
|
return [4, setPersonView(ctx, record)];
|
|
1010
1013
|
case 7:
|
|
1011
|
-
|
|
1012
|
-
|
|
1014
|
+
_e.sent();
|
|
1015
|
+
_e.label = 8;
|
|
1013
1016
|
case 8: return [4, getNextApprovers(ctx, record, nextStep)];
|
|
1014
1017
|
case 9:
|
|
1015
|
-
nextApprovers =
|
|
1016
|
-
if (!(record.current_step === consts_1.Step.submitter_revisions && (nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review))) return [3,
|
|
1018
|
+
nextApprovers = _e.sent();
|
|
1019
|
+
if (!((record.current_step === consts_1.Step.submitter_revisions || record.current_step === consts_1.Step.ai_review) && (nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review))) return [3, 26];
|
|
1017
1020
|
_nextApprovers = [];
|
|
1018
|
-
|
|
1021
|
+
autoApproveUpdates = {};
|
|
1022
|
+
_e.label = 10;
|
|
1019
1023
|
case 10:
|
|
1020
|
-
|
|
1024
|
+
_e.trys.push([10, 19, 20, 21]);
|
|
1021
1025
|
nextApprovers_2 = tslib_1.__values(nextApprovers), nextApprovers_2_1 = nextApprovers_2.next();
|
|
1022
|
-
|
|
1026
|
+
_e.label = 11;
|
|
1023
1027
|
case 11:
|
|
1024
|
-
if (!!nextApprovers_2_1.done) return [3,
|
|
1028
|
+
if (!!nextApprovers_2_1.done) return [3, 18];
|
|
1025
1029
|
reviewer = nextApprovers_2_1.value;
|
|
1026
1030
|
fieldName = (0, material_1.getApproverFieldByType)(reviewer.type);
|
|
1027
1031
|
console.log("getApproverFieldByType", reviewer.type, fieldName);
|
|
1028
1032
|
if (!fieldName) {
|
|
1029
|
-
return [3,
|
|
1033
|
+
return [3, 17];
|
|
1030
1034
|
}
|
|
1031
1035
|
return [4, (0, material_1.getUserReviewedAllMaterialsStatus)(ctx, record._id, fieldName)];
|
|
1032
1036
|
case 12:
|
|
1033
|
-
status =
|
|
1037
|
+
status = _e.sent();
|
|
1034
1038
|
console.log("getUserReviewedAllMaterialsStatus", record._id, fieldName, status);
|
|
1035
|
-
if (!(status === consts_1.ApprovalStatus.approved)) return [3,
|
|
1039
|
+
if (!(status === consts_1.ApprovalStatus.approved)) return [3, 15];
|
|
1040
|
+
preInfo = PRE_TO_FORMAL_MAPPING[fieldName];
|
|
1041
|
+
formalStatus = preInfo ? record[preInfo.statusField] : undefined;
|
|
1042
|
+
if (!(preInfo && formalStatus !== true && formalStatus !== consts_1.ApprovalStatus.pass)) return [3, 14];
|
|
1043
|
+
formalReviewerIds = record[preInfo.reviewerField];
|
|
1044
|
+
formalUserIds = !formalReviewerIds ? [] : (Array.isArray(formalReviewerIds) ? formalReviewerIds : [formalReviewerIds]);
|
|
1045
|
+
if (formalUserIds.length === 0) {
|
|
1046
|
+
throw new Error("".concat(preInfo.type, "\u6B63\u5F0F\u5BA1\u6838\u4EBA\u7F3A\u5931, \u9884\u5BA1\u81EA\u52A8\u901A\u8FC7\u540E\u65E0\u6CD5\u5206\u6D3E\u6B63\u5F0F\u5BA1\u6838, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u5728\u5BA1\u6838\u4EBA\u5458\u914D\u7F6E\u4E2D\u8865\u5145\u540E\u91CD\u65B0\u63D0\u4EA4"));
|
|
1047
|
+
}
|
|
1048
|
+
return [4, (0, agent_1.getReviewerAgentsInfo)(ctx, record.space, formalUserIds)];
|
|
1049
|
+
case 13:
|
|
1050
|
+
formalAgents = _e.sent();
|
|
1051
|
+
formalAgents.userIds = (0, lodash_1.uniq)(formalAgents.userIds);
|
|
1052
|
+
_nextApprovers.push(tslib_1.__assign(tslib_1.__assign({}, formalAgents), { type: preInfo.type }));
|
|
1053
|
+
console.log("[advanceApproval] \u9884\u5BA1\u81EA\u52A8\u901A\u8FC7, \u8F6C\u5165\u6B63\u5F0F\u5BA1\u6838", recordId, fieldName, preInfo.type, formalAgents.userIds);
|
|
1054
|
+
_e.label = 14;
|
|
1055
|
+
case 14:
|
|
1036
1056
|
console.log("[advanceApproval] \u81EA\u52A8\u66F4\u65B0\u5BA1\u6279\u5355\u4E0A\u7684\u72B6\u6001\u5B57\u6BB5", recordId, (_b = {},
|
|
1037
1057
|
_b[fieldName] = consts_1.ApprovalStatus.approved,
|
|
1038
1058
|
_b));
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
case 13:
|
|
1043
|
-
_f.sent();
|
|
1044
|
-
return [3, 15];
|
|
1045
|
-
case 14:
|
|
1059
|
+
autoApproveUpdates[fieldName] = true;
|
|
1060
|
+
return [3, 16];
|
|
1061
|
+
case 15:
|
|
1046
1062
|
if (status === consts_1.ApprovalStatus.pass) {
|
|
1047
1063
|
console.log("[advanceApproval] \u90E8\u95E8\u5DF2\u8DF3\u8FC7\uFF0C\u4FDD\u6301bypass\u72B6\u6001", recordId, fieldName);
|
|
1048
1064
|
}
|
|
1049
1065
|
else {
|
|
1050
1066
|
_nextApprovers.push(reviewer);
|
|
1051
1067
|
}
|
|
1052
|
-
|
|
1053
|
-
case 15:
|
|
1054
|
-
;
|
|
1055
|
-
_f.label = 16;
|
|
1068
|
+
_e.label = 16;
|
|
1056
1069
|
case 16:
|
|
1070
|
+
;
|
|
1071
|
+
_e.label = 17;
|
|
1072
|
+
case 17:
|
|
1057
1073
|
nextApprovers_2_1 = nextApprovers_2.next();
|
|
1058
1074
|
return [3, 11];
|
|
1059
|
-
case
|
|
1060
|
-
case 18:
|
|
1061
|
-
e_7_1 = _f.sent();
|
|
1062
|
-
e_7 = { error: e_7_1 };
|
|
1063
|
-
return [3, 20];
|
|
1075
|
+
case 18: return [3, 21];
|
|
1064
1076
|
case 19:
|
|
1077
|
+
e_7_1 = _e.sent();
|
|
1078
|
+
e_7 = { error: e_7_1 };
|
|
1079
|
+
return [3, 21];
|
|
1080
|
+
case 20:
|
|
1065
1081
|
try {
|
|
1066
1082
|
if (nextApprovers_2_1 && !nextApprovers_2_1.done && (_a = nextApprovers_2.return)) _a.call(nextApprovers_2);
|
|
1067
1083
|
}
|
|
1068
1084
|
finally { if (e_7) throw e_7.error; }
|
|
1069
1085
|
return [7];
|
|
1070
|
-
case 20:
|
|
1071
|
-
if (!(_nextApprovers.length > 0)) return [3, 21];
|
|
1072
|
-
nextApprovers = _nextApprovers;
|
|
1073
|
-
return [3, 23];
|
|
1074
1086
|
case 21:
|
|
1075
|
-
|
|
1076
|
-
return [4,
|
|
1087
|
+
if (!(Object.keys(autoApproveUpdates).length > 0)) return [3, 23];
|
|
1088
|
+
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, autoApproveUpdates)];
|
|
1077
1089
|
case 22:
|
|
1078
|
-
|
|
1079
|
-
|
|
1090
|
+
_e.sent();
|
|
1091
|
+
_e.label = 23;
|
|
1080
1092
|
case 23:
|
|
1093
|
+
if (!(_nextApprovers.length > 0)) return [3, 24];
|
|
1094
|
+
nextApprovers = _nextApprovers;
|
|
1095
|
+
return [3, 26];
|
|
1096
|
+
case 24:
|
|
1097
|
+
nextStep = consts_1.Step.awaiting_deployment;
|
|
1098
|
+
return [4, getNextApprovers(ctx, record, nextStep)];
|
|
1099
|
+
case 25:
|
|
1100
|
+
nextApprovers = _e.sent();
|
|
1101
|
+
_e.label = 26;
|
|
1102
|
+
case 26:
|
|
1081
1103
|
console.log("[advanceApproval] currentStepApprovalStatus:", currentStepApprovalStatus, " nextStep:", nextStep, " nextApprovers:", nextApprovers);
|
|
1082
1104
|
nextApproversUserIds_1 = [];
|
|
1083
1105
|
nextApproversClientUserIds_1 = [];
|
|
@@ -1098,44 +1120,44 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1098
1120
|
}
|
|
1099
1121
|
}
|
|
1100
1122
|
};
|
|
1101
|
-
if (!(record.current_step === consts_1.Step.draft)) return [3,
|
|
1123
|
+
if (!(record.current_step === consts_1.Step.draft)) return [3, 28];
|
|
1102
1124
|
setDoc.draft_submitted = new Date();
|
|
1103
1125
|
return [4, ctx.getObject('pepsico_material').directUpdateMany(['pepsico_material_approval', '=', record._id], {
|
|
1104
1126
|
draft_submitted: setDoc.draft_submitted
|
|
1105
1127
|
})];
|
|
1106
|
-
case
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
case
|
|
1128
|
+
case 27:
|
|
1129
|
+
_e.sent();
|
|
1130
|
+
_e.label = 28;
|
|
1131
|
+
case 28:
|
|
1110
1132
|
if (record.current_step === consts_1.Step.ai_review) {
|
|
1111
1133
|
setDoc.ai_reviewed_date = new Date();
|
|
1112
1134
|
}
|
|
1113
1135
|
if (record.current_step === consts_1.Step.departmental_review || record.current_step === consts_1.Step.personnel_review) {
|
|
1114
1136
|
setDoc.re_reviewed_date = new Date();
|
|
1115
1137
|
}
|
|
1116
|
-
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3,
|
|
1138
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 30];
|
|
1117
1139
|
setDoc.review_completed_date = new Date();
|
|
1118
1140
|
return [4, ctx.getObject('pepsico_material').directUpdateMany(['pepsico_material_approval', '=', record._id], {
|
|
1119
1141
|
review_completed_date: setDoc.review_completed_date
|
|
1120
1142
|
})];
|
|
1121
|
-
case
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
case
|
|
1143
|
+
case 29:
|
|
1144
|
+
_e.sent();
|
|
1145
|
+
_e.label = 30;
|
|
1146
|
+
case 30:
|
|
1125
1147
|
if (record.current_step === consts_1.Step.awaiting_deployment) {
|
|
1126
1148
|
setDoc.awaiting_deployment_date = new Date();
|
|
1127
1149
|
}
|
|
1128
|
-
if (!(record.current_step === consts_1.Step.conclusion)) return [3,
|
|
1150
|
+
if (!(record.current_step === consts_1.Step.conclusion)) return [3, 32];
|
|
1129
1151
|
setDoc.conclusion_date = new Date();
|
|
1130
|
-
if (!!record.review_completed_date) return [3,
|
|
1152
|
+
if (!!record.review_completed_date) return [3, 32];
|
|
1131
1153
|
setDoc.review_completed_date = setDoc.conclusion_date;
|
|
1132
1154
|
return [4, ctx.getObject('pepsico_material').directUpdateMany(['pepsico_material_approval', '=', record._id], {
|
|
1133
1155
|
review_completed_date: setDoc.review_completed_date
|
|
1134
1156
|
})];
|
|
1135
|
-
case
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
case
|
|
1157
|
+
case 31:
|
|
1158
|
+
_e.sent();
|
|
1159
|
+
_e.label = 32;
|
|
1160
|
+
case 32:
|
|
1139
1161
|
if (record.current_step === consts_1.Step.submitter_revisions) {
|
|
1140
1162
|
setDoc.submitter_revision_date = new Date();
|
|
1141
1163
|
console.log("[advanceApproval] \u68C0\u6D4B\u5230\u4FEE\u6539\u540E\u63D0\u4EA4\u573A\u666F, \u6807\u8BB0\u56FE\u7247\u5BF9\u6BD4\u4EFB\u52A1: ".concat(recordId));
|
|
@@ -1144,20 +1166,20 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1144
1166
|
setDoc.image_comparison_failed_count = 0;
|
|
1145
1167
|
}
|
|
1146
1168
|
return [4, ctx.getObject('pepsico_material_approval').update(recordId, setDoc)];
|
|
1147
|
-
case
|
|
1148
|
-
|
|
1169
|
+
case 33:
|
|
1170
|
+
_e.sent();
|
|
1149
1171
|
return [4, changeApprovalProcess(ctx, record, {
|
|
1150
1172
|
nextStep: nextStep,
|
|
1151
1173
|
nextApprovers: nextApprovers,
|
|
1152
1174
|
description: ""
|
|
1153
1175
|
})];
|
|
1154
|
-
case
|
|
1155
|
-
|
|
1156
|
-
if (!(nextStep === consts_1.Step.ai_review)) return [3,
|
|
1157
|
-
if (!(record.current_step === consts_1.Step.submitter_revisions)) return [3,
|
|
1176
|
+
case 34:
|
|
1177
|
+
_e.sent();
|
|
1178
|
+
if (!(nextStep === consts_1.Step.ai_review)) return [3, 38];
|
|
1179
|
+
if (!(record.current_step === consts_1.Step.submitter_revisions)) return [3, 37];
|
|
1158
1180
|
return [4, (0, pls_1.invalidateApprovalAIReviews)(ctx, recordId)];
|
|
1159
|
-
case
|
|
1160
|
-
invalidated =
|
|
1181
|
+
case 35:
|
|
1182
|
+
invalidated = _e.sent();
|
|
1161
1183
|
console.log("[advanceApproval] \u4FEE\u6539\u540E\u91CD\u65B0AI\u5BA1\u6838, \u5931\u6548\u5386\u53F2AI\u610F\u89C1 ".concat(invalidated, " \u6761: ").concat(recordId));
|
|
1162
1184
|
return [4, (0, pls_1.writeSystemLog)(ctx, 'info', {
|
|
1163
1185
|
action: 'invalidate-ai-review',
|
|
@@ -1168,231 +1190,231 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1168
1190
|
to_step: nextStep,
|
|
1169
1191
|
count: invalidated
|
|
1170
1192
|
}, 'AI意见失效')];
|
|
1171
|
-
case
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
case
|
|
1193
|
+
case 36:
|
|
1194
|
+
_e.sent();
|
|
1195
|
+
_e.label = 37;
|
|
1196
|
+
case 37:
|
|
1175
1197
|
(0, AI_1.callAIReview)(ctx, recordId).catch(function () { });
|
|
1176
|
-
|
|
1177
|
-
case
|
|
1178
|
-
|
|
1198
|
+
_e.label = 38;
|
|
1199
|
+
case 38:
|
|
1200
|
+
_e.trys.push([38, 80, 81, 82]);
|
|
1179
1201
|
nextApprovers_3 = tslib_1.__values(nextApprovers), nextApprovers_3_1 = nextApprovers_3.next();
|
|
1180
|
-
|
|
1181
|
-
case
|
|
1182
|
-
if (!!nextApprovers_3_1.done) return [3,
|
|
1202
|
+
_e.label = 39;
|
|
1203
|
+
case 39:
|
|
1204
|
+
if (!!nextApprovers_3_1.done) return [3, 79];
|
|
1183
1205
|
nextApprover = nextApprovers_3_1.value;
|
|
1184
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.CA)) return [3,
|
|
1206
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.CA)) return [3, 42];
|
|
1185
1207
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1186
1208
|
ca_approval_status: ''
|
|
1187
1209
|
})];
|
|
1188
|
-
case
|
|
1189
|
-
|
|
1210
|
+
case 40:
|
|
1211
|
+
_e.sent();
|
|
1190
1212
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['ca_approval_status', '=', false]], {
|
|
1191
1213
|
ca_approval_status: ''
|
|
1192
1214
|
})];
|
|
1193
|
-
case
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
case
|
|
1197
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.QC)) return [3,
|
|
1215
|
+
case 41:
|
|
1216
|
+
_e.sent();
|
|
1217
|
+
_e.label = 42;
|
|
1218
|
+
case 42:
|
|
1219
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.QC)) return [3, 45];
|
|
1198
1220
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1199
1221
|
qc_approval_status: ''
|
|
1200
1222
|
})];
|
|
1201
|
-
case
|
|
1202
|
-
|
|
1223
|
+
case 43:
|
|
1224
|
+
_e.sent();
|
|
1203
1225
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['qc_approval_status', '=', false]], {
|
|
1204
1226
|
qc_approval_status: ''
|
|
1205
1227
|
})];
|
|
1206
|
-
case
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
case
|
|
1210
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.Legal)) return [3,
|
|
1228
|
+
case 44:
|
|
1229
|
+
_e.sent();
|
|
1230
|
+
_e.label = 45;
|
|
1231
|
+
case 45:
|
|
1232
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Legal)) return [3, 48];
|
|
1211
1233
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1212
1234
|
legal_approval_status: ''
|
|
1213
1235
|
})];
|
|
1214
|
-
case
|
|
1215
|
-
|
|
1236
|
+
case 46:
|
|
1237
|
+
_e.sent();
|
|
1216
1238
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['legal_approval_status', '=', false]], {
|
|
1217
1239
|
legal_approval_status: ''
|
|
1218
1240
|
})];
|
|
1219
|
-
case
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
case
|
|
1223
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.NS)) return [3,
|
|
1241
|
+
case 47:
|
|
1242
|
+
_e.sent();
|
|
1243
|
+
_e.label = 48;
|
|
1244
|
+
case 48:
|
|
1245
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.NS)) return [3, 51];
|
|
1224
1246
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1225
1247
|
ns_approval_status: ''
|
|
1226
1248
|
})];
|
|
1227
|
-
case
|
|
1228
|
-
|
|
1249
|
+
case 49:
|
|
1250
|
+
_e.sent();
|
|
1229
1251
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['ns_approval_status', '=', false]], {
|
|
1230
1252
|
ns_approval_status: ''
|
|
1231
1253
|
})];
|
|
1232
|
-
case
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
case
|
|
1236
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.SRA)) return [3,
|
|
1254
|
+
case 50:
|
|
1255
|
+
_e.sent();
|
|
1256
|
+
_e.label = 51;
|
|
1257
|
+
case 51:
|
|
1258
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.SRA)) return [3, 54];
|
|
1237
1259
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1238
1260
|
sra_approval_status: ''
|
|
1239
1261
|
})];
|
|
1240
|
-
case
|
|
1241
|
-
|
|
1262
|
+
case 52:
|
|
1263
|
+
_e.sent();
|
|
1242
1264
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['sra_approval_status', '=', false]], {
|
|
1243
1265
|
sra_approval_status: ''
|
|
1244
1266
|
})];
|
|
1245
|
-
case
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
case
|
|
1249
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.guding)) return [3,
|
|
1267
|
+
case 53:
|
|
1268
|
+
_e.sent();
|
|
1269
|
+
_e.label = 54;
|
|
1270
|
+
case 54:
|
|
1271
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.guding)) return [3, 57];
|
|
1250
1272
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1251
1273
|
approval_status: ''
|
|
1252
1274
|
})];
|
|
1253
|
-
case
|
|
1254
|
-
|
|
1275
|
+
case 55:
|
|
1276
|
+
_e.sent();
|
|
1255
1277
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['approval_status', '=', false]], {
|
|
1256
1278
|
approval_status: ''
|
|
1257
1279
|
})];
|
|
1258
|
-
case
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
case
|
|
1262
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.Kids)) return [3,
|
|
1280
|
+
case 56:
|
|
1281
|
+
_e.sent();
|
|
1282
|
+
_e.label = 57;
|
|
1283
|
+
case 57:
|
|
1284
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Kids)) return [3, 60];
|
|
1263
1285
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1264
1286
|
kids_approval_status: ''
|
|
1265
1287
|
})];
|
|
1266
|
-
case
|
|
1267
|
-
|
|
1288
|
+
case 58:
|
|
1289
|
+
_e.sent();
|
|
1268
1290
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['kids_approval_status', '=', false]], {
|
|
1269
1291
|
kids_approval_status: ''
|
|
1270
1292
|
})];
|
|
1271
|
-
case
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
case
|
|
1275
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreNS)) return [3,
|
|
1293
|
+
case 59:
|
|
1294
|
+
_e.sent();
|
|
1295
|
+
_e.label = 60;
|
|
1296
|
+
case 60:
|
|
1297
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreNS)) return [3, 63];
|
|
1276
1298
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1277
1299
|
pre_ns_approval_status: ''
|
|
1278
1300
|
})];
|
|
1279
|
-
case
|
|
1280
|
-
|
|
1301
|
+
case 61:
|
|
1302
|
+
_e.sent();
|
|
1281
1303
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_ns_approval_status', '=', false]], {
|
|
1282
1304
|
pre_ns_approval_status: ''
|
|
1283
1305
|
})];
|
|
1284
|
-
case
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
case
|
|
1288
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreLegal)) return [3,
|
|
1306
|
+
case 62:
|
|
1307
|
+
_e.sent();
|
|
1308
|
+
_e.label = 63;
|
|
1309
|
+
case 63:
|
|
1310
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreLegal)) return [3, 66];
|
|
1289
1311
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1290
1312
|
pre_legal_approval_status: ''
|
|
1291
1313
|
})];
|
|
1292
|
-
case
|
|
1293
|
-
|
|
1314
|
+
case 64:
|
|
1315
|
+
_e.sent();
|
|
1294
1316
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_legal_approval_status', '=', false]], {
|
|
1295
1317
|
pre_legal_approval_status: ''
|
|
1296
1318
|
})];
|
|
1297
|
-
case
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
case
|
|
1301
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreSRA)) return [3,
|
|
1319
|
+
case 65:
|
|
1320
|
+
_e.sent();
|
|
1321
|
+
_e.label = 66;
|
|
1322
|
+
case 66:
|
|
1323
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreSRA)) return [3, 69];
|
|
1302
1324
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1303
1325
|
pre_sra_approval_status: ''
|
|
1304
1326
|
})];
|
|
1305
|
-
case
|
|
1306
|
-
|
|
1327
|
+
case 67:
|
|
1328
|
+
_e.sent();
|
|
1307
1329
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_sra_approval_status', '=', false]], {
|
|
1308
1330
|
pre_sra_approval_status: ''
|
|
1309
1331
|
})];
|
|
1310
|
-
case
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
case
|
|
1314
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreCA)) return [3,
|
|
1332
|
+
case 68:
|
|
1333
|
+
_e.sent();
|
|
1334
|
+
_e.label = 69;
|
|
1335
|
+
case 69:
|
|
1336
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreCA)) return [3, 72];
|
|
1315
1337
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1316
1338
|
pre_ca_approval_status: ''
|
|
1317
1339
|
})];
|
|
1318
|
-
case
|
|
1319
|
-
|
|
1340
|
+
case 70:
|
|
1341
|
+
_e.sent();
|
|
1320
1342
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_ca_approval_status', '=', false]], {
|
|
1321
1343
|
pre_ca_approval_status: ''
|
|
1322
1344
|
})];
|
|
1323
|
-
case
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
case
|
|
1327
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreQC)) return [3,
|
|
1345
|
+
case 71:
|
|
1346
|
+
_e.sent();
|
|
1347
|
+
_e.label = 72;
|
|
1348
|
+
case 72:
|
|
1349
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreQC)) return [3, 75];
|
|
1328
1350
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1329
1351
|
pre_qc_approval_status: ''
|
|
1330
1352
|
})];
|
|
1331
|
-
case
|
|
1332
|
-
|
|
1353
|
+
case 73:
|
|
1354
|
+
_e.sent();
|
|
1333
1355
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_qc_approval_status', '=', false]], {
|
|
1334
1356
|
pre_qc_approval_status: ''
|
|
1335
1357
|
})];
|
|
1336
|
-
case
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
case
|
|
1340
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.Preguding)) return [3,
|
|
1358
|
+
case 74:
|
|
1359
|
+
_e.sent();
|
|
1360
|
+
_e.label = 75;
|
|
1361
|
+
case 75:
|
|
1362
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Preguding)) return [3, 78];
|
|
1341
1363
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1342
1364
|
pre_approval_status: ''
|
|
1343
1365
|
})];
|
|
1344
|
-
case
|
|
1345
|
-
|
|
1366
|
+
case 76:
|
|
1367
|
+
_e.sent();
|
|
1346
1368
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_approval_status', '=', false]], {
|
|
1347
1369
|
pre_approval_status: ''
|
|
1348
1370
|
})];
|
|
1349
|
-
case 74:
|
|
1350
|
-
_f.sent();
|
|
1351
|
-
_f.label = 75;
|
|
1352
|
-
case 75:
|
|
1353
|
-
nextApprovers_3_1 = nextApprovers_3.next();
|
|
1354
|
-
return [3, 36];
|
|
1355
|
-
case 76: return [3, 79];
|
|
1356
1371
|
case 77:
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
return [3, 79];
|
|
1372
|
+
_e.sent();
|
|
1373
|
+
_e.label = 78;
|
|
1360
1374
|
case 78:
|
|
1375
|
+
nextApprovers_3_1 = nextApprovers_3.next();
|
|
1376
|
+
return [3, 39];
|
|
1377
|
+
case 79: return [3, 82];
|
|
1378
|
+
case 80:
|
|
1379
|
+
e_8_1 = _e.sent();
|
|
1380
|
+
e_8 = { error: e_8_1 };
|
|
1381
|
+
return [3, 82];
|
|
1382
|
+
case 81:
|
|
1361
1383
|
try {
|
|
1362
|
-
if (nextApprovers_3_1 && !nextApprovers_3_1.done && (
|
|
1384
|
+
if (nextApprovers_3_1 && !nextApprovers_3_1.done && (_c = nextApprovers_3.return)) _c.call(nextApprovers_3);
|
|
1363
1385
|
}
|
|
1364
1386
|
finally { if (e_8) throw e_8.error; }
|
|
1365
1387
|
return [7];
|
|
1366
|
-
case
|
|
1367
|
-
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3,
|
|
1388
|
+
case 82:
|
|
1389
|
+
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3, 84];
|
|
1368
1390
|
return [4, setPersonView(ctx, record)];
|
|
1369
|
-
case
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
case
|
|
1373
|
-
if (!(record.current_step === consts_1.Step.departmental_review || record.current_step === consts_1.Step.personnel_review)) return [3,
|
|
1391
|
+
case 83:
|
|
1392
|
+
_e.sent();
|
|
1393
|
+
_e.label = 84;
|
|
1394
|
+
case 84:
|
|
1395
|
+
if (!(record.current_step === consts_1.Step.departmental_review || record.current_step === consts_1.Step.personnel_review)) return [3, 86];
|
|
1374
1396
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1375
1397
|
materials_remove_share_link_from_onedrive_status: 'pending'
|
|
1376
1398
|
})];
|
|
1377
|
-
case 82:
|
|
1378
|
-
_f.sent();
|
|
1379
|
-
_f.label = 83;
|
|
1380
|
-
case 83:
|
|
1381
|
-
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 85];
|
|
1382
|
-
return [4, pendingDeployment(ctx, recordId)];
|
|
1383
|
-
case 84:
|
|
1384
|
-
_f.sent();
|
|
1385
|
-
_f.label = 85;
|
|
1386
1399
|
case 85:
|
|
1387
|
-
|
|
1400
|
+
_e.sent();
|
|
1401
|
+
_e.label = 86;
|
|
1402
|
+
case 86:
|
|
1403
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 88];
|
|
1404
|
+
return [4, pendingDeployment(ctx, recordId)];
|
|
1405
|
+
case 87:
|
|
1406
|
+
_e.sent();
|
|
1407
|
+
_e.label = 88;
|
|
1408
|
+
case 88:
|
|
1409
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment || (nextStep === consts_1.Step.conclusion && record.current_step === consts_1.Step.ai_review))) return [3, 90];
|
|
1388
1410
|
setDoc_1 = {
|
|
1389
1411
|
materials_download_from_onedrive_status: 'pending'
|
|
1390
1412
|
};
|
|
1391
1413
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, setDoc_1)];
|
|
1392
|
-
case
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
case
|
|
1414
|
+
case 89:
|
|
1415
|
+
_e.sent();
|
|
1416
|
+
_e.label = 90;
|
|
1417
|
+
case 90:
|
|
1396
1418
|
if (currentStepApprovalStatus === consts_1.ApprovalStatus.rejected) {
|
|
1397
1419
|
actionLabel = '内容审批被驳回';
|
|
1398
1420
|
}
|
|
@@ -1404,7 +1426,7 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1404
1426
|
actionLabel = "\u5185\u5BB9\u5BA1\u6279\u5DF2\u901A\u8FC7\u5F85\u4E0A\u7EBF";
|
|
1405
1427
|
}
|
|
1406
1428
|
postponedUserIds_1 = [];
|
|
1407
|
-
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3,
|
|
1429
|
+
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3, 102];
|
|
1408
1430
|
now = new Date();
|
|
1409
1431
|
visibleAfter = new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000);
|
|
1410
1432
|
return [4, ctx.getObject('pepsico_review_postpone').directFind({
|
|
@@ -1413,25 +1435,25 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1413
1435
|
['is_marker', '=', true]
|
|
1414
1436
|
]
|
|
1415
1437
|
})];
|
|
1416
|
-
case
|
|
1417
|
-
pastPostponeRecords =
|
|
1418
|
-
if (!(pastPostponeRecords && pastPostponeRecords.length > 0)) return [3,
|
|
1438
|
+
case 91:
|
|
1439
|
+
pastPostponeRecords = _e.sent();
|
|
1440
|
+
if (!(pastPostponeRecords && pastPostponeRecords.length > 0)) return [3, 102];
|
|
1419
1441
|
postponedDepts = new Set(pastPostponeRecords.map(function (r) { return r.department_type; }));
|
|
1420
1442
|
_loop_1 = function (reviewer) {
|
|
1421
1443
|
var deptUserIds, deptMarkers, deptMarkers_1, deptMarkers_1_1, marker, e_10_1;
|
|
1422
|
-
var e_10,
|
|
1423
|
-
return tslib_1.__generator(this, function (
|
|
1424
|
-
switch (
|
|
1444
|
+
var e_10, _f;
|
|
1445
|
+
return tslib_1.__generator(this, function (_g) {
|
|
1446
|
+
switch (_g.label) {
|
|
1425
1447
|
case 0:
|
|
1426
1448
|
if (!postponedDepts.has(reviewer.type))
|
|
1427
1449
|
return [2, "continue"];
|
|
1428
1450
|
deptUserIds = reviewer.userIds || [];
|
|
1429
1451
|
deptMarkers = pastPostponeRecords.filter(function (r) { return r.department_type === reviewer.type; });
|
|
1430
|
-
|
|
1452
|
+
_g.label = 1;
|
|
1431
1453
|
case 1:
|
|
1432
|
-
|
|
1454
|
+
_g.trys.push([1, 6, 7, 8]);
|
|
1433
1455
|
deptMarkers_1 = (e_10 = void 0, tslib_1.__values(deptMarkers)), deptMarkers_1_1 = deptMarkers_1.next();
|
|
1434
|
-
|
|
1456
|
+
_g.label = 2;
|
|
1435
1457
|
case 2:
|
|
1436
1458
|
if (!!deptMarkers_1_1.done) return [3, 5];
|
|
1437
1459
|
marker = deptMarkers_1_1.value;
|
|
@@ -1444,19 +1466,19 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1444
1466
|
modified_by: user.userId
|
|
1445
1467
|
})];
|
|
1446
1468
|
case 3:
|
|
1447
|
-
|
|
1448
|
-
|
|
1469
|
+
_g.sent();
|
|
1470
|
+
_g.label = 4;
|
|
1449
1471
|
case 4:
|
|
1450
1472
|
deptMarkers_1_1 = deptMarkers_1.next();
|
|
1451
1473
|
return [3, 2];
|
|
1452
1474
|
case 5: return [3, 8];
|
|
1453
1475
|
case 6:
|
|
1454
|
-
e_10_1 =
|
|
1476
|
+
e_10_1 = _g.sent();
|
|
1455
1477
|
e_10 = { error: e_10_1 };
|
|
1456
1478
|
return [3, 8];
|
|
1457
1479
|
case 7:
|
|
1458
1480
|
try {
|
|
1459
|
-
if (deptMarkers_1_1 && !deptMarkers_1_1.done && (
|
|
1481
|
+
if (deptMarkers_1_1 && !deptMarkers_1_1.done && (_f = deptMarkers_1.return)) _f.call(deptMarkers_1);
|
|
1460
1482
|
}
|
|
1461
1483
|
finally { if (e_10) throw e_10.error; }
|
|
1462
1484
|
return [7];
|
|
@@ -1466,37 +1488,37 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1466
1488
|
}
|
|
1467
1489
|
});
|
|
1468
1490
|
};
|
|
1469
|
-
|
|
1470
|
-
case
|
|
1471
|
-
|
|
1491
|
+
_e.label = 92;
|
|
1492
|
+
case 92:
|
|
1493
|
+
_e.trys.push([92, 97, 98, 99]);
|
|
1472
1494
|
nextApprovers_4 = tslib_1.__values(nextApprovers), nextApprovers_4_1 = nextApprovers_4.next();
|
|
1473
|
-
|
|
1474
|
-
case
|
|
1475
|
-
if (!!nextApprovers_4_1.done) return [3,
|
|
1495
|
+
_e.label = 93;
|
|
1496
|
+
case 93:
|
|
1497
|
+
if (!!nextApprovers_4_1.done) return [3, 96];
|
|
1476
1498
|
reviewer = nextApprovers_4_1.value;
|
|
1477
1499
|
return [5, _loop_1(reviewer)];
|
|
1478
|
-
case 91:
|
|
1479
|
-
_f.sent();
|
|
1480
|
-
_f.label = 92;
|
|
1481
|
-
case 92:
|
|
1482
|
-
nextApprovers_4_1 = nextApprovers_4.next();
|
|
1483
|
-
return [3, 90];
|
|
1484
|
-
case 93: return [3, 96];
|
|
1485
1500
|
case 94:
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
return [3, 96];
|
|
1501
|
+
_e.sent();
|
|
1502
|
+
_e.label = 95;
|
|
1489
1503
|
case 95:
|
|
1504
|
+
nextApprovers_4_1 = nextApprovers_4.next();
|
|
1505
|
+
return [3, 93];
|
|
1506
|
+
case 96: return [3, 99];
|
|
1507
|
+
case 97:
|
|
1508
|
+
e_9_1 = _e.sent();
|
|
1509
|
+
e_9 = { error: e_9_1 };
|
|
1510
|
+
return [3, 99];
|
|
1511
|
+
case 98:
|
|
1490
1512
|
try {
|
|
1491
|
-
if (nextApprovers_4_1 && !nextApprovers_4_1.done && (
|
|
1513
|
+
if (nextApprovers_4_1 && !nextApprovers_4_1.done && (_d = nextApprovers_4.return)) _d.call(nextApprovers_4);
|
|
1492
1514
|
}
|
|
1493
1515
|
finally { if (e_9) throw e_9.error; }
|
|
1494
1516
|
return [7];
|
|
1495
|
-
case
|
|
1496
|
-
if (!(postponedUserIds_1.length > 0)) return [3,
|
|
1517
|
+
case 99:
|
|
1518
|
+
if (!(postponedUserIds_1.length > 0)) return [3, 102];
|
|
1497
1519
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1498
|
-
case
|
|
1499
|
-
currentRecord =
|
|
1520
|
+
case 100:
|
|
1521
|
+
currentRecord = _e.sent();
|
|
1500
1522
|
currentPostponed = currentRecord.review_postponed_users || [];
|
|
1501
1523
|
newPostponed = (0, lodash_1.compact)((0, lodash_1.uniq)((0, lodash_1.concat)(currentPostponed, postponedUserIds_1)));
|
|
1502
1524
|
currentMarkerUsers = currentRecord.postpone_marker_users || [];
|
|
@@ -1505,44 +1527,44 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1505
1527
|
review_postponed_users: newPostponed,
|
|
1506
1528
|
postpone_marker_users: newMarkerUsers
|
|
1507
1529
|
})];
|
|
1508
|
-
case
|
|
1509
|
-
|
|
1530
|
+
case 101:
|
|
1531
|
+
_e.sent();
|
|
1510
1532
|
console.log("[advanceApproval] \u81EA\u52A8\u5EF6\u540E\u5BA1\u6838\u4EBA: ".concat(postponedUserIds_1, ", visibleAfter: ").concat(visibleAfter));
|
|
1511
|
-
|
|
1512
|
-
case
|
|
1533
|
+
_e.label = 102;
|
|
1534
|
+
case 102:
|
|
1513
1535
|
notifyUserIds = postponedUserIds_1.length > 0
|
|
1514
1536
|
? nextApproversUserIds_1.filter(function (id) { return !postponedUserIds_1.includes(id); })
|
|
1515
1537
|
: nextApproversUserIds_1;
|
|
1516
1538
|
return [4, (0, notification_1.sendNotifications)(ctx, record, notifyUserIds, actionLabel)];
|
|
1517
|
-
case
|
|
1518
|
-
|
|
1519
|
-
if (!(actionLabel === '内容审批被驳回' || actionLabel === '内容审批已通过待上线')) return [3,
|
|
1539
|
+
case 103:
|
|
1540
|
+
_e.sent();
|
|
1541
|
+
if (!(actionLabel === '内容审批被驳回' || actionLabel === '内容审批已通过待上线')) return [3, 105];
|
|
1520
1542
|
return [4, (0, approval_cc_1.notifyApprovalCcUsers)(ctx, record, actionLabel, notification_1.sendCcNotifications, notifyUserIds)];
|
|
1521
|
-
case
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
case
|
|
1525
|
-
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3,
|
|
1543
|
+
case 104:
|
|
1544
|
+
_e.sent();
|
|
1545
|
+
_e.label = 105;
|
|
1546
|
+
case 105:
|
|
1547
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 107];
|
|
1526
1548
|
initiator = record.owner;
|
|
1527
1549
|
materialOwner = record.material_owner_id;
|
|
1528
|
-
if (!(initiator && materialOwner && initiator !== materialOwner)) return [3,
|
|
1550
|
+
if (!(initiator && materialOwner && initiator !== materialOwner)) return [3, 107];
|
|
1529
1551
|
console.log("[advanceApproval] \u901A\u77E5\u53D1\u8D77\u4EBA\u5BA1\u6838\u5B8C\u6210: initiator=".concat(initiator, ", material_owner=").concat(materialOwner));
|
|
1530
1552
|
return [4, (0, notification_1.sendNotifications)(ctx, record, [initiator], '审核完成')];
|
|
1531
|
-
case
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
case 104:
|
|
1535
|
-
if (!(nextStep === consts_1.Step.conclusion)) return [3, 106];
|
|
1536
|
-
return [4, (0, approval_cc_1.notifyApprovalCcUsers)(ctx, record, '内容审批已完成', notification_1.sendCcNotifications, notifyUserIds)];
|
|
1537
|
-
case 105:
|
|
1538
|
-
_f.sent();
|
|
1539
|
-
_f.label = 106;
|
|
1540
|
-
case 106: return [2, {}];
|
|
1553
|
+
case 106:
|
|
1554
|
+
_e.sent();
|
|
1555
|
+
_e.label = 107;
|
|
1541
1556
|
case 107:
|
|
1542
|
-
|
|
1557
|
+
if (!(nextStep === consts_1.Step.conclusion)) return [3, 109];
|
|
1558
|
+
return [4, (0, approval_cc_1.notifyApprovalCcUsers)(ctx, record, '内容审批已完成', notification_1.sendCcNotifications, notifyUserIds)];
|
|
1559
|
+
case 108:
|
|
1560
|
+
_e.sent();
|
|
1561
|
+
_e.label = 109;
|
|
1562
|
+
case 109: return [2, {}];
|
|
1563
|
+
case 110:
|
|
1564
|
+
error_1 = _e.sent();
|
|
1543
1565
|
console.error('[advanceApproval] Error:', error_1.message, error_1.stack);
|
|
1544
1566
|
throw error_1;
|
|
1545
|
-
case
|
|
1567
|
+
case 111: return [2];
|
|
1546
1568
|
}
|
|
1547
1569
|
});
|
|
1548
1570
|
}); };
|
|
@@ -1726,26 +1748,37 @@ var approvalContent = function (ctx, recordId, _a) {
|
|
|
1726
1748
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1727
1749
|
case 1:
|
|
1728
1750
|
approvalOld = _c.sent();
|
|
1729
|
-
if (approvalOld.current_step != consts_1.Step.draft && !(0, lodash_1.includes)(approvalOld.person_pending_approve, user.userId))
|
|
1730
|
-
|
|
1731
|
-
|
|
1751
|
+
if (!(approvalOld.current_step != consts_1.Step.draft && !(0, lodash_1.includes)(approvalOld.person_pending_approve, user.userId))) return [3, 3];
|
|
1752
|
+
return [4, (0, pls_1.writeSystemLog)(ctx, 'warn', {
|
|
1753
|
+
action: 'approve-denied-not-pending',
|
|
1754
|
+
id: recordId,
|
|
1755
|
+
approval_name: approvalOld.name,
|
|
1756
|
+
operator: user && user.userId,
|
|
1757
|
+
approve_field: approveField,
|
|
1758
|
+
current_step: approvalOld.current_step,
|
|
1759
|
+
person_pending_approve: approvalOld.person_pending_approve
|
|
1760
|
+
}, '核准被拒绝: 用户不在待办名单')];
|
|
1761
|
+
case 2:
|
|
1762
|
+
_c.sent();
|
|
1763
|
+
return [2, {}];
|
|
1764
|
+
case 3:
|
|
1732
1765
|
fieldStatus = materialStatus === consts_1.ApprovalStatus.pass ? consts_1.ApprovalStatus.pass : true;
|
|
1733
1766
|
return [4, updateApproveFieldStatus(ctx, recordId, approveField, fieldStatus)];
|
|
1734
|
-
case
|
|
1767
|
+
case 4:
|
|
1735
1768
|
_c.sent();
|
|
1736
1769
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1737
|
-
case
|
|
1770
|
+
case 5:
|
|
1738
1771
|
approvalNew = _c.sent();
|
|
1739
1772
|
currentStepApprovalStatus = fieldStatus === true ? consts_1.ApprovalStatus.approved : fieldStatus;
|
|
1740
1773
|
return [4, updateUserStepStatus(ctx, approvalNew, { approvalStatus: currentStepApprovalStatus, approveField: approveField })];
|
|
1741
|
-
case
|
|
1774
|
+
case 6:
|
|
1742
1775
|
_c.sent();
|
|
1743
|
-
if (!(PRE_TO_FORMAL_MAPPING[approveField] && (fieldStatus === true || fieldStatus === consts_1.ApprovalStatus.pass))) return [3,
|
|
1744
|
-
return [4, addFormalReviewerAfterPreApproval(ctx, recordId, approveField, approvalNew)];
|
|
1745
|
-
case
|
|
1776
|
+
if (!(PRE_TO_FORMAL_MAPPING[approveField] && (fieldStatus === true || fieldStatus === consts_1.ApprovalStatus.pass))) return [3, 8];
|
|
1777
|
+
return [4, (0, exports.addFormalReviewerAfterPreApproval)(ctx, recordId, approveField, approvalNew)];
|
|
1778
|
+
case 7:
|
|
1746
1779
|
_c.sent();
|
|
1747
|
-
_c.label =
|
|
1748
|
-
case
|
|
1780
|
+
_c.label = 8;
|
|
1781
|
+
case 8:
|
|
1749
1782
|
isPositive = function (status) { return status === true || status === consts_1.ApprovalStatus.approved || status === consts_1.ApprovalStatus.pass; };
|
|
1750
1783
|
isPass = function (status) { return status === consts_1.ApprovalStatus.pass; };
|
|
1751
1784
|
if (approvalNew.current_step === consts_1.Step.departmental_review) {
|
|
@@ -1790,7 +1823,7 @@ var approvalContent = function (ctx, recordId, _a) {
|
|
|
1790
1823
|
}
|
|
1791
1824
|
console.log("[approvalContent] \u63A8\u8FDB\u5BA1\u6279\u8FDB\u5EA6,\u53C2\u6570\u4E3A \u5BA1\u6279\u5355: ".concat(recordId, " \u5F53\u524D\u6B65\u9AA4: ").concat(approvalNew.current_step, " \u5BA1\u6279\u7ED3\u679C\u4E3A: ").concat(currentStepApprovalStatus));
|
|
1792
1825
|
return [4, (0, exports.advanceApproval)(ctx, recordId, currentStepApprovalStatus)];
|
|
1793
|
-
case
|
|
1826
|
+
case 9:
|
|
1794
1827
|
_c.sent();
|
|
1795
1828
|
return [2, {}];
|
|
1796
1829
|
}
|
|
@@ -1809,18 +1842,28 @@ var rejectContent = function (ctx, recordId, _a) {
|
|
|
1809
1842
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1810
1843
|
case 1:
|
|
1811
1844
|
approvalOld = _b.sent();
|
|
1812
|
-
if (approvalOld.current_step != consts_1.Step.draft && !(0, lodash_1.includes)(approvalOld.person_pending_approve, user.userId))
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1845
|
+
if (!(approvalOld.current_step != consts_1.Step.draft && !(0, lodash_1.includes)(approvalOld.person_pending_approve, user.userId))) return [3, 3];
|
|
1846
|
+
return [4, (0, pls_1.writeSystemLog)(ctx, 'warn', {
|
|
1847
|
+
action: 'reject-denied-not-pending',
|
|
1848
|
+
id: recordId,
|
|
1849
|
+
approval_name: approvalOld.name,
|
|
1850
|
+
operator: user && user.userId,
|
|
1851
|
+
approve_field: approveField,
|
|
1852
|
+
current_step: approvalOld.current_step,
|
|
1853
|
+
person_pending_approve: approvalOld.person_pending_approve
|
|
1854
|
+
}, '驳回被拒绝: 用户不在待办名单')];
|
|
1816
1855
|
case 2:
|
|
1856
|
+
_b.sent();
|
|
1857
|
+
return [2, {}];
|
|
1858
|
+
case 3: return [4, updateApproveFieldStatus(ctx, recordId, approveField, false)];
|
|
1859
|
+
case 4:
|
|
1817
1860
|
_b.sent();
|
|
1818
1861
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1819
|
-
case
|
|
1862
|
+
case 5:
|
|
1820
1863
|
approvalNew = _b.sent();
|
|
1821
1864
|
currentStepApprovalStatus = consts_1.ApprovalStatus.rejected;
|
|
1822
1865
|
return [4, updateUserStepStatus(ctx, approvalNew, { approvalStatus: consts_1.ApprovalStatus.rejected, approveField: approveField })];
|
|
1823
|
-
case
|
|
1866
|
+
case 6:
|
|
1824
1867
|
_b.sent();
|
|
1825
1868
|
isPositive = function (status) { return status === true || status === consts_1.ApprovalStatus.approved || status === consts_1.ApprovalStatus.pass; };
|
|
1826
1869
|
if (approvalNew.current_step === consts_1.Step.departmental_review) {
|
|
@@ -1846,7 +1889,7 @@ var rejectContent = function (ctx, recordId, _a) {
|
|
|
1846
1889
|
}
|
|
1847
1890
|
console.log("[rejectContent] \u63A8\u8FDB\u5BA1\u6279\u8FDB\u5EA6,\u53C2\u6570\u4E3A \u5BA1\u6279\u5355: ".concat(recordId, " \u5F53\u524D\u6B65\u9AA4: ").concat(approvalNew.current_step, " \u5BA1\u6279\u7ED3\u679C\u4E3A: ").concat(currentStepApprovalStatus));
|
|
1848
1891
|
return [4, (0, exports.advanceApproval)(ctx, recordId, currentStepApprovalStatus)];
|
|
1849
|
-
case
|
|
1892
|
+
case 7:
|
|
1850
1893
|
_b.sent();
|
|
1851
1894
|
return [2, {}];
|
|
1852
1895
|
}
|