@steedos-labs/content-compliance 0.8.17 → 0.8.19
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__/plsReview.test.js +78 -4
- package/lib/methods/__tests__/plsReview.test.js.map +1 -1
- package/lib/methods/approval_engine.js +144 -133
- package/lib/methods/approval_engine.js.map +1 -1
- package/lib/methods/pls.js +48 -13
- package/lib/methods/pls.js.map +1 -1
- package/lib/pages/__tests__/plsReviewPage.test.js +1 -0
- package/lib/pages/__tests__/plsReviewPage.test.js.map +1 -1
- package/main/default/pages/pepsico_material_detail.page.amis.json +4 -2
- package/main/default/pages/pepsico_material_detail_mobile.page.amis.json +2 -1
- package/package.json +1 -1
|
@@ -979,7 +979,7 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
979
979
|
return tslib_1.__generator(this, function (_f) {
|
|
980
980
|
switch (_f.label) {
|
|
981
981
|
case 0:
|
|
982
|
-
_f.trys.push([0,
|
|
982
|
+
_f.trys.push([0, 107, , 108]);
|
|
983
983
|
actionLabel = '请查看';
|
|
984
984
|
user = ctx.meta.user;
|
|
985
985
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
@@ -1153,235 +1153,246 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1153
1153
|
})];
|
|
1154
1154
|
case 31:
|
|
1155
1155
|
_f.sent();
|
|
1156
|
-
if (!(nextStep === consts_1.Step.ai_review)) return [3,
|
|
1157
|
-
if (!(record.current_step === consts_1.Step.submitter_revisions)) return [3,
|
|
1156
|
+
if (!(nextStep === consts_1.Step.ai_review)) return [3, 35];
|
|
1157
|
+
if (!(record.current_step === consts_1.Step.submitter_revisions)) return [3, 34];
|
|
1158
1158
|
return [4, (0, pls_1.invalidateApprovalAIReviews)(ctx, recordId)];
|
|
1159
1159
|
case 32:
|
|
1160
1160
|
invalidated = _f.sent();
|
|
1161
1161
|
console.log("[advanceApproval] \u4FEE\u6539\u540E\u91CD\u65B0AI\u5BA1\u6838, \u5931\u6548\u5386\u53F2AI\u610F\u89C1 ".concat(invalidated, " \u6761: ").concat(recordId));
|
|
1162
|
-
|
|
1162
|
+
return [4, (0, pls_1.writeSystemLog)(ctx, 'info', {
|
|
1163
|
+
action: 'invalidate-ai-review',
|
|
1164
|
+
id: recordId,
|
|
1165
|
+
approval_name: record.name,
|
|
1166
|
+
operator: user && user.userId,
|
|
1167
|
+
from_step: record.current_step,
|
|
1168
|
+
to_step: nextStep,
|
|
1169
|
+
count: invalidated
|
|
1170
|
+
}, 'AI意见失效')];
|
|
1163
1171
|
case 33:
|
|
1164
|
-
|
|
1172
|
+
_f.sent();
|
|
1165
1173
|
_f.label = 34;
|
|
1166
1174
|
case 34:
|
|
1167
|
-
|
|
1168
|
-
nextApprovers_3 = tslib_1.__values(nextApprovers), nextApprovers_3_1 = nextApprovers_3.next();
|
|
1175
|
+
(0, AI_1.callAIReview)(ctx, recordId).catch(function () { });
|
|
1169
1176
|
_f.label = 35;
|
|
1170
1177
|
case 35:
|
|
1171
|
-
|
|
1178
|
+
_f.trys.push([35, 77, 78, 79]);
|
|
1179
|
+
nextApprovers_3 = tslib_1.__values(nextApprovers), nextApprovers_3_1 = nextApprovers_3.next();
|
|
1180
|
+
_f.label = 36;
|
|
1181
|
+
case 36:
|
|
1182
|
+
if (!!nextApprovers_3_1.done) return [3, 76];
|
|
1172
1183
|
nextApprover = nextApprovers_3_1.value;
|
|
1173
|
-
if (!(nextApprover.type === consts_1.ProcessApprovalType.CA)) return [3,
|
|
1184
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.CA)) return [3, 39];
|
|
1174
1185
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1175
1186
|
ca_approval_status: ''
|
|
1176
1187
|
})];
|
|
1177
|
-
case
|
|
1188
|
+
case 37:
|
|
1178
1189
|
_f.sent();
|
|
1179
1190
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['ca_approval_status', '=', false]], {
|
|
1180
1191
|
ca_approval_status: ''
|
|
1181
1192
|
})];
|
|
1182
|
-
case 37:
|
|
1183
|
-
_f.sent();
|
|
1184
|
-
_f.label = 38;
|
|
1185
1193
|
case 38:
|
|
1186
|
-
|
|
1194
|
+
_f.sent();
|
|
1195
|
+
_f.label = 39;
|
|
1196
|
+
case 39:
|
|
1197
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.QC)) return [3, 42];
|
|
1187
1198
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1188
1199
|
qc_approval_status: ''
|
|
1189
1200
|
})];
|
|
1190
|
-
case
|
|
1201
|
+
case 40:
|
|
1191
1202
|
_f.sent();
|
|
1192
1203
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['qc_approval_status', '=', false]], {
|
|
1193
1204
|
qc_approval_status: ''
|
|
1194
1205
|
})];
|
|
1195
|
-
case 40:
|
|
1196
|
-
_f.sent();
|
|
1197
|
-
_f.label = 41;
|
|
1198
1206
|
case 41:
|
|
1199
|
-
|
|
1207
|
+
_f.sent();
|
|
1208
|
+
_f.label = 42;
|
|
1209
|
+
case 42:
|
|
1210
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Legal)) return [3, 45];
|
|
1200
1211
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1201
1212
|
legal_approval_status: ''
|
|
1202
1213
|
})];
|
|
1203
|
-
case
|
|
1214
|
+
case 43:
|
|
1204
1215
|
_f.sent();
|
|
1205
1216
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['legal_approval_status', '=', false]], {
|
|
1206
1217
|
legal_approval_status: ''
|
|
1207
1218
|
})];
|
|
1208
|
-
case 43:
|
|
1209
|
-
_f.sent();
|
|
1210
|
-
_f.label = 44;
|
|
1211
1219
|
case 44:
|
|
1212
|
-
|
|
1220
|
+
_f.sent();
|
|
1221
|
+
_f.label = 45;
|
|
1222
|
+
case 45:
|
|
1223
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.NS)) return [3, 48];
|
|
1213
1224
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1214
1225
|
ns_approval_status: ''
|
|
1215
1226
|
})];
|
|
1216
|
-
case
|
|
1227
|
+
case 46:
|
|
1217
1228
|
_f.sent();
|
|
1218
1229
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['ns_approval_status', '=', false]], {
|
|
1219
1230
|
ns_approval_status: ''
|
|
1220
1231
|
})];
|
|
1221
|
-
case 46:
|
|
1222
|
-
_f.sent();
|
|
1223
|
-
_f.label = 47;
|
|
1224
1232
|
case 47:
|
|
1225
|
-
|
|
1233
|
+
_f.sent();
|
|
1234
|
+
_f.label = 48;
|
|
1235
|
+
case 48:
|
|
1236
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.SRA)) return [3, 51];
|
|
1226
1237
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1227
1238
|
sra_approval_status: ''
|
|
1228
1239
|
})];
|
|
1229
|
-
case
|
|
1240
|
+
case 49:
|
|
1230
1241
|
_f.sent();
|
|
1231
1242
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['sra_approval_status', '=', false]], {
|
|
1232
1243
|
sra_approval_status: ''
|
|
1233
1244
|
})];
|
|
1234
|
-
case 49:
|
|
1235
|
-
_f.sent();
|
|
1236
|
-
_f.label = 50;
|
|
1237
1245
|
case 50:
|
|
1238
|
-
|
|
1246
|
+
_f.sent();
|
|
1247
|
+
_f.label = 51;
|
|
1248
|
+
case 51:
|
|
1249
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.guding)) return [3, 54];
|
|
1239
1250
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1240
1251
|
approval_status: ''
|
|
1241
1252
|
})];
|
|
1242
|
-
case
|
|
1253
|
+
case 52:
|
|
1243
1254
|
_f.sent();
|
|
1244
1255
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['approval_status', '=', false]], {
|
|
1245
1256
|
approval_status: ''
|
|
1246
1257
|
})];
|
|
1247
|
-
case 52:
|
|
1248
|
-
_f.sent();
|
|
1249
|
-
_f.label = 53;
|
|
1250
1258
|
case 53:
|
|
1251
|
-
|
|
1259
|
+
_f.sent();
|
|
1260
|
+
_f.label = 54;
|
|
1261
|
+
case 54:
|
|
1262
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Kids)) return [3, 57];
|
|
1252
1263
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1253
1264
|
kids_approval_status: ''
|
|
1254
1265
|
})];
|
|
1255
|
-
case
|
|
1266
|
+
case 55:
|
|
1256
1267
|
_f.sent();
|
|
1257
1268
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['kids_approval_status', '=', false]], {
|
|
1258
1269
|
kids_approval_status: ''
|
|
1259
1270
|
})];
|
|
1260
|
-
case 55:
|
|
1261
|
-
_f.sent();
|
|
1262
|
-
_f.label = 56;
|
|
1263
1271
|
case 56:
|
|
1264
|
-
|
|
1272
|
+
_f.sent();
|
|
1273
|
+
_f.label = 57;
|
|
1274
|
+
case 57:
|
|
1275
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreNS)) return [3, 60];
|
|
1265
1276
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1266
1277
|
pre_ns_approval_status: ''
|
|
1267
1278
|
})];
|
|
1268
|
-
case
|
|
1279
|
+
case 58:
|
|
1269
1280
|
_f.sent();
|
|
1270
1281
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_ns_approval_status', '=', false]], {
|
|
1271
1282
|
pre_ns_approval_status: ''
|
|
1272
1283
|
})];
|
|
1273
|
-
case 58:
|
|
1274
|
-
_f.sent();
|
|
1275
|
-
_f.label = 59;
|
|
1276
1284
|
case 59:
|
|
1277
|
-
|
|
1285
|
+
_f.sent();
|
|
1286
|
+
_f.label = 60;
|
|
1287
|
+
case 60:
|
|
1288
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreLegal)) return [3, 63];
|
|
1278
1289
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1279
1290
|
pre_legal_approval_status: ''
|
|
1280
1291
|
})];
|
|
1281
|
-
case
|
|
1292
|
+
case 61:
|
|
1282
1293
|
_f.sent();
|
|
1283
1294
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_legal_approval_status', '=', false]], {
|
|
1284
1295
|
pre_legal_approval_status: ''
|
|
1285
1296
|
})];
|
|
1286
|
-
case 61:
|
|
1287
|
-
_f.sent();
|
|
1288
|
-
_f.label = 62;
|
|
1289
1297
|
case 62:
|
|
1290
|
-
|
|
1298
|
+
_f.sent();
|
|
1299
|
+
_f.label = 63;
|
|
1300
|
+
case 63:
|
|
1301
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreSRA)) return [3, 66];
|
|
1291
1302
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1292
1303
|
pre_sra_approval_status: ''
|
|
1293
1304
|
})];
|
|
1294
|
-
case
|
|
1305
|
+
case 64:
|
|
1295
1306
|
_f.sent();
|
|
1296
1307
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_sra_approval_status', '=', false]], {
|
|
1297
1308
|
pre_sra_approval_status: ''
|
|
1298
1309
|
})];
|
|
1299
|
-
case 64:
|
|
1300
|
-
_f.sent();
|
|
1301
|
-
_f.label = 65;
|
|
1302
1310
|
case 65:
|
|
1303
|
-
|
|
1311
|
+
_f.sent();
|
|
1312
|
+
_f.label = 66;
|
|
1313
|
+
case 66:
|
|
1314
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreCA)) return [3, 69];
|
|
1304
1315
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1305
1316
|
pre_ca_approval_status: ''
|
|
1306
1317
|
})];
|
|
1307
|
-
case
|
|
1318
|
+
case 67:
|
|
1308
1319
|
_f.sent();
|
|
1309
1320
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_ca_approval_status', '=', false]], {
|
|
1310
1321
|
pre_ca_approval_status: ''
|
|
1311
1322
|
})];
|
|
1312
|
-
case 67:
|
|
1313
|
-
_f.sent();
|
|
1314
|
-
_f.label = 68;
|
|
1315
1323
|
case 68:
|
|
1316
|
-
|
|
1324
|
+
_f.sent();
|
|
1325
|
+
_f.label = 69;
|
|
1326
|
+
case 69:
|
|
1327
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.PreQC)) return [3, 72];
|
|
1317
1328
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1318
1329
|
pre_qc_approval_status: ''
|
|
1319
1330
|
})];
|
|
1320
|
-
case
|
|
1331
|
+
case 70:
|
|
1321
1332
|
_f.sent();
|
|
1322
1333
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_qc_approval_status', '=', false]], {
|
|
1323
1334
|
pre_qc_approval_status: ''
|
|
1324
1335
|
})];
|
|
1325
|
-
case 70:
|
|
1326
|
-
_f.sent();
|
|
1327
|
-
_f.label = 71;
|
|
1328
1336
|
case 71:
|
|
1329
|
-
|
|
1337
|
+
_f.sent();
|
|
1338
|
+
_f.label = 72;
|
|
1339
|
+
case 72:
|
|
1340
|
+
if (!(nextApprover.type === consts_1.ProcessApprovalType.Preguding)) return [3, 75];
|
|
1330
1341
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1331
1342
|
pre_approval_status: ''
|
|
1332
1343
|
})];
|
|
1333
|
-
case
|
|
1344
|
+
case 73:
|
|
1334
1345
|
_f.sent();
|
|
1335
1346
|
return [4, ctx.getObject('pepsico_material').directUpdateMany([['pepsico_material_approval', '=', recordId], ['pre_approval_status', '=', false]], {
|
|
1336
1347
|
pre_approval_status: ''
|
|
1337
1348
|
})];
|
|
1338
|
-
case 73:
|
|
1339
|
-
_f.sent();
|
|
1340
|
-
_f.label = 74;
|
|
1341
1349
|
case 74:
|
|
1350
|
+
_f.sent();
|
|
1351
|
+
_f.label = 75;
|
|
1352
|
+
case 75:
|
|
1342
1353
|
nextApprovers_3_1 = nextApprovers_3.next();
|
|
1343
|
-
return [3,
|
|
1344
|
-
case
|
|
1345
|
-
case
|
|
1354
|
+
return [3, 36];
|
|
1355
|
+
case 76: return [3, 79];
|
|
1356
|
+
case 77:
|
|
1346
1357
|
e_8_1 = _f.sent();
|
|
1347
1358
|
e_8 = { error: e_8_1 };
|
|
1348
|
-
return [3,
|
|
1349
|
-
case
|
|
1359
|
+
return [3, 79];
|
|
1360
|
+
case 78:
|
|
1350
1361
|
try {
|
|
1351
1362
|
if (nextApprovers_3_1 && !nextApprovers_3_1.done && (_d = nextApprovers_3.return)) _d.call(nextApprovers_3);
|
|
1352
1363
|
}
|
|
1353
1364
|
finally { if (e_8) throw e_8.error; }
|
|
1354
1365
|
return [7];
|
|
1355
|
-
case 78:
|
|
1356
|
-
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3, 80];
|
|
1357
|
-
return [4, setPersonView(ctx, record)];
|
|
1358
1366
|
case 79:
|
|
1359
|
-
|
|
1360
|
-
|
|
1367
|
+
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3, 81];
|
|
1368
|
+
return [4, setPersonView(ctx, record)];
|
|
1361
1369
|
case 80:
|
|
1362
|
-
|
|
1370
|
+
_f.sent();
|
|
1371
|
+
_f.label = 81;
|
|
1372
|
+
case 81:
|
|
1373
|
+
if (!(record.current_step === consts_1.Step.departmental_review || record.current_step === consts_1.Step.personnel_review)) return [3, 83];
|
|
1363
1374
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
1364
1375
|
materials_remove_share_link_from_onedrive_status: 'pending'
|
|
1365
1376
|
})];
|
|
1366
|
-
case 81:
|
|
1367
|
-
_f.sent();
|
|
1368
|
-
_f.label = 82;
|
|
1369
1377
|
case 82:
|
|
1370
|
-
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 84];
|
|
1371
|
-
return [4, pendingDeployment(ctx, recordId)];
|
|
1372
|
-
case 83:
|
|
1373
1378
|
_f.sent();
|
|
1374
|
-
_f.label =
|
|
1379
|
+
_f.label = 83;
|
|
1380
|
+
case 83:
|
|
1381
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 85];
|
|
1382
|
+
return [4, pendingDeployment(ctx, recordId)];
|
|
1375
1383
|
case 84:
|
|
1376
|
-
|
|
1384
|
+
_f.sent();
|
|
1385
|
+
_f.label = 85;
|
|
1386
|
+
case 85:
|
|
1387
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment || (nextStep === consts_1.Step.conclusion && record.current_step === consts_1.Step.ai_review))) return [3, 87];
|
|
1377
1388
|
setDoc_1 = {
|
|
1378
1389
|
materials_download_from_onedrive_status: 'pending'
|
|
1379
1390
|
};
|
|
1380
1391
|
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, setDoc_1)];
|
|
1381
|
-
case 85:
|
|
1382
|
-
_f.sent();
|
|
1383
|
-
_f.label = 86;
|
|
1384
1392
|
case 86:
|
|
1393
|
+
_f.sent();
|
|
1394
|
+
_f.label = 87;
|
|
1395
|
+
case 87:
|
|
1385
1396
|
if (currentStepApprovalStatus === consts_1.ApprovalStatus.rejected) {
|
|
1386
1397
|
actionLabel = '内容审批被驳回';
|
|
1387
1398
|
}
|
|
@@ -1393,7 +1404,7 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1393
1404
|
actionLabel = "\u5185\u5BB9\u5BA1\u6279\u5DF2\u901A\u8FC7\u5F85\u4E0A\u7EBF";
|
|
1394
1405
|
}
|
|
1395
1406
|
postponedUserIds_1 = [];
|
|
1396
|
-
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3,
|
|
1407
|
+
if (!(nextStep === consts_1.Step.departmental_review || nextStep === consts_1.Step.personnel_review)) return [3, 99];
|
|
1397
1408
|
now = new Date();
|
|
1398
1409
|
visibleAfter = new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000);
|
|
1399
1410
|
return [4, ctx.getObject('pepsico_review_postpone').directFind({
|
|
@@ -1402,9 +1413,9 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1402
1413
|
['is_marker', '=', true]
|
|
1403
1414
|
]
|
|
1404
1415
|
})];
|
|
1405
|
-
case
|
|
1416
|
+
case 88:
|
|
1406
1417
|
pastPostponeRecords = _f.sent();
|
|
1407
|
-
if (!(pastPostponeRecords && pastPostponeRecords.length > 0)) return [3,
|
|
1418
|
+
if (!(pastPostponeRecords && pastPostponeRecords.length > 0)) return [3, 99];
|
|
1408
1419
|
postponedDepts = new Set(pastPostponeRecords.map(function (r) { return r.department_type; }));
|
|
1409
1420
|
_loop_1 = function (reviewer) {
|
|
1410
1421
|
var deptUserIds, deptMarkers, deptMarkers_1, deptMarkers_1_1, marker, e_10_1;
|
|
@@ -1455,36 +1466,36 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1455
1466
|
}
|
|
1456
1467
|
});
|
|
1457
1468
|
};
|
|
1458
|
-
_f.label = 88;
|
|
1459
|
-
case 88:
|
|
1460
|
-
_f.trys.push([88, 93, 94, 95]);
|
|
1461
|
-
nextApprovers_4 = tslib_1.__values(nextApprovers), nextApprovers_4_1 = nextApprovers_4.next();
|
|
1462
1469
|
_f.label = 89;
|
|
1463
1470
|
case 89:
|
|
1464
|
-
|
|
1471
|
+
_f.trys.push([89, 94, 95, 96]);
|
|
1472
|
+
nextApprovers_4 = tslib_1.__values(nextApprovers), nextApprovers_4_1 = nextApprovers_4.next();
|
|
1473
|
+
_f.label = 90;
|
|
1474
|
+
case 90:
|
|
1475
|
+
if (!!nextApprovers_4_1.done) return [3, 93];
|
|
1465
1476
|
reviewer = nextApprovers_4_1.value;
|
|
1466
1477
|
return [5, _loop_1(reviewer)];
|
|
1467
|
-
case 90:
|
|
1468
|
-
_f.sent();
|
|
1469
|
-
_f.label = 91;
|
|
1470
1478
|
case 91:
|
|
1479
|
+
_f.sent();
|
|
1480
|
+
_f.label = 92;
|
|
1481
|
+
case 92:
|
|
1471
1482
|
nextApprovers_4_1 = nextApprovers_4.next();
|
|
1472
|
-
return [3,
|
|
1473
|
-
case
|
|
1474
|
-
case
|
|
1483
|
+
return [3, 90];
|
|
1484
|
+
case 93: return [3, 96];
|
|
1485
|
+
case 94:
|
|
1475
1486
|
e_9_1 = _f.sent();
|
|
1476
1487
|
e_9 = { error: e_9_1 };
|
|
1477
|
-
return [3,
|
|
1478
|
-
case
|
|
1488
|
+
return [3, 96];
|
|
1489
|
+
case 95:
|
|
1479
1490
|
try {
|
|
1480
1491
|
if (nextApprovers_4_1 && !nextApprovers_4_1.done && (_e = nextApprovers_4.return)) _e.call(nextApprovers_4);
|
|
1481
1492
|
}
|
|
1482
1493
|
finally { if (e_9) throw e_9.error; }
|
|
1483
1494
|
return [7];
|
|
1484
|
-
case 95:
|
|
1485
|
-
if (!(postponedUserIds_1.length > 0)) return [3, 98];
|
|
1486
|
-
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1487
1495
|
case 96:
|
|
1496
|
+
if (!(postponedUserIds_1.length > 0)) return [3, 99];
|
|
1497
|
+
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
1498
|
+
case 97:
|
|
1488
1499
|
currentRecord = _f.sent();
|
|
1489
1500
|
currentPostponed = currentRecord.review_postponed_users || [];
|
|
1490
1501
|
newPostponed = (0, lodash_1.compact)((0, lodash_1.uniq)((0, lodash_1.concat)(currentPostponed, postponedUserIds_1)));
|
|
@@ -1494,44 +1505,44 @@ var advanceApproval = function (ctx, recordId, currentStepApprovalStatus) { retu
|
|
|
1494
1505
|
review_postponed_users: newPostponed,
|
|
1495
1506
|
postpone_marker_users: newMarkerUsers
|
|
1496
1507
|
})];
|
|
1497
|
-
case
|
|
1508
|
+
case 98:
|
|
1498
1509
|
_f.sent();
|
|
1499
1510
|
console.log("[advanceApproval] \u81EA\u52A8\u5EF6\u540E\u5BA1\u6838\u4EBA: ".concat(postponedUserIds_1, ", visibleAfter: ").concat(visibleAfter));
|
|
1500
|
-
_f.label =
|
|
1501
|
-
case
|
|
1511
|
+
_f.label = 99;
|
|
1512
|
+
case 99:
|
|
1502
1513
|
notifyUserIds = postponedUserIds_1.length > 0
|
|
1503
1514
|
? nextApproversUserIds_1.filter(function (id) { return !postponedUserIds_1.includes(id); })
|
|
1504
1515
|
: nextApproversUserIds_1;
|
|
1505
1516
|
return [4, (0, notification_1.sendNotifications)(ctx, record, notifyUserIds, actionLabel)];
|
|
1506
|
-
case 99:
|
|
1507
|
-
_f.sent();
|
|
1508
|
-
if (!(actionLabel === '内容审批被驳回' || actionLabel === '内容审批已通过待上线')) return [3, 101];
|
|
1509
|
-
return [4, (0, approval_cc_1.notifyApprovalCcUsers)(ctx, record, actionLabel, notification_1.sendCcNotifications, notifyUserIds)];
|
|
1510
1517
|
case 100:
|
|
1511
1518
|
_f.sent();
|
|
1512
|
-
|
|
1519
|
+
if (!(actionLabel === '内容审批被驳回' || actionLabel === '内容审批已通过待上线')) return [3, 102];
|
|
1520
|
+
return [4, (0, approval_cc_1.notifyApprovalCcUsers)(ctx, record, actionLabel, notification_1.sendCcNotifications, notifyUserIds)];
|
|
1513
1521
|
case 101:
|
|
1514
|
-
|
|
1522
|
+
_f.sent();
|
|
1523
|
+
_f.label = 102;
|
|
1524
|
+
case 102:
|
|
1525
|
+
if (!(nextStep === consts_1.Step.awaiting_deployment)) return [3, 104];
|
|
1515
1526
|
initiator = record.owner;
|
|
1516
1527
|
materialOwner = record.material_owner_id;
|
|
1517
|
-
if (!(initiator && materialOwner && initiator !== materialOwner)) return [3,
|
|
1528
|
+
if (!(initiator && materialOwner && initiator !== materialOwner)) return [3, 104];
|
|
1518
1529
|
console.log("[advanceApproval] \u901A\u77E5\u53D1\u8D77\u4EBA\u5BA1\u6838\u5B8C\u6210: initiator=".concat(initiator, ", material_owner=").concat(materialOwner));
|
|
1519
1530
|
return [4, (0, notification_1.sendNotifications)(ctx, record, [initiator], '审核完成')];
|
|
1520
|
-
case 102:
|
|
1521
|
-
_f.sent();
|
|
1522
|
-
_f.label = 103;
|
|
1523
1531
|
case 103:
|
|
1524
|
-
|
|
1525
|
-
|
|
1532
|
+
_f.sent();
|
|
1533
|
+
_f.label = 104;
|
|
1526
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:
|
|
1527
1538
|
_f.sent();
|
|
1528
|
-
_f.label =
|
|
1529
|
-
case
|
|
1530
|
-
case
|
|
1539
|
+
_f.label = 106;
|
|
1540
|
+
case 106: return [2, {}];
|
|
1541
|
+
case 107:
|
|
1531
1542
|
error_1 = _f.sent();
|
|
1532
1543
|
console.error('[advanceApproval] Error:', error_1.message, error_1.stack);
|
|
1533
1544
|
throw error_1;
|
|
1534
|
-
case
|
|
1545
|
+
case 108: return [2];
|
|
1535
1546
|
}
|
|
1536
1547
|
});
|
|
1537
1548
|
}); };
|