weaver-work-cli 0.1.63 → 0.1.64
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/chunks/{archive-BLDYBZDX.js → archive-WUZKAEZ6.js} +2 -2
- package/dist/chunks/{archive-oa-3GJ3TWXR.js → archive-oa-PN46RTI2.js} +2 -2
- package/dist/chunks/{asset-AFXJN4CK.js → asset-ZPC5VWZM.js} +2 -2
- package/dist/chunks/{asset-idle-VUJXWGWJ.js → asset-idle-DHGP3NYY.js} +2 -2
- package/dist/chunks/{attachment-content-VMJA7NSQ.js → attachment-content-JQDW3BIB.js} +3 -3
- package/dist/chunks/{blog-EREB35VU.js → blog-JC47AIXK.js} +2 -2
- package/dist/chunks/{caizhilian-ATM2JO5S.js → caizhilian-IKIHM77A.js} +4 -4
- package/dist/chunks/{calendar-E26ZIH7S.js → calendar-GZTSJ57Y.js} +2 -2
- package/dist/chunks/{chunk-OMAGCLUE.js → chunk-26FCCU5O.js} +2 -2
- package/dist/chunks/{chunk-BY3WDJO5.js → chunk-3PCXBG4H.js} +1 -1
- package/dist/chunks/{chunk-EOZHSNND.js → chunk-3W5NMGDS.js} +2 -2
- package/dist/chunks/{chunk-TNFIUZ4H.js → chunk-4AFWOGOV.js} +1 -1
- package/dist/chunks/{chunk-QAMIIFP6.js → chunk-5QQKLR6H.js} +11 -11
- package/dist/chunks/{chunk-C5PIGPGX.js → chunk-6T5X6YWX.js} +2 -2
- package/dist/chunks/{chunk-WPBZQVLS.js → chunk-AFZTMYGC.js} +1 -1
- package/dist/chunks/{chunk-IGICM3WJ.js → chunk-AGSO3PIK.js} +2 -2
- package/dist/chunks/{chunk-6VCQLZXE.js → chunk-FDBAFANU.js} +1 -0
- package/dist/chunks/{chunk-RV2JAA5I.js → chunk-FJUOUSV3.js} +1 -1
- package/dist/chunks/{chunk-6G2JARDK.js → chunk-HLT6B26P.js} +1 -1
- package/dist/chunks/{chunk-THMBDCRA.js → chunk-HWA2A25Y.js} +2 -2
- package/dist/chunks/{chunk-SHBDXEUE.js → chunk-I3MOFD6Q.js} +4 -4
- package/dist/chunks/{chunk-5CY37VLS.js → chunk-INVYKG4I.js} +45 -43
- package/dist/chunks/{chunk-QZYKZ7MQ.js → chunk-K7QKQRSL.js} +155 -57
- package/dist/chunks/{chunk-HEJPVXD3.js → chunk-KDFEHDIB.js} +4 -4
- package/dist/chunks/{chunk-I4C2KR2G.js → chunk-KYDXWYFB.js} +1 -1
- package/dist/chunks/{chunk-RR45ELVE.js → chunk-Q6D6PSMH.js} +2 -2
- package/dist/chunks/{chunk-G3ZM57PD.js → chunk-RMOH2GMF.js} +2 -2
- package/dist/chunks/{chunk-LOVAIGM2.js → chunk-SCMHG23G.js} +50 -50
- package/dist/chunks/{chunk-GQK6WLOS.js → chunk-VLY5RTVO.js} +2 -2
- package/dist/chunks/{chunk-SDPC7BG2.js → chunk-WSHIOSGM.js} +2 -2
- package/dist/chunks/{chunk-4OB22YKE.js → chunk-XHSEK2VM.js} +6 -6
- package/dist/chunks/{chunk-GOBNIGWS.js → chunk-YTFNMQO4.js} +1 -1
- package/dist/chunks/{conflict-AMNTM3FV.js → conflict-UUC7AFUI.js} +2 -2
- package/dist/chunks/{contract-PLO2V2NO.js → contract-INMS7SYQ.js} +846 -199
- package/dist/chunks/{cowork-FZAXE6FO.js → cowork-34CBYVQP.js} +2 -2
- package/dist/chunks/{create-flow-2DAUN7HU.js → create-flow-YOR4QTAJ.js} +8 -6
- package/dist/chunks/{data-7NXMWET4.js → data-QKWI5325.js} +13 -2
- package/dist/chunks/{ebuilder-form-DEYHX6M7.js → ebuilder-form-ZONRROK4.js} +3 -3
- package/dist/chunks/{ehr-QQH2DYYA.js → ehr-2CONM7R6.js} +2 -2
- package/dist/chunks/{entry-mode-2JTVEKMP.js → entry-mode-S2ENJ6GZ.js} +3 -3
- package/dist/chunks/{env-2JZMXC6I.js → env-ZSAXU5PJ.js} +2 -2
- package/dist/chunks/{esb-I5ZFHJUK.js → esb-FQASCY2H.js} +4 -4
- package/dist/chunks/{factory-XIATYHU6.js → factory-N76QQA53.js} +1 -1
- package/dist/chunks/{fna-3V2TL6B2.js → fna-FCLVIWAS.js} +2 -2
- package/dist/chunks/{group-chat-CVYUZCOQ.js → group-chat-UM665WDZ.js} +3 -3
- package/dist/chunks/{host-CBONEAZS.js → host-2ED2KC4X.js} +3 -3
- package/dist/chunks/{host-4DP7C7YQ.js → host-2UYZEY2V.js} +3 -3
- package/dist/chunks/{host-4KQCAEWA.js → host-46NYKDQP.js} +3 -3
- package/dist/chunks/{host-BD7NAM33.js → host-7IPZKIM4.js} +3 -3
- package/dist/chunks/{host-L37QVNIV.js → host-P7G22WNM.js} +3 -3
- package/dist/chunks/{host-4X2F3JPQ.js → host-XLCBLNJD.js} +3 -3
- package/dist/chunks/{hrm-OL3IKN7C.js → hrm-XKL27NX2.js} +3 -3
- package/dist/chunks/{im-YXQWUF3R.js → im-NDYIMASG.js} +3 -3
- package/dist/chunks/{invoice-4WY32PR2.js → invoice-MOGNB6HN.js} +3 -3
- package/dist/chunks/{jiuchuanhui-L6SHLONH.js → jiuchuanhui-3T5X7SB7.js} +2 -2
- package/dist/chunks/{lazy-dispatch-OYE6QV24.js → lazy-dispatch-4WOIL3ZQ.js} +4 -4
- package/dist/chunks/{mail-PZV2KNRU.js → mail-P7VMUKQW.js} +2 -2
- package/dist/chunks/{meeting-6SOBCC6N.js → meeting-MMTYDHXA.js} +13 -13
- package/dist/chunks/{minute-doc-KSJSJNOH.js → minute-doc-LCSBWGJ3.js} +4 -4
- package/dist/chunks/{okr-B76FW5M2.js → okr-VZXRQGS4.js} +2 -2
- package/dist/chunks/{operations-YOMEGFLV.js → operations-MI2BSKZX.js} +4 -4
- package/dist/chunks/{performance-4VBKUPFO.js → performance-OPEQNW7Y.js} +870 -15
- package/dist/chunks/{plan-HBNZRQTI.js → plan-TJAS4N5X.js} +2 -2
- package/dist/chunks/{project-IV6FWK74.js → project-CYBGU6K6.js} +2 -2
- package/dist/chunks/{reception-BR5YURT6.js → reception-3FT2F66K.js} +2 -2
- package/dist/chunks/{recruit-stage-4HQ6OGXT.js → recruit-stage-WPGB5BDJ.js} +2 -2
- package/dist/chunks/{registry-JFQEFC7E.js → registry-BAWCWV4D.js} +2 -2
- package/dist/chunks/{registry-7LICMV5J.js → registry-FNI5E76J.js} +12 -12
- package/dist/chunks/{registry-MZJQX65Q.js → registry-QRMXRSCT.js} +4 -4
- package/dist/chunks/{room-recommend-43GLLE7Y.js → room-recommend-I7QQRHEL.js} +4 -4
- package/dist/chunks/{schedule-ZQ42BEW6.js → schedule-3P7EWGNZ.js} +4 -4
- package/dist/chunks/{smart-extract-QKAEAZGM.js → smart-extract-FOBSVNYW.js} +2 -2
- package/dist/chunks/{workflow-6HV7H5PC.js → workflow-U2KKTVQY.js} +4 -4
- package/dist/index.js +33 -33
- package/dist/internal/e10/auth/commands.js +182 -43
- package/dist/shortcuts/contract/error-actions.js +112 -0
- package/dist/shortcuts/contract/errors.js +9 -1
- package/dist/shortcuts/contract/manifest.js +18 -7
- package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
- package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
- package/dist/shortcuts/contract/operations/elements-build.js +82 -56
- package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
- package/dist/shortcuts/contract/operations/ledger-card.js +25 -2
- package/dist/shortcuts/contract/operations/ledger.js +33 -5
- package/dist/shortcuts/contract/operations/money.js +90 -0
- package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +54 -17
- package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +20 -3
- package/dist/shortcuts/contract/operations/quote.js +66 -12
- package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
- package/dist/shortcuts/contract/operations/triage.js +55 -9
- package/dist/shortcuts/data/operations/shared.js +14 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +25 -11
- package/dist/shortcuts/performance/flow-utils.js +363 -0
- package/dist/shortcuts/performance/manifest.js +2 -2
- package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
- package/dist/shortcuts/performance/operations/flow-list.js +213 -0
- package/dist/shortcuts/performance/operations/flow-score.js +241 -0
- package/dist/shortcuts/performance/operations/registry.js +6 -0
- package/docs/e10-auth.md +27 -2
- package/package.json +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +87 -39
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +29 -29
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +29 -7
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +22 -25
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -314
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +19 -11
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +43 -25
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +103 -212
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +7 -7
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +7 -6
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +34 -21
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +22 -22
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +21 -19
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +132 -95
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +5 -5
- package/skills/weaver-e10-meeting/SKILL.md +8 -7
- package/skills/weaver-e10-meeting/references/create-commands.md +2 -2
- package/skills/weaver-e10-meeting/references/create-flow.md +6 -6
- package/skills/weaver-e10-meeting/references/create-guardrails.md +10 -10
- package/skills/weaver-e10-meeting/references/invitation.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-performance/SKILL.md +45 -5
- package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
- package/skills/weaver-e10-performance/references/flow-api.md +128 -0
- package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -5
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
createE10RequestRuntime,
|
|
9
9
|
isE10SessionExpiredResponse,
|
|
10
10
|
requireE10Session
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FJUOUSV3.js";
|
|
12
12
|
import {
|
|
13
13
|
E10_SESSION_EXPIRED_MESSAGE
|
|
14
14
|
} from "./chunk-TJN4PIYO.js";
|
|
15
15
|
import {
|
|
16
16
|
getActiveProfile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FDBAFANU.js";
|
|
18
18
|
import {
|
|
19
19
|
CliError,
|
|
20
20
|
isCliError,
|
|
@@ -484,9 +484,9 @@ function num(v) {
|
|
|
484
484
|
function stepsOf(req) {
|
|
485
485
|
const steps = [];
|
|
486
486
|
for (const [key, label] of Object.entries(STEP_TYPE_LABELS)) {
|
|
487
|
-
const
|
|
488
|
-
if (!Array.isArray(
|
|
489
|
-
for (const step of
|
|
487
|
+
const list2 = req[key];
|
|
488
|
+
if (!Array.isArray(list2)) continue;
|
|
489
|
+
for (const step of list2) {
|
|
490
490
|
const operators = Array.isArray(step?.stepOperators) ? step.stepOperators : [];
|
|
491
491
|
const who = operators.map((op) => OPERATE_TYPE_LABELS[String(op?.operateType)] || String(op?.operateType || "?")).join("/");
|
|
492
492
|
steps.push(`${label}${who ? `(${who})` : ""}`);
|
|
@@ -596,8 +596,8 @@ function schemeFingerprint(req) {
|
|
|
596
596
|
var MODE_LABELS = { qualitative: "\u5B9A\u6027", quantify: "\u5B9A\u91CF" };
|
|
597
597
|
function categoryNameMap(req) {
|
|
598
598
|
const map = {};
|
|
599
|
-
const
|
|
600
|
-
for (const item of
|
|
599
|
+
const list2 = Array.isArray(req.checkType) ? req.checkType : [];
|
|
600
|
+
for (const item of list2) {
|
|
601
601
|
if (item && item.id !== void 0 && item.typeName) map[String(item.id)] = String(item.typeName);
|
|
602
602
|
}
|
|
603
603
|
return map;
|
|
@@ -669,13 +669,13 @@ function normalizeSchemeBody(input) {
|
|
|
669
669
|
});
|
|
670
670
|
}
|
|
671
671
|
const fillStep = (listKey, stepKey, stepType) => {
|
|
672
|
-
const
|
|
672
|
+
const list2 = Array.isArray(body[listKey]) ? body[listKey] : [];
|
|
673
673
|
const steps = Array.isArray(body[stepKey]) ? body[stepKey] : [];
|
|
674
|
-
if (
|
|
674
|
+
if (list2.length === 0 || steps.length > 0) return;
|
|
675
675
|
body[stepKey] = [{ stepType, stepOperators: [{ operateType: "directSuperior" }] }];
|
|
676
676
|
issues.push({
|
|
677
677
|
level: "warn",
|
|
678
|
-
message: `${listKey} \u6709 ${
|
|
678
|
+
message: `${listKey} \u6709 ${list2.length} \u9879\u4F46\u672A\u63D0\u4F9B ${stepKey}\uFF0C\u5DF2\u6309\u9ED8\u8BA4\u300C\u76F4\u63A5\u4E0A\u7EA7\u300D\u8865\u9F50\u8BC4\u5206\u4EBA\uFF08\u5426\u5219\u8BC4\u5206\u4EBA\u4E0D\u4F1A\u843D\u5E93\uFF09`
|
|
679
679
|
});
|
|
680
680
|
};
|
|
681
681
|
fillStep("plusList", "plusStepList", "kpiplus");
|
|
@@ -1085,8 +1085,8 @@ async function resolve2(args, env) {
|
|
|
1085
1085
|
body: { ...spec.body, searchValue: keyword },
|
|
1086
1086
|
operation: "performance.hrm.resolve"
|
|
1087
1087
|
});
|
|
1088
|
-
const
|
|
1089
|
-
const candidates =
|
|
1088
|
+
const list2 = Array.isArray(response?.data?.data) ? response.data.data : [];
|
|
1089
|
+
const candidates = list2.map((item) => ({
|
|
1090
1090
|
id: item?.id,
|
|
1091
1091
|
name: item?.name ?? null,
|
|
1092
1092
|
title: item?.title ?? null,
|
|
@@ -1129,12 +1129,867 @@ var hrmResolveOperations = [
|
|
|
1129
1129
|
}
|
|
1130
1130
|
];
|
|
1131
1131
|
|
|
1132
|
+
// src/shortcuts/performance/flow-utils.ts
|
|
1133
|
+
var FLOW_STATUS_LABELS = {
|
|
1134
|
+
audit: "\u5F85\u5BA1\u6838",
|
|
1135
|
+
score: "\u8BC4\u5206\u4E2D",
|
|
1136
|
+
noScore: "\u4E0D\u53EF\u8BC4\u5206",
|
|
1137
|
+
frozen: "\u51BB\u7ED3",
|
|
1138
|
+
approve: "\u5BA1\u6279\u4E2D",
|
|
1139
|
+
noApprove: "\u4E0D\u53EF\u5BA1\u6279",
|
|
1140
|
+
drawback: "\u9000\u56DE",
|
|
1141
|
+
noDrawback: "\u4E0D\u53EF\u9000\u56DE",
|
|
1142
|
+
finished: "\u5DF2\u7ED3\u675F",
|
|
1143
|
+
scoreOverTime: "\u5DF2\u8D85\u65F6",
|
|
1144
|
+
waitArchive: "\u5DF2\u8BC4\u5206\u5F85\u5F52\u6863",
|
|
1145
|
+
interviewing: "\u9762\u8C08\u4E2D"
|
|
1146
|
+
};
|
|
1147
|
+
var DATE_TYPE_LABELS = {
|
|
1148
|
+
year: "\u5E74\u5EA6",
|
|
1149
|
+
halfyear: "\u534A\u5E74",
|
|
1150
|
+
quarter: "\u5B63\u5EA6",
|
|
1151
|
+
month: "\u6708\u5EA6"
|
|
1152
|
+
};
|
|
1153
|
+
var INDICATOR_MODE_LABELS = {
|
|
1154
|
+
quantify: "\u5B9A\u91CF",
|
|
1155
|
+
qualitative: "\u5B9A\u6027"
|
|
1156
|
+
};
|
|
1157
|
+
function parseScoreColumn(detailData) {
|
|
1158
|
+
const cols = (detailData?.basicHeader || []).filter(
|
|
1159
|
+
(c) => c?.canEdit && /^kps.+-.+$/.test(String(c?.dataIndex || ""))
|
|
1160
|
+
);
|
|
1161
|
+
if (!cols.length) return null;
|
|
1162
|
+
const dataIndex = String(cols[0].dataIndex);
|
|
1163
|
+
const m = dataIndex.match(/^kps(.+)-([^-.]+)$/);
|
|
1164
|
+
return m ? { scoreColumn: dataIndex, stepId: m[1], scoreUserId: m[2] } : null;
|
|
1165
|
+
}
|
|
1166
|
+
function rowValueKeys(stepId, userId) {
|
|
1167
|
+
return {
|
|
1168
|
+
targetKey: `targetValue${stepId}-${userId}`,
|
|
1169
|
+
actualKey: `actualValue${stepId}-${userId}`,
|
|
1170
|
+
kpsKey: `kps${stepId}-${userId}`
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
function parseDatasourceText(jsonStr) {
|
|
1174
|
+
if (!jsonStr) return null;
|
|
1175
|
+
try {
|
|
1176
|
+
const parsed = typeof jsonStr === "string" ? JSON.parse(jsonStr) : jsonStr;
|
|
1177
|
+
return parsed?.text ?? parsed?.config?.title ?? null;
|
|
1178
|
+
} catch {
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
async function fetchAggregated(host, config, operation) {
|
|
1183
|
+
const response = await host.request({
|
|
1184
|
+
path: "/api/workrelate/performance/flow/getDataSourceData",
|
|
1185
|
+
body: config,
|
|
1186
|
+
operation
|
|
1187
|
+
});
|
|
1188
|
+
const data = unwrapWeaData(response, "\u6570\u636E\u6E90\u53D6\u6570");
|
|
1189
|
+
return typeof data === "number" ? data : String(data);
|
|
1190
|
+
}
|
|
1191
|
+
function unwrapWeaData(response, context) {
|
|
1192
|
+
if (!response || typeof response !== "object") {
|
|
1193
|
+
throw pfFail(`${context}\uFF1A\u63A5\u53E3\u8FD4\u56DE\u4E0D\u662F\u5BF9\u8C61`);
|
|
1194
|
+
}
|
|
1195
|
+
const failed = response.fail === true || response.status !== void 0 && response.status !== true || response.code !== void 0 && response.code !== 200;
|
|
1196
|
+
if (failed) {
|
|
1197
|
+
throw pfFail(`${context}\uFF1A${response.msg || "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25"}`, { code: response.code, msg: response.msg });
|
|
1198
|
+
}
|
|
1199
|
+
return response.data;
|
|
1200
|
+
}
|
|
1201
|
+
async function describeDatasource(host, cfg, operation) {
|
|
1202
|
+
if (!cfg) return null;
|
|
1203
|
+
const view = {
|
|
1204
|
+
formName: parseDatasourceText(cfg.dataSet),
|
|
1205
|
+
fieldName: parseDatasourceText(cfg.target),
|
|
1206
|
+
countType: cfg.targetCountType ?? null,
|
|
1207
|
+
startDate: cfg.startDate ?? null,
|
|
1208
|
+
endDate: cfg.endDate ?? null
|
|
1209
|
+
};
|
|
1210
|
+
try {
|
|
1211
|
+
view.aggregated = await fetchAggregated(host, cfg, operation);
|
|
1212
|
+
} catch (error) {
|
|
1213
|
+
view.error = error?.message ?? String(error);
|
|
1214
|
+
}
|
|
1215
|
+
return view;
|
|
1216
|
+
}
|
|
1217
|
+
async function buildAssessContext(host, flowId, operation) {
|
|
1218
|
+
const detailData = unwrapWeaData(
|
|
1219
|
+
await host.request({
|
|
1220
|
+
path: `/api/workrelate/performance/flow/detail/${encodeURIComponent(flowId)}`,
|
|
1221
|
+
method: "GET",
|
|
1222
|
+
operation
|
|
1223
|
+
}),
|
|
1224
|
+
"\u8003\u6838\u8BE6\u60C5"
|
|
1225
|
+
);
|
|
1226
|
+
if (!detailData || !Array.isArray(detailData.basicData)) {
|
|
1227
|
+
throw pfFail("\u8003\u6838\u8BE6\u60C5\u7F3A\u5C11\u6307\u6807\u6570\u636E\uFF08basicData\uFF09", { keys: detailData ? Object.keys(detailData) : [] });
|
|
1228
|
+
}
|
|
1229
|
+
const column = parseScoreColumn(detailData);
|
|
1230
|
+
if (!column) {
|
|
1231
|
+
throw pfValidationError(
|
|
1232
|
+
"not_scorable",
|
|
1233
|
+
"\u5F53\u524D\u7528\u6237\u5BF9\u8BE5\u8003\u6838\u4E0D\u53EF\u8BC4\u5206\uFF08\u627E\u4E0D\u5230\u53EF\u7F16\u8F91\u8BC4\u5206\u5217\uFF09\uFF1A\u53EF\u80FD\u4E0D\u662F\u672C\u8F6E\u8BC4\u5206\u4EBA\uFF0C\u6216\u8003\u6838\u4E0D\u5728\u8BC4\u5206\u9636\u6BB5",
|
|
1234
|
+
{ flowStatus: detailData.flowStatus ?? null, canScore: detailData.canScore ?? null }
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
const keys = rowValueKeys(column.stepId, column.scoreUserId);
|
|
1238
|
+
const indicators = [];
|
|
1239
|
+
for (let i = 0; i < detailData.basicData.length; i += 1) {
|
|
1240
|
+
const row = detailData.basicData[i];
|
|
1241
|
+
const isQuantitative = String(row?.indicatorMode) === "quantify";
|
|
1242
|
+
const item = {
|
|
1243
|
+
index: i + 1,
|
|
1244
|
+
dataRow: row?.dataRow,
|
|
1245
|
+
name: row?.type ?? null,
|
|
1246
|
+
description: row?.describe ?? row?.indicatorDescription ?? null,
|
|
1247
|
+
weight: row?.weight ?? null,
|
|
1248
|
+
mode: INDICATOR_MODE_LABELS[String(row?.indicatorMode)] ?? null,
|
|
1249
|
+
scoreType: row?.scoreType ?? null,
|
|
1250
|
+
currentTarget: row?.[keys.targetKey] ?? null,
|
|
1251
|
+
currentActual: row?.[keys.actualKey] ?? null,
|
|
1252
|
+
currentScore: row?.[keys.kpsKey] ?? null,
|
|
1253
|
+
// 后端为 AI 预留的镜像字段(FlowServiceImpl 796-809,注释「AI创建使用」)
|
|
1254
|
+
aiTarget: row?.targetAIValue ?? null,
|
|
1255
|
+
aiActual: row?.actualAIValue ?? null
|
|
1256
|
+
};
|
|
1257
|
+
if (isQuantitative && Number(row?.targetSource) === 2 && row?.targetDatasourceData) {
|
|
1258
|
+
item.targetDatasource = await describeDatasource(host, row.targetDatasourceData, operation);
|
|
1259
|
+
}
|
|
1260
|
+
if (isQuantitative && Number(row?.dataSource) === 2 && String(row?.dataModule || "").toLowerCase() === "datasource" && row?.datasourceData) {
|
|
1261
|
+
item.actualDatasource = await describeDatasource(host, row.datasourceData, operation);
|
|
1262
|
+
}
|
|
1263
|
+
indicators.push(item);
|
|
1264
|
+
}
|
|
1265
|
+
return {
|
|
1266
|
+
flowId,
|
|
1267
|
+
meta: {
|
|
1268
|
+
name: detailData.name ?? null,
|
|
1269
|
+
schemeName: detailData.schemeName ?? null,
|
|
1270
|
+
kpiUserName: detailData.kpiUserName ?? null,
|
|
1271
|
+
assessmentCycle: detailData.assessmentCycle ?? null,
|
|
1272
|
+
periodStart: detailData.periodStartDate ?? null,
|
|
1273
|
+
periodEnd: detailData.periodEndDate ?? null,
|
|
1274
|
+
flowStatus: detailData.flowStatus ?? null,
|
|
1275
|
+
flowStatusLabel: FLOW_STATUS_LABELS[String(detailData.flowStatus)] ?? null,
|
|
1276
|
+
currentScore: detailData.score ?? null,
|
|
1277
|
+
maxScore: detailData.total ?? null,
|
|
1278
|
+
scoreLimit: detailData.scoreLimit ?? null,
|
|
1279
|
+
canScore: detailData.canScore ?? null,
|
|
1280
|
+
stepId: column.stepId,
|
|
1281
|
+
scoreUserId: column.scoreUserId
|
|
1282
|
+
},
|
|
1283
|
+
indicators,
|
|
1284
|
+
detailUrl: buildDetailUrl(flowId, [])
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function buildDetailUrl(flowId, rows = []) {
|
|
1288
|
+
const base = `/sp/performance/flow/deal/detail/${flowId}`;
|
|
1289
|
+
if (!rows.length) return base;
|
|
1290
|
+
const aikps = [...rows].sort((a, b) => Number(a.dataRow) - Number(b.dataRow)).map((row) => {
|
|
1291
|
+
const value = Number(row.kps);
|
|
1292
|
+
return Number.isFinite(value) ? String(value) : "";
|
|
1293
|
+
}).join(",");
|
|
1294
|
+
return `${base}?kpiext=1&aikps=${aikps}`;
|
|
1295
|
+
}
|
|
1296
|
+
function buildScoreRequest(detailData, payloadRows, column) {
|
|
1297
|
+
if (detailData?.canScore === false) {
|
|
1298
|
+
throw pfValidationError("not_scorable", "\u5F53\u524D\u7528\u6237\u5BF9\u8BE5\u8003\u6838\u4E0D\u53EF\u8BC4\u5206\uFF08canScore=false\uFF09", {
|
|
1299
|
+
flowStatus: detailData?.flowStatus ?? null
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
if (!Array.isArray(payloadRows) || payloadRows.length === 0) {
|
|
1303
|
+
throw pfValidationError("payload_empty", "\u8BC4\u5206\u884C\u4E0D\u80FD\u4E3A\u7A7A\uFF08\u6BCF\u884C\u81F3\u5C11\u63D0\u4F9B dataRow \u4E0E kps\uFF09");
|
|
1304
|
+
}
|
|
1305
|
+
const keys = rowValueKeys(column.stepId, column.scoreUserId);
|
|
1306
|
+
const maxScore = Number(detailData?.total);
|
|
1307
|
+
const basicData = Array.isArray(detailData?.basicData) ? detailData.basicData : [];
|
|
1308
|
+
const linkList = [];
|
|
1309
|
+
for (const payloadRow of payloadRows) {
|
|
1310
|
+
if (!payloadRow || typeof payloadRow !== "object" || payloadRow.dataRow === void 0) {
|
|
1311
|
+
throw pfValidationError("payload_invalid", "\u6BCF\u884C\u5FC5\u987B\u5305\u542B dataRow", { row: payloadRow });
|
|
1312
|
+
}
|
|
1313
|
+
const row = basicData.find((r) => Number(r?.dataRow) === Number(payloadRow.dataRow));
|
|
1314
|
+
if (!row) {
|
|
1315
|
+
throw pfValidationError("data_row_unknown", `dataRow=${payloadRow.dataRow} \u5728\u6307\u6807\u8868\u4E2D\u4E0D\u5B58\u5728`, {
|
|
1316
|
+
valid: basicData.map((r) => r?.dataRow)
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
const rowName = row?.type ?? `\u7B2C ${row?.dataRow} \u884C`;
|
|
1320
|
+
let kpsValue = payloadRow.kps;
|
|
1321
|
+
if ((kpsValue === void 0 || kpsValue === null || kpsValue === "") && row?.scoreType === "formula") {
|
|
1322
|
+
const inline = row?.[keys.kpsKey];
|
|
1323
|
+
if (inline !== void 0 && inline !== null && inline !== "") kpsValue = inline;
|
|
1324
|
+
}
|
|
1325
|
+
if (kpsValue === void 0 || kpsValue === null || kpsValue === "") {
|
|
1326
|
+
throw pfValidationError("kps_missing", `\u300C${rowName}\u300D\u7F3A\u5C11\u8BC4\u5206\uFF08kps\uFF09`, {
|
|
1327
|
+
dataRow: row?.dataRow,
|
|
1328
|
+
hint: "\u6BCF\u884C\u5FC5\u586B\uFF1B\u516C\u5F0F\u884C\u53EF\u7701\u7565\u4F46\u8BE6\u60C5\u91CC\u9700\u5DF2\u6709\u8BA1\u7B97\u503C"
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
const kpsNumber = Number(kpsValue);
|
|
1332
|
+
if (!Number.isFinite(kpsNumber) || kpsNumber < 0) {
|
|
1333
|
+
throw pfValidationError("kps_invalid", `\u300C${rowName}\u300D\u8BC4\u5206\u975E\u6CD5\uFF1A${kpsValue}`, { dataRow: row?.dataRow });
|
|
1334
|
+
}
|
|
1335
|
+
if (detailData?.scoreLimit !== false && Number.isFinite(maxScore) && maxScore > 0 && kpsNumber > maxScore) {
|
|
1336
|
+
throw pfValidationError("kps_exceeds_max", `\u300C${rowName}\u300D\u8BC4\u5206 ${kpsNumber} \u8D85\u51FA\u6EE1\u5206 ${maxScore}`, {
|
|
1337
|
+
dataRow: row?.dataRow,
|
|
1338
|
+
hint: "\u4E0D\u505A\u9759\u9ED8\u622A\u65AD\uFF0C\u8BF7\u8C03\u6574\u8BC4\u5206"
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
const isQuantitative = String(row?.indicatorMode) === "quantify";
|
|
1342
|
+
let targetValue = payloadRow.targetValue !== void 0 ? payloadRow.targetValue : row?.[keys.targetKey];
|
|
1343
|
+
if (isQuantitative && (targetValue === void 0 || targetValue === null || targetValue === "")) {
|
|
1344
|
+
throw pfValidationError("target_missing", `\u5B9A\u91CF\u6307\u6807\u300C${rowName}\u300D\u7F3A\u5C11\u76EE\u6807\u503C\uFF08targetValue\uFF09`, {
|
|
1345
|
+
dataRow: row?.dataRow,
|
|
1346
|
+
hint: "\u53EF\u5728 payload \u63D0\u4F9B\uFF0C\u6216\u786E\u8BA4\u8BE6\u60C5\u4E2D\u5DF2\u6709\u76EE\u6807\u503C"
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
const targetNumber = targetValue === void 0 || targetValue === null || targetValue === "" ? 0 : Number(targetValue);
|
|
1350
|
+
if (!Number.isFinite(targetNumber)) {
|
|
1351
|
+
throw pfValidationError("target_invalid", `\u300C${rowName}\u300D\u76EE\u6807\u503C\u975E\u6570\u5B57\uFF1A${targetValue}`, { dataRow: row?.dataRow });
|
|
1352
|
+
}
|
|
1353
|
+
let actualValue = null;
|
|
1354
|
+
if (payloadRow.actualValue !== void 0 && payloadRow.actualValue !== null && payloadRow.actualValue !== "") {
|
|
1355
|
+
actualValue = String(payloadRow.actualValue);
|
|
1356
|
+
} else if (row?.[keys.actualKey] !== void 0 && row?.[keys.actualKey] !== null && row?.[keys.actualKey] !== "") {
|
|
1357
|
+
actualValue = String(row?.[keys.actualKey]);
|
|
1358
|
+
}
|
|
1359
|
+
if (isQuantitative && actualValue === null) {
|
|
1360
|
+
const needsActual = Number(row?.dataSource) === 1 || Number(row?.dataSource) === 2 && row?.editActualValue === true;
|
|
1361
|
+
if (needsActual) {
|
|
1362
|
+
throw pfValidationError("actual_missing", `\u5B9A\u91CF\u6307\u6807\u300C${rowName}\u300D\u7F3A\u5C11\u5B9E\u9645\u503C\uFF08actualValue\uFF09`, {
|
|
1363
|
+
dataRow: row?.dataRow,
|
|
1364
|
+
dataSource: row?.dataSource ?? null,
|
|
1365
|
+
editActualValue: row?.editActualValue === true,
|
|
1366
|
+
hint: "\u8BE5\u6307\u6807\u9700\u8BC4\u5206\u4EBA\u63D0\u4F9B\u5B9E\u9645\u503C\uFF08dataSource=1 \u624B\u52A8\u5F55\u5165\uFF0C\u6216\u6570\u636E\u6E90\u6A21\u5F0F\u4F46\u5141\u8BB8\u7F16\u8F91\u5B9E\u9645\u503C\uFF09"
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
linkList.push({
|
|
1371
|
+
weight: row?.weight ?? null,
|
|
1372
|
+
dataRow: row?.dataRow,
|
|
1373
|
+
operater: column.scoreUserId,
|
|
1374
|
+
kps: kpsNumber.toFixed(2),
|
|
1375
|
+
kpiFlowStep: column.stepId,
|
|
1376
|
+
targetValue: targetNumber,
|
|
1377
|
+
actualValue: actualValue === null ? "" : actualValue,
|
|
1378
|
+
...payloadRow.remark !== void 0 && payloadRow.remark !== null && payloadRow.remark !== "" ? { name: String(payloadRow.remark) } : {}
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
const rows = linkList.map((link) => ({ dataRow: link.dataRow, kps: link.kps, actualValue: link.actualValue }));
|
|
1382
|
+
return {
|
|
1383
|
+
body: {
|
|
1384
|
+
flowid: String(detailData?.id ?? ""),
|
|
1385
|
+
stepId: column.stepId,
|
|
1386
|
+
operater: column.scoreUserId,
|
|
1387
|
+
rewardMoney: 0,
|
|
1388
|
+
kpiFlowStepLinkList: linkList,
|
|
1389
|
+
distributeCheck: true
|
|
1390
|
+
},
|
|
1391
|
+
rows,
|
|
1392
|
+
meta: {
|
|
1393
|
+
name: detailData?.name ?? null,
|
|
1394
|
+
kpiUserName: detailData?.kpiUserName ?? null,
|
|
1395
|
+
assessmentCycle: detailData?.assessmentCycle ?? null,
|
|
1396
|
+
flowStatus: detailData?.flowStatus ?? null,
|
|
1397
|
+
maxScore: detailData?.total ?? null
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
function estimateTotal(detailData, linkList) {
|
|
1402
|
+
const basicData = Array.isArray(detailData?.basicData) ? detailData.basicData : [];
|
|
1403
|
+
let weighted = 0;
|
|
1404
|
+
let weightSum = 0;
|
|
1405
|
+
for (const link of linkList) {
|
|
1406
|
+
const row = basicData.find((r) => Number(r?.dataRow) === Number(link.dataRow));
|
|
1407
|
+
const weight = Number(row?.weight);
|
|
1408
|
+
const kps = Number(link.kps);
|
|
1409
|
+
if (!Number.isFinite(weight) || !Number.isFinite(kps)) continue;
|
|
1410
|
+
weighted += kps * weight;
|
|
1411
|
+
weightSum += weight;
|
|
1412
|
+
}
|
|
1413
|
+
if (weightSum === 0) return null;
|
|
1414
|
+
return Math.round(weighted / weightSum * 100) / 100;
|
|
1415
|
+
}
|
|
1416
|
+
function toFlowRowView(row) {
|
|
1417
|
+
return {
|
|
1418
|
+
flowId: row?.id === void 0 || row?.id === null ? null : String(row.id),
|
|
1419
|
+
name: row?.name ?? null,
|
|
1420
|
+
kpiUserName: row?.kpiUserName ?? null,
|
|
1421
|
+
kpiSchemeName: row?.kpiSchemeName ?? null,
|
|
1422
|
+
department: row?.departmentDesc ?? null,
|
|
1423
|
+
subcompany: row?.subcompanyDesc ?? null,
|
|
1424
|
+
dateType: DATE_TYPE_LABELS[String(row?.dateType)] ?? null,
|
|
1425
|
+
assessmentCycle: row?.assessmentCycle ?? null,
|
|
1426
|
+
status: FLOW_STATUS_LABELS[String(row?.flowStatus)] ?? (row?.flowStatusDesc ?? null),
|
|
1427
|
+
score: row?.score ?? null,
|
|
1428
|
+
scoreDesc: row?.scoreDesc ?? null,
|
|
1429
|
+
createTime: row?.createTime ?? null,
|
|
1430
|
+
finishTime: row?.finishTime ?? null,
|
|
1431
|
+
detailUrl: row?.id === void 0 || row?.id === null ? null : `/sp/performance/flow/deal/detail/${row.id}`
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
function extractRows(data) {
|
|
1435
|
+
if (Array.isArray(data)) return data;
|
|
1436
|
+
if (data && Array.isArray(data.data)) return data.data;
|
|
1437
|
+
return [];
|
|
1438
|
+
}
|
|
1439
|
+
function extractTotal(data) {
|
|
1440
|
+
if (data && typeof data === "object" && !Array.isArray(data) && typeof data.total === "number") {
|
|
1441
|
+
return data.total;
|
|
1442
|
+
}
|
|
1443
|
+
return null;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
// src/shortcuts/performance/operations/flow-list.ts
|
|
1447
|
+
var API = {
|
|
1448
|
+
recent: "/api/workrelate/performance/flow/getPortalRecently",
|
|
1449
|
+
pending: "/api/workrelate/performance/flow/getPendingNums",
|
|
1450
|
+
todo: "/api/workrelate/performance/flow/pendinglist",
|
|
1451
|
+
done: "/api/workrelate/performance/flow/dealDonelist",
|
|
1452
|
+
list: "/api/workrelate/performance/flow/list"
|
|
1453
|
+
};
|
|
1454
|
+
async function recent(_args, env) {
|
|
1455
|
+
const data = unwrapWeaData(
|
|
1456
|
+
await env.host.request({ path: API.recent, body: {}, operation: "performance.flow.recent" }),
|
|
1457
|
+
"\u6700\u8FD1\u8003\u6838\u5217\u8868"
|
|
1458
|
+
);
|
|
1459
|
+
const rows = extractRows(data).map((row) => ({
|
|
1460
|
+
flowId: row?.id === void 0 || row?.id === null ? null : String(row.id),
|
|
1461
|
+
assessmentCycle: row?.assessmentCycle ?? null,
|
|
1462
|
+
scoreText: row?.score ?? null,
|
|
1463
|
+
detailUrl: row?.linkUrl ? String(row.linkUrl) : row?.id === void 0 || row?.id === null ? null : `/sp/performance/flow/deal/detail/${row.id}`
|
|
1464
|
+
}));
|
|
1465
|
+
return pfSuccess("performance.flow.recent", {
|
|
1466
|
+
count: rows.length,
|
|
1467
|
+
rows,
|
|
1468
|
+
note: "\u6700\u8FD1\u8003\u6838\u63A5\u53E3\u53EA\u8FD4\u56DE\u8003\u6838 id\u3001\u6210\u7EE9\u6587\u672C\u4E0E\u5468\u671F\uFF1B\u540D\u79F0/\u88AB\u8003\u6838\u4EBA\u9700\u7528 performance.flow.detail \u83B7\u53D6"
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
async function pending(_args, env) {
|
|
1472
|
+
const data = unwrapWeaData(
|
|
1473
|
+
await env.host.request({ path: API.pending, body: {}, operation: "performance.flow.pending" }),
|
|
1474
|
+
"\u5F85\u5904\u7406\u6570\u91CF"
|
|
1475
|
+
);
|
|
1476
|
+
return pfSuccess("performance.flow.pending", {
|
|
1477
|
+
scoreNum: data?.scoreNum ?? 0,
|
|
1478
|
+
approveNum: data?.approveNum ?? 0,
|
|
1479
|
+
interviewNum: data?.interviewNum ?? 0,
|
|
1480
|
+
auditNum: data?.auditNum ?? 0,
|
|
1481
|
+
frozenNum: data?.frozenNum ?? 0,
|
|
1482
|
+
totalNum: data?.totalNum ?? 0,
|
|
1483
|
+
hint: "scoreNum>0 \u8868\u793A\u6709\u5F85\u8BC4\u5206\u8003\u6838\uFF1B\u53D6\u660E\u7EC6\u7528 performance.flow.todo"
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
async function todo(args, env) {
|
|
1487
|
+
const tab = String(args.tab || "score");
|
|
1488
|
+
const current = Number(args.current ?? 1);
|
|
1489
|
+
const pageSize = Number(args.pageSize ?? 20);
|
|
1490
|
+
const data = unwrapWeaData(
|
|
1491
|
+
await env.host.request({
|
|
1492
|
+
path: API.todo,
|
|
1493
|
+
body: { status: tab, current, pageSize },
|
|
1494
|
+
operation: "performance.flow.todo"
|
|
1495
|
+
}),
|
|
1496
|
+
"\u5F85\u5904\u7406\u660E\u7EC6"
|
|
1497
|
+
);
|
|
1498
|
+
const rows = extractRows(data).map(toFlowRowView);
|
|
1499
|
+
return pfSuccess("performance.flow.todo", {
|
|
1500
|
+
tab,
|
|
1501
|
+
current,
|
|
1502
|
+
pageSize,
|
|
1503
|
+
count: rows.length,
|
|
1504
|
+
rows,
|
|
1505
|
+
paging: {
|
|
1506
|
+
note: "\u540E\u7AEF total \u6052\u4E3A 0\u3001hasMore \u6052\u4E3A false\uFF0C\u4E0D\u80FD\u7528\u4E8E\u5224\u65AD\u662F\u5426\u8FD8\u6709\u4E0B\u4E00\u9875\uFF1B\u672C\u9875\u884C\u6570\u5C0F\u4E8E pageSize \u5373\u5230\u672B\u9875",
|
|
1507
|
+
nextCurrent: rows.length < pageSize ? null : current + 1
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
async function done(args, env) {
|
|
1512
|
+
const current = Number(args.current ?? 1);
|
|
1513
|
+
const pageSize = Number(args.pageSize ?? 20);
|
|
1514
|
+
const searchParams = {};
|
|
1515
|
+
if (args.kpiUserName) {
|
|
1516
|
+
searchParams.formDatas = { userIdList: [{ userIdList: [{ id: String(args.kpiUserId ?? args.kpiUserName) }] }] };
|
|
1517
|
+
}
|
|
1518
|
+
if (args.keyword) searchParams.formDatas = { ...searchParams.formDatas || {}, name: String(args.keyword) };
|
|
1519
|
+
const data = unwrapWeaData(
|
|
1520
|
+
await env.host.request({
|
|
1521
|
+
path: API.done,
|
|
1522
|
+
body: { searchParams, current, pageSize },
|
|
1523
|
+
operation: "performance.flow.done"
|
|
1524
|
+
}),
|
|
1525
|
+
"\u5DF2\u529E\u5217\u8868"
|
|
1526
|
+
);
|
|
1527
|
+
const rows = extractRows(data).map(toFlowRowView);
|
|
1528
|
+
return pfSuccess("performance.flow.done", { current, pageSize, count: rows.length, rows });
|
|
1529
|
+
}
|
|
1530
|
+
async function list(args, env) {
|
|
1531
|
+
const dataTypes = Array.isArray(args.dataType) && args.dataType.length ? args.dataType.map((x) => String(x)) : ["mine"];
|
|
1532
|
+
const current = Number(args.current ?? 1);
|
|
1533
|
+
const pageSize = Number(args.pageSize ?? 20);
|
|
1534
|
+
const body = {
|
|
1535
|
+
dataType: dataTypes,
|
|
1536
|
+
// 前端同源写法:高级搜索侧也带同一份 dataType(flow/sub/list.tsx:127-136)
|
|
1537
|
+
searchParams: { formDatas: { dataType: dataTypes.map((t) => ({ dataType: [t] })) } },
|
|
1538
|
+
current,
|
|
1539
|
+
pageSize,
|
|
1540
|
+
dateType: args.dateType ?? null,
|
|
1541
|
+
startTime: args.startTime ?? null,
|
|
1542
|
+
endTime: args.endTime ?? null
|
|
1543
|
+
};
|
|
1544
|
+
if (args.status !== void 0) body.status = args.status;
|
|
1545
|
+
if (args.keyword) body.keywords = String(args.keyword);
|
|
1546
|
+
if (args.schemeId !== void 0) body.schemeId = args.schemeId;
|
|
1547
|
+
const data = unwrapWeaData(
|
|
1548
|
+
await env.host.request({ path: API.list, body, operation: "performance.flow.list" }),
|
|
1549
|
+
"\u8003\u6838\u6210\u7EE9\u5217\u8868"
|
|
1550
|
+
);
|
|
1551
|
+
const rows = extractRows(data).map(toFlowRowView);
|
|
1552
|
+
const scopeLabels = {
|
|
1553
|
+
mine: "\u6211\u7684",
|
|
1554
|
+
directsub: "\u76F4\u63A5\u4E0B\u5C5E",
|
|
1555
|
+
indirectsub: "\u95F4\u63A5\u4E0B\u5C5E",
|
|
1556
|
+
sub: "\u4E0B\u5C5E",
|
|
1557
|
+
all: "\u5168\u90E8",
|
|
1558
|
+
myself: "\u672C\u4EBA",
|
|
1559
|
+
pending: "\u5F85\u5904\u7406"
|
|
1560
|
+
};
|
|
1561
|
+
return pfSuccess("performance.flow.list", {
|
|
1562
|
+
scope: dataTypes.map((t) => scopeLabels[t] || t).join("+"),
|
|
1563
|
+
current,
|
|
1564
|
+
pageSize,
|
|
1565
|
+
count: rows.length,
|
|
1566
|
+
rows,
|
|
1567
|
+
total: extractTotal(data),
|
|
1568
|
+
paging: {
|
|
1569
|
+
note: "\u672C\u63A5\u53E3\u7684 total \u7531 pageUid \u51B3\u5B9A\uFF0C\u53EF\u80FD\u4E3A 0 \u6216\u4E0D\u51C6\u786E\uFF1B\u4EE5\u672C\u9875\u884C\u6570\u5224\u65AD\u662F\u5426\u5230\u672B\u9875",
|
|
1570
|
+
nextCurrent: rows.length < pageSize ? null : current + 1
|
|
1571
|
+
},
|
|
1572
|
+
statusLegend: FLOW_STATUS_LABELS
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
var flowListOperations = [
|
|
1576
|
+
{
|
|
1577
|
+
name: "performance.flow.recent",
|
|
1578
|
+
resource: "performance.flow",
|
|
1579
|
+
method: "query",
|
|
1580
|
+
action: "flow.recent",
|
|
1581
|
+
summary: "\u6700\u8FD1\u5DF2\u6709\u8003\u6838\u6210\u7EE9\u5217\u8868\uFF08\u6211\u7684\uFF09",
|
|
1582
|
+
capability: "performance.flow.query",
|
|
1583
|
+
risk: "read",
|
|
1584
|
+
inputSchema: schemaOf({}),
|
|
1585
|
+
handler: recent
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
name: "performance.flow.pending",
|
|
1589
|
+
resource: "performance.flow",
|
|
1590
|
+
method: "query",
|
|
1591
|
+
action: "flow.pending",
|
|
1592
|
+
summary: "\u5F85\u5904\u7406\u6570\u91CF\uFF08\u5F85\u8BC4\u5206/\u5F85\u5BA1\u6279/\u9762\u8C08/\u5BA1\u6838\uFF09",
|
|
1593
|
+
capability: "performance.flow.query",
|
|
1594
|
+
risk: "read",
|
|
1595
|
+
inputSchema: schemaOf({}),
|
|
1596
|
+
handler: pending
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
name: "performance.flow.todo",
|
|
1600
|
+
resource: "performance.flow",
|
|
1601
|
+
method: "query",
|
|
1602
|
+
action: "flow.todo",
|
|
1603
|
+
summary: "\u5F85\u5904\u7406\u660E\u7EC6\u5217\u8868\uFF08\u9ED8\u8BA4\u5F85\u8BC4\u5206\uFF1Btotal/hasMore \u4E0D\u53EF\u4FE1\uFF09",
|
|
1604
|
+
capability: "performance.flow.query",
|
|
1605
|
+
risk: "read",
|
|
1606
|
+
inputSchema: schemaOf({
|
|
1607
|
+
tab: { type: "string", enum: ["score", "approve"], description: "\u5F85\u8BC4\u5206(score) \u6216 \u5F85\u5BA1\u6279(approve)\uFF0C\u9ED8\u8BA4 score" },
|
|
1608
|
+
current: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" },
|
|
1609
|
+
pageSize: { type: "integer", minimum: 1, maximum: 100, description: "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20" }
|
|
1610
|
+
}),
|
|
1611
|
+
handler: todo
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
name: "performance.flow.done",
|
|
1615
|
+
resource: "performance.flow",
|
|
1616
|
+
method: "query",
|
|
1617
|
+
action: "flow.done",
|
|
1618
|
+
summary: "\u5DF2\u529E\u8003\u6838\u5217\u8868\uFF08\u6211\u4F5C\u4E3A\u8BC4\u5206/\u5BA1\u6279\u4EBA\u5DF2\u5904\u7406\u7684\uFF09",
|
|
1619
|
+
capability: "performance.flow.query",
|
|
1620
|
+
risk: "read",
|
|
1621
|
+
inputSchema: schemaOf({
|
|
1622
|
+
keyword: { type: "string", description: "\u8003\u6838\u540D\u79F0\u5173\u952E\u5B57" },
|
|
1623
|
+
kpiUserId: { type: "string", description: "\u88AB\u8003\u6838\u4EBA userId\uFF08\u5B57\u7B26\u4E32\uFF0C\u6309\u88AB\u8003\u6838\u4EBA\u8FC7\u6EE4\uFF09" },
|
|
1624
|
+
current: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" },
|
|
1625
|
+
pageSize: { type: "integer", minimum: 1, maximum: 100, description: "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20" }
|
|
1626
|
+
}),
|
|
1627
|
+
handler: done
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
name: "performance.flow.list",
|
|
1631
|
+
resource: "performance.flow",
|
|
1632
|
+
method: "query",
|
|
1633
|
+
action: "flow.list",
|
|
1634
|
+
summary: "\u8003\u6838\u6210\u7EE9\u5217\u8868\uFF1A\u6211\u7684/\u76F4\u63A5\u4E0B\u5C5E/\u95F4\u63A5\u4E0B\u5C5E/\u4E0B\u5C5E/\u5168\u90E8/\u672C\u4EBA/\u5F85\u5904\u7406\uFF08dataType \u5355\u9009\u6216\u7EC4\u5408\uFF09",
|
|
1635
|
+
capability: "performance.flow.query",
|
|
1636
|
+
risk: "read",
|
|
1637
|
+
inputSchema: schemaOf({
|
|
1638
|
+
dataType: {
|
|
1639
|
+
type: "array",
|
|
1640
|
+
items: { type: "string", enum: ["mine", "directsub", "indirectsub", "sub", "all", "myself", "pending"] },
|
|
1641
|
+
description: '\u67E5\u8BE2\u8303\u56F4\uFF1Amine=\u6211\u7684 / directsub=\u76F4\u63A5\u4E0B\u5C5E / indirectsub=\u95F4\u63A5\u4E0B\u5C5E / sub=\u4E0B\u5C5E / all=\u5168\u90E8 / myself=\u672C\u4EBA / pending=\u5F85\u5904\u7406\uFF1B\u9ED8\u8BA4 ["mine"]'
|
|
1642
|
+
},
|
|
1643
|
+
status: { type: "array", items: { type: "string" }, description: "\u6D41\u7A0B\u72B6\u6001\u8FC7\u6EE4\uFF08\u53EF\u9009\uFF09" },
|
|
1644
|
+
dateType: { type: "string", enum: ["year", "halfyear", "quarter", "month"], description: "\u8003\u6838\u5468\u671F\u7C7B\u578B\uFF08\u53EF\u9009\uFF09" },
|
|
1645
|
+
startTime: { type: ["string", "integer"], description: "\u5F00\u59CB\u65F6\u95F4\uFF08\u53EF\u9009\uFF09\uFF1B\u6309\u524D\u7AEF\u540C\u6E90\u5199\u6CD5\u539F\u6837\u900F\u4F20" },
|
|
1646
|
+
endTime: { type: ["string", "integer"], description: "\u7ED3\u675F\u65F6\u95F4\uFF08\u53EF\u9009\uFF09" },
|
|
1647
|
+
keyword: { type: "string", description: "\u8003\u6838\u540D\u79F0\u5173\u952E\u5B57\uFF08\u53EF\u9009\uFF09" },
|
|
1648
|
+
schemeId: { type: ["string", "integer"], description: "\u9650\u5B9A\u67D0\u4E2A\u65B9\u6848\uFF08\u53EF\u9009\uFF09" },
|
|
1649
|
+
current: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" },
|
|
1650
|
+
pageSize: { type: "integer", minimum: 1, maximum: 100, description: "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20" }
|
|
1651
|
+
}),
|
|
1652
|
+
handler: list
|
|
1653
|
+
}
|
|
1654
|
+
];
|
|
1655
|
+
|
|
1656
|
+
// src/shortcuts/performance/operations/flow-detail.ts
|
|
1657
|
+
async function detail2(args, env) {
|
|
1658
|
+
if (args.flowId === void 0 || args.flowId === null || args.flowId === "") {
|
|
1659
|
+
throw pfValidationError("flow_id_missing", "\u7F3A\u5C11\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF09");
|
|
1660
|
+
}
|
|
1661
|
+
const flowId = String(args.flowId);
|
|
1662
|
+
const data = unwrapWeaData(
|
|
1663
|
+
await env.host.request({
|
|
1664
|
+
path: `/api/workrelate/performance/flow/detail/${encodeURIComponent(flowId)}`,
|
|
1665
|
+
method: "GET",
|
|
1666
|
+
operation: "performance.flow.detail"
|
|
1667
|
+
}),
|
|
1668
|
+
"\u8003\u6838\u8BE6\u60C5"
|
|
1669
|
+
);
|
|
1670
|
+
const column = parseScoreColumn(data);
|
|
1671
|
+
const keys = column ? rowValueKeys(column.stepId, column.scoreUserId) : null;
|
|
1672
|
+
const indicatorRows = (Array.isArray(data?.basicData) ? data.basicData : []).map((row, index) => ({
|
|
1673
|
+
index: index + 1,
|
|
1674
|
+
dataRow: row?.dataRow,
|
|
1675
|
+
name: row?.type ?? null,
|
|
1676
|
+
mode: INDICATOR_MODE_LABELS[String(row?.indicatorMode)] ?? null,
|
|
1677
|
+
weight: row?.weight === void 0 || row?.weight === null ? null : `${row.weight}%`,
|
|
1678
|
+
targetValue: keys ? row?.[keys.targetKey] ?? null : null,
|
|
1679
|
+
actualValue: keys ? row?.[keys.actualKey] ?? null : null,
|
|
1680
|
+
score: keys ? row?.[keys.kpsKey] ?? null : null,
|
|
1681
|
+
description: row?.describe ?? row?.indicatorDescription ?? null
|
|
1682
|
+
}));
|
|
1683
|
+
return pfSuccess("performance.flow.detail", {
|
|
1684
|
+
flowId,
|
|
1685
|
+
name: data?.name ?? null,
|
|
1686
|
+
kpiUserName: data?.kpiUserName ?? null,
|
|
1687
|
+
assessmentCycle: data?.assessmentCycle ?? null,
|
|
1688
|
+
status: FLOW_STATUS_LABELS[String(data?.flowStatus)] ?? (data?.flowStatus ?? null),
|
|
1689
|
+
score: data?.score ?? null,
|
|
1690
|
+
maxScore: data?.total ?? null,
|
|
1691
|
+
canScore: data?.canScore ?? false,
|
|
1692
|
+
currentStep: data?.kpiCurrentStep ?? null,
|
|
1693
|
+
indicatorRows,
|
|
1694
|
+
detailUrl: buildDetailUrl(flowId),
|
|
1695
|
+
data
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
async function assess(args, env) {
|
|
1699
|
+
if (args.flowId === void 0 || args.flowId === null || args.flowId === "") {
|
|
1700
|
+
throw pfValidationError("flow_id_missing", "\u7F3A\u5C11\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF09");
|
|
1701
|
+
}
|
|
1702
|
+
const context = await buildAssessContext(env.host, String(args.flowId), "performance.flow.assess");
|
|
1703
|
+
return pfSuccess("performance.flow.assess", {
|
|
1704
|
+
...context,
|
|
1705
|
+
scoringHints: [
|
|
1706
|
+
"\u5B9A\u91CF\u6307\u6807\uFF1A\u4EE5\u76EE\u6807\u503C\u4E0E\u5B9E\u9645\u503C\uFF08\u6570\u636E\u6E90\u805A\u5408\u7ED3\u679C\uFF09\u4E3A\u4F9D\u636E\uFF0C\u5148\u7B97\u8FBE\u6210\u7387\u518D\u6620\u5C04\u5206\u6570",
|
|
1707
|
+
"\u5B9A\u6027\u6307\u6807\uFF1A\u57FA\u4E8E\u6307\u6807\u8BF4\u660E\u4E0E\u53EF\u7528\u6570\u636E\u7ED9\u51FA\u53EF\u8FFD\u6EAF\u7684\u5224\u65AD\u4F9D\u636E\uFF0C\u4E0D\u7A7A\u6CDB",
|
|
1708
|
+
"\u6570\u636E\u6E90 error \u5B57\u6BB5\u975E\u7A7A\u7684\u6307\u6807\u6807\u6CE8\u300C\u65E0\u6CD5\u53D6\u6570\u300D\uFF0C\u4E0D\u5F3A\u884C\u6253\u5206",
|
|
1709
|
+
"\u8BC4\u5206\u4E0A\u9650\u4E3A\u6EE1\u5206\uFF08maxScore\uFF09\uFF1B\u8D85\u51FA\u4F1A\u88AB\u62D2\u7EDD\uFF0C\u4E0D\u505A\u9759\u9ED8\u622A\u65AD"
|
|
1710
|
+
]
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
var flowDetailOperations = [
|
|
1714
|
+
{
|
|
1715
|
+
name: "performance.flow.detail",
|
|
1716
|
+
resource: "performance.flow",
|
|
1717
|
+
method: "query",
|
|
1718
|
+
action: "flow.detail",
|
|
1719
|
+
summary: "\u8003\u6838\u8BE6\u60C5\uFF08\u6307\u6807\u884C + \u5F53\u524D\u8BC4\u5206 + \u5B8C\u6574\u539F\u6587\uFF09",
|
|
1720
|
+
capability: "performance.flow.query",
|
|
1721
|
+
risk: "read",
|
|
1722
|
+
inputSchema: schemaOf(
|
|
1723
|
+
{ flowId: { type: "string", description: "\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF0C\u5B57\u7B26\u4E32\uFF09" } },
|
|
1724
|
+
{ required: ["flowId"] }
|
|
1725
|
+
),
|
|
1726
|
+
handler: detail2
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
name: "performance.flow.assess",
|
|
1730
|
+
resource: "performance.flow",
|
|
1731
|
+
method: "query",
|
|
1732
|
+
action: "flow.assess",
|
|
1733
|
+
summary: "\u7EC4\u88C5 AI \u8BC4\u5206\u4E0A\u4E0B\u6587\uFF08\u9010\u6307\u6807\u76EE\u6807/\u5B9E\u9645/\u5F53\u524D\u8BC4\u5206 + \u6570\u636E\u6E90\u805A\u5408\u503C\uFF09",
|
|
1734
|
+
capability: "performance.flow.score",
|
|
1735
|
+
risk: "read",
|
|
1736
|
+
inputSchema: schemaOf(
|
|
1737
|
+
{ flowId: { type: "string", description: "\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF0C\u5B57\u7B26\u4E32\uFF09" } },
|
|
1738
|
+
{ required: ["flowId"] }
|
|
1739
|
+
),
|
|
1740
|
+
handler: assess
|
|
1741
|
+
}
|
|
1742
|
+
];
|
|
1743
|
+
|
|
1744
|
+
// src/shortcuts/performance/operations/flow-score.ts
|
|
1745
|
+
var DETAIL_PATH4 = "/api/workrelate/performance/flow/detail";
|
|
1746
|
+
var STAGE_PATH = "/api/workrelate/performance/flow/countBasicFlowTotal";
|
|
1747
|
+
var SUBMIT_PATH = "/api/workrelate/performance/flow/updateScore";
|
|
1748
|
+
var PAYLOAD_SCHEMA = {
|
|
1749
|
+
type: "array",
|
|
1750
|
+
description: "\u8BC4\u5206\u884C\u6570\u7EC4\uFF1A[{dataRow, kps, targetValue?, actualValue?, remark?}]\uFF1BdataRow \u4E0E kps \u5FC5\u586B\uFF08\u516C\u5F0F\u884C kps \u53EF\u7701\u7565\uFF09",
|
|
1751
|
+
items: {
|
|
1752
|
+
type: "object",
|
|
1753
|
+
additionalProperties: false,
|
|
1754
|
+
properties: {
|
|
1755
|
+
dataRow: { type: "integer", description: "\u6307\u6807\u884C\u53F7\uFF08\u5FC5\u586B\uFF0C\u53D6\u81EA flow.assess \u7684 indicators[].dataRow\uFF09" },
|
|
1756
|
+
kps: { type: ["string", "number"], description: "\u8BC4\u5206\uFF08\u5FC5\u586B\uFF1B\u4E0D\u5F97\u8D85\u8FC7\u6EE1\u5206\uFF09" },
|
|
1757
|
+
targetValue: { type: ["string", "number"], description: "\u76EE\u6807\u503C\uFF08\u5B9A\u91CF\u6307\u6807\u5FC5\u586B\uFF0C\u53EF\u7701\u7565\u53D6\u8BE6\u60C5\u5DF2\u6709\u503C\uFF09" },
|
|
1758
|
+
actualValue: { type: ["string", "number"], description: "\u5B9E\u9645\u503C\uFF08dataSource=1 \u6216\u6570\u636E\u6E90\u6A21\u5F0F\u5141\u8BB8\u7F16\u8F91\u65F6\u5FC5\u586B\uFF09" },
|
|
1759
|
+
remark: { type: "string", description: "\u8BC4\u5206\u5907\u6CE8\uFF08\u53EF\u9009\uFF0C\u9875\u9762\u5907\u6CE8\u6846\u540C\u6E90\uFF09" }
|
|
1760
|
+
},
|
|
1761
|
+
required: ["dataRow"]
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
async function loadDetail(env, flowId, operation) {
|
|
1765
|
+
const data = unwrapWeaData(
|
|
1766
|
+
await env.host.request({
|
|
1767
|
+
path: `${DETAIL_PATH4}/${encodeURIComponent(flowId)}`,
|
|
1768
|
+
method: "GET",
|
|
1769
|
+
operation
|
|
1770
|
+
}),
|
|
1771
|
+
"\u8003\u6838\u8BE6\u60C5"
|
|
1772
|
+
);
|
|
1773
|
+
const column = parseScoreColumn(data);
|
|
1774
|
+
if (!column) {
|
|
1775
|
+
throw pfValidationError(
|
|
1776
|
+
"not_scorable",
|
|
1777
|
+
"\u5F53\u524D\u7528\u6237\u5BF9\u8BE5\u8003\u6838\u4E0D\u53EF\u8BC4\u5206\uFF08\u627E\u4E0D\u5230\u53EF\u7F16\u8F91\u8BC4\u5206\u5217\uFF09\uFF1A\u53EF\u80FD\u4E0D\u662F\u672C\u8F6E\u8BC4\u5206\u4EBA\uFF0C\u6216\u8003\u6838\u4E0D\u5728\u8BC4\u5206\u9636\u6BB5",
|
|
1778
|
+
{ flowStatus: data?.flowStatus ?? null, canScore: data?.canScore ?? null }
|
|
1779
|
+
);
|
|
1780
|
+
}
|
|
1781
|
+
return { data, column };
|
|
1782
|
+
}
|
|
1783
|
+
async function stage(args, env) {
|
|
1784
|
+
if (args.confirm !== true) {
|
|
1785
|
+
throw pfConfirmationError("performance.flow.score.stage", {
|
|
1786
|
+
hint: "\u6682\u5B58\u4F1A\u628A\u8BC4\u5206\u5199\u8FDB\u8003\u6838\u8BE6\u60C5\u9875\uFF08\u4E0D\u6D41\u8F6C\u3001\u53EF\u8986\u76D6\uFF09\u3002\u786E\u8BA4\u7528\u6237\u5DF2\u77E5\u6653\u8BE5\u526F\u4F5C\u7528\u540E\uFF0C\u5E26 confirm=true \u91CD\u8BD5"
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
const flowId = String(args.flowId ?? "");
|
|
1790
|
+
if (!flowId) throw pfValidationError("flow_id_missing", "\u7F3A\u5C11\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF09");
|
|
1791
|
+
const { data, column } = await loadDetail(env, flowId, "performance.flow.score.stage");
|
|
1792
|
+
const built = buildScoreRequest(data, args.rows, column);
|
|
1793
|
+
const response = await env.host.request({
|
|
1794
|
+
path: STAGE_PATH,
|
|
1795
|
+
body: {
|
|
1796
|
+
stepId: column.stepId,
|
|
1797
|
+
operater: column.scoreUserId,
|
|
1798
|
+
flowid: flowId,
|
|
1799
|
+
stepLinkData: built.body.kpiFlowStepLinkList,
|
|
1800
|
+
type: "1"
|
|
1801
|
+
},
|
|
1802
|
+
operation: "performance.flow.score.stage"
|
|
1803
|
+
});
|
|
1804
|
+
const computed = unwrapWeaData(response, "\u6682\u5B58\u8BC4\u5206");
|
|
1805
|
+
const missingRemark = (Array.isArray(args.rows) ? args.rows : []).filter((row) => !row?.remark).map((row) => row?.dataRow);
|
|
1806
|
+
return pfSuccess("performance.flow.score.stage", {
|
|
1807
|
+
flowId,
|
|
1808
|
+
staged: true,
|
|
1809
|
+
computedTotal: computed?.score ?? computed?.finalScore ?? null,
|
|
1810
|
+
backendTotalScore: computed?.totalScore ?? null,
|
|
1811
|
+
estimatedTotal: estimateTotal(data, built.body.kpiFlowStepLinkList),
|
|
1812
|
+
rows: built.rows,
|
|
1813
|
+
detailUrl: buildDetailUrl(flowId, built.rows),
|
|
1814
|
+
sideEffect: "\u8BC4\u5206\u5DF2\u5199\u5165\u8BE6\u60C5\u9875\uFF08\u4E0D\u6D41\u8F6C\u3001\u53EF\u8986\u76D6\uFF09\uFF1B\u82E5\u4E0D\u63D0\u4EA4\uFF0C\u9875\u9762\u4F1A\u4FDD\u7559 AI \u9884\u586B\u5206\uFF0C\u53EF\u5728\u9875\u9762\u6E05\u9664",
|
|
1815
|
+
...missingRemark.length ? { warnings: [`\u4EE5\u4E0B\u6307\u6807\u884C\u672A\u63D0\u4F9B\u8BC4\u5206\u7406\u7531\uFF08remark\uFF09\uFF0C\u9875\u9762\u5907\u6CE8\u5217\u4F1A\u662F\u7A7A\u7684\uFF1AdataRow=${missingRemark.join("\u3001")}\u2014\u2014\u6BCF\u884C\u90FD\u5E94\u628A\u8BC4\u5206\u7406\u7531\u5199\u5165 remark`] } : {},
|
|
1816
|
+
next: "\u7528\u6237\u5728\u8BE6\u60C5\u9875\u67E5\u770B\u540E\uFF0C\u53EF\u81EA\u884C\u70B9\u300C\u786E\u8BA4\u5E76\u901A\u8FC7\u300D\uFF0C\u6216\u8BA9 AI \u8D70 performance.flow.score.submit.prepare \u2192 apply"
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
async function submitPrepare(args, env) {
|
|
1820
|
+
const flowId = String(args.flowId ?? "");
|
|
1821
|
+
if (!flowId) throw pfValidationError("flow_id_missing", "\u7F3A\u5C11\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF09");
|
|
1822
|
+
const { data, column } = await loadDetail(env, flowId, "performance.flow.score.submit.prepare");
|
|
1823
|
+
const built = buildScoreRequest(data, args.rows, column);
|
|
1824
|
+
const fingerprint = schemeFingerprint(built.body);
|
|
1825
|
+
const continuation = await env.continuation.issue({
|
|
1826
|
+
operation: "performance.flow.score.submit.apply",
|
|
1827
|
+
fingerprint
|
|
1828
|
+
});
|
|
1829
|
+
return pfSuccess("performance.flow.score.submit.prepare", {
|
|
1830
|
+
continuation,
|
|
1831
|
+
fingerprint,
|
|
1832
|
+
preview: {
|
|
1833
|
+
flowId,
|
|
1834
|
+
name: built.meta.name,
|
|
1835
|
+
kpiUserName: built.meta.kpiUserName,
|
|
1836
|
+
assessmentCycle: built.meta.assessmentCycle,
|
|
1837
|
+
maxScore: built.meta.maxScore,
|
|
1838
|
+
estimatedTotal: estimateTotal(data, built.body.kpiFlowStepLinkList),
|
|
1839
|
+
rows: built.rows,
|
|
1840
|
+
missingRemark: (Array.isArray(args.rows) ? args.rows : []).filter((row) => !row?.remark).map((row) => row?.dataRow),
|
|
1841
|
+
impact: "\u63D0\u4EA4\u4F1A\u6D41\u8F6C\u8BC4\u5206\u8282\u70B9\uFF1B\u6240\u6709\u8282\u70B9\u8BC4\u5B8C\u5C06\u7ED3\u675F\u8003\u6838\uFF08finished\uFF09\uFF0C\u53EF\u80FD\u89E6\u53D1 ESB \u52A8\u4F5C\u6D41\u4E0E\u6D88\u606F\u63D0\u9192"
|
|
1842
|
+
}
|
|
1843
|
+
}, {
|
|
1844
|
+
continuation,
|
|
1845
|
+
fingerprint,
|
|
1846
|
+
confirmHint: "\u63D0\u4EA4\u4E3A\u9AD8\u98CE\u9669\u5199\u5165\uFF1A\u5411\u7528\u6237\u5C55\u793A preview \u5E76\u53D6\u5F97\u660E\u786E\u540C\u610F\u540E\uFF0C\u5E26 confirm=true \u4E0E continuation \u8C03\u7528 performance.flow.score.submit.apply"
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
async function submitApply(args, env) {
|
|
1850
|
+
if (args.confirm !== true) {
|
|
1851
|
+
throw pfConfirmationError("performance.flow.score.submit.apply", {
|
|
1852
|
+
hint: "\u63D0\u4EA4\u4F1A\u6D41\u8F6C\u8003\u6838\u6D41\u7A0B\u8282\u70B9\uFF0C\u5FC5\u987B\u7528\u6237\u660E\u786E\u540C\u610F"
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
if (typeof args.continuation !== "string" || !args.continuation) {
|
|
1856
|
+
throw pfValidationError("continuation_missing", "\u7F3A\u5C11 continuation\uFF08\u5148\u8FD0\u884C performance.flow.score.submit.prepare\uFF09");
|
|
1857
|
+
}
|
|
1858
|
+
const verified = await env.continuation.verify(args.continuation, "performance.flow.score.submit.apply");
|
|
1859
|
+
const flowId = String(args.flowId ?? "");
|
|
1860
|
+
if (!flowId) throw pfValidationError("flow_id_missing", "\u7F3A\u5C11\u8003\u6838\u6D41\u7A0B id\uFF08flowId\uFF09");
|
|
1861
|
+
const { data, column } = await loadDetail(env, flowId, "performance.flow.score.submit.apply");
|
|
1862
|
+
const built = buildScoreRequest(data, args.rows, column);
|
|
1863
|
+
const fingerprint = schemeFingerprint(built.body);
|
|
1864
|
+
if (String(verified.fingerprint) !== fingerprint) {
|
|
1865
|
+
throw pfValidationError("fingerprint_mismatch", "\u63D0\u4EA4\u5185\u5BB9\u4E0E\u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF08\u8BC4\u5206\u6216\u8003\u6838\u6570\u636E\u5728 prepare \u540E\u53D1\u751F\u53D8\u5316\uFF09\uFF0C\u8BF7\u91CD\u65B0 prepare \u5E76\u518D\u6B21\u786E\u8BA4", {
|
|
1866
|
+
expected: verified.fingerprint,
|
|
1867
|
+
actual: fingerprint
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
const body = { ...built.body, distributeCheck: args.skipDistributeCheck === true ? false : true };
|
|
1871
|
+
let response;
|
|
1872
|
+
try {
|
|
1873
|
+
response = await env.host.request({
|
|
1874
|
+
path: SUBMIT_PATH,
|
|
1875
|
+
body,
|
|
1876
|
+
operation: "performance.flow.score.submit.apply"
|
|
1877
|
+
});
|
|
1878
|
+
} catch (error) {
|
|
1879
|
+
const message = error?.message ?? String(error);
|
|
1880
|
+
if (/数据已更新|182612/.test(message)) {
|
|
1881
|
+
throw pfFail("\u8BE5\u8003\u6838\u5DF2\u7531\u4F60\u63D0\u4EA4\u8FC7\uFF08\u6570\u636E\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\uFF09\u2014\u2014\u4E0D\u8981\u91CD\u8BD5\uFF0C\u76F4\u63A5\u56DE\u8BFB\u6838\u5BF9\u72B6\u6001", { flowId });
|
|
1882
|
+
}
|
|
1883
|
+
throw error;
|
|
1884
|
+
}
|
|
1885
|
+
const remindType = response?.data?.remindType ?? response?.remindType ?? null;
|
|
1886
|
+
if (remindType === "stop") {
|
|
1887
|
+
throw pfFail("\u7EE9\u6548\u5F3A\u5236\u5206\u5E03\u6821\u9A8C\u672A\u901A\u8FC7\uFF08stop\uFF09\uFF1A\u672C\u6B21\u672A\u6D41\u8F6C\uFF0C\u8BF7\u8C03\u6574\u8BC4\u5206\u6216\u8054\u7CFB\u7BA1\u7406\u5458", { flowId, remindType });
|
|
1888
|
+
}
|
|
1889
|
+
if (remindType === "warning") {
|
|
1890
|
+
return pfSuccess("performance.flow.score.submit.apply", {
|
|
1891
|
+
flowId,
|
|
1892
|
+
submitted: false,
|
|
1893
|
+
distributeConflict: "warning",
|
|
1894
|
+
message: "\u7EE9\u6548\u5206\u5E03\u6BD4\u4F8B\u51B2\u7A81\uFF08warning\uFF09\uFF1A\u672C\u6B21\u672A\u6D41\u8F6C\u3002\u5411\u7528\u6237\u8BF4\u660E\u540E\uFF0C\u53EF\u5E26 skipDistributeCheck=true \u91CD\u65B0\u63D0\u4EA4",
|
|
1895
|
+
estimatedTotal: estimateTotal(data, built.body.kpiFlowStepLinkList)
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
unwrapWeaData(response, "\u63D0\u4EA4\u8BC4\u5206");
|
|
1899
|
+
const after = unwrapWeaData(
|
|
1900
|
+
await env.host.request({
|
|
1901
|
+
path: `${DETAIL_PATH4}/${encodeURIComponent(flowId)}`,
|
|
1902
|
+
method: "GET",
|
|
1903
|
+
operation: "performance.flow.score.submit.apply"
|
|
1904
|
+
}),
|
|
1905
|
+
"\u63D0\u4EA4\u540E\u56DE\u8BFB"
|
|
1906
|
+
);
|
|
1907
|
+
const keys = { kpsKey: `kps${column.stepId}-${column.scoreUserId}` };
|
|
1908
|
+
const verifyRows = (Array.isArray(after?.basicData) ? after.basicData : []).map((row) => ({
|
|
1909
|
+
dataRow: row?.dataRow,
|
|
1910
|
+
name: row?.type ?? null,
|
|
1911
|
+
score: row?.[keys.kpsKey] ?? null
|
|
1912
|
+
}));
|
|
1913
|
+
return pfSuccess("performance.flow.score.submit.apply", {
|
|
1914
|
+
flowId,
|
|
1915
|
+
submitted: true,
|
|
1916
|
+
total: after?.score ?? null,
|
|
1917
|
+
flowStatus: after?.flowStatus ?? null,
|
|
1918
|
+
verify: { rows: verifyRows },
|
|
1919
|
+
detailUrl: buildDetailUrl(flowId),
|
|
1920
|
+
next: "\u5DF2\u56DE\u8BFB\u6838\u5BF9\uFF1B\u5982\u72B6\u6001\u4E3A\u5DF2\u7ED3\u675F(finished)\uFF0C\u8BE5\u8003\u6838\u672C\u8F6E\u5DF2\u5B8C\u6210"
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
var flowScoreOperations = [
|
|
1924
|
+
{
|
|
1925
|
+
name: "performance.flow.score.stage",
|
|
1926
|
+
resource: "performance.flow",
|
|
1927
|
+
method: "apply",
|
|
1928
|
+
action: "flow.score.stage",
|
|
1929
|
+
summary: "\u8BC4\u5206\u6682\u5B58\u5230\u8003\u6838\u8BE6\u60C5\u9875\uFF08\u4F4E\u98CE\u9669\u9884\u89C8\u5199\uFF1A\u4E0D\u6D41\u8F6C\u3001\u53EF\u8986\u76D6\u3001\u9875\u9762\u7ACB\u5373\u53EF\u89C1\uFF09",
|
|
1930
|
+
capability: "performance.flow.score",
|
|
1931
|
+
risk: "write",
|
|
1932
|
+
requiresConfirmation: true,
|
|
1933
|
+
inputSchema: schemaOf(
|
|
1934
|
+
{
|
|
1935
|
+
flowId: { type: "string", description: "\u8003\u6838\u6D41\u7A0B id\uFF08\u5B57\u7B26\u4E32\uFF09" },
|
|
1936
|
+
rows: PAYLOAD_SCHEMA,
|
|
1937
|
+
confirm: { type: "boolean", description: "\u5FC5\u987B true\uFF08\u7528\u6237\u5DF2\u77E5\u6653\u4F1A\u5199\u5165\u8BE6\u60C5\u9875\u3001\u4E0D\u6D41\u8F6C\u3001\u53EF\u8986\u76D6\uFF09" }
|
|
1938
|
+
},
|
|
1939
|
+
{ required: ["flowId", "rows", "confirm"] }
|
|
1940
|
+
),
|
|
1941
|
+
handler: stage
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
name: "performance.flow.score.submit.prepare",
|
|
1945
|
+
resource: "performance.flow",
|
|
1946
|
+
method: "prepare",
|
|
1947
|
+
action: "flow.score.submit",
|
|
1948
|
+
summary: "\u63D0\u4EA4\u8BC4\u5206\u524D\u7EC4\u88C5\u4E0E\u6821\u9A8C\uFF08\u4E0D\u843D\u5E93\uFF09\uFF1A\u524D\u7F6E\u6821\u9A8C kps/\u76EE\u6807\u503C/\u5B9E\u9645\u503C/\u6EE1\u5206\uFF0C\u8FD4\u56DE\u786E\u8BA4\u6458\u8981\u4E0E continuation",
|
|
1949
|
+
capability: "performance.flow.score",
|
|
1950
|
+
risk: "write",
|
|
1951
|
+
requiresConfirmation: true,
|
|
1952
|
+
inputSchema: schemaOf(
|
|
1953
|
+
{
|
|
1954
|
+
flowId: { type: "string", description: "\u8003\u6838\u6D41\u7A0B id\uFF08\u5B57\u7B26\u4E32\uFF09" },
|
|
1955
|
+
rows: PAYLOAD_SCHEMA
|
|
1956
|
+
},
|
|
1957
|
+
{ required: ["flowId", "rows"] }
|
|
1958
|
+
),
|
|
1959
|
+
handler: submitPrepare
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
name: "performance.flow.score.submit.apply",
|
|
1963
|
+
resource: "performance.flow",
|
|
1964
|
+
method: "apply",
|
|
1965
|
+
action: "flow.score.submit",
|
|
1966
|
+
summary: "\u786E\u8BA4\u540E\u63D0\u4EA4\u8BC4\u5206\uFF08\u6D41\u8F6C\u8282\u70B9\u3001\u53EF\u80FD\u7ED3\u675F\u8003\u6838\u5E76\u89E6\u53D1\u63D0\u9192\uFF09\uFF0C\u6210\u529F\u540E\u81EA\u52A8\u56DE\u8BFB",
|
|
1967
|
+
capability: "performance.flow.score",
|
|
1968
|
+
risk: "write",
|
|
1969
|
+
requiresConfirmation: true,
|
|
1970
|
+
inputSchema: schemaOf(
|
|
1971
|
+
{
|
|
1972
|
+
flowId: { type: "string", description: "\u8003\u6838\u6D41\u7A0B id\uFF08\u5B57\u7B26\u4E32\uFF09" },
|
|
1973
|
+
rows: PAYLOAD_SCHEMA,
|
|
1974
|
+
confirm: { type: "boolean", description: "\u5FC5\u987B true\uFF08\u7528\u6237\u5DF2\u660E\u786E\u540C\u610F\u63D0\u4EA4\uFF09" },
|
|
1975
|
+
continuation: { type: "string", description: "prepare \u8FD4\u56DE\u7684 continuation" },
|
|
1976
|
+
skipDistributeCheck: { type: "boolean", description: "\u4EC5\u5F53\u7528\u6237\u786E\u8BA4\u63A5\u53D7\u5206\u5E03\u51B2\u7A81\u540E\u8DF3\u8FC7\u5F3A\u5236\u5206\u5E03\u6821\u9A8C\uFF08warning \u65F6\u7528\uFF09" }
|
|
1977
|
+
},
|
|
1978
|
+
{ required: ["flowId", "rows", "confirm", "continuation"] }
|
|
1979
|
+
),
|
|
1980
|
+
handler: submitApply
|
|
1981
|
+
}
|
|
1982
|
+
];
|
|
1983
|
+
|
|
1132
1984
|
// src/shortcuts/performance/operations/registry.ts
|
|
1133
1985
|
var definitions = [
|
|
1134
1986
|
...hrmResolveOperations,
|
|
1135
1987
|
...schemeDetailOperations,
|
|
1136
1988
|
...schemeDraftOperations,
|
|
1137
|
-
...schemePublishOperations
|
|
1989
|
+
...schemePublishOperations,
|
|
1990
|
+
...flowListOperations,
|
|
1991
|
+
...flowDetailOperations,
|
|
1992
|
+
...flowScoreOperations
|
|
1138
1993
|
];
|
|
1139
1994
|
var registry = /* @__PURE__ */ new Map();
|
|
1140
1995
|
for (const definition of definitions) {
|
|
@@ -1188,12 +2043,12 @@ function buildOperations() {
|
|
|
1188
2043
|
var performanceManifest = {
|
|
1189
2044
|
schemaVersion: 1,
|
|
1190
2045
|
name: "performance",
|
|
1191
|
-
title: "\u6CDB\u5FAEE10\u7EE9\u6548\
|
|
2046
|
+
title: "\u6CDB\u5FAEE10\u7EE9\u6548\u8003\u6838\uFF08\u65B9\u6848\u5BFC\u5165 + \u8003\u6838\u67E5\u8BE2\u4E0E AI \u8BC4\u5206\uFF09",
|
|
1192
2047
|
version: "0.1.0",
|
|
1193
2048
|
host: "e10-performance",
|
|
1194
2049
|
status: "builtin",
|
|
1195
2050
|
sourceSkill: "weaver-e10-performance",
|
|
1196
|
-
capabilities: ["performance.hrm.resolve", "performance.scheme.detail", "performance.scheme.draft", "performance.scheme.publish"],
|
|
2051
|
+
capabilities: ["performance.hrm.resolve", "performance.scheme.detail", "performance.scheme.draft", "performance.scheme.publish", "performance.flow.query", "performance.flow.score"],
|
|
1197
2052
|
operations: buildOperations(),
|
|
1198
2053
|
withheldOperations: []
|
|
1199
2054
|
};
|