weaver-work-cli 0.1.71 → 0.1.75
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/README.md +37 -1
- package/dist/chunks/{archive-5P33NAUN.js → archive-OZJ6PYUR.js} +14 -9
- package/dist/chunks/{archive-oa-YTY5D7DG.js → archive-oa-BHL5RK2F.js} +10 -7
- package/dist/chunks/{asset-3Q5MFQBX.js → asset-HKRFRQR2.js} +10 -7
- package/dist/chunks/{asset-idle-PQPNYIS7.js → asset-idle-GGIR4KE7.js} +7 -4
- package/dist/chunks/{attachment-content-7CN7JB6B.js → attachment-content-4OV65NK5.js} +3 -3
- package/dist/chunks/{blog-MFHHK6ZR.js → blog-HYDP4DV3.js} +10 -7
- package/dist/chunks/{caizhilian-OZ435AYW.js → caizhilian-JS4RQZ6Z.js} +10 -7
- package/dist/chunks/{calendar-TNJXS5UC.js → calendar-SWRY4DIT.js} +10 -7
- package/dist/chunks/chunk-257JXJGD.js +30 -0
- package/dist/chunks/{chunk-FRMDHZSN.js → chunk-2AUFKU2D.js} +11 -11
- package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
- package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
- package/dist/chunks/{chunk-X2C5CGGM.js → chunk-4FCBEWNB.js} +74 -68
- package/dist/chunks/{chunk-YN5SD4TX.js → chunk-5D2V7ZAN.js} +2 -2
- package/dist/chunks/{chunk-UPVAQJKS.js → chunk-5QUTQHXF.js} +282 -158
- package/dist/chunks/{chunk-SKWKCLJX.js → chunk-5ZJGPEIB.js} +2 -2
- package/dist/chunks/chunk-7DE3VMZD.js +35 -0
- package/dist/chunks/chunk-BNKUHN4N.js +1346 -0
- package/dist/chunks/{chunk-VMVMEIL3.js → chunk-BSR5TM7U.js} +4 -4
- package/dist/chunks/{chunk-EJLP63UO.js → chunk-ERZY6GYL.js} +7 -3
- package/dist/chunks/{chunk-OFCF23FY.js → chunk-FEZK536Z.js} +25 -9
- package/dist/chunks/{chunk-Q3EXRNB4.js → chunk-I6NOHKEK.js} +1 -1
- package/dist/chunks/{chunk-OZ7CJC7W.js → chunk-J7FAAHWH.js} +2 -2
- package/dist/chunks/{chunk-6MMSLE6K.js → chunk-JJONWB5N.js} +16 -2
- package/dist/chunks/chunk-JOY3HZXL.js +467 -0
- package/dist/chunks/{chunk-2DNCKZRX.js → chunk-JWF2R6EQ.js} +0 -462
- package/dist/chunks/{chunk-ICNUOWLL.js → chunk-KEA4XQPO.js} +4 -4
- package/dist/chunks/chunk-KINXYJXM.js +205 -0
- package/dist/chunks/{chunk-VJWVB55R.js → chunk-KWJEICD4.js} +2 -2
- package/dist/chunks/{chunk-P3AFNAJ6.js → chunk-LJI4N6FV.js} +1 -1
- package/dist/chunks/{chunk-DRJYPXKC.js → chunk-MXCRKXOP.js} +48 -6
- package/dist/chunks/{chunk-OPTJ6IF7.js → chunk-NWYHCZTY.js} +1 -1
- package/dist/chunks/chunk-OJ4JPD25.js +428 -0
- package/dist/chunks/{chunk-B4NINGP2.js → chunk-OQCK5SAU.js} +2 -2
- package/dist/chunks/chunk-PG5YSNYY.js +1166 -0
- package/dist/chunks/{chunk-LU2SPJYY.js → chunk-QJWVYOOV.js} +2 -2
- package/dist/chunks/{chunk-SUWR5QEG.js → chunk-QVKRNL7L.js} +287 -305
- package/dist/chunks/chunk-SU6IJD6D.js +49 -0
- package/dist/chunks/{chunk-MD5RXRI3.js → chunk-TA2RBUTH.js} +2 -2
- package/dist/chunks/{chunk-SSS75WXW.js → chunk-U6Y32KEV.js} +2 -2
- package/dist/chunks/chunk-UUJK76HV.js +209 -0
- package/dist/chunks/{chunk-GB2MCJPG.js → chunk-VOMDD2C5.js} +1 -1
- package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
- package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
- package/dist/chunks/{chunk-G7ZM2VOX.js → chunk-ZUB4M4N3.js} +38 -36
- package/dist/chunks/{chunk-XLSJC6JZ.js → chunk-ZWIMLT6P.js} +8 -7
- package/dist/chunks/cli-FULPXIKJ.js +226 -0
- package/dist/chunks/commands-BNWFNTD3.js +70 -0
- package/dist/chunks/{conflict-Y4PXZ2YQ.js → conflict-5BKCDV2F.js} +2 -2
- package/dist/chunks/{contract-C3BGUMBM.js → contract-WI23OXVC.js} +12446 -5964
- package/dist/chunks/{cowork-2AWG4QLA.js → cowork-DZBBVNMQ.js} +11 -8
- package/dist/chunks/{create-flow-LOUOK46Z.js → create-flow-7ZRBRKX7.js} +6 -6
- package/dist/chunks/{data-BSFYMXVO.js → data-PAZVE6QE.js} +6 -3
- package/dist/chunks/{ebuilder-form-LAAMTD2Y.js → ebuilder-form-5SQXIGXN.js} +9 -6
- package/dist/chunks/{ehr-36KEX5SH.js → ehr-CX5F4ZAU.js} +27 -19
- package/dist/chunks/{entry-mode-6N2IGCS4.js → entry-mode-I2BYNONZ.js} +3 -3
- package/dist/chunks/{env-QYLS3EB3.js → env-ZAQZ7EHN.js} +2 -2
- package/dist/chunks/{esb-PTYS3E67.js → esb-DQTXDIBF.js} +10 -7
- package/dist/chunks/{factory-LPFPKZ4T.js → factory-XRI6KZ7H.js} +1 -1
- package/dist/chunks/{fna-JNHCLRDE.js → fna-FK6HQVJL.js} +13 -8
- package/dist/chunks/{group-chat-QP2WX4QJ.js → group-chat-MLWNYM2P.js} +3 -3
- package/dist/chunks/{host-C2BLBIID.js → host-3EPREGXS.js} +6 -3
- package/dist/chunks/{host-QXFKQXNX.js → host-J74JGYAW.js} +6 -3
- package/dist/chunks/{host-57LSRSE7.js → host-KUMU3DDK.js} +6 -3
- package/dist/chunks/{host-7BVR7CQ3.js → host-MEC4VQZA.js} +6 -3
- package/dist/chunks/{host-NS36QFLR.js → host-T6NNQGVZ.js} +6 -3
- package/dist/chunks/{host-K2ZKNXME.js → host-VI7Q45PM.js} +6 -3
- package/dist/chunks/{hrm-FSGO4NSH.js → hrm-KKVAW4P5.js} +8 -5
- package/dist/chunks/{im-2BFGS2XO.js → im-47CIWQNL.js} +7 -4
- package/dist/chunks/{invoice-JKLTTHSZ.js → invoice-CDYRBNIG.js} +21 -16
- package/dist/chunks/{jiuchuanhui-PTABJE7V.js → jiuchuanhui-M7QTRHZK.js} +17 -10
- package/dist/chunks/{lazy-dispatch-YN2ZP3CS.js → lazy-dispatch-FKQJZFI5.js} +22 -8
- package/dist/chunks/{mail-YNO7ZZUK.js → mail-NRBS5N6Y.js} +11 -8
- package/dist/chunks/{meeting-NIDHDBCB.js → meeting-WC5LD3IO.js} +22 -18
- package/dist/chunks/{minute-doc-G3QAT7DE.js → minute-doc-OQUMDTKG.js} +4 -4
- package/dist/chunks/{okr-QC52G6AJ.js → okr-EHKSKMPL.js} +10 -7
- package/dist/chunks/{operations-MQV32ITT.js → operations-V5VM5MS2.js} +7 -4
- package/dist/chunks/{performance-3MQ3AHDQ.js → performance-ZJADXJPN.js} +6 -3
- package/dist/chunks/{plan-ISINIEPY.js → plan-OTDNBDJ7.js} +10 -7
- package/dist/chunks/{project-IJ6DVKT7.js → project-4XVBQ3HX.js} +10 -7
- package/dist/chunks/{reception-3H5LUG2I.js → reception-3FAHOOH7.js} +118 -45
- package/dist/chunks/{recruit-stage-MIOJXP6W.js → recruit-stage-3WTVWW2K.js} +1056 -191
- package/dist/chunks/register-SQOPIR2G.js +16 -0
- package/dist/chunks/{registry-3S7AVMXR.js → registry-F4YFZLOD.js} +7 -3
- package/dist/chunks/registry-NBTBXR4L.js +30 -0
- package/dist/chunks/{registry-NHHKOEU3.js → registry-TJGCVRCW.js} +7 -4
- package/dist/chunks/{room-recommend-IOKBJVYP.js → room-recommend-KL62XB2Y.js} +4 -4
- package/dist/chunks/root-YZG2TS5W.js +16 -0
- package/dist/chunks/{schedule-IB6EUARH.js → schedule-XOISYUPB.js} +4 -4
- package/dist/chunks/{smart-extract-N2TK3CEF.js → smart-extract-UYGNV3BM.js} +15 -7
- package/dist/chunks/update-AV5VOXGY.js +13 -0
- package/dist/chunks/{workflow-RINBAL2M.js → workflow-V54LJPXL.js} +15 -10
- package/dist/cli.js +40 -0
- package/dist/cmd/action.js +3 -1
- package/dist/cmd/doctor/index.js +1 -1
- package/dist/cmd/e10/index.js +1 -1
- package/dist/cmd/identity/index.js +5 -8
- package/dist/cmd/index.js +2 -0
- package/dist/cmd/setup/index.js +1 -1
- package/dist/cmd/update/index.js +38 -0
- package/dist/core/manifest-view.js +1 -1
- package/dist/core/output.js +12 -1
- package/dist/core/runtime-agent.js +13 -0
- package/dist/core/update-notice.js +23 -0
- package/dist/index.js +105 -198
- package/dist/internal/e10/auth/agent-host-key.js +16 -0
- package/dist/internal/e10/auth/agent-hosts.js +45 -9
- package/dist/internal/e10/auth/commands.js +66 -36
- package/dist/internal/e10/auth/session.js +30 -15
- package/dist/internal/e10/auth/xiaoe.js +4 -20
- package/dist/internal/e10/auth-recovery.js +44 -4
- package/dist/internal/e10/context.js +5 -2
- package/dist/internal/update/bootstrap.js +96 -0
- package/dist/internal/update/npm.js +78 -0
- package/dist/internal/update/service.js +252 -0
- package/dist/internal/update/store.js +135 -0
- package/dist/shortcuts/archive/index.js +2 -2
- package/dist/shortcuts/archive/manifest.js +1 -0
- package/dist/shortcuts/archive/operations/search.js +3 -1
- package/dist/shortcuts/archive-oa/index.js +1 -1
- package/dist/shortcuts/asset/index.js +1 -1
- package/dist/shortcuts/asset-idle/index.js +1 -1
- package/dist/shortcuts/blog/index.js +1 -1
- package/dist/shortcuts/caizhilian/index.js +1 -1
- package/dist/shortcuts/calendar/index.js +1 -1
- package/dist/shortcuts/contract/data/bi-config.js +156 -0
- package/dist/shortcuts/contract/data/collection-ledger-html.js +189 -0
- package/dist/shortcuts/contract/data/collection-node-catalog.js +226 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +154 -20
- package/dist/shortcuts/contract/data/report-renderers.js +414 -0
- package/dist/shortcuts/contract/data/report-spec.js +132 -0
- package/dist/shortcuts/contract/error-actions.js +114 -0
- package/dist/shortcuts/contract/host.js +12 -3
- package/dist/shortcuts/contract/index.js +17 -1
- package/dist/shortcuts/contract/manifest.js +398 -3
- package/dist/shortcuts/contract/ooxml/docx-table.js +48 -0
- package/dist/shortcuts/contract/operations/bi-preview.js +131 -0
- package/dist/shortcuts/contract/operations/bizreview-report.js +496 -0
- package/dist/shortcuts/contract/operations/collection-node.js +229 -0
- package/dist/shortcuts/contract/operations/docx-slots.js +735 -16
- package/dist/shortcuts/contract/operations/draft-build.js +940 -0
- package/dist/shortcuts/contract/operations/draft-submit.js +229 -0
- package/dist/shortcuts/contract/operations/first-screen.js +3 -2
- package/dist/shortcuts/contract/operations/generated-submit.js +175 -0
- package/dist/shortcuts/contract/operations/ledger-report.js +233 -0
- package/dist/shortcuts/contract/operations/ledger-stat.js +1400 -0
- package/dist/shortcuts/contract/operations/ledger.js +4 -1
- package/dist/shortcuts/contract/operations/metrics.js +9 -3
- package/dist/shortcuts/contract/operations/ops-draft.js +527 -0
- package/dist/shortcuts/contract/operations/page.js +9 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +55 -229
- package/dist/shortcuts/contract/operations/registry.js +20 -0
- package/dist/shortcuts/contract/operations/sign-launch.js +256 -0
- package/dist/shortcuts/contract/operations/viewlink.js +334 -0
- package/dist/shortcuts/cowork/index.js +2 -2
- package/dist/shortcuts/ebuilder-form/index.js +1 -1
- package/dist/shortcuts/ehr/index.js +2 -2
- package/dist/shortcuts/ehr/manifest.js +1 -1
- package/dist/shortcuts/ehr/operations/recruit-position.js +11 -5
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +10 -9
- package/dist/shortcuts/ehr/operations/recruit.js +390 -196
- package/dist/shortcuts/ehr/operations/shared.js +51 -0
- package/dist/shortcuts/esb/index.js +1 -1
- package/dist/shortcuts/fna/index.js +1 -1
- package/dist/shortcuts/fna/manifest.js +1 -0
- package/dist/shortcuts/fna/operations/expense-chart.js +3 -1
- package/dist/shortcuts/hrm/index.js +1 -1
- package/dist/shortcuts/invoice/index.js +1 -1
- package/dist/shortcuts/jiuchuanhui/index.js +2 -2
- package/dist/shortcuts/jiuchuanhui/manifest.js +3 -0
- package/dist/shortcuts/mail/index.js +2 -2
- package/dist/shortcuts/meeting/index.js +1 -1
- package/dist/shortcuts/meeting/manifest.js +1 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -3
- package/dist/shortcuts/meeting/operations/eb/conflict.js +3 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +10 -9
- package/dist/shortcuts/meeting/operations/eb/factory.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +3 -2
- package/dist/shortcuts/meeting/operations/invitation-publish.js +3 -3
- package/dist/shortcuts/meeting/operations/invitation.js +4 -4
- package/dist/shortcuts/meeting/operations/link.js +3 -1
- package/dist/shortcuts/okr/index.js +1 -1
- package/dist/shortcuts/performance/index.js +1 -1
- package/dist/shortcuts/plan/index.js +1 -1
- package/dist/shortcuts/project/index.js +1 -1
- package/dist/shortcuts/reception/constants.js +22 -0
- package/dist/shortcuts/reception/index.js +4 -0
- package/dist/shortcuts/reception/manifest.js +16 -2
- package/dist/shortcuts/reception/operations/doc.js +24 -11
- package/dist/shortcuts/reception/operations/docrender.js +18 -1
- package/dist/shortcuts/reception/operations/render-assets.js +93 -22
- package/dist/shortcuts/recruit-stage/context.js +22 -8
- package/dist/shortcuts/recruit-stage/index.js +16 -3
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +20 -11
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +467 -26
- package/dist/shortcuts/recruit-stage/operations/list.js +73 -2
- package/dist/shortcuts/recruit-stage/operations/profile.js +13 -5
- package/dist/shortcuts/recruit-stage/operations/registry.js +18 -2
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +363 -54
- package/dist/shortcuts/recruit-stage/operations/search.js +80 -16
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +124 -0
- package/dist/shortcuts/recruit-stage/shared.js +174 -56
- package/dist/shortcuts/smart-extract/manifest.js +1 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +7 -2
- package/dist/shortcuts/smart-extract/operations/validate.js +4 -1
- package/dist/shortcuts/workflow/index.js +2 -2
- package/dist/shortcuts/workflow/manifest.js +1 -0
- package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +4 -1
- package/dist/shortcuts/workflow/operations/deepRead.js +23 -2
- package/dist/shortcuts/workflow/operations/form.js +44 -4
- package/docs/contract.md +6 -1
- package/docs/e10-auth.md +25 -7
- package/docs/operation-manual.md +15 -0
- package/package.json +2 -2
- package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
- package/skill-template/business-info.json +28 -0
- package/skill-template/domains/jinchengda.md +13 -1
- package/skills/weaver-e10-archive-oa/references/source-manifest.json +3 -3
- package/skills/weaver-e10-caizhilian/references/auth-and-install.md +2 -1
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
- package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +90 -32
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +45 -0
- package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +68 -0
- package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +216 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-negotiate.md +215 -0
- package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +113 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +19 -3
- package/skills/weaver-e10-jinchengda/references/contract-decisions.md +114 -0
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -44
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +200 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -1
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +138 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +158 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +3 -1
- package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +139 -0
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +10 -3
- package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +106 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +176 -56
- package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +123 -0
- package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +410 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-viewlink.md +110 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +38 -24
- package/skills/weaver-e10-jucailin/SKILL.md +7 -3
- package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +13 -0
- package/skills/weaver-e10-okr/SKILL.md +11 -0
- package/skills/weaver-e10-okr/references/source-manifest.json +7 -6
- package/skills/weaver-e10-performance/SKILL.md +131 -39
- package/skills/weaver-e10-performance/agents/openai.yaml +48 -17
- package/skills/weaver-e10-performance/references/default-assembly.md +3 -0
- package/skills/weaver-e10-performance/references/extraction-guide.md +17 -3
- package/skills/weaver-e10-performance/references/flow-assess.md +38 -5
- package/skills/weaver-e10-performance/references/scheme-setting-page.md +20 -3
- package/skills/weaver-e10-performance/scripts/assemble_scheme.py +461 -0
- package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +41 -0
- package/skills/weaver-e10-plan/SKILL.md +10 -0
- package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
- package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
- package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
- package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +533 -137
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +103 -62
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +282 -0
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +331 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +865 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +162 -11
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +15 -1
- package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +38 -0
- package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +6 -2
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +26 -21
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +33 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +5 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +22 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +42 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +87 -50
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +48 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +45 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +17 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +162 -31
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +55 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +75 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +12 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +8 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +80 -46
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +11 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +12 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +10 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +15 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +7 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +7 -3
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +119 -0
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +322 -0
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +166 -76
- package/skills/weaver-e10-shared/SKILL.md +40 -5
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -1
- package/skills/weaver-e10-shared/references/json-output-contract.md +144 -8
- package/skills/weaver-e10-shared/references/weaver-e10-installation.md +11 -0
- package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
- package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +5 -5
- package/dist/chunks/chunk-MZVQKQP5.js +0 -2849
- package/dist/chunks/registry-3GQRYP2R.js +0 -27
- package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 报表渲染层(2026-11-28):五类积木,一套视觉规范。
|
|
3
|
+
*
|
|
4
|
+
* 约定:
|
|
5
|
+
* - 纯字符串拼接,无 JS、无外链;图表是内联 SVG(打印 / file:// 都稳定);
|
|
6
|
+
* - 金额一律「元 + 2 位小数 + 千分位」,率值只带一层 `%`,计数不带后缀;
|
|
7
|
+
* - 率值同比用**百分点**(25.58% vs 87.37% 说「跌 61.79 个百分点」,不是跌 70.72%);
|
|
8
|
+
* - `null` 一律显示「—」,绝不补 0。
|
|
9
|
+
*/
|
|
10
|
+
const INK = '#0f172a';
|
|
11
|
+
const MUTED = '#64748b';
|
|
12
|
+
const LINE = '#e2e8f0';
|
|
13
|
+
const ACCENT = '#2563eb';
|
|
14
|
+
const ACCENT_SOFT = '#c7d2fe';
|
|
15
|
+
const UP = '#047857';
|
|
16
|
+
const DOWN = '#b91c1c';
|
|
17
|
+
export const REPORT_STYLE = `
|
|
18
|
+
:root{--ink:${INK};--muted:${MUTED};--line:${LINE};--accent:${ACCENT};--up:${UP};--down:${DOWN}}
|
|
19
|
+
.rp *{box-sizing:border-box}
|
|
20
|
+
.rp{margin:0;padding:32px 20px 56px;background:#f6f8fb;color:var(--ink);
|
|
21
|
+
font:14px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
|
|
22
|
+
font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased}
|
|
23
|
+
.rp .wrap{max-width:1040px;margin:0 auto}
|
|
24
|
+
.rp .hd{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px;margin-bottom:20px}
|
|
25
|
+
.rp .hd h1{flex:1 1 auto;margin:0;font-size:22px;font-weight:650;letter-spacing:-.01em}
|
|
26
|
+
.rp .pill{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;
|
|
27
|
+
background:#fff;border:1px solid var(--line);font-size:12.5px;color:var(--muted)}
|
|
28
|
+
.rp .meta{font-size:12.5px;color:var(--muted);margin-bottom:20px}
|
|
29
|
+
.rp .card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:20px 22px 22px;
|
|
30
|
+
margin-bottom:16px;box-shadow:0 1px 2px rgba(15,23,42,.04)}
|
|
31
|
+
.rp .card h2{margin:0 0 4px;font-size:15px;font-weight:650}
|
|
32
|
+
.rp .card .hint{margin:0 0 16px;font-size:12.5px;color:var(--muted)}
|
|
33
|
+
.rp .kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
|
|
34
|
+
.rp .kpi{border:1px solid var(--line);border-radius:12px;padding:14px 16px;background:#fcfdff}
|
|
35
|
+
.rp .kpi .k{font-size:12.5px;color:var(--muted);margin-bottom:6px}
|
|
36
|
+
.rp .kpi .n{font-size:24px;font-weight:650;line-height:1.15;letter-spacing:-.02em;white-space:nowrap}
|
|
37
|
+
.rp .kpi .d{margin-top:8px;font-size:12px;color:var(--muted)}
|
|
38
|
+
.rp .chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;font-size:11.5px;font-weight:600}
|
|
39
|
+
.rp .chip.up{color:var(--up);background:#ecfdf5}
|
|
40
|
+
.rp .chip.down{color:var(--down);background:#fef2f2}
|
|
41
|
+
.rp .chip.flat{color:var(--muted);background:#f1f5f9}
|
|
42
|
+
.rp table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px}
|
|
43
|
+
.rp thead th{text-align:right;font-weight:600;font-size:12px;color:var(--muted);
|
|
44
|
+
padding:0 10px 10px;border-bottom:1px solid var(--line);white-space:nowrap}
|
|
45
|
+
.rp thead th:first-child{text-align:left}
|
|
46
|
+
.rp tbody td{text-align:right;padding:9px 10px;border-bottom:1px solid #f1f5f9;white-space:nowrap}
|
|
47
|
+
.rp tbody td:first-child{text-align:left;color:var(--muted)}
|
|
48
|
+
.rp tbody tr:last-child td{border-bottom:none}
|
|
49
|
+
.rp tbody tr:hover td{background:#f8fafc}
|
|
50
|
+
.rp .strong{font-weight:600;color:var(--ink)}
|
|
51
|
+
.rp .na{color:#cbd5e1}
|
|
52
|
+
.rp .trend{font-size:11.5px;font-weight:600;margin-left:2px}
|
|
53
|
+
.rp .trend.up{color:var(--up)}
|
|
54
|
+
.rp .trend.down{color:var(--down)}
|
|
55
|
+
.rp .trend.flat{color:var(--muted)}
|
|
56
|
+
.rp .chart{width:100%;height:auto;display:block}
|
|
57
|
+
.rp .legend{display:flex;flex-wrap:wrap;gap:16px;font-size:12px;color:var(--muted);margin-top:10px}
|
|
58
|
+
.rp .legend span{display:inline-flex;align-items:center;gap:6px}
|
|
59
|
+
.rp .swatch{width:10px;height:10px;border-radius:3px;display:inline-block}
|
|
60
|
+
.rp .rank{display:flex;flex-direction:column;gap:9px}
|
|
61
|
+
.rp .rank-row{display:grid;grid-template-columns:170px 1fr 128px;align-items:center;gap:12px}
|
|
62
|
+
.rp .rank-name{font-size:12.5px;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
63
|
+
.rp .rank-track{background:#f1f5f9;border-radius:6px;height:18px;overflow:hidden}
|
|
64
|
+
.rp .rank-fill{height:100%;background:var(--accent);border-radius:6px}
|
|
65
|
+
.rp .rank-val{text-align:right;font-size:12.5px;font-weight:600}
|
|
66
|
+
.rp .notes{margin:0;padding-left:18px;font-size:12.5px;color:#475569}
|
|
67
|
+
.rp .notes li{margin-bottom:6px}
|
|
68
|
+
.rp .notes li:last-child{margin-bottom:0}
|
|
69
|
+
.rp .warn{border:1px solid #fed7aa;background:#fff7ed;color:#9a3412;border-radius:12px;padding:12px 16px;
|
|
70
|
+
font-size:12.5px;margin-bottom:16px}
|
|
71
|
+
.rp .warn b{font-weight:650}
|
|
72
|
+
.rp .foot{margin-top:22px;text-align:center;font-size:12px;color:#94a3b8}
|
|
73
|
+
@media print{.rp{background:#fff;padding:0}.rp .card{box-shadow:none;break-inside:avoid}}
|
|
74
|
+
`;
|
|
75
|
+
// ---------------------------------------------------------------- 格式化
|
|
76
|
+
function str(value) {
|
|
77
|
+
return typeof value === 'string' ? value : typeof value === 'number' ? String(value) : '';
|
|
78
|
+
}
|
|
79
|
+
/** 只用于纯文本位置,接口原文不二次转义。 */
|
|
80
|
+
export function esc(value) {
|
|
81
|
+
return str(value)
|
|
82
|
+
.replace(/&/gu, '&')
|
|
83
|
+
.replace(/</gu, '<')
|
|
84
|
+
.replace(/>/gu, '>')
|
|
85
|
+
.replace(/"/gu, '"');
|
|
86
|
+
}
|
|
87
|
+
export function formatMoney(value) {
|
|
88
|
+
if (value === null || value === undefined || !Number.isFinite(value))
|
|
89
|
+
return '—';
|
|
90
|
+
const fixed = Number(value).toFixed(2);
|
|
91
|
+
const [integer, decimal] = fixed.split('.');
|
|
92
|
+
const sign = integer.startsWith('-') ? '-' : '';
|
|
93
|
+
const digits = sign ? integer.slice(1) : integer;
|
|
94
|
+
return `${sign}${digits.replace(/\B(?=(\d{3})+(?!\d))/gu, ',')}.${decimal}`;
|
|
95
|
+
}
|
|
96
|
+
export function formatPercent(value) {
|
|
97
|
+
if (value === null || value === undefined || !Number.isFinite(value))
|
|
98
|
+
return '—';
|
|
99
|
+
return `${Number(value).toFixed(2)}%`;
|
|
100
|
+
}
|
|
101
|
+
export function formatCount(value) {
|
|
102
|
+
if (value === null || value === undefined || !Number.isFinite(value))
|
|
103
|
+
return '—';
|
|
104
|
+
return String(Math.round(Number(value)));
|
|
105
|
+
}
|
|
106
|
+
export function formatYoy(pct) {
|
|
107
|
+
if (pct === null || pct === undefined || !Number.isFinite(pct))
|
|
108
|
+
return { text: '同比 —', cls: 'flat' };
|
|
109
|
+
const rounded = Number(Number(pct).toFixed(2));
|
|
110
|
+
if (rounded === 0)
|
|
111
|
+
return { text: '同比 0.00%', cls: 'flat' };
|
|
112
|
+
return { text: `同比 ${rounded > 0 ? '↑' : '↓'} ${Math.abs(rounded).toFixed(2)}%`, cls: rounded > 0 ? 'up' : 'down' };
|
|
113
|
+
}
|
|
114
|
+
export function formatPointDelta(delta) {
|
|
115
|
+
if (delta === null || delta === undefined || !Number.isFinite(delta))
|
|
116
|
+
return { text: '同比 —', cls: 'flat' };
|
|
117
|
+
const rounded = Number(Number(delta).toFixed(2));
|
|
118
|
+
if (rounded === 0)
|
|
119
|
+
return { text: '同比 0.00 个百分点', cls: 'flat' };
|
|
120
|
+
return {
|
|
121
|
+
text: `同比 ${rounded > 0 ? '↑' : '↓'} ${Math.abs(rounded).toFixed(2)} 个百分点`,
|
|
122
|
+
cls: rounded > 0 ? 'up' : 'down',
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function yoyText(aggregation, current, previous, pct) {
|
|
126
|
+
if (aggregation === 'ratio') {
|
|
127
|
+
if (current === null || previous === null)
|
|
128
|
+
return { text: '同比 —', cls: 'flat' };
|
|
129
|
+
return formatPointDelta(current - previous);
|
|
130
|
+
}
|
|
131
|
+
return formatYoy(pct);
|
|
132
|
+
}
|
|
133
|
+
/** 单位:header 用于表头/提示,suffix 用于 KPI(率值不带 suffix,避免 `%%`)。 */
|
|
134
|
+
export function unitOf(aggregation) {
|
|
135
|
+
if (aggregation === 'ratio')
|
|
136
|
+
return { header: '%', value: (v) => formatPercent(v), suffix: '' };
|
|
137
|
+
if (aggregation === 'countDistinct')
|
|
138
|
+
return { header: '家', value: (v) => formatCount(v), suffix: '' };
|
|
139
|
+
return { header: '元', value: (v) => formatMoney(v), suffix: ' 元' };
|
|
140
|
+
}
|
|
141
|
+
/** 坐标轴刻度:按原值加千分位,不折万/亿(口径手册禁止万元折算)。 */
|
|
142
|
+
function axisTick(value) {
|
|
143
|
+
const rounded = Math.round(value);
|
|
144
|
+
const sign = rounded < 0 ? '-' : '';
|
|
145
|
+
return `${sign}${String(Math.abs(rounded)).replace(/\B(?=(\d{3})+(?!\d))/gu, ',')}`;
|
|
146
|
+
}
|
|
147
|
+
function metricOf(data, key) {
|
|
148
|
+
const found = data.metrics.find((metric) => metric.key === key);
|
|
149
|
+
if (!found)
|
|
150
|
+
throw new Error(`指标 ${key} 不在统计数据里`);
|
|
151
|
+
return found;
|
|
152
|
+
}
|
|
153
|
+
function bucketLabel(row) {
|
|
154
|
+
return str(row.month) || str(row.key) || '—';
|
|
155
|
+
}
|
|
156
|
+
function dimensionLabel(data) {
|
|
157
|
+
const dimension = data.window.dimension ?? 'month';
|
|
158
|
+
const grain = data.window.grain ?? 'month';
|
|
159
|
+
if (dimension === 'customer')
|
|
160
|
+
return '客户';
|
|
161
|
+
if (dimension === 'salesman')
|
|
162
|
+
return '销售经理';
|
|
163
|
+
if (dimension === 'date') {
|
|
164
|
+
if (grain === 'day')
|
|
165
|
+
return '日期(签约日)';
|
|
166
|
+
if (grain === 'year')
|
|
167
|
+
return '年度(签约日)';
|
|
168
|
+
return '月份(签约日)';
|
|
169
|
+
}
|
|
170
|
+
return '月份(业绩年月)';
|
|
171
|
+
}
|
|
172
|
+
// ---------------------------------------------------------------- SVG 基础
|
|
173
|
+
const CHART_W = 960;
|
|
174
|
+
const CHART_H = 260;
|
|
175
|
+
const PAD = { top: 14, right: 18, bottom: 30, left: 68 };
|
|
176
|
+
function chartFrame(maxValue, rateMode) {
|
|
177
|
+
const innerW = CHART_W - PAD.left - PAD.right;
|
|
178
|
+
const innerH = CHART_H - PAD.top - PAD.bottom;
|
|
179
|
+
const top = rateMode ? 100 : maxValue || 1;
|
|
180
|
+
const y = (value) => PAD.top + innerH - (value / top) * innerH;
|
|
181
|
+
const ticks = [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
182
|
+
const value = top * ratio;
|
|
183
|
+
return { y: y(value), label: rateMode ? `${Math.round(value)}%` : axisTick(value) };
|
|
184
|
+
});
|
|
185
|
+
return { y, ticks, innerW, innerH };
|
|
186
|
+
}
|
|
187
|
+
function gridSvg(ticks) {
|
|
188
|
+
return ticks.map((tick) => `
|
|
189
|
+
<line x1="${PAD.left}" y1="${tick.y.toFixed(1)}" x2="${CHART_W - PAD.right}" y2="${tick.y.toFixed(1)}"
|
|
190
|
+
stroke="${LINE}" stroke-width="1" ${tick.label === '0' || tick.label === '0%' ? '' : 'stroke-dasharray="3 4"'} />
|
|
191
|
+
<text x="${PAD.left - 10}" y="${(tick.y + 3.5).toFixed(1)}" text-anchor="end" font-size="10.5" fill="${MUTED}">${esc(tick.label)}</text>`).join('');
|
|
192
|
+
}
|
|
193
|
+
function axisLabels(rows, innerW, rotate) {
|
|
194
|
+
const band = innerW / Math.max(rows.length, 1);
|
|
195
|
+
return rows.map((row, index) => {
|
|
196
|
+
const cx = PAD.left + band * index + band / 2;
|
|
197
|
+
const label = rotate ? bucketLabel(row) : bucketLabel(row).slice(-2);
|
|
198
|
+
return `<text x="${cx.toFixed(1)}" y="${CHART_H - 8}" text-anchor="${rotate ? 'end' : 'middle'}"
|
|
199
|
+
font-size="10.5" fill="${MUTED}"${rotate ? ` transform="rotate(-28 ${cx.toFixed(1)} ${CHART_H - 8})"` : ''}>${esc(label)}</text>`;
|
|
200
|
+
}).join('');
|
|
201
|
+
}
|
|
202
|
+
// ---------------------------------------------------------------- 积木:KPI
|
|
203
|
+
export function renderKpi(data, block) {
|
|
204
|
+
const keys = block.metrics ?? data.metrics.map((metric) => metric.key);
|
|
205
|
+
const compareMode = block.compare ?? data.window.compare;
|
|
206
|
+
const cards = keys.map((key) => {
|
|
207
|
+
const metric = metricOf(data, key);
|
|
208
|
+
const unit = unitOf(metric.aggregation);
|
|
209
|
+
const compareEntry = data.compare[key] ?? { current: null, previous: null, delta: null, pct: null };
|
|
210
|
+
const current = data.totals[key] ?? compareEntry.current ?? null;
|
|
211
|
+
const previous = data.previousTotals[key] ?? compareEntry.previous ?? null;
|
|
212
|
+
const incomplete = (data.incompleteMetrics ?? []).includes(key);
|
|
213
|
+
const yoyInfo = compareMode === 'yoy'
|
|
214
|
+
? yoyText(metric.aggregation, current, previous, compareEntry.pct ?? null)
|
|
215
|
+
: null;
|
|
216
|
+
const missing = current === null;
|
|
217
|
+
const valueText = missing ? (incomplete ? '不完整' : '—') : `${unit.value(current)}${unit.suffix}`;
|
|
218
|
+
const chip = missing
|
|
219
|
+
? '<span class="chip flat">不可用</span>'
|
|
220
|
+
: yoyInfo
|
|
221
|
+
? `<span class="chip ${yoyInfo.cls}">${esc(yoyInfo.text.replace('同比 ', ''))}</span>`
|
|
222
|
+
: '';
|
|
223
|
+
const previousLine = compareMode === 'yoy' && previous !== null && !missing
|
|
224
|
+
? `<div class="d">去年 ${esc(unit.value(previous))}${esc(unit.suffix)}</div>`
|
|
225
|
+
: '';
|
|
226
|
+
return `<div class="kpi">
|
|
227
|
+
<div class="k">${esc(metric.label)}</div>
|
|
228
|
+
<div class="n">${esc(valueText)}</div>
|
|
229
|
+
<div class="d">${chip}</div>
|
|
230
|
+
${previousLine}
|
|
231
|
+
</div>`;
|
|
232
|
+
}).join('');
|
|
233
|
+
return `<section class="card">
|
|
234
|
+
<h2>${esc(block.title ?? '总览')}</h2>
|
|
235
|
+
<p class="hint">${esc(data.window.from)} ~ ${esc(data.window.to)} 合计${compareMode === 'yoy' ? ',同比为「去年同期」对比' : ''}</p>
|
|
236
|
+
<div class="kpis">${cards}</div>
|
|
237
|
+
</section>`;
|
|
238
|
+
}
|
|
239
|
+
// ---------------------------------------------------------------- 积木:双柱
|
|
240
|
+
export function renderGroupedBar(data, block) {
|
|
241
|
+
const key = block.metric ?? data.metrics.find((metric) => metric.aggregation === 'sum')?.key;
|
|
242
|
+
if (!key)
|
|
243
|
+
throw new Error('grouped-bar 需要一个数值口径');
|
|
244
|
+
const metric = metricOf(data, key);
|
|
245
|
+
const unit = unitOf(metric.aggregation);
|
|
246
|
+
const compareMode = (block.compare ?? data.window.compare) === 'yoy';
|
|
247
|
+
const values = data.series.map((row) => {
|
|
248
|
+
const current = row.values[key] ?? null;
|
|
249
|
+
const previous = compareMode ? row.previousYear?.values?.[key] ?? null : null;
|
|
250
|
+
return { current: current === null ? 0 : Number(current), previous: previous === null ? null : Number(previous) };
|
|
251
|
+
});
|
|
252
|
+
const maxValue = Math.max(...values.flatMap((item) => [item.current, item.previous ?? 0]), 1);
|
|
253
|
+
const { y, ticks, innerW, innerH } = chartFrame(maxValue, false);
|
|
254
|
+
const band = innerW / Math.max(values.length, 1);
|
|
255
|
+
const barW = Math.min(26, band * 0.26);
|
|
256
|
+
const bars = values.map((item, index) => {
|
|
257
|
+
const cx = PAD.left + band * index + band / 2;
|
|
258
|
+
const currentX = compareMode ? cx - barW - 1 : cx - barW / 2;
|
|
259
|
+
const currentH = Math.max(item.current > 0 ? 2 : 0, innerH - (y(item.current) - PAD.top));
|
|
260
|
+
const currentRect = `<rect x="${currentX.toFixed(1)}" y="${(PAD.top + innerH - currentH).toFixed(1)}" width="${barW.toFixed(1)}" height="${currentH.toFixed(1)}" rx="3" fill="${ACCENT}" />`;
|
|
261
|
+
let previousRect = '';
|
|
262
|
+
if (item.previous !== null) {
|
|
263
|
+
const previousH = Math.max(item.previous > 0 ? 2 : 0, innerH - (y(item.previous) - PAD.top));
|
|
264
|
+
previousRect = `<rect x="${(cx + 1).toFixed(1)}" y="${(PAD.top + innerH - previousH).toFixed(1)}" width="${barW.toFixed(1)}" height="${previousH.toFixed(1)}" rx="3" fill="${ACCENT_SOFT}" />`;
|
|
265
|
+
}
|
|
266
|
+
return `<g><title>${esc(bucketLabel(data.series[index]))}|本期 ${esc(unit.value(item.current))}${item.previous === null ? '' : `|去年 ${esc(unit.value(item.previous))}`}</title>${previousRect}${currentRect}</g>`;
|
|
267
|
+
}).join('');
|
|
268
|
+
return `<section class="card">
|
|
269
|
+
<h2>${esc(block.title ?? `${metric.label} · 按月`)}</h2>
|
|
270
|
+
<p class="hint">${esc(data.window.from)} ~ ${esc(data.window.to)}${compareMode ? ' 与去年同期对比' : ''},单位:${unit.header === '家' ? '家' : '元'}</p>
|
|
271
|
+
<svg class="chart" viewBox="0 0 ${CHART_W} ${CHART_H}" role="img" aria-label="${esc(metric.label)}按月柱状图">
|
|
272
|
+
${gridSvg(ticks)}${bars}${axisLabels(data.series, innerW, data.series.length > 14)}
|
|
273
|
+
</svg>
|
|
274
|
+
<div class="legend">
|
|
275
|
+
<span><i class="swatch" style="background:${ACCENT}"></i>本期</span>
|
|
276
|
+
${compareMode ? `<span><i class="swatch" style="background:${ACCENT_SOFT}"></i>去年同期</span>` : ''}
|
|
277
|
+
</div>
|
|
278
|
+
</section>`;
|
|
279
|
+
}
|
|
280
|
+
// ---------------------------------------------------------------- 积木:折线
|
|
281
|
+
export function renderLine(data, block) {
|
|
282
|
+
const key = block.metric ?? data.metrics.find((metric) => metric.aggregation === 'ratio')?.key;
|
|
283
|
+
if (!key)
|
|
284
|
+
throw new Error('line 需要一个率值/趋势口径');
|
|
285
|
+
const metric = metricOf(data, key);
|
|
286
|
+
const rateMode = metric.aggregation === 'ratio';
|
|
287
|
+
const compareMode = (block.compare ?? data.window.compare) === 'yoy';
|
|
288
|
+
const { y, ticks, innerW } = chartFrame(rateMode ? 100 : 0, rateMode);
|
|
289
|
+
const band = innerW / Math.max(data.series.length, 1);
|
|
290
|
+
const pointsOf = (source) => data.series.map((row, index) => {
|
|
291
|
+
const container = source === 'current' ? row.values : (row.previousYear?.values ?? null);
|
|
292
|
+
const raw = container ? container[key] : null;
|
|
293
|
+
if (raw === null || raw === undefined)
|
|
294
|
+
return null;
|
|
295
|
+
return {
|
|
296
|
+
x: PAD.left + band * index + band / 2,
|
|
297
|
+
y: y(Number(raw)),
|
|
298
|
+
label: `${bucketLabel(row)}・${unitOf(metric.aggregation).value(Number(raw))}`,
|
|
299
|
+
};
|
|
300
|
+
});
|
|
301
|
+
const pathOf = (points, color, dashed) => {
|
|
302
|
+
let path = '';
|
|
303
|
+
let open = false;
|
|
304
|
+
for (const point of points) {
|
|
305
|
+
if (!point) {
|
|
306
|
+
open = false;
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
path += `${open ? 'L' : 'M'}${point.x.toFixed(1)} ${point.y.toFixed(1)} `;
|
|
310
|
+
open = true;
|
|
311
|
+
}
|
|
312
|
+
return path
|
|
313
|
+
? `<path d="${path.trim()}" fill="none" stroke="${color}" stroke-width="${dashed ? 1.8 : 2.4}"
|
|
314
|
+
stroke-linecap="round" ${dashed ? 'stroke-dasharray="5 5"' : ''} />`
|
|
315
|
+
: '';
|
|
316
|
+
};
|
|
317
|
+
const dotsOf = (points, color) => points.filter(Boolean).map((point) => `<circle cx="${point.x.toFixed(1)}" cy="${point.y.toFixed(1)}" r="3.2"
|
|
318
|
+
fill="#fff" stroke="${color}" stroke-width="2"><title>${esc(point.label)}</title></circle>`).join('');
|
|
319
|
+
const current = pointsOf('current');
|
|
320
|
+
const previous = compareMode ? pointsOf('previous') : [];
|
|
321
|
+
return `<section class="card">
|
|
322
|
+
<h2>${esc(block.title ?? `${metric.label} · 走势`)}</h2>
|
|
323
|
+
<p class="hint">${rateMode ? '分母为 0 的月份不绘制(不补 0、不画 100%)' : '缺失值不连线'}</p>
|
|
324
|
+
<svg class="chart" viewBox="0 0 ${CHART_W} ${CHART_H}" role="img" aria-label="${esc(metric.label)}走势图">
|
|
325
|
+
${gridSvg(ticks)}
|
|
326
|
+
${compareMode ? pathOf(previous, '#94a3b8', true) : ''}
|
|
327
|
+
${pathOf(current, ACCENT, false)}
|
|
328
|
+
${compareMode ? dotsOf(previous, '#94a3b8') : ''}
|
|
329
|
+
${dotsOf(current, ACCENT)}
|
|
330
|
+
${axisLabels(data.series, innerW, data.series.length > 14)}
|
|
331
|
+
</svg>
|
|
332
|
+
<div class="legend">
|
|
333
|
+
<span><i class="swatch" style="background:${ACCENT}"></i>本期</span>
|
|
334
|
+
${compareMode ? '<span><i class="swatch" style="background:#94a3b8"></i>去年同期(虚线)</span>' : ''}
|
|
335
|
+
</div>
|
|
336
|
+
</section>`;
|
|
337
|
+
}
|
|
338
|
+
// ---------------------------------------------------------------- 积木:排行
|
|
339
|
+
export function renderHbar(data, block) {
|
|
340
|
+
const key = block.metric ?? data.metrics.find((metric) => metric.aggregation === 'sum')?.key;
|
|
341
|
+
if (!key)
|
|
342
|
+
throw new Error('hbar 需要一个可比大小的口径');
|
|
343
|
+
const metric = metricOf(data, key);
|
|
344
|
+
const unit = unitOf(metric.aggregation);
|
|
345
|
+
const limit = block.limit ?? 10;
|
|
346
|
+
const sortDesc = (block.sort ?? 'desc') === 'desc';
|
|
347
|
+
const rows = data.series
|
|
348
|
+
.map((row) => ({ label: bucketLabel(row), value: row.values[key] ?? null }))
|
|
349
|
+
.filter((row) => row.value !== null)
|
|
350
|
+
.sort((a, b) => (sortDesc ? Number(b.value) - Number(a.value) : Number(a.value) - Number(b.value)))
|
|
351
|
+
.slice(0, limit);
|
|
352
|
+
const max = Math.max(...rows.map((row) => Math.abs(Number(row.value))), 1);
|
|
353
|
+
const bars = rows.map((row) => {
|
|
354
|
+
const width = Math.max(1, Math.round((Math.abs(Number(row.value)) / max) * 100));
|
|
355
|
+
return `<div class="rank-row">
|
|
356
|
+
<div class="rank-name" title="${esc(row.label)}">${esc(row.label)}</div>
|
|
357
|
+
<div class="rank-track"><div class="rank-fill" style="width:${width}%"></div></div>
|
|
358
|
+
<div class="rank-val">${esc(unit.value(Number(row.value)))}${esc(unit.suffix)}</div>
|
|
359
|
+
</div>`;
|
|
360
|
+
}).join('');
|
|
361
|
+
const omitted = data.series.length - rows.length;
|
|
362
|
+
return `<section class="card">
|
|
363
|
+
<h2>${esc(block.title ?? `${metric.label} · ${dimensionLabel(data)}排行`)}</h2>
|
|
364
|
+
<p class="hint">按${esc(dimensionLabel(data))}聚合,${sortDesc ? '从高到低' : '从低到高'}取前 ${limit}${omitted > 0 ? `(共 ${data.series.length} 项,其余 ${omitted} 项未展示)` : ''}</p>
|
|
365
|
+
<div class="rank">${bars || '<div class="hint">无数据</div>'}</div>
|
|
366
|
+
</section>`;
|
|
367
|
+
}
|
|
368
|
+
// ---------------------------------------------------------------- 积木:明细表
|
|
369
|
+
export function renderTable(data, block) {
|
|
370
|
+
const keys = block.metrics ?? data.metrics.map((metric) => metric.key);
|
|
371
|
+
const compareMode = (block.compare ?? data.window.compare) === 'yoy';
|
|
372
|
+
// 分类维度可能返回成千上万个分组;允许显式 limit 收窄(默认全量,保持明细语义)
|
|
373
|
+
const rows = typeof block.limit === 'number' ? data.series.slice(0, block.limit) : data.series;
|
|
374
|
+
const omitted = data.series.length - rows.length;
|
|
375
|
+
const head = keys.map((key) => {
|
|
376
|
+
const unit = unitOf(metricOf(data, key).aggregation);
|
|
377
|
+
const suffix = unit.header === '元' ? '(元)' : unit.header === '%' ? '(%)' : `(${unit.header})`;
|
|
378
|
+
return `<th>${esc(metricOf(data, key).label)}${suffix}</th>`;
|
|
379
|
+
}).join('');
|
|
380
|
+
const body = rows.map((row) => {
|
|
381
|
+
const cells = keys.map((key) => {
|
|
382
|
+
const metric = metricOf(data, key);
|
|
383
|
+
const unit = unitOf(metric.aggregation);
|
|
384
|
+
const current = row.values[key] ?? null;
|
|
385
|
+
const previous = row.previousYear?.values?.[key] ?? null;
|
|
386
|
+
const yoyInfo = compareMode
|
|
387
|
+
? yoyText(metric.aggregation, current, previous, row.yoy?.[key] ?? null)
|
|
388
|
+
: null;
|
|
389
|
+
const valueHtml = current === null
|
|
390
|
+
? '<span class="na">—</span>'
|
|
391
|
+
: `<span class="strong">${unit.value(Number(current))}</span>`;
|
|
392
|
+
const delta = compareMode && yoyInfo && current !== null && yoyInfo.text !== '同比 —'
|
|
393
|
+
? ` <span class="trend ${yoyInfo.cls}">${esc(yoyInfo.text.replace('同比 ', ''))}</span>`
|
|
394
|
+
: '';
|
|
395
|
+
return `<td>${valueHtml}${delta}</td>`;
|
|
396
|
+
}).join('');
|
|
397
|
+
return `<tr><td>${esc(bucketLabel(row))}</td>${cells}</tr>`;
|
|
398
|
+
}).join('');
|
|
399
|
+
return `<section class="card">
|
|
400
|
+
<h2>${esc(block.title ?? `${dimensionLabel(data)}明细`)}</h2>
|
|
401
|
+
<p class="hint">每格为本期值${compareMode ? ' + 同比;率值的同比为「百分点」,金额/户数为相对百分比' : ''}${omitted > 0 ? `;本表展示前 ${rows.length} 项,其余 ${omitted} 项未列出(如需完整清单请用 stat 的 out 落盘)` : ''}</p>
|
|
402
|
+
<table>
|
|
403
|
+
<thead><tr><th>${esc(dimensionLabel(data))}</th>${head}</tr></thead>
|
|
404
|
+
<tbody>${body || `<tr><td colspan="${keys.length + 1}">无数据</td></tr>`}</tbody>
|
|
405
|
+
</table>
|
|
406
|
+
</section>`;
|
|
407
|
+
}
|
|
408
|
+
export const RENDERERS = {
|
|
409
|
+
kpi: renderKpi,
|
|
410
|
+
'grouped-bar': renderGroupedBar,
|
|
411
|
+
line: renderLine,
|
|
412
|
+
hbar: renderHbar,
|
|
413
|
+
table: renderTable,
|
|
414
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 报表视图层(2026-11-28):声明式 spec + 白名单校验 + 默认决策表。
|
|
3
|
+
*
|
|
4
|
+
* 背景:报表原先是「一份写死的 HTML 骨架」。口径一多就崩(KPI 塞不下、量纲混装、
|
|
5
|
+
* 分类排名没有形态),但如果改成"每次现场生成",口径与样式就会漂移——我们已经踩过
|
|
6
|
+
* `25.58%%`、合计多算 26,805.08、率值同比写成相对百分比这三个坑。
|
|
7
|
+
*
|
|
8
|
+
* 分层:
|
|
9
|
+
* 口径层 data/metric-catalog.ts 指标定义/单位/聚合(单一事实源)
|
|
10
|
+
* 视图层 本文件 spec(放哪些积木、按什么排序)
|
|
11
|
+
* 渲染层 report-renderers.ts 5 类积木,视觉规范统一
|
|
12
|
+
* 编排层 ledger-report.ts stat 结果 + spec → HTML
|
|
13
|
+
*
|
|
14
|
+
* 原则:
|
|
15
|
+
* - 图型只由「维度 / 是否时间序列 / 是否对比 / 量纲」决定,与具体口径无关,
|
|
16
|
+
* 所以口径增长不会导致模板数量线性膨胀;
|
|
17
|
+
* - spec 只允许白名单内的 kind 与 metric,**不认识就报错,不猜、不静默降级**;
|
|
18
|
+
* - 默认 spec 由决策表生成,调用方只在需要时覆写。
|
|
19
|
+
*/
|
|
20
|
+
/** 已实现的积木(白名单)。`stacked` 构成图需要双维度数据与构成口径,暂不提供。 */
|
|
21
|
+
export const BLOCK_KINDS = ['kpi', 'grouped-bar', 'line', 'hbar', 'table'];
|
|
22
|
+
/** 校验错误:统一用可读中文,调用方(operation)负责包成 CLI 错误。 */
|
|
23
|
+
export class ReportSpecError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = 'ReportSpecError';
|
|
28
|
+
this.code = code;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function aggregationOf(data, key) {
|
|
32
|
+
return data.metrics.find((metric) => metric.key === key)?.aggregation;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 校验 spec:kind 白名单、metric 必须存在于本次统计、量纲不得混装、图类只允许单指标。
|
|
36
|
+
*
|
|
37
|
+
* 量纲规则(硬约束):一张图只能一个量纲;`receiptRate`(%)不能与 `signedAmount`(元)
|
|
38
|
+
* 同图——双轴会让人误读"率值和金额可比大小"。
|
|
39
|
+
*/
|
|
40
|
+
export function validateSpec(spec, data) {
|
|
41
|
+
if (!spec || !Array.isArray(spec.blocks) || spec.blocks.length === 0) {
|
|
42
|
+
throw new ReportSpecError('spec_blocks_required', 'spec.blocks 不能为空');
|
|
43
|
+
}
|
|
44
|
+
const known = new Set(data.metrics.map((metric) => metric.key));
|
|
45
|
+
const seenKpi = spec.blocks.filter((block) => block.kind === 'kpi').length;
|
|
46
|
+
if (seenKpi > 1)
|
|
47
|
+
throw new ReportSpecError('spec_duplicate_kpi', 'kpi 积木只能有一个');
|
|
48
|
+
const blocks = spec.blocks.map((raw, index) => {
|
|
49
|
+
const where = `spec.blocks[${index}]`;
|
|
50
|
+
if (!raw || typeof raw !== 'object')
|
|
51
|
+
throw new ReportSpecError('spec_block_invalid', `${where} 必须是对象`);
|
|
52
|
+
if (!BLOCK_KINDS.includes(raw.kind)) {
|
|
53
|
+
throw new ReportSpecError('spec_kind_unsupported', `${where}.kind 不支持「${String(raw.kind)}」;可用:${BLOCK_KINDS.join(' / ')}`);
|
|
54
|
+
}
|
|
55
|
+
const block = { ...raw };
|
|
56
|
+
const checkMetric = (key, label) => {
|
|
57
|
+
if (typeof key !== 'string' || !key) {
|
|
58
|
+
throw new ReportSpecError('spec_metric_required', `${where}.${label} 必须是非空口径键`);
|
|
59
|
+
}
|
|
60
|
+
if (!known.has(key)) {
|
|
61
|
+
throw new ReportSpecError('spec_metric_unknown', `${where}.${label} 的口径「${key}」不在本次统计里;可用:${[...known].join('、')}`);
|
|
62
|
+
}
|
|
63
|
+
return key;
|
|
64
|
+
};
|
|
65
|
+
if (block.kind === 'kpi' || block.kind === 'table') {
|
|
66
|
+
if (block.metrics !== undefined) {
|
|
67
|
+
if (!Array.isArray(block.metrics) || block.metrics.length === 0) {
|
|
68
|
+
throw new ReportSpecError('spec_metric_required', `${where}.metrics 必须是非空数组`);
|
|
69
|
+
}
|
|
70
|
+
block.metrics = block.metrics.map((key) => checkMetric(key, 'metrics[]'));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// 图类:单指标 + 不允许跨量纲
|
|
75
|
+
if (block.metric !== undefined)
|
|
76
|
+
checkMetric(block.metric, 'metric');
|
|
77
|
+
if (block.metrics !== undefined && block.metrics.length > 1) {
|
|
78
|
+
throw new ReportSpecError('spec_single_metric', `${where}:图类积木只接受一个 metric`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (block.compare !== undefined && !['yoy', 'none'].includes(block.compare)) {
|
|
82
|
+
throw new ReportSpecError('spec_compare_invalid', `${where}.compare 只支持 yoy / none`);
|
|
83
|
+
}
|
|
84
|
+
if (block.limit !== undefined && (!Number.isInteger(block.limit) || block.limit <= 0 || block.limit > 200)) {
|
|
85
|
+
throw new ReportSpecError('spec_limit_invalid', `${where}.limit 必须是 1~200 的整数`);
|
|
86
|
+
}
|
|
87
|
+
if (block.sort !== undefined && !['desc', 'asc'].includes(block.sort)) {
|
|
88
|
+
throw new ReportSpecError('spec_sort_invalid', `${where}.sort 只支持 desc / asc`);
|
|
89
|
+
}
|
|
90
|
+
return block;
|
|
91
|
+
});
|
|
92
|
+
return { ...spec, blocks };
|
|
93
|
+
}
|
|
94
|
+
function firstMetricOf(data, aggregation) {
|
|
95
|
+
return data.metrics.find((metric) => metric.aggregation === aggregation)?.key;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 默认决策表(按数据形态选积木,不按口径名硬编码):
|
|
99
|
+
*
|
|
100
|
+
* | 数据维度 | 积木组合 |
|
|
101
|
+
* |---|---|
|
|
102
|
+
* | 时间序列(month) | kpi(≤4) + grouped-bar(首个金额口径) + line(率值口径,若有) + table(全部) |
|
|
103
|
+
* | 分类维度(customer/salesman) | kpi(≤4) + hbar(首个金额口径, Top10) + table(全部) |
|
|
104
|
+
*
|
|
105
|
+
* KPI 最多 4 个:超过时其余口径只在明细表出现(避免卡片挤成一片)。
|
|
106
|
+
*/
|
|
107
|
+
export function defaultSpec(data) {
|
|
108
|
+
const dimension = data.window.dimension ?? 'month';
|
|
109
|
+
const compare = data.window.compare;
|
|
110
|
+
// 时间类维度(签订日期 / 业绩年月)走「双柱 + 折线」;分类维度走「排行」
|
|
111
|
+
const isTime = dimension === 'date' || dimension === 'month';
|
|
112
|
+
const blocks = [];
|
|
113
|
+
const kpiMetrics = data.metrics.slice(0, 4).map((metric) => metric.key);
|
|
114
|
+
if (kpiMetrics.length)
|
|
115
|
+
blocks.push({ kind: 'kpi', metrics: kpiMetrics });
|
|
116
|
+
const amount = firstMetricOf(data, 'sum');
|
|
117
|
+
const rate = firstMetricOf(data, 'ratio');
|
|
118
|
+
const count = firstMetricOf(data, 'countDistinct');
|
|
119
|
+
if (isTime) {
|
|
120
|
+
if (amount)
|
|
121
|
+
blocks.push({ kind: 'grouped-bar', metric: amount });
|
|
122
|
+
if (rate)
|
|
123
|
+
blocks.push({ kind: 'line', metric: rate });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
const rankMetric = amount ?? count;
|
|
127
|
+
if (rankMetric)
|
|
128
|
+
blocks.push({ kind: 'hbar', metric: rankMetric, limit: 10, sort: 'desc' });
|
|
129
|
+
}
|
|
130
|
+
blocks.push({ kind: 'table', metrics: data.metrics.map((metric) => metric.key) });
|
|
131
|
+
return { blocks };
|
|
132
|
+
}
|