@steedos-labs/content-compliance 0.7.8 → 0.7.9
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/initUrgentQuota.d.ts +17 -0
- package/lib/actions/initUrgentQuota.js +99 -0
- package/lib/actions/initUrgentQuota.js.map +1 -0
- package/lib/methods/approval_engine.js +93 -36
- package/lib/methods/approval_engine.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/listviews/all.listview.yml +6 -2
- package/main/default/objects/pepsico_material_approval/listviews/collaboration.listview.yml +6 -2
- package/main/default/objects/pepsico_material_approval/listviews/handle.listview.yml +6 -2
- package/main/default/objects/pepsico_material_approval/listviews/handle_postpone.listview.yml +6 -2
- package/main/default/objects/pepsico_urgent_quota/buttons/init_year_quota.button.yml +88 -0
- package/package.json +1 -1
- package/public/content-review/amis.css +4 -0
package/lib/actions/index.d.ts
CHANGED
package/lib/actions/index.js
CHANGED
|
@@ -26,4 +26,5 @@ tslib_1.__exportStar(require("./migrateSpotCheckDepartments"), exports);
|
|
|
26
26
|
tslib_1.__exportStar(require("./fixStuckPersonnelReview"), exports);
|
|
27
27
|
tslib_1.__exportStar(require("./postponeReview"), exports);
|
|
28
28
|
tslib_1.__exportStar(require("./urgentApproval"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./initUrgentQuota"), exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
package/lib/actions/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAOA,mDAAyB;AAEzB,sDAA4B;AAE5B,6DAAmC;AAEnC,2DAAiC;AAEjC,8DAAoC;AAEpC,+DAAqC;AAErC,uDAA6B;AAE7B,4DAAkC;AAElC,oEAA0C;AAE1C,iDAAuB;AAEvB,kEAAwC;AAExC,qDAA2B;AAE3B,uDAA6B;AAE7B,gEAAsC;AAEtC,6DAAmC;AAEnC,8DAAoC;AAEpC,iEAAuC;AACvC,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,uEAA6C;AAE7C,wEAA8C;AAE9C,oEAA0C;AAE1C,2DAAiC;AAEjC,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAOA,mDAAyB;AAEzB,sDAA4B;AAE5B,6DAAmC;AAEnC,2DAAiC;AAEjC,8DAAoC;AAEpC,+DAAqC;AAErC,uDAA6B;AAE7B,4DAAkC;AAElC,oEAA0C;AAE1C,iDAAuB;AAEvB,kEAAwC;AAExC,qDAA2B;AAE3B,uDAA6B;AAE7B,gEAAsC;AAEtC,6DAAmC;AAEnC,8DAAoC;AAEpC,iEAAuC;AACvC,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC;AAElC,uEAA6C;AAE7C,wEAA8C;AAE9C,oEAA0C;AAE1C,2DAAiC;AAEjC,2DAAiC;AAEjC,4DAAkC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const initUrgentQuota: {
|
|
2
|
+
rest: {
|
|
3
|
+
method: string;
|
|
4
|
+
fullPath: string;
|
|
5
|
+
};
|
|
6
|
+
handler(ctx: any): Promise<{
|
|
7
|
+
message: string;
|
|
8
|
+
created: number;
|
|
9
|
+
updated: number;
|
|
10
|
+
total?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
message: string;
|
|
13
|
+
created: number;
|
|
14
|
+
updated: number;
|
|
15
|
+
total: number;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initUrgentQuota = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
exports.initUrgentQuota = {
|
|
6
|
+
rest: {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
fullPath: '/api/pepsico-content/urgent-quota/init'
|
|
9
|
+
},
|
|
10
|
+
handler: function (ctx) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
12
|
+
var user, space, _a, year, h1_used, h2_used, h1, h2, approvals, ownerIds, created, updated, ownerIds_1, ownerIds_1_1, userId, existing, e_1_1;
|
|
13
|
+
var e_1, _b;
|
|
14
|
+
return tslib_1.__generator(this, function (_c) {
|
|
15
|
+
switch (_c.label) {
|
|
16
|
+
case 0:
|
|
17
|
+
ctx.getObject = this.getObject;
|
|
18
|
+
user = ctx.meta.user;
|
|
19
|
+
space = user === null || user === void 0 ? void 0 : user.spaceId;
|
|
20
|
+
if (!space) {
|
|
21
|
+
throw new Error('无法获取当前工作区');
|
|
22
|
+
}
|
|
23
|
+
_a = ctx.params, year = _a.year, h1_used = _a.h1_used, h2_used = _a.h2_used;
|
|
24
|
+
if (!year || typeof year !== 'number') {
|
|
25
|
+
throw new Error('请指定有效的年份');
|
|
26
|
+
}
|
|
27
|
+
h1 = typeof h1_used === 'number' ? h1_used : 0;
|
|
28
|
+
h2 = typeof h2_used === 'number' ? h2_used : 0;
|
|
29
|
+
return [4, ctx.getObject('pepsico_material_approval').directFind({
|
|
30
|
+
filters: [['space', '=', space]],
|
|
31
|
+
fields: ['owner']
|
|
32
|
+
})];
|
|
33
|
+
case 1:
|
|
34
|
+
approvals = _c.sent();
|
|
35
|
+
ownerIds = tslib_1.__spreadArray([], tslib_1.__read(new Set(approvals.map(function (a) { return a.owner; }).filter(Boolean))), false);
|
|
36
|
+
if (ownerIds.length === 0) {
|
|
37
|
+
return [2, { message: '未找到任何审批发起人', created: 0, updated: 0 }];
|
|
38
|
+
}
|
|
39
|
+
created = 0;
|
|
40
|
+
updated = 0;
|
|
41
|
+
_c.label = 2;
|
|
42
|
+
case 2:
|
|
43
|
+
_c.trys.push([2, 10, 11, 12]);
|
|
44
|
+
ownerIds_1 = tslib_1.__values(ownerIds), ownerIds_1_1 = ownerIds_1.next();
|
|
45
|
+
_c.label = 3;
|
|
46
|
+
case 3:
|
|
47
|
+
if (!!ownerIds_1_1.done) return [3, 9];
|
|
48
|
+
userId = ownerIds_1_1.value;
|
|
49
|
+
return [4, ctx.getObject('pepsico_urgent_quota').findOne({
|
|
50
|
+
filters: [['user', '=', userId], ['space', '=', space], ['year', '=', year]]
|
|
51
|
+
})];
|
|
52
|
+
case 4:
|
|
53
|
+
existing = _c.sent();
|
|
54
|
+
if (!existing) return [3, 6];
|
|
55
|
+
return [4, ctx.getObject('pepsico_urgent_quota').directUpdate(existing._id, {
|
|
56
|
+
h1_used: h1,
|
|
57
|
+
h2_used: h2
|
|
58
|
+
})];
|
|
59
|
+
case 5:
|
|
60
|
+
_c.sent();
|
|
61
|
+
updated++;
|
|
62
|
+
return [3, 8];
|
|
63
|
+
case 6: return [4, ctx.getObject('pepsico_urgent_quota').insert({
|
|
64
|
+
user: userId,
|
|
65
|
+
space: space,
|
|
66
|
+
year: year,
|
|
67
|
+
h1_used: h1,
|
|
68
|
+
h2_used: h2
|
|
69
|
+
})];
|
|
70
|
+
case 7:
|
|
71
|
+
_c.sent();
|
|
72
|
+
created++;
|
|
73
|
+
_c.label = 8;
|
|
74
|
+
case 8:
|
|
75
|
+
ownerIds_1_1 = ownerIds_1.next();
|
|
76
|
+
return [3, 3];
|
|
77
|
+
case 9: return [3, 12];
|
|
78
|
+
case 10:
|
|
79
|
+
e_1_1 = _c.sent();
|
|
80
|
+
e_1 = { error: e_1_1 };
|
|
81
|
+
return [3, 12];
|
|
82
|
+
case 11:
|
|
83
|
+
try {
|
|
84
|
+
if (ownerIds_1_1 && !ownerIds_1_1.done && (_b = ownerIds_1.return)) _b.call(ownerIds_1);
|
|
85
|
+
}
|
|
86
|
+
finally { if (e_1) throw e_1.error; }
|
|
87
|
+
return [7];
|
|
88
|
+
case 12: return [2, {
|
|
89
|
+
message: "\u521D\u59CB\u5316\u5B8C\u6210\uFF1A".concat(created, " \u6761\u65B0\u5EFA\uFF0C").concat(updated, " \u6761\u66F4\u65B0"),
|
|
90
|
+
created: created,
|
|
91
|
+
updated: updated,
|
|
92
|
+
total: ownerIds.length
|
|
93
|
+
}];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=initUrgentQuota.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initUrgentQuota.js","sourceRoot":"","sources":["../../src/actions/initUrgentQuota.ts"],"names":[],"mappings":"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"}
|
|
@@ -1517,28 +1517,32 @@ var confirmDeployment = function (ctx, recordId, data) {
|
|
|
1517
1517
|
if (user.userId !== record.material_owner_id) {
|
|
1518
1518
|
throw new Error('只有材料拥有者才能执行此操作.');
|
|
1519
1519
|
}
|
|
1520
|
-
if (record.current_step
|
|
1520
|
+
if (record.current_step !== consts_1.Step.awaiting_deployment) {
|
|
1521
1521
|
return [2, {}];
|
|
1522
1522
|
}
|
|
1523
|
-
|
|
1523
|
+
if (!!(0, lodash_1.includes)(record.person_pending_approve, user.userId)) return [3, 3];
|
|
1524
|
+
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, { person_pending_approve: [user.userId] })];
|
|
1524
1525
|
case 2:
|
|
1525
1526
|
_a.sent();
|
|
1526
|
-
|
|
1527
|
+
record.person_pending_approve = [user.userId];
|
|
1528
|
+
_a.label = 3;
|
|
1529
|
+
case 3: return [4, updateUserStepStatus(ctx, record, { approvalStatus: consts_1.ApprovalStatus.submit, approveField: '' })];
|
|
1530
|
+
case 4:
|
|
1531
|
+
_a.sent();
|
|
1527
1532
|
return [4, ctx.getObject('pepsico_material_approval').update(recordId, {
|
|
1528
1533
|
launch: 'launched',
|
|
1529
1534
|
content_rule: data.content_rule,
|
|
1530
1535
|
aunch_time: new Date()
|
|
1531
1536
|
})];
|
|
1532
|
-
case
|
|
1537
|
+
case 5:
|
|
1533
1538
|
_a.sent();
|
|
1534
1539
|
return [4, (0, exports.advanceApproval)(ctx, recordId, consts_1.ApprovalStatus.submit)];
|
|
1535
|
-
case
|
|
1540
|
+
case 6:
|
|
1536
1541
|
_a.sent();
|
|
1537
1542
|
return [4, (0, content_hub_1.inventoryApprovalMaterial)(ctx, recordId)];
|
|
1538
|
-
case
|
|
1543
|
+
case 7:
|
|
1539
1544
|
_a.sent();
|
|
1540
|
-
|
|
1541
|
-
case 6: return [2, {}];
|
|
1545
|
+
return [2, {}];
|
|
1542
1546
|
}
|
|
1543
1547
|
});
|
|
1544
1548
|
});
|
|
@@ -1557,15 +1561,20 @@ var postponeDeployment = function (ctx, recordId, data) {
|
|
|
1557
1561
|
if (user.userId !== record.material_owner_id) {
|
|
1558
1562
|
throw new Error('只有材料拥有者才能执行此操作.');
|
|
1559
1563
|
}
|
|
1560
|
-
if (!(record.current_step === consts_1.Step.awaiting_deployment
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
postpone_launch_date: data.postpone_launch_date
|
|
1564
|
-
})];
|
|
1564
|
+
if (!(record.current_step === consts_1.Step.awaiting_deployment)) return [3, 5];
|
|
1565
|
+
if (!!(0, lodash_1.includes)(record.person_pending_approve, user.userId)) return [3, 3];
|
|
1566
|
+
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, { person_pending_approve: [user.userId] })];
|
|
1565
1567
|
case 2:
|
|
1566
1568
|
_a.sent();
|
|
1567
1569
|
_a.label = 3;
|
|
1568
|
-
case 3: return [
|
|
1570
|
+
case 3: return [4, ctx.getObject('pepsico_material_approval').update(recordId, {
|
|
1571
|
+
launch: 'postpone',
|
|
1572
|
+
postpone_launch_date: data.postpone_launch_date
|
|
1573
|
+
})];
|
|
1574
|
+
case 4:
|
|
1575
|
+
_a.sent();
|
|
1576
|
+
_a.label = 5;
|
|
1577
|
+
case 5: return [2, {}];
|
|
1569
1578
|
}
|
|
1570
1579
|
});
|
|
1571
1580
|
});
|
|
@@ -2056,15 +2065,15 @@ var TYPE_TO_REVIEWER_FIELD = (_a = {},
|
|
|
2056
2065
|
_a);
|
|
2057
2066
|
var postponeReview = function (ctx, recordId, data) {
|
|
2058
2067
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2059
|
-
var user, record, progessRecords, userProcessRecords, departmentType, reviewerField, deptUserIds, val, now, unactivatedMarkers, latestMarker, _a, _b, marker, e_13_1;
|
|
2060
|
-
var e_13, _c;
|
|
2061
|
-
return tslib_1.__generator(this, function (
|
|
2062
|
-
switch (
|
|
2068
|
+
var user, record, progessRecords, userProcessRecords, departmentType, reviewerField, deptUserIds, val, now, unactivatedMarkers, latestMarker, _a, _b, marker, e_13_1, visibleAfter, markersToActivate, markersToActivate_1, markersToActivate_1_1, marker, e_14_1, currentRecord, currentPostponed, newPostponed;
|
|
2069
|
+
var e_13, _c, e_14, _d;
|
|
2070
|
+
return tslib_1.__generator(this, function (_e) {
|
|
2071
|
+
switch (_e.label) {
|
|
2063
2072
|
case 0:
|
|
2064
2073
|
user = ctx.meta.user;
|
|
2065
2074
|
return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
2066
2075
|
case 1:
|
|
2067
|
-
record =
|
|
2076
|
+
record = _e.sent();
|
|
2068
2077
|
if (record.current_step !== consts_1.Step.departmental_review && record.current_step !== consts_1.Step.personnel_review) {
|
|
2069
2078
|
throw new Error('当前步骤不支持延后审核操作');
|
|
2070
2079
|
}
|
|
@@ -2080,7 +2089,7 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2080
2089
|
]
|
|
2081
2090
|
})];
|
|
2082
2091
|
case 2:
|
|
2083
|
-
progessRecords =
|
|
2092
|
+
progessRecords = _e.sent();
|
|
2084
2093
|
if (progessRecords.length > 0) {
|
|
2085
2094
|
throw new Error('您还有待处理的审批任务,无法执行延后审核');
|
|
2086
2095
|
}
|
|
@@ -2094,7 +2103,7 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2094
2103
|
top: 1
|
|
2095
2104
|
})];
|
|
2096
2105
|
case 3:
|
|
2097
|
-
userProcessRecords =
|
|
2106
|
+
userProcessRecords = _e.sent();
|
|
2098
2107
|
if (!userProcessRecords || userProcessRecords.length === 0) {
|
|
2099
2108
|
throw new Error('未找到您的审核记录');
|
|
2100
2109
|
}
|
|
@@ -2122,7 +2131,7 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2122
2131
|
sort: 'created desc'
|
|
2123
2132
|
})];
|
|
2124
2133
|
case 4:
|
|
2125
|
-
unactivatedMarkers =
|
|
2134
|
+
unactivatedMarkers = _e.sent();
|
|
2126
2135
|
if (!(unactivatedMarkers && unactivatedMarkers.length > 0)) return [3, 14];
|
|
2127
2136
|
latestMarker = unactivatedMarkers[0];
|
|
2128
2137
|
return [4, ctx.getObject('pepsico_review_postpone').directUpdate(latestMarker._id, {
|
|
@@ -2136,12 +2145,12 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2136
2145
|
name: "".concat(departmentType, " \u5EF6\u540E\u5BA1\u6838\u6807\u8BB0 ").concat(now.toISOString())
|
|
2137
2146
|
})];
|
|
2138
2147
|
case 5:
|
|
2139
|
-
|
|
2140
|
-
|
|
2148
|
+
_e.sent();
|
|
2149
|
+
_e.label = 6;
|
|
2141
2150
|
case 6:
|
|
2142
|
-
|
|
2151
|
+
_e.trys.push([6, 11, 12, 13]);
|
|
2143
2152
|
_a = tslib_1.__values(unactivatedMarkers.slice(1)), _b = _a.next();
|
|
2144
|
-
|
|
2153
|
+
_e.label = 7;
|
|
2145
2154
|
case 7:
|
|
2146
2155
|
if (!!_b.done) return [3, 10];
|
|
2147
2156
|
marker = _b.value;
|
|
@@ -2152,14 +2161,14 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2152
2161
|
modified_by: user.userId
|
|
2153
2162
|
})];
|
|
2154
2163
|
case 8:
|
|
2155
|
-
|
|
2156
|
-
|
|
2164
|
+
_e.sent();
|
|
2165
|
+
_e.label = 9;
|
|
2157
2166
|
case 9:
|
|
2158
2167
|
_b = _a.next();
|
|
2159
2168
|
return [3, 7];
|
|
2160
2169
|
case 10: return [3, 13];
|
|
2161
2170
|
case 11:
|
|
2162
|
-
e_13_1 =
|
|
2171
|
+
e_13_1 = _e.sent();
|
|
2163
2172
|
e_13 = { error: e_13_1 };
|
|
2164
2173
|
return [3, 13];
|
|
2165
2174
|
case 12:
|
|
@@ -2186,17 +2195,65 @@ var postponeReview = function (ctx, recordId, data) {
|
|
|
2186
2195
|
name: "".concat(departmentType, " \u5EF6\u540E\u5BA1\u6838\u6807\u8BB0 ").concat(now.toISOString())
|
|
2187
2196
|
})];
|
|
2188
2197
|
case 15:
|
|
2189
|
-
|
|
2190
|
-
|
|
2198
|
+
_e.sent();
|
|
2199
|
+
_e.label = 16;
|
|
2191
2200
|
case 16:
|
|
2192
2201
|
console.log("[postponeReview] recordId=".concat(recordId, ", departmentType=").concat(departmentType, ", deptUserIds=").concat(deptUserIds, ", markedForNextRound=true"));
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2202
|
+
visibleAfter = new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000);
|
|
2203
|
+
return [4, ctx.getObject('pepsico_review_postpone').directFind({
|
|
2204
|
+
filters: [
|
|
2205
|
+
['pepsico_material_approval', '=', recordId],
|
|
2206
|
+
['postpone_by', '=', user.userId],
|
|
2207
|
+
['is_marker', '=', true],
|
|
2208
|
+
['space', '=', record.space]
|
|
2209
|
+
]
|
|
2197
2210
|
})];
|
|
2198
2211
|
case 17:
|
|
2199
|
-
|
|
2212
|
+
markersToActivate = _e.sent();
|
|
2213
|
+
_e.label = 18;
|
|
2214
|
+
case 18:
|
|
2215
|
+
_e.trys.push([18, 23, 24, 25]);
|
|
2216
|
+
markersToActivate_1 = tslib_1.__values(markersToActivate), markersToActivate_1_1 = markersToActivate_1.next();
|
|
2217
|
+
_e.label = 19;
|
|
2218
|
+
case 19:
|
|
2219
|
+
if (!!markersToActivate_1_1.done) return [3, 22];
|
|
2220
|
+
marker = markersToActivate_1_1.value;
|
|
2221
|
+
return [4, ctx.getObject('pepsico_review_postpone').directUpdate(marker._id, {
|
|
2222
|
+
is_marker: false,
|
|
2223
|
+
visible_after: visibleAfter,
|
|
2224
|
+
notification_sent: false,
|
|
2225
|
+
postponed_user_ids: deptUserIds.join(','),
|
|
2226
|
+
modified: now,
|
|
2227
|
+
modified_by: user.userId
|
|
2228
|
+
})];
|
|
2229
|
+
case 20:
|
|
2230
|
+
_e.sent();
|
|
2231
|
+
_e.label = 21;
|
|
2232
|
+
case 21:
|
|
2233
|
+
markersToActivate_1_1 = markersToActivate_1.next();
|
|
2234
|
+
return [3, 19];
|
|
2235
|
+
case 22: return [3, 25];
|
|
2236
|
+
case 23:
|
|
2237
|
+
e_14_1 = _e.sent();
|
|
2238
|
+
e_14 = { error: e_14_1 };
|
|
2239
|
+
return [3, 25];
|
|
2240
|
+
case 24:
|
|
2241
|
+
try {
|
|
2242
|
+
if (markersToActivate_1_1 && !markersToActivate_1_1.done && (_d = markersToActivate_1.return)) _d.call(markersToActivate_1);
|
|
2243
|
+
}
|
|
2244
|
+
finally { if (e_14) throw e_14.error; }
|
|
2245
|
+
return [7];
|
|
2246
|
+
case 25: return [4, ctx.getObject('pepsico_material_approval').findOne(recordId)];
|
|
2247
|
+
case 26:
|
|
2248
|
+
currentRecord = _e.sent();
|
|
2249
|
+
currentPostponed = currentRecord.review_postponed_users || [];
|
|
2250
|
+
newPostponed = (0, lodash_1.compact)((0, lodash_1.uniq)((0, lodash_1.concat)(currentPostponed, deptUserIds)));
|
|
2251
|
+
return [4, ctx.getObject('pepsico_material_approval').directUpdate(recordId, {
|
|
2252
|
+
review_postponed_users: newPostponed
|
|
2253
|
+
})];
|
|
2254
|
+
case 27:
|
|
2255
|
+
_e.sent();
|
|
2256
|
+
console.log("[postponeReview] \u7ACB\u5373\u6FC0\u6D3B\u5EF6\u540E: recordId=".concat(recordId, ", deptUserIds=").concat(deptUserIds, ", visibleAfter=").concat(visibleAfter));
|
|
2200
2257
|
return [2, {}];
|
|
2201
2258
|
}
|
|
2202
2259
|
});
|