@yuku123/z-cognition-component 2.0.1 → 2.0.3
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-lib/BaseInput-DHrGPDB9.js +1096 -0
- package/dist-lib/ClockCircleOutlined-DP6fSLgk.js +12 -0
- package/dist-lib/Collapse-B77SsmFh.js +523 -0
- package/dist-lib/{ConceptsPage-BOeKdDKI.js → ConceptsPage-DOf_CJlz.js} +13 -16
- package/dist-lib/DeleteOutlined-BAZSAooQ.js +12 -0
- package/dist-lib/{DocsPage-BZOBFp3c.js → DocsPage-CiC7TU96.js} +4 -4
- package/dist-lib/EllipsisOutlined-Dr4orLLw.js +1109 -0
- package/dist-lib/EvidenceFormList-CrE2FzHk.js +90 -0
- package/dist-lib/{EyeOutlined-DGSrX-0M.js → EyeOutlined-CudyDdjH.js} +1 -1
- package/dist-lib/ImpactPage-CYiuqy0S.js +68 -0
- package/dist-lib/{LeftOutlined-Cgo6Izj-.js → LeftOutlined-CJasZIyX.js} +1 -1
- package/dist-lib/{OntologyDetailPage-B8DyU8WW.js → OntologyDetailPage-mgK_NQxP.js} +99 -93
- package/dist-lib/{OntologyInferPage-CvcjxpBB.js → OntologyInferPage-NUaoaQpN.js} +38 -40
- package/dist-lib/{OntologyListPage-Cb0XfpWE.js → OntologyListPage-C9wH01y0.js} +47 -49
- package/dist-lib/OntologyMaterializePage-D_fDqYHY.js +134 -0
- package/dist-lib/OntologyNodesPage-5kH7RHwE.js +2844 -0
- package/dist-lib/{OntologyValidatePage-abQVJwzV.js → OntologyValidatePage-DtkYK_l4.js} +49 -52
- package/dist-lib/Pagination-BJ8wnqAa.js +1112 -0
- package/dist-lib/PlusOutlined-BSTPGLOH.js +21 -0
- package/dist-lib/{ReloadOutlined-CS-e-TmN.js → ReloadOutlined-B26pDoyV.js} +19 -10
- package/dist-lib/{ResolvePage-rbQ-8nNZ.js → ResolvePage-Cz9HORZ3.js} +31 -33
- package/dist-lib/{RotateRightOutlined-q7zp2e47.js → RotateRightOutlined-DqyspFCO.js} +1 -1
- package/dist-lib/Skeleton-CxFsInYI.js +671 -0
- package/dist-lib/Table-Civ838nE.js +20514 -0
- package/dist-lib/{Table-CDagah-g.js → Table-J_7eBbi7.js} +414 -414
- package/dist-lib/TermDetailPage-BtkOpbPT.js +263 -0
- package/dist-lib/{TermsPage-CuufAyuL.js → TermsPage-BuzCMYov.js} +28 -31
- package/dist-lib/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist-lib/accessAk-CA30m5eX.js +64 -0
- package/dist-lib/{agents-mAJW3cEN.js → agents-eZDKzePP.js} +41 -41
- package/dist-lib/{ai-BcYmZiRo.js → ai-CNSn3-sd.js} +32 -32
- package/dist-lib/{ai-chat-share-DO7GXjG4.js → ai-chat-share-Yrqt_J6a.js} +13 -14
- package/dist-lib/ak-manage-DklVFT5I.js +805 -0
- package/dist-lib/{approval-RPDUKg9-.js → approval-B-bCSmfi.js} +25 -26
- package/dist-lib/{approvals-CNjxJUpR.js → approvals-B0ggYiyD.js} +42 -43
- package/dist-lib/{assistant-FIQQziCn.js → assistant-Of0mgMsM.js} +33 -34
- package/dist-lib/{assistant-history-DsEGBJnq.js → assistant-history-DcyDhUzJ.js} +5 -5
- package/dist-lib/{assistant-summary-B-f3k55y.js → assistant-summary-CjLaTyFz.js} +1 -1
- package/dist-lib/{audit-NwnH1hm5.js → audit-wDNCfmOy.js} +1 -1
- package/dist-lib/{bios-CRwKtcit.js → bios-CIwO1AUK.js} +128 -130
- package/dist-lib/callSuper-CpMOVGin.js +7 -0
- package/dist-lib/callSuper-CwIeyYoc.js +7 -0
- package/dist-lib/category-9gqNseEa.js +76 -0
- package/dist-lib/causal-CzAYukj9.js +789 -0
- package/dist-lib/{changelog-DlL5u9o4.js → changelog-CQfIMS51.js} +2 -2
- package/dist-lib/changelog-sKJMQrlV.js +103 -0
- package/dist-lib/chat-panel-BPbqKckR.js +1543 -0
- package/dist-lib/chunk-6KYCQHYJ-DcgZQlO5.js +1627 -0
- package/dist-lib/code-space-D_ZE966E.js +1070 -0
- package/dist-lib/{colors-sdAcAcU3.js → colors-DpKdb8L-.js} +3 -3
- package/dist-lib/community-9_7ExHcm.js +70 -0
- package/dist-lib/community-CfWXxujB.js +217 -0
- package/dist-lib/community-material-page-Z_EZuBPl.js +747 -0
- package/dist-lib/connections-Bcqsp11M.js +1065 -0
- package/dist-lib/context-T27uno74.js +54 -0
- package/dist-lib/{createForOfIteratorHelper-DEx_aTey.js → createForOfIteratorHelper-CasBzL_Q.js} +1 -1
- package/dist-lib/{dayjs.min-BauDENhn.js → dayjs.min-DoEf5yCX.js} +1 -1
- package/dist-lib/detail-CV6xp_Jp.js +84 -0
- package/dist-lib/{detail-Cfb-zdr9.js → detail-DioaWKWj.js} +5847 -7224
- package/dist-lib/{detail-Dcfg3W8B.js → detail-EyLdjGpX.js} +71 -72
- package/dist-lib/development-CFcOIUKc.js +167 -0
- package/dist-lib/{docx-preview-B5nQuTwk.js → docx-preview-D4v2g8Yg.js} +1 -1
- package/dist-lib/{downloads-MkyxiHxi.js → downloads-DtV5hOQv.js} +3 -4
- package/dist-lib/{edit-DLGAM-Vo.js → edit-NtXUNj5N.js} +262 -266
- package/dist-lib/{editor-BtiheUpe.js → editor-KZhj-rwT.js} +25 -26
- package/dist-lib/editor-page-BaxK_OYm.js +1169 -0
- package/dist-lib/embed-mf8t3QXh.js +51841 -0
- package/dist-lib/embed.css +2 -2
- package/dist-lib/{evaluation-Dz9bUuhS.js → evaluation-CZTpC9v3.js} +14 -15
- package/dist-lib/execution-B6HmOA2_.js +159 -0
- package/dist-lib/focus-set-lt52maBX.js +38 -0
- package/dist-lib/{format-UGmYKemG.js → format-CWI99NCN.js} +1 -1
- package/dist-lib/graph-BllA9bmL.js +44 -0
- package/dist-lib/graph-DHV-rdiK.js +640 -0
- package/dist-lib/{index-o65vKUwa.js → index--AI-htgA.js} +44 -45
- package/dist-lib/index-2SysmGHo.js +1166 -0
- package/dist-lib/{index-CJSTTgTM.js → index-3J47mTL1.js} +10 -10
- package/dist-lib/index-4tbtbcAt.js +550 -0
- package/dist-lib/index-B12ZggsE.js +77 -0
- package/dist-lib/{index-D3GHtSlM.js → index-B5Roo82U.js} +49 -50
- package/dist-lib/{index-nQSVLWfW.js → index-B7SfTpox.js} +79 -81
- package/dist-lib/index-BEO8itgt.js +566 -0
- package/dist-lib/index-BPbOPT2j.js +413 -0
- package/dist-lib/index-BVgdmf6r.js +2487 -0
- package/dist-lib/index-Bd7AGv4a.js +34 -0
- package/dist-lib/index-BkJjYgKD.js +5012 -0
- package/dist-lib/{index-DBlG9uXV.js → index-BkTegt8T.js} +513 -590
- package/dist-lib/{index-BGB6NawZ.js → index-Bln3mJfp.js} +2 -2
- package/dist-lib/index-BoCtPJD4.js +915 -0
- package/dist-lib/{index-DMTPsTna.js → index-BqTsLClH.js} +3 -4
- package/dist-lib/index-Bs4MevzC.js +16075 -0
- package/dist-lib/index-BsoHetYT.js +236 -0
- package/dist-lib/{index-9aQ4BzIK.js → index-BvJ35WL3.js} +13 -14
- package/dist-lib/{index-BEjXaDfk.js → index-Bw4M9KLv.js} +84 -85
- package/dist-lib/index-C2CV4bte.js +242 -0
- package/dist-lib/{index-D_Qey9G8.js → index-CF0ucN_K.js} +12 -12
- package/dist-lib/{index-B57Fj7Y0.js → index-CLhLA2ig.js} +92 -94
- package/dist-lib/{index-Vu6sPBci.js → index-CSJA8wvL.js} +301 -296
- package/dist-lib/index-CSnvcFg-.js +543 -0
- package/dist-lib/{index-C3AMwzIi.js → index-CZipVp1G.js} +1 -1
- package/dist-lib/{index-ounfql2z.js → index-CdJ5ggvp.js} +26 -28
- package/dist-lib/index-CgwK2maq.js +1987 -0
- package/dist-lib/{index-Bc-Vin3j.js → index-CtqUgNxs.js} +53 -55
- package/dist-lib/index-CvxfA0ZK.js +215 -0
- package/dist-lib/{index-y7jVGGI0.js → index-CwyFMPcr.js} +16 -18
- package/dist-lib/index-D35Ry0PG.js +1162 -0
- package/dist-lib/{index-c2HokEFp.js → index-D6ns_Xmf.js} +10 -11
- package/dist-lib/{index-DsuUGhTA.js → index-DGbjbjBY.js} +46 -48
- package/dist-lib/index-DKAGVWMX.js +390 -0
- package/dist-lib/index-DQ16Zb7x.js +546 -0
- package/dist-lib/index-DRcTwC17.js +418 -0
- package/dist-lib/index-DU6bO95v.js +2075 -0
- package/dist-lib/index-DaMLYomP.js +853 -0
- package/dist-lib/index-Dd9pPAT3.js +2192 -0
- package/dist-lib/{index-DuI4K5e1.js → index-DgfIEgir.js} +29 -29
- package/dist-lib/{index-Cy9i4Kx7.js → index-DhSCFLtV.js} +113 -117
- package/dist-lib/index-DxzorPvG.js +13960 -0
- package/dist-lib/index-If4xc1-H.js +559 -0
- package/dist-lib/index-QZ9JPfVR.js +251 -0
- package/dist-lib/index-VeAMz0iC.js +1719 -0
- package/dist-lib/index-mUlorJxp.js +3279 -0
- package/dist-lib/{index-g16g7A4k.js → index-xQmDaKK3.js} +6 -6
- package/dist-lib/{index-BwVZgt5s.js → index-zXwXfn-X.js} +48 -50
- package/dist-lib/index.js +3 -4
- package/dist-lib/json-field-COcz5F2R.js +196 -0
- package/dist-lib/{jszip.min-DcEHhn-b.js → jszip.min-dcaDnWUw.js} +1 -1
- package/dist-lib/{kb-form-modal-BNoIhw6B.js → kb-form-modal-D9gnvXbE.js} +67 -67
- package/dist-lib/{kbTeam-EgcbWseM.js → kbTeam-CorrPJFr.js} +3 -3
- package/dist-lib/{knowledge-base-C023dnJ-.js → knowledge-base-DJkjMFHW.js} +103 -104
- package/dist-lib/{knowledge-hub-B4fGCn8m.js → knowledge-hub-DKiDlaZz.js} +54 -55
- package/dist-lib/login-56zv4aLO.js +36 -0
- package/dist-lib/{markdown-lite-EvJ9Fw7X.js → markdown-lite-p1tiuSZM.js} +198 -202
- package/dist-lib/material-DtPASeqq.js +204 -0
- package/dist-lib/material-draft-markdown-281d5_GN.js +443 -0
- package/dist-lib/material-original-preview-CPGjdmbe.js +214 -0
- package/dist-lib/{material-preview-docx-CH-09KeC.js → material-preview-docx-lp_xPipj.js} +1 -1
- package/dist-lib/{material-preview-pdf-CKAovvpc.js → material-preview-pdf-CTSo215V.js} +7 -7
- package/dist-lib/{material-preview-pptx-D8XGDF-u.js → material-preview-pptx-6Byitp0J.js} +1 -1
- package/dist-lib/material-workspace-model-QLsU5qUO.js +328 -0
- package/dist-lib/{member-BUg2QYlE.js → member-Cz-OIdj9.js} +1 -1
- package/dist-lib/memory-reorganization-DgJnWIrW.js +8 -0
- package/dist-lib/memory-spaces-D-orVNR7.js +2340 -0
- package/dist-lib/{message-GF-w8HuR.js → message-C9gfvpGg.js} +1 -1
- package/dist-lib/{message-Cwj8dO78.js → message-D6FhzB7J.js} +24 -25
- package/dist-lib/{messages-JID13L8-.js → messages-cctmEVcG.js} +15 -16
- package/dist-lib/meta-DT_O4zM9.js +708 -0
- package/dist-lib/{metrics-CT4eLzrq.js → metrics-BNeVcI8-.js} +2 -2
- package/dist-lib/mobile-D8kZjfQU.js +2413 -0
- package/dist-lib/{monitor-Bs9BfJOj.js → monitor-DTUyqumg.js} +4 -4
- package/dist-lib/{monitor-CmS65YSu.js → monitor-DexMYjzF.js} +8 -8
- package/dist-lib/{my-access-1Yj7UloI.js → my-access-DWBV6ohp.js} +120 -132
- package/dist-lib/{my-permissions-yQDHPLYI.js → my-permissions-B-gJZQYM.js} +22 -23
- package/dist-lib/navigation-DVlyWnpD.js +102 -0
- package/dist-lib/{new-BgkoBnZV.js → new-JmARyD88.js} +14 -15
- package/dist-lib/{ontology-BPrbXPor.js → ontology-B4rkO33J.js} +50 -52
- package/dist-lib/ontology-dataprep-BwD5TKs2.js +322 -0
- package/dist-lib/{ontology-domains-Cbqnm-po.js → ontology-domains-zxFrjn0v.js} +89 -92
- package/dist-lib/ontology-extract-BHOxruRO.js +3199 -0
- package/dist-lib/ontology-extract-iR_rXxFe.js +295 -0
- package/dist-lib/ontology-flow-CW0SzeK7.js +456 -0
- package/dist-lib/ontology-flow-Dv5iQ20f.js +154 -0
- package/dist-lib/ontology-modeling-B9wswveh.js +510 -0
- package/dist-lib/ontology-modeling-hakCluBi.js +15136 -0
- package/dist-lib/{ontology-scenarios-D3xy6IZL.js → ontology-scenarios-C2kp7Rs-.js} +1466 -1482
- package/dist-lib/ontology-scenarios-DKnfydG6.js +675 -0
- package/dist-lib/ontology-task-config-DmnWyCCB.js +122 -0
- package/dist-lib/ontology-terms-BoNB-5ar.js +66 -0
- package/dist-lib/ontology-terms-C-NhpcIZ.js +1195 -0
- package/dist-lib/pages-CticGC6S.js +512 -0
- package/dist-lib/pages.js +3 -3
- package/dist-lib/{permission-fTfxpEhV.js → permission-Dq1-AOQw.js} +41 -41
- package/dist-lib/pipeline-layout-CJlOMXJF.js +70 -0
- package/dist-lib/{pptx-preview.es-AUrdYKu3.js → pptx-preview.es-D4ODiBv2.js} +2 -2
- package/dist-lib/preset-Bp_mvsJm.js +56827 -0
- package/dist-lib/{preset-gh5SGoYT.js → preset-DCNSE--Y.js} +8 -8
- package/dist-lib/progress-CZxOOnIs.js +778 -0
- package/dist-lib/{quota-BlHnhkAT.js → quota-oICQRHFU.js} +4 -4
- package/dist-lib/row-By17TCiW.js +154 -0
- package/dist-lib/runs-DQTDpPaN.js +565 -0
- package/dist-lib/{save-blob-B-pzX8eT.js → save-blob-CwCZE1Dn.js} +2 -2
- package/dist-lib/{scenario-mapping-preview-DByQXh0y.js → scenario-mapping-preview-sJtjgmry.js} +46 -48
- package/dist-lib/scenario-simple-form-BvKSPFzw.js +989 -0
- package/dist-lib/{schedule-H4_9KnRj.js → schedule-CwkPPSuT.js} +8 -8
- package/dist-lib/script-gYJAFobb.js +2709 -0
- package/dist-lib/{settings-C3PI8KYa.js → settings-CJd5Jj4y.js} +133 -134
- package/dist-lib/{shared-DqeN-Wbb.js → shared-DG5-VCDM.js} +1 -1
- package/dist-lib/{shared-utils-DN3zT9P-.js → shared-utils-CFHws1DA.js} +2 -2
- package/dist-lib/{skills-eGlCExr0.js → skills-lxpJ5Lzx.js} +39 -40
- package/dist-lib/{source-selection-BCvClzc-.js → source-selection-DJnQQckl.js} +16 -16
- package/dist-lib/sources-C83LpCcV.js +279 -0
- package/dist-lib/style-B5THvtDY.js +191 -0
- package/dist-lib/{task-config-DEJVJ7zK.js → task-config-BNYoOb79.js} +4 -4
- package/dist-lib/{tech-C-4uM9bS.js → tech-LuZvKDo6.js} +3 -4
- package/dist-lib/templates-a-kbCamr.js +58 -0
- package/dist-lib/tenant-login-COB-5h_2.js +338 -0
- package/dist-lib/{tools-le6miafZ.js → tools-CrA6GrY6.js} +14 -14
- package/dist-lib/{use-domain-access-B3pDp3s5.js → use-domain-access-ehGJBGvU.js} +15 -15
- package/dist-lib/{use-g6-graph-WLX0PweO.js → use-g6-graph-DfRnsBS6.js} +1 -1
- package/dist-lib/{use-graph-layers-Dmp7uMHO.js → use-graph-layers-CrhEeHfD.js} +48 -50
- package/dist-lib/use-resizable-columns-BpMCRKif.js +59 -0
- package/dist-lib/useBreakpoint-Cul9y9Cu.js +87 -0
- package/dist-lib/{useForm-Byp1LopG.js → useForm-B-dwOwJ8.js} +11 -11
- package/dist-lib/{version-control-panel-WT1PobuV.js → version-control-panel-mWXkC-uB.js} +26 -27
- package/dist-lib/{version-management-DC0k1DRg.js → version-management-nPlG7wQO.js} +6 -7
- package/dist-lib/{welcome-VyWLrbth.js → welcome-Cqv1-rXT.js} +3 -4
- package/package.json +1 -1
- package/dist-lib/ApartmentOutlined-M6qSurnE.js +0 -12
- package/dist-lib/ArrowLeftOutlined-DowsrSUj.js +0 -12
- package/dist-lib/EvidenceFormList-DXqqSpPV.js +0 -91
- package/dist-lib/ImpactPage-DyhUR6fT.js +0 -71
- package/dist-lib/OntologyMaterializePage-B0f9TnJa.js +0 -136
- package/dist-lib/OntologyNodesPage-D4MWlm6q.js +0 -1268
- package/dist-lib/Pagination-Dxslodkq.js +0 -1344
- package/dist-lib/PlusOutlined-B_dXo_97.js +0 -12
- package/dist-lib/SearchOutlined-puH6bCY6.js +0 -979
- package/dist-lib/Skeleton-DXcERb5r.js +0 -557
- package/dist-lib/TagsOutlined-B4_qkn6-.js +0 -20
- package/dist-lib/TermDetailPage-CP0D6OvA.js +0 -242
- package/dist-lib/TextArea-DTpTS5HL.js +0 -1897
- package/dist-lib/ThunderboltOutlined-Bf54AaFE.js +0 -20
- package/dist-lib/callSuper-DZEfdkXG.js +0 -7
- package/dist-lib/changelog-Dj_Pv2nc.js +0 -69
- package/dist-lib/chunk-YDNE64FV-DGyyfCo0.js +0 -2004
- package/dist-lib/context-Buz0ggsK.js +0 -710
- package/dist-lib/context-DpmyNOn3.js +0 -21
- package/dist-lib/embed-DwLg9RDW.js +0 -31148
- package/dist-lib/focus-set-h0YtOUB2.js +0 -427
- package/dist-lib/index-CaXylbQR.js +0 -3419
- package/dist-lib/index-Cfu1W1H6.js +0 -535
- package/dist-lib/index-CrMcNEAZ.js +0 -9656
- package/dist-lib/index-CyKWCYMK.js +0 -218
- package/dist-lib/index-DBtGE89a.js +0 -168
- package/dist-lib/index-DjFPRXl5.js +0 -1484
- package/dist-lib/index-DvWHYX81.js +0 -450
- package/dist-lib/index-HieOUSwH.js +0 -340
- package/dist-lib/index-bOY1cBol.js +0 -4890
- package/dist-lib/meta-DPp5L3Uc.js +0 -540
- package/dist-lib/ontology-modeling-6k-m8fzr.js +0 -38946
- package/dist-lib/ontology-modeling-BT-EuDCs.js +0 -1039
- package/dist-lib/ontology-scenarios-DWYC2yxd.js +0 -660
- package/dist-lib/pages-CsexFuEz.js +0 -73
- package/dist-lib/row-B5MnGm9M.js +0 -156
- package/dist-lib/scenario-simple-form-Bw-6n9Kh.js +0 -2396
- package/dist-lib/useClosable-BY7FgWKy.js +0 -59
|
@@ -0,0 +1,2413 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as q, useRef as X } from "react";
|
|
3
|
+
import { I as w, K as $e, dk as $t, dl as St, dm as It } from "./embed-mf8t3QXh.js";
|
|
4
|
+
import { M as ct } from "./markdown-lite-p1tiuSZM.js";
|
|
5
|
+
const Mt = [
|
|
6
|
+
{ key: "home", label: "首页", icon: "home" },
|
|
7
|
+
{ key: "library", label: "知识库", icon: "book-open" },
|
|
8
|
+
{ key: "assistant", label: "助手", icon: "sparkles" },
|
|
9
|
+
{ key: "profile", label: "我的", icon: "user" }
|
|
10
|
+
];
|
|
11
|
+
function xt({ active: t, onChange: a }) {
|
|
12
|
+
return /* @__PURE__ */ e("nav", { className: "m-tabbar", "aria-label": "主导航", children: Mt.map((l) => /* @__PURE__ */ r(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
type: "button",
|
|
16
|
+
className: `m-tabbar-item${t === l.key ? " is-active" : ""}`,
|
|
17
|
+
onClick: () => a(l.key),
|
|
18
|
+
"aria-current": t === l.key ? "page" : void 0,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ e(w, { name: l.icon, size: 20 }),
|
|
21
|
+
/* @__PURE__ */ e("span", { className: "m-tabbar-label", children: l.label })
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
l.key
|
|
25
|
+
)) });
|
|
26
|
+
}
|
|
27
|
+
const Se = "/kapi/future-brain/v1", zt = 50, Lt = 4, Dt = 6, qe = "fb-mobile-logged-out";
|
|
28
|
+
function Pt() {
|
|
29
|
+
try {
|
|
30
|
+
sessionStorage.setItem(qe, "1");
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function Ot() {
|
|
35
|
+
try {
|
|
36
|
+
sessionStorage.removeItem(qe);
|
|
37
|
+
} catch {
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function et() {
|
|
41
|
+
try {
|
|
42
|
+
if (sessionStorage.getItem(qe))
|
|
43
|
+
return "guest";
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
let t;
|
|
47
|
+
try {
|
|
48
|
+
t = await fetch(`${Se}/message/unreadCount`, {
|
|
49
|
+
credentials: "include",
|
|
50
|
+
headers: { Accept: "application/json", "X-Tenant-Code": $e() }
|
|
51
|
+
});
|
|
52
|
+
} catch {
|
|
53
|
+
return "demo";
|
|
54
|
+
}
|
|
55
|
+
if (t.status === 401)
|
|
56
|
+
return "guest";
|
|
57
|
+
if (!t.ok)
|
|
58
|
+
return "demo";
|
|
59
|
+
try {
|
|
60
|
+
const a = await t.json();
|
|
61
|
+
return Number(a == null ? void 0 : a.code) === 101012001 ? "guest" : "authed";
|
|
62
|
+
} catch {
|
|
63
|
+
return "demo";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function Rt(t, a) {
|
|
67
|
+
const l = await fetch(`${Se}${t}`, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
credentials: "include",
|
|
70
|
+
headers: {
|
|
71
|
+
Accept: "application/json",
|
|
72
|
+
"X-Tenant-Code": $e()
|
|
73
|
+
},
|
|
74
|
+
body: a
|
|
75
|
+
});
|
|
76
|
+
if (!l.ok)
|
|
77
|
+
throw new Error(`HTTP ${l.status}`);
|
|
78
|
+
const i = await l.json();
|
|
79
|
+
if (i.success === !0 || i.code === 0 || i.code === 200) {
|
|
80
|
+
if (i.data === void 0 || i.data === null)
|
|
81
|
+
throw new Error("响应缺少 data");
|
|
82
|
+
return i.data;
|
|
83
|
+
}
|
|
84
|
+
throw new Error(i.message || `code ${i.code}`);
|
|
85
|
+
}
|
|
86
|
+
async function K(t, a) {
|
|
87
|
+
const l = await fetch(`${Se}${t}`, {
|
|
88
|
+
method: "POST",
|
|
89
|
+
credentials: "include",
|
|
90
|
+
headers: {
|
|
91
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
92
|
+
Accept: "application/json",
|
|
93
|
+
"X-Tenant-Code": $e()
|
|
94
|
+
},
|
|
95
|
+
body: JSON.stringify(a)
|
|
96
|
+
});
|
|
97
|
+
if (!l.ok)
|
|
98
|
+
throw new Error(`HTTP ${l.status}`);
|
|
99
|
+
const i = await l.json();
|
|
100
|
+
if (i.success === !0 || i.code === 0 || i.code === 200) {
|
|
101
|
+
if (i.data === void 0 || i.data === null)
|
|
102
|
+
throw new Error("响应缺少 data");
|
|
103
|
+
return i.data;
|
|
104
|
+
}
|
|
105
|
+
throw new Error(i.message || `code ${i.code}`);
|
|
106
|
+
}
|
|
107
|
+
function he(t) {
|
|
108
|
+
if (!t)
|
|
109
|
+
return "";
|
|
110
|
+
const a = new Date(t);
|
|
111
|
+
if (Number.isNaN(a.getTime()))
|
|
112
|
+
return t;
|
|
113
|
+
const l = (i) => String(i).padStart(2, "0");
|
|
114
|
+
return `${l(a.getMonth() + 1)}-${l(a.getDate())} ${l(a.getHours())}:${l(a.getMinutes())}`;
|
|
115
|
+
}
|
|
116
|
+
function Kt(t) {
|
|
117
|
+
var l;
|
|
118
|
+
if ((l = t.sourceType) != null && l.includes("LINK"))
|
|
119
|
+
return "link";
|
|
120
|
+
if (t.sourceType === "NOTE" || t.entryType === "NOTE")
|
|
121
|
+
return "note";
|
|
122
|
+
const a = (t.fileExt || "").toLowerCase();
|
|
123
|
+
return a === "pdf" ? "pdf" : a === "doc" || a === "docx" ? "word" : a === "xls" || a === "xlsx" || a === "csv" ? "sheet" : a === "ppt" || a === "pptx" ? "slides" : "note";
|
|
124
|
+
}
|
|
125
|
+
function Pe(t) {
|
|
126
|
+
return {
|
|
127
|
+
id: t.materialId,
|
|
128
|
+
kbId: t.kbId,
|
|
129
|
+
name: t.title,
|
|
130
|
+
kind: Kt(t),
|
|
131
|
+
status: t.compileStatus === "COMPLETED" ? "compiled" : "pending",
|
|
132
|
+
updatedAt: he(t.updateTime),
|
|
133
|
+
categoryId: t.categoryId || null
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function W(t) {
|
|
137
|
+
const a = Number(t);
|
|
138
|
+
return Number.isFinite(a) ? a : 0;
|
|
139
|
+
}
|
|
140
|
+
function _t(t) {
|
|
141
|
+
return {
|
|
142
|
+
id: t.kbId,
|
|
143
|
+
type: t.type,
|
|
144
|
+
icon: t.icon,
|
|
145
|
+
code: t.code || "",
|
|
146
|
+
name: t.name,
|
|
147
|
+
scope: t.scopeType === "TEAM" ? "team" : "personal",
|
|
148
|
+
materialCount: W(t.materialCount),
|
|
149
|
+
updatedAt: he(t.updateTime)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function tt(t) {
|
|
153
|
+
return [...t].sort((a, l) => a.updatedAt < l.updatedAt ? 1 : -1);
|
|
154
|
+
}
|
|
155
|
+
async function Bt() {
|
|
156
|
+
const t = await K("/knowledgeBase/page", {
|
|
157
|
+
current: 1,
|
|
158
|
+
size: zt
|
|
159
|
+
}), a = tt(
|
|
160
|
+
(t.records || []).map((m) => ({ ...m, updatedAt: m.updateTime || "" }))
|
|
161
|
+
).map(_t), l = await Promise.all(
|
|
162
|
+
(t.records || []).slice(0, Lt).map(async (m) => ((await K("/material/page", {
|
|
163
|
+
kbId: m.kbId,
|
|
164
|
+
current: 1,
|
|
165
|
+
size: 6
|
|
166
|
+
})).records || []).map(Pe))
|
|
167
|
+
), [i, n] = await Promise.all([
|
|
168
|
+
fe("/approval/tickets", { view: "todo", current: "1", size: "1" }).catch(
|
|
169
|
+
() => {
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
Fe().catch(() => {
|
|
173
|
+
})
|
|
174
|
+
]);
|
|
175
|
+
return {
|
|
176
|
+
kbs: a,
|
|
177
|
+
recentMaterials: tt(l.flat()).slice(0, Dt),
|
|
178
|
+
kbTotal: W(t.total) || a.length,
|
|
179
|
+
materialTotal: a.reduce((m, p) => m + p.materialCount, 0),
|
|
180
|
+
teamKbCount: a.filter((m) => m.scope === "team").length,
|
|
181
|
+
approvalTodoCount: W(i == null ? void 0 : i.total),
|
|
182
|
+
unreadCount: W(n)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function ot(t) {
|
|
186
|
+
return {
|
|
187
|
+
id: t.categoryId,
|
|
188
|
+
name: t.name || "未命名目录",
|
|
189
|
+
children: (t.children || []).map(ot)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
async function Ft(t) {
|
|
193
|
+
return (await fe("/materialCategory/tree", { kbId: t }) || []).map(ot);
|
|
194
|
+
}
|
|
195
|
+
async function jt(t) {
|
|
196
|
+
return ((await K("/material/page", {
|
|
197
|
+
kbId: t,
|
|
198
|
+
rootOnly: !0,
|
|
199
|
+
current: 1,
|
|
200
|
+
size: 200
|
|
201
|
+
})).records || []).filter((l) => !l.categoryId).map(Pe);
|
|
202
|
+
}
|
|
203
|
+
async function Ut(t, a) {
|
|
204
|
+
return ((await K("/material/page", {
|
|
205
|
+
kbId: t,
|
|
206
|
+
categoryId: a,
|
|
207
|
+
includeChildren: !1,
|
|
208
|
+
current: 1,
|
|
209
|
+
size: 200
|
|
210
|
+
})).records || []).filter((i) => i.categoryId === a).map(Pe);
|
|
211
|
+
}
|
|
212
|
+
async function Gt(t, a) {
|
|
213
|
+
return ((await K("/material/page", {
|
|
214
|
+
kbId: t,
|
|
215
|
+
keyword: a,
|
|
216
|
+
current: 1,
|
|
217
|
+
size: 50
|
|
218
|
+
})).records || []).map(Pe);
|
|
219
|
+
}
|
|
220
|
+
function Yt(t, a) {
|
|
221
|
+
const l = (t || []).filter((i) => i.success === !1);
|
|
222
|
+
if (l.length > 0)
|
|
223
|
+
throw new Error(l.map((i) => `${i.fileName || "文件"}:${i.message || "处理失败"}`).join(";"));
|
|
224
|
+
if (!t || t.length === 0)
|
|
225
|
+
throw new Error(a);
|
|
226
|
+
}
|
|
227
|
+
async function Xt(t, a, l) {
|
|
228
|
+
return (await K("/materialCategory/add", {
|
|
229
|
+
kbId: t,
|
|
230
|
+
name: a,
|
|
231
|
+
parentId: l || void 0
|
|
232
|
+
})).categoryId || "";
|
|
233
|
+
}
|
|
234
|
+
function Ht(t, a) {
|
|
235
|
+
return K("/materialCategory/update", { categoryId: t, name: a }).then(() => {
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function qt(t) {
|
|
239
|
+
return K("/materialCategory/remove", { categoryId: t }).then(() => {
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async function Vt(t, a, l) {
|
|
243
|
+
const i = await K("/material/registerText", {
|
|
244
|
+
kbId: t,
|
|
245
|
+
title: a,
|
|
246
|
+
categoryId: l || void 0,
|
|
247
|
+
content: `# ${a}
|
|
248
|
+
`
|
|
249
|
+
});
|
|
250
|
+
if (i && i.success === !1)
|
|
251
|
+
throw new Error(i.message || "创建失败");
|
|
252
|
+
}
|
|
253
|
+
async function Wt(t, a, l) {
|
|
254
|
+
const i = await K("/material/upload-tokens", {
|
|
255
|
+
kbId: t,
|
|
256
|
+
categoryId: l || void 0,
|
|
257
|
+
files: a.map((f) => ({ fileName: f.name, size: f.size }))
|
|
258
|
+
}) || [], n = [], m = [];
|
|
259
|
+
for (let f = 0; f < a.length; f += 1) {
|
|
260
|
+
const N = a[f], d = i[f];
|
|
261
|
+
if (!(d != null && d.success) || !d.uploadUrl) {
|
|
262
|
+
n.push({
|
|
263
|
+
fileName: N.name,
|
|
264
|
+
success: !1,
|
|
265
|
+
message: (d == null ? void 0 : d.message) || "上传地址签发失败"
|
|
266
|
+
});
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const k = await fetch(d.uploadUrl, { method: "PUT", body: N });
|
|
270
|
+
if (!k.ok) {
|
|
271
|
+
n.push({
|
|
272
|
+
fileName: N.name,
|
|
273
|
+
success: !1,
|
|
274
|
+
message: `对象存储返回 ${k.status}`
|
|
275
|
+
});
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
m.push({ objectKey: d.objectKey || "", fileName: N.name });
|
|
279
|
+
}
|
|
280
|
+
const p = m.length ? await K("/material/upload-register", {
|
|
281
|
+
kbId: t,
|
|
282
|
+
categoryId: l || void 0,
|
|
283
|
+
files: m
|
|
284
|
+
}) || [] : [];
|
|
285
|
+
Yt([...n, ...p], "上传接口未返回结果");
|
|
286
|
+
}
|
|
287
|
+
function at(t, a, l) {
|
|
288
|
+
return K("/material/updateCategory", {
|
|
289
|
+
kbId: t,
|
|
290
|
+
materialIds: a,
|
|
291
|
+
categoryId: l || void 0
|
|
292
|
+
}).then(() => {
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function Jt(t, a) {
|
|
296
|
+
return K("/material/remove", { kbId: t, materialIds: a }).then(() => {
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
async function fe(t, a) {
|
|
300
|
+
const l = new URLSearchParams(a).toString(), i = await fetch(`${Se}${t}?${l}`, {
|
|
301
|
+
method: "GET",
|
|
302
|
+
credentials: "include",
|
|
303
|
+
headers: {
|
|
304
|
+
Accept: "application/json",
|
|
305
|
+
"X-Tenant-Code": $e()
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
if (!i.ok)
|
|
309
|
+
throw new Error(`HTTP ${i.status}`);
|
|
310
|
+
const n = await i.json();
|
|
311
|
+
if (n.success === !0 || n.code === 0 || n.code === 200) {
|
|
312
|
+
if (n.data === void 0 || n.data === null)
|
|
313
|
+
throw new Error("响应缺少 data");
|
|
314
|
+
return n.data;
|
|
315
|
+
}
|
|
316
|
+
throw new Error(n.message || `code ${n.code}`);
|
|
317
|
+
}
|
|
318
|
+
function Qt(t) {
|
|
319
|
+
return t ? t === "NOTE" ? "笔记" : t === "LOCAL" || t === "UPLOAD" ? "上传" : t.includes("LINK") ? "外链" : t.includes("YUQUE") ? "语雀" : t : "未知来源";
|
|
320
|
+
}
|
|
321
|
+
async function Zt(t) {
|
|
322
|
+
const a = await fe("/material/queryDetailById", { materialId: t });
|
|
323
|
+
if (!a.material)
|
|
324
|
+
throw new Error("资料不存在");
|
|
325
|
+
const l = Pe(a.material), i = a.currentDraft;
|
|
326
|
+
return {
|
|
327
|
+
title: a.material.title,
|
|
328
|
+
kbId: a.material.kbId,
|
|
329
|
+
kind: l.kind,
|
|
330
|
+
status: l.status,
|
|
331
|
+
updatedAt: l.updatedAt,
|
|
332
|
+
sourceLabel: Qt(a.material.sourceType),
|
|
333
|
+
sourceType: a.material.sourceType || "",
|
|
334
|
+
fileExt: (a.material.fileExt || "").toLowerCase(),
|
|
335
|
+
versionNo: a.material.versionNo === void 0 || a.material.versionNo === null ? null : W(a.material.versionNo) || null,
|
|
336
|
+
charCount: i != null && i.textLength && i.textLength > 0 ? i.textLength : null,
|
|
337
|
+
content: (i == null ? void 0 : i.textContent) || ""
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function mt(t) {
|
|
341
|
+
return K("/compilation/run", { materialId: t });
|
|
342
|
+
}
|
|
343
|
+
function ea(t) {
|
|
344
|
+
return K("/material/reparse", { materialId: t });
|
|
345
|
+
}
|
|
346
|
+
function ta(t, a, l) {
|
|
347
|
+
const i = new FormData();
|
|
348
|
+
i.append("file", l);
|
|
349
|
+
const n = new URLSearchParams({ kbId: t, materialId: a }).toString();
|
|
350
|
+
return Rt(`/material/revise?${n}`, i);
|
|
351
|
+
}
|
|
352
|
+
async function dt(t, a) {
|
|
353
|
+
const l = await fetch(`${Se}/material/download?materialId=${encodeURIComponent(t)}`, {
|
|
354
|
+
credentials: "include",
|
|
355
|
+
headers: { "X-Tenant-Code": $e() }
|
|
356
|
+
});
|
|
357
|
+
if (!l.ok)
|
|
358
|
+
throw new Error(`HTTP ${l.status}`);
|
|
359
|
+
const i = l.headers.get("Content-Disposition") || "", n = /filename\*=(?:UTF-8'')?"?([^";]+)"?|filename="?([^";]+)"?/i.exec(i), m = decodeURIComponent((n == null ? void 0 : n[1]) || (n == null ? void 0 : n[2]) || a), p = await l.blob(), f = URL.createObjectURL(p), N = document.createElement("a");
|
|
360
|
+
N.href = f, N.download = m, N.click(), setTimeout(() => URL.revokeObjectURL(f), 4e3);
|
|
361
|
+
}
|
|
362
|
+
const aa = "kb_hub_assistant";
|
|
363
|
+
function na(t, a) {
|
|
364
|
+
const l = new AbortController(), i = (async () => {
|
|
365
|
+
const n = await fetch(`${Se}/ai/chat/streaming`, {
|
|
366
|
+
method: "POST",
|
|
367
|
+
credentials: "include",
|
|
368
|
+
headers: {
|
|
369
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
370
|
+
Accept: "text/event-stream",
|
|
371
|
+
"X-Tenant-Code": $e()
|
|
372
|
+
},
|
|
373
|
+
body: JSON.stringify({ agentCode: aa, ...t }),
|
|
374
|
+
signal: l.signal
|
|
375
|
+
});
|
|
376
|
+
if (!n.ok)
|
|
377
|
+
throw new Error(`HTTP ${n.status}`);
|
|
378
|
+
if (!n.body)
|
|
379
|
+
throw new Error("当前浏览器不支持流式响应");
|
|
380
|
+
const m = n.body.getReader(), p = new TextDecoder("utf-8");
|
|
381
|
+
let f = "";
|
|
382
|
+
const N = (d) => {
|
|
383
|
+
const k = d.split(/\r?\n/).filter(($) => $.startsWith("data:")).map(($) => $.slice(5)).join(`
|
|
384
|
+
`).trim();
|
|
385
|
+
if (k)
|
|
386
|
+
try {
|
|
387
|
+
a(JSON.parse(k));
|
|
388
|
+
} catch {
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
for (; ; ) {
|
|
392
|
+
const { done: d, value: k } = await m.read();
|
|
393
|
+
if (d)
|
|
394
|
+
break;
|
|
395
|
+
f += p.decode(k, { stream: !0 });
|
|
396
|
+
let $ = f.search(/\r?\n\r?\n/);
|
|
397
|
+
for (; $ >= 0; ) {
|
|
398
|
+
const g = f.slice($).match(/^\r?\n\r?\n/);
|
|
399
|
+
N(f.slice(0, $)), f = f.slice($ + (g ? g[0].length : 2)), $ = f.search(/\r?\n\r?\n/);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
f += p.decode(), f.trim() && N(f);
|
|
403
|
+
})();
|
|
404
|
+
return {
|
|
405
|
+
abort: () => l.abort(),
|
|
406
|
+
done: i.catch((n) => {
|
|
407
|
+
if (!l.signal.aborted)
|
|
408
|
+
throw n;
|
|
409
|
+
})
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
async function nt(t) {
|
|
413
|
+
const a = {
|
|
414
|
+
view: t.view || "todo",
|
|
415
|
+
current: String(t.current),
|
|
416
|
+
size: String(t.size)
|
|
417
|
+
};
|
|
418
|
+
t.keyword && (a.keyword = t.keyword);
|
|
419
|
+
const l = await fe("/approval/tickets", a), i = (l.records || []).map((n) => ({
|
|
420
|
+
id: W(n.id),
|
|
421
|
+
title: n.title || "(无标题)",
|
|
422
|
+
applicantName: n.applicantName || "—",
|
|
423
|
+
templateName: n.templateName || "—",
|
|
424
|
+
status: n.status || "PENDING",
|
|
425
|
+
createTime: he(n.createTime)
|
|
426
|
+
}));
|
|
427
|
+
return { total: W(l.total) || i.length, items: i };
|
|
428
|
+
}
|
|
429
|
+
async function sa(t) {
|
|
430
|
+
const a = await fe("/approval/tickets/detail", { id: String(t) }), l = Array.isArray(a.resourceCodes) ? a.resourceCodes.filter((n) => typeof n == "string") : [], i = Array.isArray(a.nodes) ? a.nodes.map((n) => ({
|
|
431
|
+
name: typeof n.name == "string" ? n.name : "—",
|
|
432
|
+
approverName: typeof n.approverName == "string" ? n.approverName : "—",
|
|
433
|
+
state: typeof n.state == "string" ? n.state : "WAITING",
|
|
434
|
+
comment: typeof n.comment == "string" ? n.comment : "",
|
|
435
|
+
actedAt: he(typeof n.actedAt == "string" ? n.actedAt : null)
|
|
436
|
+
})) : [];
|
|
437
|
+
return {
|
|
438
|
+
id: W(a.id),
|
|
439
|
+
code: typeof a.code == "string" ? a.code : "",
|
|
440
|
+
title: typeof a.title == "string" && a.title ? a.title : "(无标题)",
|
|
441
|
+
templateName: typeof a.templateName == "string" && a.templateName ? a.templateName : "—",
|
|
442
|
+
status: typeof a.status == "string" ? a.status : "PENDING",
|
|
443
|
+
applicantName: typeof a.applicantName == "string" && a.applicantName ? a.applicantName : "—",
|
|
444
|
+
createTime: he(typeof a.createTime == "string" ? a.createTime : null),
|
|
445
|
+
finishedAt: he(typeof a.finishedAt == "string" ? a.finishedAt : null),
|
|
446
|
+
bizName: typeof a.bizName == "string" ? a.bizName : "",
|
|
447
|
+
bizRole: typeof a.bizRole == "string" ? a.bizRole : "",
|
|
448
|
+
resourceCodes: l,
|
|
449
|
+
reason: typeof a.reason == "string" ? a.reason : "",
|
|
450
|
+
currentApproverName: typeof a.currentApproverName == "string" && a.currentApproverName ? a.currentApproverName : "—",
|
|
451
|
+
canApprove: a.canApprove === !0,
|
|
452
|
+
nodes: i
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
async function ia(t, a, l) {
|
|
456
|
+
await K(`/approval/tickets/${a}`, { id: t, comment: l || void 0 });
|
|
457
|
+
}
|
|
458
|
+
async function Fe() {
|
|
459
|
+
const t = await fe("/message/unreadCount", {});
|
|
460
|
+
return W(t);
|
|
461
|
+
}
|
|
462
|
+
async function ra(t) {
|
|
463
|
+
await K("/message/read", { ids: [t] });
|
|
464
|
+
}
|
|
465
|
+
async function la() {
|
|
466
|
+
await K("/message/read", { all: !0 });
|
|
467
|
+
}
|
|
468
|
+
async function st(t) {
|
|
469
|
+
const [a, l] = await Promise.all([
|
|
470
|
+
fe("/message/page", {
|
|
471
|
+
view: "all",
|
|
472
|
+
current: String(t.current),
|
|
473
|
+
size: String(t.size)
|
|
474
|
+
}),
|
|
475
|
+
Fe()
|
|
476
|
+
]), i = (a.records || []).map((n) => ({
|
|
477
|
+
id: W(n.id),
|
|
478
|
+
title: n.title || "(无标题)",
|
|
479
|
+
content: n.content || "",
|
|
480
|
+
unread: n.read !== !0,
|
|
481
|
+
createTime: he(n.createTime)
|
|
482
|
+
}));
|
|
483
|
+
return { unread: W(l), total: W(a.total), items: i };
|
|
484
|
+
}
|
|
485
|
+
async function ca() {
|
|
486
|
+
const t = await fe("/identity/auth/context", {}), a = t.menus || [], l = (m) => {
|
|
487
|
+
let p = 0, f = 0;
|
|
488
|
+
for (const N of m || []) {
|
|
489
|
+
p += 1, f += Array.isArray(N.buttons) ? N.buttons.length : 0;
|
|
490
|
+
const [d, k] = l(N.children);
|
|
491
|
+
p += d, f += k;
|
|
492
|
+
}
|
|
493
|
+
return [p, f];
|
|
494
|
+
}, [i, n] = l(a);
|
|
495
|
+
return {
|
|
496
|
+
name: t.name || "",
|
|
497
|
+
roles: (t.roles || []).map((m) => m.roleName || m.roleCode || "").filter(Boolean),
|
|
498
|
+
menuCount: i,
|
|
499
|
+
buttonCount: n,
|
|
500
|
+
menus: a.map((m) => m.name || "").filter(Boolean)
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
async function oa() {
|
|
504
|
+
return (await K("/ak/list", {}) || []).map((a) => ({
|
|
505
|
+
akName: a.akName || "未命名 AK",
|
|
506
|
+
akCode: a.akCode || "",
|
|
507
|
+
ownerLabel: a.ownerType === "APPLICATION" ? "应用" : a.ownerType === "SYSTEM" ? "系统" : "个人",
|
|
508
|
+
createTime: he(a.createTime)
|
|
509
|
+
}));
|
|
510
|
+
}
|
|
511
|
+
function ma() {
|
|
512
|
+
const [t, a] = h(null), l = (i) => {
|
|
513
|
+
a((n) => n && { ...n, ...i });
|
|
514
|
+
};
|
|
515
|
+
return q(() => {
|
|
516
|
+
let i = !1;
|
|
517
|
+
return Bt().then((n) => {
|
|
518
|
+
i || a(n);
|
|
519
|
+
}).catch(() => {
|
|
520
|
+
}), () => {
|
|
521
|
+
i = !0;
|
|
522
|
+
};
|
|
523
|
+
}, []), { live: t, patchLive: l };
|
|
524
|
+
}
|
|
525
|
+
const da = [
|
|
526
|
+
{ name: "book", label: "书籍" },
|
|
527
|
+
{ name: "book-open", label: "阅读" },
|
|
528
|
+
{ name: "folder", label: "文件夹" },
|
|
529
|
+
{ name: "file-text", label: "文档" },
|
|
530
|
+
{ name: "layers", label: "知识集" },
|
|
531
|
+
{ name: "database", label: "数据库" },
|
|
532
|
+
{ name: "code", label: "代码" },
|
|
533
|
+
{ name: "brain", label: "思考" },
|
|
534
|
+
{ name: "lightbulb", label: "灵感" },
|
|
535
|
+
{ name: "compass", label: "探索" },
|
|
536
|
+
{ name: "globe", label: "世界" },
|
|
537
|
+
{ name: "target", label: "目标" },
|
|
538
|
+
{ name: "star", label: "星标" },
|
|
539
|
+
{ name: "shield", label: "守护" }
|
|
540
|
+
], ua = {
|
|
541
|
+
FILE: "file-text",
|
|
542
|
+
MIX: "layers",
|
|
543
|
+
YUQUE: "book",
|
|
544
|
+
CODE: "code",
|
|
545
|
+
DATABASE: "database"
|
|
546
|
+
};
|
|
547
|
+
function ut({ kb: t, size: a = 16, className: l = "" }) {
|
|
548
|
+
const [i, n] = h(""), m = t.icon || "";
|
|
549
|
+
if ((/^https?:\/\/[^\s]+$/i.test(m) || /^data:image\/(png|jpeg|gif);base64,[A-Za-z0-9+/=]+$/.test(m)) && i !== m)
|
|
550
|
+
return /* @__PURE__ */ e(
|
|
551
|
+
"img",
|
|
552
|
+
{
|
|
553
|
+
className: `knowledge-base-icon-image ${l}`,
|
|
554
|
+
src: m,
|
|
555
|
+
width: a,
|
|
556
|
+
height: a,
|
|
557
|
+
alt: "",
|
|
558
|
+
referrerPolicy: "no-referrer",
|
|
559
|
+
onError: () => n(m)
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
const f = da.some((N) => N.name === m) ? m : ua[t.type || "MIX"];
|
|
563
|
+
return /* @__PURE__ */ e(w, { name: f, size: a, className: l });
|
|
564
|
+
}
|
|
565
|
+
const je = [
|
|
566
|
+
{ id: "kb-rnd-spec", code: "KB_RND_SPEC", name: "研发规范库", scope: "team", materialCount: 128, compiledCount: 121, updatedAt: "11-20 14:32" },
|
|
567
|
+
{ id: "kb-policy-compliance", code: "KB_POLICY", name: "政策法规库", scope: "team", materialCount: 210, compiledCount: 198, updatedAt: "11-20 11:05" },
|
|
568
|
+
{ id: "kb-market-insight", code: "KB_MARKET", name: "市场洞察库", scope: "personal", materialCount: 67, compiledCount: 67, updatedAt: "11-19 18:47" },
|
|
569
|
+
{ id: "kb-ops-runbook", code: "KB_OPS", name: "运维手册库", scope: "team", materialCount: 86, compiledCount: 80, updatedAt: "11-19 09:12" },
|
|
570
|
+
{ id: "kb-training-course", code: "KB_TRAINING", name: "内训课件库", scope: "personal", materialCount: 45, compiledCount: 40, updatedAt: "11-18 16:20" },
|
|
571
|
+
{ id: "kb-product-manual", code: "KB_PRODUCT", name: "产品手册库", scope: "personal", materialCount: 32, compiledCount: 32, updatedAt: "11-17 10:36" }
|
|
572
|
+
], Ue = [
|
|
573
|
+
{ id: "mt-001", kbId: "kb-rnd-spec", name: "代码评审管理办法.docx", kind: "word", status: "compiled", updatedAt: "11-20 14:32" },
|
|
574
|
+
{ id: "mt-002", kbId: "kb-rnd-spec", name: "研发流程总纲.pdf", kind: "pdf", status: "compiled", updatedAt: "11-20 10:18" },
|
|
575
|
+
{ id: "mt-003", kbId: "kb-rnd-spec", name: "接口设计规范.docx", kind: "word", status: "compiled", updatedAt: "11-19 15:44" },
|
|
576
|
+
{ id: "mt-004", kbId: "kb-rnd-spec", name: "分支管理矩阵.xlsx", kind: "sheet", status: "pending", updatedAt: "11-19 09:12" },
|
|
577
|
+
{ id: "mt-005", kbId: "kb-rnd-spec", name: "上线检查清单.md", kind: "note", status: "compiled", updatedAt: "11-18 20:03" },
|
|
578
|
+
{ id: "mt-101", kbId: "kb-policy-compliance", name: "数据安全管理办法.pdf", kind: "pdf", status: "compiled", updatedAt: "11-20 11:05" },
|
|
579
|
+
{ id: "mt-102", kbId: "kb-policy-compliance", name: "个人信息保护指引.docx", kind: "word", status: "compiled", updatedAt: "11-19 13:40" },
|
|
580
|
+
{ id: "mt-103", kbId: "kb-policy-compliance", name: "行业合规白皮书 2026.pdf", kind: "pdf", status: "pending", updatedAt: "11-18 17:22" },
|
|
581
|
+
{ id: "mt-104", kbId: "kb-policy-compliance", name: "季度监管动态.xlsx", kind: "sheet", status: "compiled", updatedAt: "11-17 09:30" },
|
|
582
|
+
{ id: "mt-201", kbId: "kb-market-insight", name: "2026 冬季选型指南.pdf", kind: "pdf", status: "compiled", updatedAt: "11-19 18:47" },
|
|
583
|
+
{ id: "mt-202", kbId: "kb-market-insight", name: "竞品功能对比.xlsx", kind: "sheet", status: "compiled", updatedAt: "11-18 14:11" },
|
|
584
|
+
{ id: "mt-203", kbId: "kb-market-insight", name: "客户访谈纪要(11 月).docx", kind: "word", status: "compiled", updatedAt: "11-18 10:02" },
|
|
585
|
+
{ id: "mt-301", kbId: "kb-ops-runbook", name: "发布回滚手册.pdf", kind: "pdf", status: "compiled", updatedAt: "11-19 09:12" },
|
|
586
|
+
{ id: "mt-302", kbId: "kb-ops-runbook", name: "值班应答模板.md", kind: "note", status: "compiled", updatedAt: "11-18 15:55" },
|
|
587
|
+
{ id: "mt-303", kbId: "kb-ops-runbook", name: "告警分级一览.xlsx", kind: "sheet", status: "pending", updatedAt: "11-17 11:26" },
|
|
588
|
+
{ id: "mt-401", kbId: "kb-training-course", name: "新人上手路线.pptx", kind: "slides", status: "compiled", updatedAt: "11-18 16:20" },
|
|
589
|
+
{ id: "mt-402", kbId: "kb-training-course", name: "平台功能演示.pptx", kind: "slides", status: "compiled", updatedAt: "11-17 14:08" },
|
|
590
|
+
{ id: "mt-403", kbId: "kb-training-course", name: "常见问题速查.md", kind: "note", status: "pending", updatedAt: "11-16 09:45" },
|
|
591
|
+
{ id: "mt-501", kbId: "kb-product-manual", name: "用户操作手册.pdf", kind: "pdf", status: "compiled", updatedAt: "11-17 10:36" },
|
|
592
|
+
{ id: "mt-502", kbId: "kb-product-manual", name: "版本更新说明.md", kind: "note", status: "compiled", updatedAt: "11-16 17:31" }
|
|
593
|
+
], pa = [
|
|
594
|
+
{
|
|
595
|
+
id: "msg-001",
|
|
596
|
+
role: "user",
|
|
597
|
+
content: "代码评审的硬性要求有哪些?"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
id: "msg-002",
|
|
601
|
+
role: "assistant",
|
|
602
|
+
content: "依据《代码评审管理办法.docx》:合并请求必须至少一名高级工程师评审通过;涉及数据结构变更时需同步 DBA 评审;评审意见须在 2 个工作日内闭环,超期自动升级到技术负责人。",
|
|
603
|
+
sources: ["代码评审管理办法.docx", "研发流程总纲.pdf"]
|
|
604
|
+
}
|
|
605
|
+
], it = [
|
|
606
|
+
{
|
|
607
|
+
id: "reply-001",
|
|
608
|
+
role: "assistant",
|
|
609
|
+
content: "《研发流程总纲.pdf》要求:功能分支从 master 拉出,发布前需通过定向测试与代码评审;发版窗口内禁止无评审的直接合并。",
|
|
610
|
+
sources: ["研发流程总纲.pdf"]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
id: "reply-002",
|
|
614
|
+
role: "assistant",
|
|
615
|
+
content: "《数据安全管理办法.pdf》规定:生产数据的导出需走审批流,敏感字段必须脱敏后交付;导出记录保留 180 天可审计。",
|
|
616
|
+
sources: ["数据安全管理办法.pdf"]
|
|
617
|
+
}
|
|
618
|
+
];
|
|
619
|
+
function ha(t) {
|
|
620
|
+
return Ue.filter((a) => a.kbId === t);
|
|
621
|
+
}
|
|
622
|
+
function fa(t) {
|
|
623
|
+
return je.find((a) => a.id === t);
|
|
624
|
+
}
|
|
625
|
+
const Na = {
|
|
626
|
+
pdf: "file-pdf",
|
|
627
|
+
word: "file-word",
|
|
628
|
+
sheet: "file-sheet",
|
|
629
|
+
slides: "file-slides",
|
|
630
|
+
note: "file-text",
|
|
631
|
+
link: "link"
|
|
632
|
+
};
|
|
633
|
+
function Ve(t) {
|
|
634
|
+
return Na[t];
|
|
635
|
+
}
|
|
636
|
+
const ba = { personal: "个人", team: "团队" };
|
|
637
|
+
function ga({ onSearch: t, onOpenKb: a, onOpenMaterial: l, data: i }) {
|
|
638
|
+
const n = (i == null ? void 0 : i.kbs) ?? je, m = i ? i.recentMaterials : [...Ue].sort((p, f) => p.updatedAt < f.updatedAt ? 1 : -1).slice(0, 5);
|
|
639
|
+
return /* @__PURE__ */ r("div", { className: "m-screen", children: [
|
|
640
|
+
/* @__PURE__ */ r("button", { type: "button", className: "m-search", onClick: t, children: [
|
|
641
|
+
/* @__PURE__ */ e(w, { name: "search", size: 15 }),
|
|
642
|
+
/* @__PURE__ */ e("span", { className: "m-search-placeholder", children: "搜索知识库与资料" })
|
|
643
|
+
] }),
|
|
644
|
+
/* @__PURE__ */ r("div", { className: "m-stats", children: [
|
|
645
|
+
/* @__PURE__ */ r("div", { className: "m-stat", children: [
|
|
646
|
+
/* @__PURE__ */ e("b", { className: "m-stat-value", children: i ? i.kbTotal : je.length }),
|
|
647
|
+
/* @__PURE__ */ e("span", { className: "m-stat-label", children: "知识库" })
|
|
648
|
+
] }),
|
|
649
|
+
/* @__PURE__ */ r("div", { className: "m-stat", children: [
|
|
650
|
+
/* @__PURE__ */ e("b", { className: "m-stat-value", children: i ? i.materialTotal : Ue.length }),
|
|
651
|
+
/* @__PURE__ */ e("span", { className: "m-stat-label", children: "资料" })
|
|
652
|
+
] }),
|
|
653
|
+
/* @__PURE__ */ r("div", { className: "m-stat", children: [
|
|
654
|
+
/* @__PURE__ */ e("b", { className: "m-stat-value", children: i ? i.teamKbCount : 12 }),
|
|
655
|
+
/* @__PURE__ */ e("span", { className: "m-stat-label", children: i ? "团队库" : "本周编译" })
|
|
656
|
+
] })
|
|
657
|
+
] }),
|
|
658
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
659
|
+
/* @__PURE__ */ e("h2", { className: "m-section-title", children: "常用知识库" }),
|
|
660
|
+
n.slice(0, 4).map((p) => /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => a(p.id), children: [
|
|
661
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(ut, { kb: p, size: 17 }) }),
|
|
662
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
663
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: p.name }),
|
|
664
|
+
/* @__PURE__ */ r("span", { className: "m-row-meta", children: [
|
|
665
|
+
ba[p.scope],
|
|
666
|
+
" · ",
|
|
667
|
+
p.materialCount,
|
|
668
|
+
" 份资料",
|
|
669
|
+
p.updatedAt ? ` · ${p.updatedAt}` : ""
|
|
670
|
+
] })
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
673
|
+
] }, p.id))
|
|
674
|
+
] }),
|
|
675
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
676
|
+
/* @__PURE__ */ e("h2", { className: "m-section-title", children: "最近更新" }),
|
|
677
|
+
m.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "暂无最近更新的资料" }) }) }),
|
|
678
|
+
m.map((p) => /* @__PURE__ */ r(
|
|
679
|
+
"button",
|
|
680
|
+
{
|
|
681
|
+
type: "button",
|
|
682
|
+
className: "m-row",
|
|
683
|
+
onClick: () => l(p.id),
|
|
684
|
+
children: [
|
|
685
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: Ve(p.kind), size: 16 }) }),
|
|
686
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
687
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: p.name }),
|
|
688
|
+
/* @__PURE__ */ e("span", { className: "m-row-meta", children: p.updatedAt })
|
|
689
|
+
] }),
|
|
690
|
+
/* @__PURE__ */ e(
|
|
691
|
+
"i",
|
|
692
|
+
{
|
|
693
|
+
className: `m-dot m-dot-${p.status}`,
|
|
694
|
+
"aria-label": p.status === "compiled" ? "已编译" : "待编译"
|
|
695
|
+
}
|
|
696
|
+
)
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
p.id
|
|
700
|
+
))
|
|
701
|
+
] })
|
|
702
|
+
] });
|
|
703
|
+
}
|
|
704
|
+
function Ee({ rows: t = 4 }) {
|
|
705
|
+
return /* @__PURE__ */ e("div", { "aria-hidden": "true", children: Array.from({ length: t }, (a, l) => /* @__PURE__ */ r("div", { className: "m-skel-row", children: [
|
|
706
|
+
/* @__PURE__ */ e("span", { className: "m-skel-ico" }),
|
|
707
|
+
/* @__PURE__ */ r("span", { className: "m-skel-main", children: [
|
|
708
|
+
/* @__PURE__ */ e("span", { className: "m-skel-line is-title" }),
|
|
709
|
+
/* @__PURE__ */ e("span", { className: "m-skel-line is-meta" })
|
|
710
|
+
] })
|
|
711
|
+
] }, l)) });
|
|
712
|
+
}
|
|
713
|
+
const pt = { personal: "个人", team: "团队" }, wa = [
|
|
714
|
+
{ key: "all", label: "全部" },
|
|
715
|
+
{ key: "personal", label: "个人" },
|
|
716
|
+
{ key: "team", label: "团队" }
|
|
717
|
+
];
|
|
718
|
+
function ht(t) {
|
|
719
|
+
const a = [pt[t.scope]];
|
|
720
|
+
return a.push(
|
|
721
|
+
t.compiledCount === void 0 ? `${t.materialCount} 份资料` : `${t.compiledCount}/${t.materialCount} 已编译`
|
|
722
|
+
), t.updatedAt && a.push(t.updatedAt), a.join(" · ");
|
|
723
|
+
}
|
|
724
|
+
function _e({
|
|
725
|
+
material: t,
|
|
726
|
+
onOpen: a,
|
|
727
|
+
onMenu: l,
|
|
728
|
+
pressHandlers: i,
|
|
729
|
+
dragging: n
|
|
730
|
+
}) {
|
|
731
|
+
const m = /* @__PURE__ */ r(
|
|
732
|
+
"button",
|
|
733
|
+
{
|
|
734
|
+
type: "button",
|
|
735
|
+
className: `m-row${n ? " is-dragging" : ""}`,
|
|
736
|
+
onClick: () => a(t.id),
|
|
737
|
+
...i,
|
|
738
|
+
children: [
|
|
739
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: Ve(t.kind), size: 16 }) }),
|
|
740
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
741
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: t.name }),
|
|
742
|
+
/* @__PURE__ */ e("span", { className: "m-row-meta", children: t.updatedAt })
|
|
743
|
+
] }),
|
|
744
|
+
/* @__PURE__ */ e(
|
|
745
|
+
"i",
|
|
746
|
+
{
|
|
747
|
+
className: `m-dot m-dot-${t.status}`,
|
|
748
|
+
"aria-label": t.status === "compiled" ? "已编译" : "待编译"
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
!l && /* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
return l ? /* @__PURE__ */ r("div", { className: "m-row-wrap", children: [
|
|
756
|
+
m,
|
|
757
|
+
/* @__PURE__ */ e(
|
|
758
|
+
"button",
|
|
759
|
+
{
|
|
760
|
+
type: "button",
|
|
761
|
+
className: "m-row-more",
|
|
762
|
+
"aria-label": `${t.name} 操作`,
|
|
763
|
+
onClick: () => l(t),
|
|
764
|
+
children: /* @__PURE__ */ e(w, { name: "more-horizontal", size: 16 })
|
|
765
|
+
}
|
|
766
|
+
)
|
|
767
|
+
] }) : m;
|
|
768
|
+
}
|
|
769
|
+
function ft(t, a) {
|
|
770
|
+
for (const l of t) {
|
|
771
|
+
if (l.id === a)
|
|
772
|
+
return [l.name];
|
|
773
|
+
const i = ft(l.children, a);
|
|
774
|
+
if (i)
|
|
775
|
+
return [l.name, ...i];
|
|
776
|
+
}
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
function rt({
|
|
780
|
+
tree: t,
|
|
781
|
+
value: a,
|
|
782
|
+
onPick: l
|
|
783
|
+
}) {
|
|
784
|
+
const [i, n] = h(() => /* @__PURE__ */ new Set()), m = (f) => {
|
|
785
|
+
n((N) => {
|
|
786
|
+
const d = new Set(N);
|
|
787
|
+
return d.has(f) ? d.delete(f) : d.add(f), d;
|
|
788
|
+
});
|
|
789
|
+
}, p = (f, N) => f.map((d) => /* @__PURE__ */ r("div", { children: [
|
|
790
|
+
/* @__PURE__ */ r("div", { className: `m-target-row${a === d.id ? " is-active" : ""}`, style: { paddingLeft: N * 16 }, children: [
|
|
791
|
+
d.children.length > 0 ? /* @__PURE__ */ e(
|
|
792
|
+
"button",
|
|
793
|
+
{
|
|
794
|
+
type: "button",
|
|
795
|
+
className: "m-target-arrow",
|
|
796
|
+
"aria-label": `${i.has(d.id) ? "收起" : "展开"} ${d.name}`,
|
|
797
|
+
onClick: () => m(d.id),
|
|
798
|
+
children: /* @__PURE__ */ e(w, { name: "chevron-right", size: 12, className: `m-dir-arrow${i.has(d.id) ? " is-open" : ""}` })
|
|
799
|
+
}
|
|
800
|
+
) : /* @__PURE__ */ e("span", { className: "m-target-nub" }),
|
|
801
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-target-name", onClick: () => l(d.id), children: d.name })
|
|
802
|
+
] }),
|
|
803
|
+
i.has(d.id) && d.children.length > 0 && p(d.children, N + 1)
|
|
804
|
+
] }, d.id));
|
|
805
|
+
return /* @__PURE__ */ r("div", { className: "m-target-tree", children: [
|
|
806
|
+
/* @__PURE__ */ r("div", { className: `m-target-row${a === null ? " is-active" : ""}`, children: [
|
|
807
|
+
/* @__PURE__ */ e("span", { className: "m-target-nub" }),
|
|
808
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-target-name", onClick: () => l(null), children: "根目录(未分类)" })
|
|
809
|
+
] }),
|
|
810
|
+
p(t, 1)
|
|
811
|
+
] });
|
|
812
|
+
}
|
|
813
|
+
const lt = (t) => t.preventDefault(), we = /* @__PURE__ */ new Map();
|
|
814
|
+
function Nt({
|
|
815
|
+
node: t,
|
|
816
|
+
depth: a,
|
|
817
|
+
isOpen: l,
|
|
818
|
+
materialsOf: i,
|
|
819
|
+
onToggle: n,
|
|
820
|
+
onRetry: m,
|
|
821
|
+
onOpenMaterial: p,
|
|
822
|
+
onMenu: f,
|
|
823
|
+
onMenuMaterial: N,
|
|
824
|
+
pressOf: d,
|
|
825
|
+
dragId: k,
|
|
826
|
+
dropTargetId: $
|
|
827
|
+
}) {
|
|
828
|
+
const g = l(t.id), D = i(t.id);
|
|
829
|
+
return /* @__PURE__ */ r("div", { className: "m-row-wrap", children: [
|
|
830
|
+
/* @__PURE__ */ r(
|
|
831
|
+
"button",
|
|
832
|
+
{
|
|
833
|
+
type: "button",
|
|
834
|
+
className: `m-row m-dir-row${$ === t.id ? " is-drop-target" : ""}`,
|
|
835
|
+
style: { paddingLeft: a * 18 },
|
|
836
|
+
"data-dir-row": t.id,
|
|
837
|
+
onClick: () => n(t),
|
|
838
|
+
children: [
|
|
839
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 14, className: `m-dir-arrow${g ? " is-open" : ""}` }),
|
|
840
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon m-dir-icon", children: /* @__PURE__ */ e(w, { name: g ? "folder-open" : "folder", size: 16 }) }),
|
|
841
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: t.name }) })
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
),
|
|
845
|
+
/* @__PURE__ */ e(
|
|
846
|
+
"button",
|
|
847
|
+
{
|
|
848
|
+
type: "button",
|
|
849
|
+
className: "m-row-more",
|
|
850
|
+
"aria-label": `${t.name} 操作`,
|
|
851
|
+
onClick: () => f(t),
|
|
852
|
+
children: /* @__PURE__ */ e(w, { name: "more-horizontal", size: 16 })
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
g && /* @__PURE__ */ r("div", { className: "m-tree-branch", children: [
|
|
856
|
+
t.children.map((T) => /* @__PURE__ */ e(
|
|
857
|
+
Nt,
|
|
858
|
+
{
|
|
859
|
+
node: T,
|
|
860
|
+
depth: a + 1,
|
|
861
|
+
isOpen: l,
|
|
862
|
+
materialsOf: i,
|
|
863
|
+
onToggle: n,
|
|
864
|
+
onRetry: m,
|
|
865
|
+
onOpenMaterial: p,
|
|
866
|
+
onMenu: f,
|
|
867
|
+
onMenuMaterial: N,
|
|
868
|
+
pressOf: d,
|
|
869
|
+
dragId: k,
|
|
870
|
+
dropTargetId: $
|
|
871
|
+
},
|
|
872
|
+
T.id
|
|
873
|
+
)),
|
|
874
|
+
(!D || D === "loading") && /* @__PURE__ */ e(Ee, { rows: 2 }),
|
|
875
|
+
D === "failed" && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => m(t.id), children: [
|
|
876
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
877
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "目录加载失败,点按重试" }) }),
|
|
878
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
879
|
+
] }),
|
|
880
|
+
Array.isArray(D) && D.length === 0 && t.children.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "该目录暂无资料" }) }) }),
|
|
881
|
+
Array.isArray(D) && D.map((T) => /* @__PURE__ */ e(_e, { material: T, onOpen: p, onMenu: N, pressHandlers: d(T), dragging: k === T.id }, T.id))
|
|
882
|
+
] })
|
|
883
|
+
] });
|
|
884
|
+
}
|
|
885
|
+
function ya({
|
|
886
|
+
kbId: t,
|
|
887
|
+
live: a,
|
|
888
|
+
onBack: l,
|
|
889
|
+
onOpenMaterial: i
|
|
890
|
+
}) {
|
|
891
|
+
const n = a ? a.kbs.find((s) => s.id === t) : void 0, m = n ?? fa(t), [p, f] = h(null), [N, d] = h([]), [k, $] = h(!1), [g, D] = h(0), [T, F] = h(
|
|
892
|
+
() => {
|
|
893
|
+
var s;
|
|
894
|
+
return ((s = we.get(t)) == null ? void 0 : s.openDirs) ?? /* @__PURE__ */ new Set();
|
|
895
|
+
}
|
|
896
|
+
), [P, _] = h(
|
|
897
|
+
() => {
|
|
898
|
+
var s;
|
|
899
|
+
return ((s = we.get(t)) == null ? void 0 : s.dirMaterials) ?? {};
|
|
900
|
+
}
|
|
901
|
+
), [M, U] = h(!1), [C, S] = h(null), [E, R] = h(null), [O, b] = h(null), [z, L] = h(""), [A, y] = h(""), [v, te] = h(!1), [J, Ie] = h(!1), [G, V] = h(""), ce = X(null), ae = X(null), [j, Ne] = h(null), [Q, Me] = h(null), Z = X(null), ne = X(!1), [se, ye] = h(!1), [be, oe] = h(""), [ie, ee] = h(null), [me, de] = h(!1), [Ge, ke] = h(0);
|
|
902
|
+
q(() => {
|
|
903
|
+
if (!n) {
|
|
904
|
+
f(null), d([]), $(!1);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
let s = !1;
|
|
908
|
+
return f(null), d([]), $(!1), Promise.all([Ft(t), jt(t)]).then(([o, u]) => {
|
|
909
|
+
s || (f(o), d(u));
|
|
910
|
+
}).catch(() => {
|
|
911
|
+
s || $(!0);
|
|
912
|
+
}), () => {
|
|
913
|
+
s = !0;
|
|
914
|
+
};
|
|
915
|
+
}, [t, n, g]);
|
|
916
|
+
const re = be.trim();
|
|
917
|
+
if (q(() => {
|
|
918
|
+
if (!se || !re)
|
|
919
|
+
return;
|
|
920
|
+
let s = !1;
|
|
921
|
+
const o = setTimeout(() => {
|
|
922
|
+
Gt(t, re).then((u) => {
|
|
923
|
+
s || (ee(u), de(!1));
|
|
924
|
+
}).catch(() => {
|
|
925
|
+
s || (ee(null), de(!0));
|
|
926
|
+
});
|
|
927
|
+
}, 300);
|
|
928
|
+
return () => {
|
|
929
|
+
s = !0, clearTimeout(o);
|
|
930
|
+
};
|
|
931
|
+
}, [se, re, Ge, t]), q(() => {
|
|
932
|
+
if (!G)
|
|
933
|
+
return;
|
|
934
|
+
const s = setTimeout(() => V(""), 2600);
|
|
935
|
+
return () => clearTimeout(s);
|
|
936
|
+
}, [G]), !m)
|
|
937
|
+
return null;
|
|
938
|
+
const ve = pt[m.scope], Oe = n ? m.materialCount > 0 ? `${ve} · 共 ${m.materialCount} 份资料` : ve : ht(m), Ce = (s, o) => {
|
|
939
|
+
const u = we.get(t) ?? { openDirs: T, dirMaterials: P };
|
|
940
|
+
u.dirMaterials = { ...u.dirMaterials, [s]: o }, we.set(t, u);
|
|
941
|
+
}, Ae = (s) => {
|
|
942
|
+
Ce(s, "loading"), _((o) => ({ ...o, [s]: "loading" })), Ut(t, s).then((o) => {
|
|
943
|
+
Ce(s, o), _((u) => ({ ...u, [s]: o }));
|
|
944
|
+
}).catch(() => {
|
|
945
|
+
Ce(s, "failed"), _((o) => ({ ...o, [s]: "failed" }));
|
|
946
|
+
});
|
|
947
|
+
}, xe = (s) => {
|
|
948
|
+
const o = !T.has(s.id), u = new Set(T);
|
|
949
|
+
o ? u.add(s.id) : u.delete(s.id), we.set(t, { openDirs: u, dirMaterials: P }), F(u), o && P[s.id] === void 0 && Ae(s.id);
|
|
950
|
+
}, Ye = (s) => T.has(s), We = (s) => P[s], c = n ? [] : ha(t), x = () => {
|
|
951
|
+
ye(!1), oe(""), ee(null), de(!1);
|
|
952
|
+
}, Y = () => {
|
|
953
|
+
U(!1), ye(!0), oe(""), ee(null), de(!1);
|
|
954
|
+
}, le = () => {
|
|
955
|
+
oe(""), ee(null), de(!1);
|
|
956
|
+
}, ue = (s) => {
|
|
957
|
+
oe(s), !s.trim() && (ie !== null || me) && (ee(null), de(!1));
|
|
958
|
+
}, ge = (s, o = null) => {
|
|
959
|
+
U(!1), R(null), S({ kind: s, targetCategoryId: o }), b(o), L(""), y("");
|
|
960
|
+
}, ze = () => {
|
|
961
|
+
v || S(null);
|
|
962
|
+
}, pe = (s) => {
|
|
963
|
+
if (!s)
|
|
964
|
+
return `${m.name} / 根目录`;
|
|
965
|
+
const o = p ? ft(p, s) : null;
|
|
966
|
+
return o ? [m.name, ...o].join(" / ") : m.name;
|
|
967
|
+
}, Le = (s) => {
|
|
968
|
+
let o = !1;
|
|
969
|
+
s.forEach((u) => {
|
|
970
|
+
if (!u) {
|
|
971
|
+
o = !0;
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
P[u] !== void 0 && Ae(u);
|
|
975
|
+
}), o && D((u) => u + 1);
|
|
976
|
+
}, gt = (s) => {
|
|
977
|
+
const o = we.get(t);
|
|
978
|
+
if (o) {
|
|
979
|
+
o.openDirs.delete(s);
|
|
980
|
+
const u = { ...o.dirMaterials };
|
|
981
|
+
delete u[s], o.dirMaterials = u, we.set(t, o);
|
|
982
|
+
}
|
|
983
|
+
F((u) => {
|
|
984
|
+
const I = new Set(u);
|
|
985
|
+
return I.delete(s), I;
|
|
986
|
+
}), _((u) => {
|
|
987
|
+
const I = { ...u };
|
|
988
|
+
return delete I[s], I;
|
|
989
|
+
});
|
|
990
|
+
}, Te = () => {
|
|
991
|
+
const s = C;
|
|
992
|
+
if (!s)
|
|
993
|
+
return;
|
|
994
|
+
const o = z.trim();
|
|
995
|
+
if ((s.kind === "note" || s.kind === "category" || s.kind === "rename") && !o) {
|
|
996
|
+
y(s.kind === "note" ? "请输入笔记标题" : "请输入目录名称");
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
y(""), te(!0);
|
|
1000
|
+
let u, I;
|
|
1001
|
+
if (s.kind === "note") {
|
|
1002
|
+
const B = s.targetCategoryId;
|
|
1003
|
+
u = Vt(t, o, B || void 0), I = `已在「${pe(B)}」创建笔记「${o}」`;
|
|
1004
|
+
} else if (s.kind === "category") {
|
|
1005
|
+
const B = s.targetCategoryId;
|
|
1006
|
+
u = Xt(t, o, B || void 0), I = `已在「${pe(B)}」创建目录「${o}」`;
|
|
1007
|
+
} else if (s.kind === "rename")
|
|
1008
|
+
u = Ht(s.node.id, o), I = `目录已重命名为「${o}」`;
|
|
1009
|
+
else if (s.kind === "move") {
|
|
1010
|
+
const B = O;
|
|
1011
|
+
u = at(t, [s.material.id], B || void 0), I = `已移动「${s.material.name}」到「${pe(B)}」`;
|
|
1012
|
+
} else s.kind === "confirm-dir" ? (u = qt(s.node.id), I = `已删除目录「${s.node.name}」`) : (u = Jt(t, [s.material.id]), I = `已删除资料「${s.material.name}」,可在回收站找回`);
|
|
1013
|
+
u.then(() => {
|
|
1014
|
+
S(null), V(I), s.kind === "note" ? Le([s.targetCategoryId]) : s.kind === "category" || s.kind === "rename" ? D((B) => B + 1) : s.kind === "move" ? Le([s.material.categoryId ?? null, O]) : s.kind === "confirm-dir" ? (gt(s.node.id), D((B) => B + 1)) : Le([s.material.categoryId ?? null]);
|
|
1015
|
+
}).catch((B) => y(B.message || "操作失败,请稍后重试")).finally(() => te(!1));
|
|
1016
|
+
}, wt = (s) => [
|
|
1017
|
+
{ act: "upload-here", icon: "upload", label: "上传资料到此处" },
|
|
1018
|
+
{ act: "new-sub", icon: "folder", label: "新建子目录" },
|
|
1019
|
+
{ act: "rename-dir", icon: "edit", label: "重命名" },
|
|
1020
|
+
{ act: "delete-dir", icon: "trash", label: "删除目录", danger: !0 }
|
|
1021
|
+
].map((u) => ({ ...u, key: `${s.id}:${u.act}` })), yt = (s) => [
|
|
1022
|
+
{ act: "move", icon: "folder-open", label: "移动到…" },
|
|
1023
|
+
{ act: "compile", icon: "refresh", label: s.status === "compiled" ? "重新编译" : "发起编译" },
|
|
1024
|
+
{ act: "download", icon: "download", label: "下载原件" },
|
|
1025
|
+
{ act: "delete-material", icon: "trash", label: "删除资料", danger: !0 }
|
|
1026
|
+
].map((u) => ({ ...u, key: `${s.id}:${u.act}` })), kt = (s) => {
|
|
1027
|
+
var u;
|
|
1028
|
+
if (!E)
|
|
1029
|
+
return;
|
|
1030
|
+
if (E.kind === "dir") {
|
|
1031
|
+
const I = E.node;
|
|
1032
|
+
s === "upload-here" ? (R(null), ae.current = I.id, (u = ce.current) == null || u.click()) : s === "new-sub" ? (R(null), ge("category", I.id)) : s === "rename-dir" ? (R(null), S({ kind: "rename", node: I }), L(I.name), y("")) : s === "delete-dir" && (R(null), S({ kind: "confirm-dir", node: I }), L(""), y(""));
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
const o = E.material;
|
|
1036
|
+
s === "move" ? (R(null), b(o.categoryId ?? null), S({ kind: "move", material: o }), L(""), y("")) : s === "compile" ? (R(null), mt(o.id).then(() => V(`已发起编译「${o.name}」`)).catch((I) => V(`编译发起失败:${I.message || "请稍后重试"}`))) : s === "download" ? (R(null), dt(o.id, o.name).catch(
|
|
1037
|
+
(I) => V(`下载失败:${I.message || "请稍后重试"}`)
|
|
1038
|
+
)) : s === "delete-material" && (R(null), S({ kind: "confirm-material", material: o }), L(""), y(""));
|
|
1039
|
+
}, vt = (s) => {
|
|
1040
|
+
s.lifted = !0, s.rects = Array.from(document.querySelectorAll(".m-screen [data-dir-row]")).map((o) => {
|
|
1041
|
+
const u = o.getBoundingClientRect();
|
|
1042
|
+
return {
|
|
1043
|
+
id: o.getAttribute("data-dir-row") || "",
|
|
1044
|
+
top: u.top,
|
|
1045
|
+
bottom: u.bottom,
|
|
1046
|
+
left: u.left,
|
|
1047
|
+
right: u.right
|
|
1048
|
+
};
|
|
1049
|
+
});
|
|
1050
|
+
try {
|
|
1051
|
+
s.element.setPointerCapture(s.pointerId);
|
|
1052
|
+
} catch {
|
|
1053
|
+
}
|
|
1054
|
+
ne.current = !0, document.addEventListener("touchmove", lt, { passive: !1 }), Ne({ material: s.material, x: s.lastX, y: s.lastY });
|
|
1055
|
+
}, Ct = (s) => {
|
|
1056
|
+
if (!s.rects)
|
|
1057
|
+
return null;
|
|
1058
|
+
const o = s.rects.find(
|
|
1059
|
+
(u) => s.lastY >= u.top && s.lastY <= u.bottom && s.lastX >= u.left && s.lastX <= u.right
|
|
1060
|
+
);
|
|
1061
|
+
return o ? o.id : null;
|
|
1062
|
+
}, Je = (s, o) => {
|
|
1063
|
+
window.clearTimeout(s.timer), document.removeEventListener("touchmove", lt);
|
|
1064
|
+
try {
|
|
1065
|
+
s.element.releasePointerCapture(s.pointerId);
|
|
1066
|
+
} catch {
|
|
1067
|
+
}
|
|
1068
|
+
if (o && s.dropId) {
|
|
1069
|
+
const u = s.dropId;
|
|
1070
|
+
at(t, [s.material.id], u).then(() => {
|
|
1071
|
+
V(`已移动「${s.material.name}」到「${pe(u)}」`), Le([s.material.categoryId ?? null, u]);
|
|
1072
|
+
}).catch((I) => V(`移动失败:${I.message || "请稍后重试"}`));
|
|
1073
|
+
}
|
|
1074
|
+
window.setTimeout(() => {
|
|
1075
|
+
ne.current = !1;
|
|
1076
|
+
}, 80), Z.current = null, Ne(null), Me(null);
|
|
1077
|
+
}, At = (s) => ({
|
|
1078
|
+
onPointerDown: (o) => {
|
|
1079
|
+
if (!n || o.target.closest(".m-row-more") || o.pointerType === "mouse" && o.button !== 0)
|
|
1080
|
+
return;
|
|
1081
|
+
const u = {
|
|
1082
|
+
material: s,
|
|
1083
|
+
element: o.currentTarget,
|
|
1084
|
+
pointerId: o.pointerId,
|
|
1085
|
+
startX: o.clientX,
|
|
1086
|
+
startY: o.clientY,
|
|
1087
|
+
lastX: o.clientX,
|
|
1088
|
+
lastY: o.clientY,
|
|
1089
|
+
timer: window.setTimeout(() => vt(u), 350),
|
|
1090
|
+
lifted: !1,
|
|
1091
|
+
dropId: null,
|
|
1092
|
+
rects: null
|
|
1093
|
+
};
|
|
1094
|
+
Z.current = u;
|
|
1095
|
+
},
|
|
1096
|
+
onPointerMove: (o) => {
|
|
1097
|
+
const u = Z.current;
|
|
1098
|
+
if (!u || u.material.id !== s.id)
|
|
1099
|
+
return;
|
|
1100
|
+
if (u.lastX = o.clientX, u.lastY = o.clientY, !u.lifted) {
|
|
1101
|
+
(Math.abs(u.lastX - u.startX) > 10 || Math.abs(u.lastY - u.startY) > 10) && (window.clearTimeout(u.timer), Z.current = null);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
Ne((B) => B && { ...B, x: u.lastX, y: u.lastY });
|
|
1105
|
+
const I = Ct(u);
|
|
1106
|
+
u.dropId = I, Me(I);
|
|
1107
|
+
},
|
|
1108
|
+
onPointerUp: () => {
|
|
1109
|
+
const o = Z.current;
|
|
1110
|
+
!o || o.material.id !== s.id || Je(o, o.lifted);
|
|
1111
|
+
},
|
|
1112
|
+
onPointerCancel: () => {
|
|
1113
|
+
const o = Z.current;
|
|
1114
|
+
!o || o.material.id !== s.id || Je(o, !1);
|
|
1115
|
+
},
|
|
1116
|
+
onContextMenu: (o) => o.preventDefault()
|
|
1117
|
+
}), Qe = (s) => n ? At(s) : void 0, Ze = (s) => {
|
|
1118
|
+
if (ne.current) {
|
|
1119
|
+
ne.current = !1;
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
i(s);
|
|
1123
|
+
}, Tt = (s) => R({ kind: "material", material: s }), Et = (s) => {
|
|
1124
|
+
const o = Array.from(s.target.files || []);
|
|
1125
|
+
s.target.value = "";
|
|
1126
|
+
const u = ae.current;
|
|
1127
|
+
ae.current = null, !(!o.length || J) && (Ie(!0), Wt(t, o, u || void 0).then(() => {
|
|
1128
|
+
V(`已上传 ${o.length} 份到「${pe(u)}」`), Le([u]);
|
|
1129
|
+
}).catch((I) => V(`上传失败:${I.message || "请稍后重试"}`)).finally(() => Ie(!1)));
|
|
1130
|
+
};
|
|
1131
|
+
return /* @__PURE__ */ r("div", { className: "m-screen", children: [
|
|
1132
|
+
/* @__PURE__ */ r("div", { className: "m-detail-head", children: [
|
|
1133
|
+
/* @__PURE__ */ e(
|
|
1134
|
+
"button",
|
|
1135
|
+
{
|
|
1136
|
+
type: "button",
|
|
1137
|
+
className: "m-back",
|
|
1138
|
+
onClick: () => se ? x() : l(),
|
|
1139
|
+
"aria-label": "返回知识库列表",
|
|
1140
|
+
children: /* @__PURE__ */ e(w, { name: "chevron-left", size: 18 })
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ r("div", { className: "m-detail-title", children: [
|
|
1144
|
+
/* @__PURE__ */ e("span", { className: "m-detail-name", children: m.name }),
|
|
1145
|
+
/* @__PURE__ */ e("span", { className: "m-detail-meta", children: Oe })
|
|
1146
|
+
] })
|
|
1147
|
+
] }),
|
|
1148
|
+
/* @__PURE__ */ e("section", { className: "m-section", children: n && se ? /* @__PURE__ */ r(H, { children: [
|
|
1149
|
+
/* @__PURE__ */ r("div", { className: "m-search", children: [
|
|
1150
|
+
/* @__PURE__ */ e(w, { name: "search", size: 14 }),
|
|
1151
|
+
/* @__PURE__ */ e(
|
|
1152
|
+
"input",
|
|
1153
|
+
{
|
|
1154
|
+
value: be,
|
|
1155
|
+
placeholder: "搜索本库资料",
|
|
1156
|
+
"aria-label": "搜索本库资料",
|
|
1157
|
+
autoFocus: !0,
|
|
1158
|
+
onChange: (s) => ue(s.target.value),
|
|
1159
|
+
onKeyDown: (s) => {
|
|
1160
|
+
s.key === "Enter" && ke((o) => o + 1);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
),
|
|
1164
|
+
be && /* @__PURE__ */ e("button", { type: "button", className: "m-search-clear", onClick: le, "aria-label": "清空搜索", children: /* @__PURE__ */ e(w, { name: "x", size: 12 }) }),
|
|
1165
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-kb-search-cancel", onClick: x, children: "取消" })
|
|
1166
|
+
] }),
|
|
1167
|
+
!re && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "输入关键字搜索本库资料" }) }) }),
|
|
1168
|
+
re && ie === null && !me && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "搜索中…" }) }) }),
|
|
1169
|
+
me && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => ke((s) => s + 1), children: [
|
|
1170
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
1171
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "搜索失败,点按重试" }) }),
|
|
1172
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
1173
|
+
] }),
|
|
1174
|
+
ie && ie.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "无匹配资料" }) }) }),
|
|
1175
|
+
ie == null ? void 0 : ie.map((s) => /* @__PURE__ */ e(_e, { material: s, onOpen: i }, s.id))
|
|
1176
|
+
] }) : /* @__PURE__ */ r(H, { children: [
|
|
1177
|
+
n && k && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => D((s) => s + 1), children: [
|
|
1178
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
1179
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "资料加载失败,点按重试" }) }),
|
|
1180
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
1181
|
+
] }),
|
|
1182
|
+
n && !k && p === null && /* @__PURE__ */ e(Ee, {}),
|
|
1183
|
+
n && !k && p !== null && /* @__PURE__ */ r(H, { children: [
|
|
1184
|
+
p.length === 0 && N.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "该知识库暂无资料" }) }) }),
|
|
1185
|
+
p.map((s) => /* @__PURE__ */ e(
|
|
1186
|
+
Nt,
|
|
1187
|
+
{
|
|
1188
|
+
node: s,
|
|
1189
|
+
depth: 0,
|
|
1190
|
+
isOpen: Ye,
|
|
1191
|
+
materialsOf: We,
|
|
1192
|
+
onToggle: xe,
|
|
1193
|
+
onRetry: Ae,
|
|
1194
|
+
onOpenMaterial: Ze,
|
|
1195
|
+
onMenu: (o) => R({ kind: "dir", node: o }),
|
|
1196
|
+
onMenuMaterial: (o) => R({ kind: "material", material: o }),
|
|
1197
|
+
pressOf: Qe,
|
|
1198
|
+
dragId: (j == null ? void 0 : j.material.id) ?? null,
|
|
1199
|
+
dropTargetId: Q
|
|
1200
|
+
},
|
|
1201
|
+
s.id
|
|
1202
|
+
)),
|
|
1203
|
+
N.map((s) => /* @__PURE__ */ e(
|
|
1204
|
+
_e,
|
|
1205
|
+
{
|
|
1206
|
+
material: s,
|
|
1207
|
+
onOpen: Ze,
|
|
1208
|
+
onMenu: Tt,
|
|
1209
|
+
pressHandlers: Qe(s),
|
|
1210
|
+
dragging: (j == null ? void 0 : j.material.id) === s.id
|
|
1211
|
+
},
|
|
1212
|
+
s.id
|
|
1213
|
+
))
|
|
1214
|
+
] }),
|
|
1215
|
+
!n && c.map((s) => /* @__PURE__ */ e(_e, { material: s, onOpen: i }, s.id)),
|
|
1216
|
+
!n && c.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "该知识库暂无资料" }) }) })
|
|
1217
|
+
] }) }),
|
|
1218
|
+
n && /* @__PURE__ */ r(H, { children: [
|
|
1219
|
+
(M || C || E) && /* @__PURE__ */ e(
|
|
1220
|
+
"div",
|
|
1221
|
+
{
|
|
1222
|
+
className: "m-fab-scrim",
|
|
1223
|
+
onClick: () => {
|
|
1224
|
+
C ? ze() : E ? R(null) : U(!1);
|
|
1225
|
+
},
|
|
1226
|
+
"aria-hidden": "true"
|
|
1227
|
+
}
|
|
1228
|
+
),
|
|
1229
|
+
M && /* @__PURE__ */ r("div", { className: "m-fab-menu", children: [
|
|
1230
|
+
/* @__PURE__ */ r("button", { type: "button", onClick: Y, children: [
|
|
1231
|
+
/* @__PURE__ */ e("span", { className: "m-fab-ico", children: /* @__PURE__ */ e(w, { name: "search", size: 16 }) }),
|
|
1232
|
+
"查询资料"
|
|
1233
|
+
] }),
|
|
1234
|
+
/* @__PURE__ */ r(
|
|
1235
|
+
"button",
|
|
1236
|
+
{
|
|
1237
|
+
type: "button",
|
|
1238
|
+
onClick: () => {
|
|
1239
|
+
var s;
|
|
1240
|
+
U(!1), ae.current = null, (s = ce.current) == null || s.click();
|
|
1241
|
+
},
|
|
1242
|
+
disabled: J,
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ e("span", { className: "m-fab-ico", children: /* @__PURE__ */ e(w, { name: "upload", size: 16 }) }),
|
|
1245
|
+
J ? "上传中…" : "上传资料"
|
|
1246
|
+
]
|
|
1247
|
+
}
|
|
1248
|
+
),
|
|
1249
|
+
/* @__PURE__ */ r("button", { type: "button", onClick: () => ge("note"), children: [
|
|
1250
|
+
/* @__PURE__ */ e("span", { className: "m-fab-ico", children: /* @__PURE__ */ e(w, { name: "file", size: 16 }) }),
|
|
1251
|
+
"新建笔记"
|
|
1252
|
+
] }),
|
|
1253
|
+
/* @__PURE__ */ r("button", { type: "button", onClick: () => ge("category"), children: [
|
|
1254
|
+
/* @__PURE__ */ e("span", { className: "m-fab-ico", children: /* @__PURE__ */ e(w, { name: "folder", size: 16 }) }),
|
|
1255
|
+
"新建目录"
|
|
1256
|
+
] })
|
|
1257
|
+
] }),
|
|
1258
|
+
E && /* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1259
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-title", children: E.kind === "dir" ? E.node.name : E.material.name }),
|
|
1260
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-target", children: [
|
|
1261
|
+
E.kind === "dir" ? "目录" : "资料",
|
|
1262
|
+
" · 「",
|
|
1263
|
+
pe(E.kind === "dir" ? E.node.id : E.material.categoryId ?? null),
|
|
1264
|
+
"」"
|
|
1265
|
+
] }),
|
|
1266
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-menu", children: (E.kind === "dir" ? wt(E.node) : yt(E.material)).map(
|
|
1267
|
+
(s) => /* @__PURE__ */ r(
|
|
1268
|
+
"button",
|
|
1269
|
+
{
|
|
1270
|
+
type: "button",
|
|
1271
|
+
className: s.danger ? "is-danger" : void 0,
|
|
1272
|
+
onClick: () => kt(s.act),
|
|
1273
|
+
children: [
|
|
1274
|
+
/* @__PURE__ */ e("span", { className: "m-fab-ico", children: /* @__PURE__ */ e(w, { name: s.icon, size: 16 }) }),
|
|
1275
|
+
s.label
|
|
1276
|
+
]
|
|
1277
|
+
},
|
|
1278
|
+
s.key
|
|
1279
|
+
)
|
|
1280
|
+
) })
|
|
1281
|
+
] }),
|
|
1282
|
+
C && (C.kind === "note" || C.kind === "category") && /* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1283
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-title", children: C.kind === "note" ? "新建笔记" : "新建目录" }),
|
|
1284
|
+
/* @__PURE__ */ e(
|
|
1285
|
+
"input",
|
|
1286
|
+
{
|
|
1287
|
+
className: "m-sheet-input",
|
|
1288
|
+
value: z,
|
|
1289
|
+
maxLength: 100,
|
|
1290
|
+
placeholder: C.kind === "note" ? "例如:值班记录" : "例如:标准规范",
|
|
1291
|
+
"aria-label": C.kind === "note" ? "笔记标题" : "目录名称",
|
|
1292
|
+
autoFocus: !0,
|
|
1293
|
+
onChange: (s) => {
|
|
1294
|
+
L(s.target.value), A && y("");
|
|
1295
|
+
},
|
|
1296
|
+
onKeyDown: (s) => {
|
|
1297
|
+
s.key === "Enter" && Te();
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-target", children: "选择落点目录:" }),
|
|
1302
|
+
/* @__PURE__ */ e(rt, { tree: p ?? [], value: O, onPick: b }),
|
|
1303
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-target", children: [
|
|
1304
|
+
"将创建在「",
|
|
1305
|
+
pe(O),
|
|
1306
|
+
"」"
|
|
1307
|
+
] }),
|
|
1308
|
+
A && /* @__PURE__ */ e("div", { className: "m-sheet-error", children: A }),
|
|
1309
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-actions", children: [
|
|
1310
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-sheet-btn", onClick: ze, disabled: v, children: "取消" }),
|
|
1311
|
+
/* @__PURE__ */ e(
|
|
1312
|
+
"button",
|
|
1313
|
+
{
|
|
1314
|
+
type: "button",
|
|
1315
|
+
className: "m-sheet-btn is-primary",
|
|
1316
|
+
onClick: Te,
|
|
1317
|
+
disabled: v,
|
|
1318
|
+
children: v ? "创建中…" : "创建"
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
] })
|
|
1322
|
+
] }),
|
|
1323
|
+
C && C.kind === "rename" && /* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1324
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-title", children: "重命名目录" }),
|
|
1325
|
+
/* @__PURE__ */ e(
|
|
1326
|
+
"input",
|
|
1327
|
+
{
|
|
1328
|
+
className: "m-sheet-input",
|
|
1329
|
+
value: z,
|
|
1330
|
+
maxLength: 100,
|
|
1331
|
+
"aria-label": "目录名称",
|
|
1332
|
+
autoFocus: !0,
|
|
1333
|
+
onChange: (s) => {
|
|
1334
|
+
L(s.target.value), A && y("");
|
|
1335
|
+
},
|
|
1336
|
+
onKeyDown: (s) => {
|
|
1337
|
+
s.key === "Enter" && Te();
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
),
|
|
1341
|
+
A && /* @__PURE__ */ e("div", { className: "m-sheet-error", children: A }),
|
|
1342
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-actions", children: [
|
|
1343
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-sheet-btn", onClick: ze, disabled: v, children: "取消" }),
|
|
1344
|
+
/* @__PURE__ */ e(
|
|
1345
|
+
"button",
|
|
1346
|
+
{
|
|
1347
|
+
type: "button",
|
|
1348
|
+
className: "m-sheet-btn is-primary",
|
|
1349
|
+
onClick: Te,
|
|
1350
|
+
disabled: v,
|
|
1351
|
+
children: v ? "保存中…" : "保存"
|
|
1352
|
+
}
|
|
1353
|
+
)
|
|
1354
|
+
] })
|
|
1355
|
+
] }),
|
|
1356
|
+
C && C.kind === "move" && /* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1357
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-title", children: [
|
|
1358
|
+
"移动「",
|
|
1359
|
+
C.material.name,
|
|
1360
|
+
"」到…"
|
|
1361
|
+
] }),
|
|
1362
|
+
/* @__PURE__ */ e(rt, { tree: p ?? [], value: O, onPick: b }),
|
|
1363
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-target", children: [
|
|
1364
|
+
"将移动到「",
|
|
1365
|
+
pe(O),
|
|
1366
|
+
"」"
|
|
1367
|
+
] }),
|
|
1368
|
+
A && /* @__PURE__ */ e("div", { className: "m-sheet-error", children: A }),
|
|
1369
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-actions", children: [
|
|
1370
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-sheet-btn", onClick: ze, disabled: v, children: "取消" }),
|
|
1371
|
+
/* @__PURE__ */ e(
|
|
1372
|
+
"button",
|
|
1373
|
+
{
|
|
1374
|
+
type: "button",
|
|
1375
|
+
className: "m-sheet-btn is-primary",
|
|
1376
|
+
onClick: Te,
|
|
1377
|
+
disabled: v,
|
|
1378
|
+
children: v ? "移动中…" : "移动"
|
|
1379
|
+
}
|
|
1380
|
+
)
|
|
1381
|
+
] })
|
|
1382
|
+
] }),
|
|
1383
|
+
C && (C.kind === "confirm-dir" || C.kind === "confirm-material") && /* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1384
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-title", children: C.kind === "confirm-dir" ? "删除目录" : "删除资料" }),
|
|
1385
|
+
/* @__PURE__ */ e("p", { className: "m-sheet-desc", children: C.kind === "confirm-dir" ? `将删除目录「${C.node.name}」。目录需为空才能删除。` : `将删除资料「${C.material.name}」,可在回收站找回。` }),
|
|
1386
|
+
A && /* @__PURE__ */ e("div", { className: "m-sheet-error", children: A }),
|
|
1387
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-actions", children: [
|
|
1388
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-sheet-btn", onClick: ze, disabled: v, children: "取消" }),
|
|
1389
|
+
/* @__PURE__ */ e(
|
|
1390
|
+
"button",
|
|
1391
|
+
{
|
|
1392
|
+
type: "button",
|
|
1393
|
+
className: "m-sheet-btn is-danger",
|
|
1394
|
+
onClick: Te,
|
|
1395
|
+
disabled: v,
|
|
1396
|
+
children: v ? "删除中…" : "删除"
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
] })
|
|
1400
|
+
] }),
|
|
1401
|
+
!C && !E && /* @__PURE__ */ e(
|
|
1402
|
+
"button",
|
|
1403
|
+
{
|
|
1404
|
+
type: "button",
|
|
1405
|
+
className: `m-fab${M ? " is-open" : ""}`,
|
|
1406
|
+
onClick: () => U((s) => !s),
|
|
1407
|
+
"aria-label": M ? "关闭操作菜单" : "库操作菜单",
|
|
1408
|
+
"aria-expanded": M,
|
|
1409
|
+
children: /* @__PURE__ */ e(w, { name: M ? "x" : "plus", size: 22 })
|
|
1410
|
+
}
|
|
1411
|
+
),
|
|
1412
|
+
G && /* @__PURE__ */ e("div", { className: "m-fab-toast", children: G }),
|
|
1413
|
+
j && /* @__PURE__ */ r("div", { className: "m-drag-chip", style: { left: j.x, top: j.y }, children: [
|
|
1414
|
+
/* @__PURE__ */ e(w, { name: Ve(j.material.kind), size: 13 }),
|
|
1415
|
+
/* @__PURE__ */ e("span", { children: j.material.name })
|
|
1416
|
+
] }),
|
|
1417
|
+
/* @__PURE__ */ e("input", { ref: ce, type: "file", multiple: !0, hidden: !0, onChange: Et })
|
|
1418
|
+
] })
|
|
1419
|
+
] });
|
|
1420
|
+
}
|
|
1421
|
+
function ka({
|
|
1422
|
+
selectedKbId: t,
|
|
1423
|
+
onSelectKb: a,
|
|
1424
|
+
onBack: l,
|
|
1425
|
+
onOpenMaterial: i,
|
|
1426
|
+
data: n
|
|
1427
|
+
}) {
|
|
1428
|
+
const [m, p] = h("all");
|
|
1429
|
+
if (t)
|
|
1430
|
+
return /* @__PURE__ */ e(ya, { kbId: t, live: n, onBack: l, onOpenMaterial: i }, t);
|
|
1431
|
+
const N = ((n == null ? void 0 : n.kbs) ?? je).filter((d) => m === "all" || d.scope === m);
|
|
1432
|
+
return /* @__PURE__ */ e("div", { className: "m-screen", children: /* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
1433
|
+
/* @__PURE__ */ e("div", { className: "m-scope-tabs", children: wa.map((d) => /* @__PURE__ */ e(
|
|
1434
|
+
"button",
|
|
1435
|
+
{
|
|
1436
|
+
type: "button",
|
|
1437
|
+
className: `m-scope-tab${m === d.key ? " is-active" : ""}`,
|
|
1438
|
+
onClick: () => p(d.key),
|
|
1439
|
+
children: d.label
|
|
1440
|
+
},
|
|
1441
|
+
d.key
|
|
1442
|
+
)) }),
|
|
1443
|
+
N.map((d) => /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => a(d.id), children: [
|
|
1444
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(ut, { kb: d, size: 17 }) }),
|
|
1445
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
1446
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: d.name }),
|
|
1447
|
+
/* @__PURE__ */ e("span", { className: "m-row-meta", children: ht(d) })
|
|
1448
|
+
] }),
|
|
1449
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
1450
|
+
] }, d.id)),
|
|
1451
|
+
N.length === 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "该范围下暂无知识库" }) }) })
|
|
1452
|
+
] }) });
|
|
1453
|
+
}
|
|
1454
|
+
const Re = {
|
|
1455
|
+
compile: "编译中…",
|
|
1456
|
+
reparse: "解析中…",
|
|
1457
|
+
download: "下载中…",
|
|
1458
|
+
revise: "上传中…"
|
|
1459
|
+
};
|
|
1460
|
+
function va(t) {
|
|
1461
|
+
return Ue.find((a) => a.id === t);
|
|
1462
|
+
}
|
|
1463
|
+
function Ca({ children: t }) {
|
|
1464
|
+
return /* @__PURE__ */ e("span", { className: "m-meta-chip", children: t });
|
|
1465
|
+
}
|
|
1466
|
+
function Aa({ materialId: t, live: a, onBack: l }) {
|
|
1467
|
+
const [i, n] = h(null), [m, p] = h(!1), [f, N] = h(0), [d, k] = h(null), [$, g] = h(""), D = X(null);
|
|
1468
|
+
q(() => {
|
|
1469
|
+
if (!a) {
|
|
1470
|
+
n(null), p(!1);
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
let S = !1;
|
|
1474
|
+
return n(null), p(!1), Zt(t).then((E) => {
|
|
1475
|
+
S || n(E);
|
|
1476
|
+
}).catch(() => {
|
|
1477
|
+
S || p(!0);
|
|
1478
|
+
}), () => {
|
|
1479
|
+
S = !0;
|
|
1480
|
+
};
|
|
1481
|
+
}, [t, a, f]);
|
|
1482
|
+
const T = a ? void 0 : va(t), F = (i == null ? void 0 : i.title) ?? (T == null ? void 0 : T.name) ?? "资料详情", P = (i == null ? void 0 : i.status) ?? (T == null ? void 0 : T.status) ?? "pending", _ = (S, E, R) => {
|
|
1483
|
+
d || !i || (k(S), g(""), E().then(() => {
|
|
1484
|
+
k(null), R && N((O) => O + 1);
|
|
1485
|
+
}).catch((O) => {
|
|
1486
|
+
k(null), g(O instanceof Error && O.message ? O.message : "操作失败,请重试");
|
|
1487
|
+
}));
|
|
1488
|
+
}, M = (i == null ? void 0 : i.sourceType) === "NOTE", U = (i == null ? void 0 : i.sourceType.includes("YUQUE")) ?? !1, C = [];
|
|
1489
|
+
return i ? (C.push(i.sourceLabel), i.versionNo !== null && C.push(`v${i.versionNo}`), i.charCount !== null && C.push(`${i.charCount} 字`), i.updatedAt && C.push(i.updatedAt)) : T != null && T.updatedAt && C.push(T.updatedAt), /* @__PURE__ */ r("div", { className: "m-screen m-material", children: [
|
|
1490
|
+
/* @__PURE__ */ r("div", { className: "m-detail-head", children: [
|
|
1491
|
+
/* @__PURE__ */ e("button", { type: "button", className: "m-back", onClick: l, "aria-label": "返回知识库详情", children: /* @__PURE__ */ e(w, { name: "chevron-left", size: 18 }) }),
|
|
1492
|
+
/* @__PURE__ */ r("div", { className: "m-detail-title", children: [
|
|
1493
|
+
/* @__PURE__ */ e("span", { className: "m-detail-name", children: F }),
|
|
1494
|
+
/* @__PURE__ */ r("span", { className: "m-detail-meta", children: [
|
|
1495
|
+
/* @__PURE__ */ e(
|
|
1496
|
+
"i",
|
|
1497
|
+
{
|
|
1498
|
+
className: `m-dot m-dot-${P}`,
|
|
1499
|
+
"aria-label": P === "compiled" ? "已编译" : "待编译"
|
|
1500
|
+
}
|
|
1501
|
+
),
|
|
1502
|
+
P === "compiled" ? "已编译" : "待编译"
|
|
1503
|
+
] })
|
|
1504
|
+
] })
|
|
1505
|
+
] }),
|
|
1506
|
+
/* @__PURE__ */ r("div", { className: "m-material-meta", children: [
|
|
1507
|
+
C.map((S) => /* @__PURE__ */ e(Ca, { children: S }, S)),
|
|
1508
|
+
a && i && /* @__PURE__ */ r("span", { className: "m-meta-actions", children: [
|
|
1509
|
+
/* @__PURE__ */ e(
|
|
1510
|
+
"button",
|
|
1511
|
+
{
|
|
1512
|
+
type: "button",
|
|
1513
|
+
className: "m-meta-btn",
|
|
1514
|
+
disabled: d !== null,
|
|
1515
|
+
onClick: () => _("compile", () => mt(t), !0),
|
|
1516
|
+
children: d === "compile" ? Re.compile : P === "compiled" ? "重新编译" : "编译"
|
|
1517
|
+
}
|
|
1518
|
+
),
|
|
1519
|
+
!M && /* @__PURE__ */ e(
|
|
1520
|
+
"button",
|
|
1521
|
+
{
|
|
1522
|
+
type: "button",
|
|
1523
|
+
className: "m-meta-btn",
|
|
1524
|
+
disabled: d !== null,
|
|
1525
|
+
onClick: () => _(
|
|
1526
|
+
"download",
|
|
1527
|
+
() => dt(t, `${F}${i.fileExt ? `.${i.fileExt}` : ""}`),
|
|
1528
|
+
!1
|
|
1529
|
+
),
|
|
1530
|
+
children: d === "download" ? Re.download : "下载"
|
|
1531
|
+
}
|
|
1532
|
+
),
|
|
1533
|
+
!M && /* @__PURE__ */ e(
|
|
1534
|
+
"button",
|
|
1535
|
+
{
|
|
1536
|
+
type: "button",
|
|
1537
|
+
className: "m-meta-btn",
|
|
1538
|
+
disabled: d !== null,
|
|
1539
|
+
onClick: () => _("reparse", () => ea(t), !0),
|
|
1540
|
+
children: d === "reparse" ? Re.reparse : "解析"
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
!M && !U && /* @__PURE__ */ r(H, { children: [
|
|
1544
|
+
/* @__PURE__ */ e(
|
|
1545
|
+
"button",
|
|
1546
|
+
{
|
|
1547
|
+
type: "button",
|
|
1548
|
+
className: "m-meta-btn",
|
|
1549
|
+
disabled: d !== null,
|
|
1550
|
+
onClick: () => {
|
|
1551
|
+
var S;
|
|
1552
|
+
return (S = D.current) == null ? void 0 : S.click();
|
|
1553
|
+
},
|
|
1554
|
+
children: d === "revise" ? Re.revise : "换版"
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
/* @__PURE__ */ e(
|
|
1558
|
+
"input",
|
|
1559
|
+
{
|
|
1560
|
+
ref: D,
|
|
1561
|
+
type: "file",
|
|
1562
|
+
hidden: !0,
|
|
1563
|
+
onChange: (S) => {
|
|
1564
|
+
var R;
|
|
1565
|
+
const E = (R = S.target.files) == null ? void 0 : R[0];
|
|
1566
|
+
S.target.value = "", E && i && _("revise", () => ta(i.kbId, t, E), !0);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
)
|
|
1570
|
+
] })
|
|
1571
|
+
] })
|
|
1572
|
+
] }),
|
|
1573
|
+
$ && /* @__PURE__ */ e("p", { className: "m-act-error", children: $ }),
|
|
1574
|
+
a && !i && !m && /* @__PURE__ */ e(Ee, {}),
|
|
1575
|
+
a && m && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => N((S) => S + 1), children: [
|
|
1576
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
1577
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "资料加载失败,点按重试" }) }),
|
|
1578
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
1579
|
+
] }),
|
|
1580
|
+
i && /* @__PURE__ */ e("article", { className: "m-article", children: i.content ? /* @__PURE__ */ e(ct, { content: i.content }) : "该资料暂无解析正文" })
|
|
1581
|
+
] });
|
|
1582
|
+
}
|
|
1583
|
+
const Ta = 9e4;
|
|
1584
|
+
function Ea(t) {
|
|
1585
|
+
const a = t == null ? void 0 : t.hits;
|
|
1586
|
+
if (!Array.isArray(a))
|
|
1587
|
+
return [];
|
|
1588
|
+
const l = [];
|
|
1589
|
+
for (const i of a) {
|
|
1590
|
+
const n = i || {}, m = typeof n.title == "string" ? n.title : "", p = typeof n.materialTitle == "string" ? n.materialTitle : "";
|
|
1591
|
+
(m || p) && l.push(m || p);
|
|
1592
|
+
}
|
|
1593
|
+
return l;
|
|
1594
|
+
}
|
|
1595
|
+
function $a({ live: t }) {
|
|
1596
|
+
const [a, l] = h(pa), [i, n] = h(""), [m, p] = h(!1), [f, N] = h(""), d = X(null), k = X(void 0), $ = X(null), g = X(void 0), D = X(""), T = X(""), F = X(/* @__PURE__ */ new Set());
|
|
1597
|
+
q(() => {
|
|
1598
|
+
t && l([]);
|
|
1599
|
+
}, [t]), q(
|
|
1600
|
+
() => () => {
|
|
1601
|
+
var b;
|
|
1602
|
+
clearTimeout(k.current), (b = $.current) == null || b.abort(), g.current !== void 0 && clearTimeout(g.current);
|
|
1603
|
+
},
|
|
1604
|
+
[]
|
|
1605
|
+
), q(() => {
|
|
1606
|
+
const b = d.current;
|
|
1607
|
+
b && (b.scrollTop = b.scrollHeight);
|
|
1608
|
+
}, [a, m, f]);
|
|
1609
|
+
const P = (b, z) => {
|
|
1610
|
+
l((L) => L.map((A) => A.id === b ? z(A) : A));
|
|
1611
|
+
}, _ = a[a.length - 1], M = !!(_ && _.role === "assistant" && _.content), U = () => {
|
|
1612
|
+
g.current !== void 0 && (clearTimeout(g.current), g.current = void 0);
|
|
1613
|
+
}, C = () => {
|
|
1614
|
+
U(), $.current = null, p(!1), N("");
|
|
1615
|
+
}, S = (b, z, L) => {
|
|
1616
|
+
const A = z.data || {};
|
|
1617
|
+
switch (z.type) {
|
|
1618
|
+
case "status": {
|
|
1619
|
+
if (F.current.size > 0)
|
|
1620
|
+
return;
|
|
1621
|
+
const y = Math.floor(Number(A.elapsedMs || 0) / 1e3);
|
|
1622
|
+
N(y > 0 ? `正在准备会话… 已等待 ${y} 秒` : "正在准备会话…");
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
case "meta":
|
|
1626
|
+
case "conversationMeta": {
|
|
1627
|
+
const y = typeof A.conversationId == "string" ? A.conversationId : "";
|
|
1628
|
+
y && (D.current = y), N("正在检索证据并生成回答…");
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
case "token": {
|
|
1632
|
+
const y = typeof A.text == "string" ? A.text : "";
|
|
1633
|
+
y && (N(""), P(b, (v) => ({ ...v, content: v.content + y })));
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
case "tool_result": {
|
|
1637
|
+
const y = Ea(A.result);
|
|
1638
|
+
if (y.length) {
|
|
1639
|
+
for (const v of y)
|
|
1640
|
+
F.current.add(v);
|
|
1641
|
+
P(b, (v) => ({
|
|
1642
|
+
...v,
|
|
1643
|
+
sources: [.../* @__PURE__ */ new Set([...v.sources || [], ...y])]
|
|
1644
|
+
})), N(`已找到 ${F.current.size} 份参考资料,正在生成回答…`);
|
|
1645
|
+
}
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
case "done": {
|
|
1649
|
+
const y = typeof A.content == "string" ? A.content : "";
|
|
1650
|
+
y && P(b, (v) => ({ ...v, content: y })), N("");
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
case "error": {
|
|
1654
|
+
const y = typeof A.message == "string" && A.message ? A.message : "问答失败";
|
|
1655
|
+
L.abort(), P(b, (v) => ({
|
|
1656
|
+
...v,
|
|
1657
|
+
failed: !0,
|
|
1658
|
+
content: v.content ? `${v.content}
|
|
1659
|
+
|
|
1660
|
+
${y}` : y
|
|
1661
|
+
})), C();
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
default:
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
}, E = (b) => {
|
|
1668
|
+
const z = `answer-${Date.now()}`;
|
|
1669
|
+
T.current = b, F.current = /* @__PURE__ */ new Set(), l((y) => [
|
|
1670
|
+
...y,
|
|
1671
|
+
{ id: `ask-${z}`, role: "user", content: b },
|
|
1672
|
+
{ id: z, role: "assistant", content: "" }
|
|
1673
|
+
]), p(!0), N("正在准备会话…");
|
|
1674
|
+
const L = () => {
|
|
1675
|
+
U(), g.current = setTimeout(() => {
|
|
1676
|
+
var y;
|
|
1677
|
+
(y = $.current) == null || y.abort(), P(
|
|
1678
|
+
z,
|
|
1679
|
+
(v) => v.failed || v.content ? v : { ...v, failed: !0, content: "连接超时(90 秒无响应),请点按重试或换一种问法" }
|
|
1680
|
+
), C();
|
|
1681
|
+
}, Ta);
|
|
1682
|
+
}, A = na(
|
|
1683
|
+
{ userInput: b, conversationId: D.current || void 0 },
|
|
1684
|
+
(y) => {
|
|
1685
|
+
L(), S(z, y, A);
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
$.current = A, L(), A.done.then(() => {
|
|
1689
|
+
C(), P(
|
|
1690
|
+
z,
|
|
1691
|
+
(y) => y.failed || y.content ? y : { ...y, failed: !0, content: "连接已结束但没有收到模型回复,请点按重试" }
|
|
1692
|
+
);
|
|
1693
|
+
}).catch((y) => {
|
|
1694
|
+
C();
|
|
1695
|
+
const v = y instanceof Error && y.message ? y.message : "问答请求失败";
|
|
1696
|
+
P(z, (te) => ({
|
|
1697
|
+
...te,
|
|
1698
|
+
failed: !0,
|
|
1699
|
+
content: te.content ? `${te.content}
|
|
1700
|
+
|
|
1701
|
+
(连接中断:${v})` : v
|
|
1702
|
+
}));
|
|
1703
|
+
});
|
|
1704
|
+
}, R = () => {
|
|
1705
|
+
const b = T.current;
|
|
1706
|
+
!b || m || (l((z) => z.filter((L) => !(L.role === "assistant" && L.failed))), E(b));
|
|
1707
|
+
}, O = (b) => {
|
|
1708
|
+
b.preventDefault();
|
|
1709
|
+
const z = i.trim();
|
|
1710
|
+
if (!(!z || m)) {
|
|
1711
|
+
if (n(""), t) {
|
|
1712
|
+
E(z);
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
l((L) => [
|
|
1716
|
+
...L,
|
|
1717
|
+
{ id: `ask-${L.length + 1}`, role: "user", content: z }
|
|
1718
|
+
]), p(!0), k.current = setTimeout(() => {
|
|
1719
|
+
l((L) => {
|
|
1720
|
+
const A = it[L.filter((y) => y.role === "assistant").length % it.length];
|
|
1721
|
+
return [...L, { ...A, id: `reply-${L.length + 1}` }];
|
|
1722
|
+
}), p(!1);
|
|
1723
|
+
}, 900);
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
return /* @__PURE__ */ r("div", { className: "m-chat", children: [
|
|
1727
|
+
/* @__PURE__ */ r("div", { className: "m-chat-list", ref: d, children: [
|
|
1728
|
+
t && a.length === 0 && /* @__PURE__ */ r("div", { className: "m-chat-empty", children: [
|
|
1729
|
+
/* @__PURE__ */ e("p", { className: "m-chat-empty-title", children: "向知识助手提问" }),
|
|
1730
|
+
/* @__PURE__ */ e("p", { className: "m-chat-empty-hint", children: "试试:知识中台现在有哪些知识库?" })
|
|
1731
|
+
] }),
|
|
1732
|
+
a.filter(
|
|
1733
|
+
(b) => b.role !== "assistant" || b.content || b.failed || b.sources && b.sources.length > 0
|
|
1734
|
+
).map((b) => /* @__PURE__ */ r("div", { className: `m-msg m-msg-${b.role}`, children: [
|
|
1735
|
+
b.role === "assistant" && /* @__PURE__ */ e("span", { className: "m-msg-avatar", "aria-hidden": "true", children: /* @__PURE__ */ e(w, { name: "sparkles", size: 13 }) }),
|
|
1736
|
+
/* @__PURE__ */ r(
|
|
1737
|
+
"div",
|
|
1738
|
+
{
|
|
1739
|
+
className: `m-msg-bubble${b.failed ? " is-failed" : ""}`,
|
|
1740
|
+
onClick: b.failed ? R : void 0,
|
|
1741
|
+
role: b.failed ? "button" : void 0,
|
|
1742
|
+
children: [
|
|
1743
|
+
b.role === "assistant" ? /* @__PURE__ */ e("div", { className: "m-msg-text", children: b.content ? /* @__PURE__ */ e(ct, { content: b.content }) : null }) : /* @__PURE__ */ e("p", { className: "m-msg-text", children: b.content }),
|
|
1744
|
+
b.sources && b.sources.length > 0 && /* @__PURE__ */ e("div", { className: "m-msg-sources", children: b.sources.map((z) => /* @__PURE__ */ r("span", { className: "m-msg-source", children: [
|
|
1745
|
+
/* @__PURE__ */ e(w, { name: "file-text", size: 11 }),
|
|
1746
|
+
z
|
|
1747
|
+
] }, z)) }),
|
|
1748
|
+
b.failed && !m && /* @__PURE__ */ e("p", { className: "m-retry-hint", children: "点按重试" })
|
|
1749
|
+
]
|
|
1750
|
+
}
|
|
1751
|
+
)
|
|
1752
|
+
] }, b.id)),
|
|
1753
|
+
m && !M && /* @__PURE__ */ r("div", { className: "m-msg m-msg-assistant", children: [
|
|
1754
|
+
/* @__PURE__ */ e("span", { className: "m-msg-avatar", "aria-hidden": "true", children: /* @__PURE__ */ e(w, { name: "sparkles", size: 13 }) }),
|
|
1755
|
+
/* @__PURE__ */ e("div", { className: "m-msg-bubble", children: /* @__PURE__ */ r("span", { className: "m-typing", children: [
|
|
1756
|
+
/* @__PURE__ */ e("i", {}),
|
|
1757
|
+
/* @__PURE__ */ e("i", {}),
|
|
1758
|
+
/* @__PURE__ */ e("i", {}),
|
|
1759
|
+
/* @__PURE__ */ e("span", { className: "m-typing-text", children: f || "正在生成回答…" })
|
|
1760
|
+
] }) })
|
|
1761
|
+
] })
|
|
1762
|
+
] }),
|
|
1763
|
+
/* @__PURE__ */ r("form", { className: "m-chat-input", onSubmit: O, children: [
|
|
1764
|
+
/* @__PURE__ */ e(
|
|
1765
|
+
"input",
|
|
1766
|
+
{
|
|
1767
|
+
type: "text",
|
|
1768
|
+
className: "m-chat-field",
|
|
1769
|
+
placeholder: "向知识助手提问",
|
|
1770
|
+
value: i,
|
|
1771
|
+
onChange: (b) => n(b.target.value)
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
/* @__PURE__ */ e(
|
|
1775
|
+
"button",
|
|
1776
|
+
{
|
|
1777
|
+
type: "submit",
|
|
1778
|
+
className: "m-chat-send",
|
|
1779
|
+
"aria-label": "发送",
|
|
1780
|
+
disabled: !i.trim() || m,
|
|
1781
|
+
children: /* @__PURE__ */ e(w, { name: "send", size: 16 })
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
] })
|
|
1785
|
+
] });
|
|
1786
|
+
}
|
|
1787
|
+
const Sa = [
|
|
1788
|
+
{ key: "approval", icon: "check-square", label: "我的审批" },
|
|
1789
|
+
{ key: "messages", icon: "inbox", label: "我的消息" },
|
|
1790
|
+
{ key: "permission", icon: "shield", label: "我的权限" },
|
|
1791
|
+
{ key: "access", icon: "plug", label: "我的接入" },
|
|
1792
|
+
{ key: "settings", icon: "settings", label: "设置" }
|
|
1793
|
+
];
|
|
1794
|
+
function Ia({ live: t, onOpen: a, onLoggedOut: l }) {
|
|
1795
|
+
const [i, n] = h(!1), [m, p] = h(!1), f = () => {
|
|
1796
|
+
p(!0), $t().catch(() => {
|
|
1797
|
+
}).finally(() => {
|
|
1798
|
+
Pt(), n(!1), p(!1), l();
|
|
1799
|
+
});
|
|
1800
|
+
};
|
|
1801
|
+
return /* @__PURE__ */ r("div", { className: "m-screen", children: [
|
|
1802
|
+
/* @__PURE__ */ r("div", { className: "m-user-card", children: [
|
|
1803
|
+
/* @__PURE__ */ e("span", { className: "m-user-avatar", "aria-hidden": "true", children: "演" }),
|
|
1804
|
+
/* @__PURE__ */ r("div", { className: "m-user-info", children: [
|
|
1805
|
+
/* @__PURE__ */ e("span", { className: "m-user-name", children: "产品演示" }),
|
|
1806
|
+
/* @__PURE__ */ e("span", { className: "m-user-meta", children: "未来科技集团" })
|
|
1807
|
+
] })
|
|
1808
|
+
] }),
|
|
1809
|
+
/* @__PURE__ */ e("section", { className: "m-section", children: Sa.map((N) => {
|
|
1810
|
+
const d = N.key === "approval" ? (t == null ? void 0 : t.approvalTodoCount) ?? 2 : N.key === "messages" ? (t == null ? void 0 : t.unreadCount) ?? 5 : 0;
|
|
1811
|
+
return /* @__PURE__ */ r(
|
|
1812
|
+
"button",
|
|
1813
|
+
{
|
|
1814
|
+
type: "button",
|
|
1815
|
+
className: "m-row",
|
|
1816
|
+
onClick: () => a(N.key),
|
|
1817
|
+
children: [
|
|
1818
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: N.icon, size: 16 }) }),
|
|
1819
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: N.label }) }),
|
|
1820
|
+
d > 0 && /* @__PURE__ */ e("i", { className: "m-badge", children: d > 99 ? "99+" : d }),
|
|
1821
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
1822
|
+
]
|
|
1823
|
+
},
|
|
1824
|
+
N.key
|
|
1825
|
+
);
|
|
1826
|
+
}) }),
|
|
1827
|
+
t && /* @__PURE__ */ e("div", { className: "m-logout-wrap", children: /* @__PURE__ */ r("button", { type: "button", className: "m-logout-row", onClick: () => n(!0), children: [
|
|
1828
|
+
/* @__PURE__ */ e(w, { name: "logout", size: 16 }),
|
|
1829
|
+
"退出登录"
|
|
1830
|
+
] }) }),
|
|
1831
|
+
i && /* @__PURE__ */ r(H, { children: [
|
|
1832
|
+
/* @__PURE__ */ e("div", { className: "m-fab-scrim", onClick: () => !m && n(!1), "aria-hidden": "true" }),
|
|
1833
|
+
/* @__PURE__ */ r("div", { className: "m-sheet", children: [
|
|
1834
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-title", children: "退出登录" }),
|
|
1835
|
+
/* @__PURE__ */ e("div", { className: "m-sheet-desc", children: "退出后需重新通过统一登录认证才能进入知识中台。" }),
|
|
1836
|
+
/* @__PURE__ */ r("div", { className: "m-sheet-actions", children: [
|
|
1837
|
+
/* @__PURE__ */ e(
|
|
1838
|
+
"button",
|
|
1839
|
+
{
|
|
1840
|
+
type: "button",
|
|
1841
|
+
className: "m-sheet-btn",
|
|
1842
|
+
onClick: () => n(!1),
|
|
1843
|
+
disabled: m,
|
|
1844
|
+
children: "取消"
|
|
1845
|
+
}
|
|
1846
|
+
),
|
|
1847
|
+
/* @__PURE__ */ e(
|
|
1848
|
+
"button",
|
|
1849
|
+
{
|
|
1850
|
+
type: "button",
|
|
1851
|
+
className: "m-sheet-btn is-danger",
|
|
1852
|
+
onClick: f,
|
|
1853
|
+
disabled: m,
|
|
1854
|
+
children: m ? "退出中…" : "退出登录"
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
] })
|
|
1858
|
+
] })
|
|
1859
|
+
] })
|
|
1860
|
+
] });
|
|
1861
|
+
}
|
|
1862
|
+
function Ma() {
|
|
1863
|
+
return /* @__PURE__ */ e("div", { className: "m-viewport", children: /* @__PURE__ */ r("div", { className: "m-shell m-login", children: [
|
|
1864
|
+
/* @__PURE__ */ r("div", { className: "m-login-brand", children: [
|
|
1865
|
+
/* @__PURE__ */ e("span", { className: "m-login-logo", children: /* @__PURE__ */ e(w, { name: "database", size: 26 }) }),
|
|
1866
|
+
/* @__PURE__ */ e("h1", { children: "知识中台" }),
|
|
1867
|
+
/* @__PURE__ */ e("p", { children: "登录后查看你的知识库、消息与审批" })
|
|
1868
|
+
] }),
|
|
1869
|
+
/* @__PURE__ */ e("div", { className: "m-login-actions", children: /* @__PURE__ */ e(
|
|
1870
|
+
"button",
|
|
1871
|
+
{
|
|
1872
|
+
type: "button",
|
|
1873
|
+
className: "m-login-btn",
|
|
1874
|
+
onClick: () => {
|
|
1875
|
+
Ot(), St();
|
|
1876
|
+
},
|
|
1877
|
+
children: "登录"
|
|
1878
|
+
}
|
|
1879
|
+
) })
|
|
1880
|
+
] }) });
|
|
1881
|
+
}
|
|
1882
|
+
const Ke = 20, bt = {
|
|
1883
|
+
approval: "我的审批",
|
|
1884
|
+
messages: "我的消息",
|
|
1885
|
+
permission: "我的权限",
|
|
1886
|
+
access: "我的接入",
|
|
1887
|
+
settings: "设置"
|
|
1888
|
+
}, De = {
|
|
1889
|
+
approval: "暂无待审批",
|
|
1890
|
+
messages: "还没有站内信",
|
|
1891
|
+
permission: "暂无权限数据",
|
|
1892
|
+
access: "还没有接入 AK"
|
|
1893
|
+
}, Be = [
|
|
1894
|
+
{ key: "todo", label: "待办", empty: "暂无待审批", meta: "条待办" },
|
|
1895
|
+
{ key: "mine", label: "我发起的", empty: "还没有发起过审批", meta: "条已发起" }
|
|
1896
|
+
], xa = Be[1].empty, Xe = {
|
|
1897
|
+
PENDING: "待审批",
|
|
1898
|
+
APPROVED: "已通过",
|
|
1899
|
+
REJECTED: "已驳回",
|
|
1900
|
+
CANCELED: "已取消"
|
|
1901
|
+
}, za = {
|
|
1902
|
+
WAITING: "未开始",
|
|
1903
|
+
PENDING: "待审批",
|
|
1904
|
+
APPROVED: "已通过",
|
|
1905
|
+
REJECTED: "已驳回"
|
|
1906
|
+
};
|
|
1907
|
+
function He(t) {
|
|
1908
|
+
return t === "APPROVED" ? "m-dot-compiled" : t === "REJECTED" ? "m-dot-rejected" : t === "CANCELED" || t === "WAITING" ? "m-dot-waiting" : "m-dot-pending";
|
|
1909
|
+
}
|
|
1910
|
+
function La(t, a = 42) {
|
|
1911
|
+
const l = t.replace(/\s+/g, " ").trim();
|
|
1912
|
+
return l.length > a ? `${l.slice(0, a)}…` : l;
|
|
1913
|
+
}
|
|
1914
|
+
function Da({ kind: t, live: a, onBack: l, onUnreadChange: i }) {
|
|
1915
|
+
const [n, m] = h(null), [p, f] = h(!1), [N, d] = h(0), [k, $] = h(null), [g, D] = h(null), [T, F] = h(!1), [P, _] = h(0), [M, U] = h(""), [C, S] = h(null), [E, R] = h(""), [O, b] = h(null), [z, L] = h(!1), [A, y] = h(""), [v, te] = h(""), [J, Ie] = h("todo"), [G, V] = h(null), [ce, ae] = h(!1), [j, Ne] = h(!1), [Q, Me] = h(null), [Z, ne] = h(!1), [se, ye] = h(!1), be = X(void 0), oe = X(null);
|
|
1916
|
+
q(() => {
|
|
1917
|
+
t !== "approval" && ($(null), te(""), Ie("todo")), t !== "messages" && b(null);
|
|
1918
|
+
}, [t]);
|
|
1919
|
+
const ie = (c) => {
|
|
1920
|
+
b(c), c.unread && ra(c.id).catch(() => {
|
|
1921
|
+
}).then(Fe).then((x) => i == null ? void 0 : i(x)).catch(() => {
|
|
1922
|
+
}).finally(() => d((x) => x + 1));
|
|
1923
|
+
}, ee = (n == null ? void 0 : n.kind) === "approval" ? [...n.items, ...(G == null ? void 0 : G.items) || []] : [], me = (n == null ? void 0 : n.kind) === "messages" ? [...n.items, ...(Q == null ? void 0 : Q.items) || []] : [], de = (n == null ? void 0 : n.kind) === "messages" ? n.unread : 0, Ge = () => {
|
|
1924
|
+
!a || z || (L(!0), y(""), la().then(Fe).then((c) => {
|
|
1925
|
+
i == null || i(c), L(!1), d((x) => x + 1);
|
|
1926
|
+
}).catch(() => {
|
|
1927
|
+
L(!1), y("清理失败,点按重试");
|
|
1928
|
+
}));
|
|
1929
|
+
}, ke = (n == null ? void 0 : n.kind) === "approval" ? !(G != null && G.exhausted) && ee.length < n.total : !1, re = (n == null ? void 0 : n.kind) === "messages" ? !(Q != null && Q.exhausted) && me.length < n.total : !1, ve = (c, x = !1) => {
|
|
1930
|
+
if (t !== c || !n || n.kind !== c)
|
|
1931
|
+
return;
|
|
1932
|
+
if (c === "approval") {
|
|
1933
|
+
if (ce || !x && (j || !ke))
|
|
1934
|
+
return;
|
|
1935
|
+
const le = ((G == null ? void 0 : G.page) ?? 1) + 1;
|
|
1936
|
+
ae(!0), Ne(!1), nt({ view: J, keyword: v, current: le, size: Ke }).then((ue) => {
|
|
1937
|
+
V((ge) => ({
|
|
1938
|
+
items: [...(ge == null ? void 0 : ge.items) || [], ...ue.items],
|
|
1939
|
+
page: le,
|
|
1940
|
+
exhausted: ue.items.length === 0
|
|
1941
|
+
})), ae(!1);
|
|
1942
|
+
}).catch(() => {
|
|
1943
|
+
ae(!1), Ne(!0);
|
|
1944
|
+
});
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
if (Z || !x && (se || !re))
|
|
1948
|
+
return;
|
|
1949
|
+
const Y = ((Q == null ? void 0 : Q.page) ?? 1) + 1;
|
|
1950
|
+
ne(!0), ye(!1), st({ current: Y, size: Ke }).then((le) => {
|
|
1951
|
+
Me((ue) => ({
|
|
1952
|
+
items: [...(ue == null ? void 0 : ue.items) || [], ...le.items],
|
|
1953
|
+
page: Y,
|
|
1954
|
+
exhausted: le.items.length === 0
|
|
1955
|
+
})), ne(!1);
|
|
1956
|
+
}).catch(() => {
|
|
1957
|
+
ne(!1), ye(!0);
|
|
1958
|
+
});
|
|
1959
|
+
};
|
|
1960
|
+
q(() => {
|
|
1961
|
+
const c = oe.current;
|
|
1962
|
+
if (!c)
|
|
1963
|
+
return;
|
|
1964
|
+
const x = new IntersectionObserver(
|
|
1965
|
+
(Y) => {
|
|
1966
|
+
Y.some((le) => le.isIntersecting) && (t === "approval" || t === "messages") && ve(t);
|
|
1967
|
+
},
|
|
1968
|
+
{ rootMargin: "120px" }
|
|
1969
|
+
);
|
|
1970
|
+
return x.observe(c), () => x.disconnect();
|
|
1971
|
+
});
|
|
1972
|
+
const Oe = (c) => {
|
|
1973
|
+
te(c), be.current !== void 0 && clearTimeout(be.current), be.current = setTimeout(() => d((x) => x + 1), 400);
|
|
1974
|
+
};
|
|
1975
|
+
q(() => {
|
|
1976
|
+
if (t === "settings") {
|
|
1977
|
+
m({ kind: "settings" }), f(!1);
|
|
1978
|
+
return;
|
|
1979
|
+
}
|
|
1980
|
+
if (!a) {
|
|
1981
|
+
m(null), f(!1);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
let c = !1;
|
|
1985
|
+
return m(null), f(!1), V(null), ae(!1), Ne(!1), Me(null), ne(!1), ye(!1), (t === "approval" ? nt({
|
|
1986
|
+
view: J,
|
|
1987
|
+
keyword: v,
|
|
1988
|
+
current: 1,
|
|
1989
|
+
size: Ke
|
|
1990
|
+
}).then((Y) => m({ kind: t, ...Y })) : t === "messages" ? st({ current: 1, size: Ke }).then(
|
|
1991
|
+
(Y) => m({ kind: t, ...Y })
|
|
1992
|
+
) : t === "permission" ? ca().then((Y) => m({ kind: t, summary: Y })) : oa().then((Y) => m({ kind: t, items: Y }))).catch(() => {
|
|
1993
|
+
c || f(!0);
|
|
1994
|
+
}), () => {
|
|
1995
|
+
c = !0;
|
|
1996
|
+
};
|
|
1997
|
+
}, [t, a, N, v, J]), q(() => {
|
|
1998
|
+
if (k === null || !a) {
|
|
1999
|
+
D(null), F(!1);
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
let c = !1;
|
|
2003
|
+
return D(null), F(!1), sa(k).then((x) => {
|
|
2004
|
+
c || D(x);
|
|
2005
|
+
}).catch(() => {
|
|
2006
|
+
c || F(!0);
|
|
2007
|
+
}), () => {
|
|
2008
|
+
c = !0;
|
|
2009
|
+
};
|
|
2010
|
+
}, [k, a, P]);
|
|
2011
|
+
const Ce = (c) => {
|
|
2012
|
+
k === null || C || (S(c), R(""), ia(k, c, M.trim() || void 0).then(() => {
|
|
2013
|
+
U(""), S(null), _((x) => x + 1), d((x) => x + 1);
|
|
2014
|
+
}).catch((x) => {
|
|
2015
|
+
S(null), R(x instanceof Error && x.message ? x.message : "操作失败,请重试");
|
|
2016
|
+
}));
|
|
2017
|
+
}, Ae = (() => {
|
|
2018
|
+
if (t === "approval" && k !== null) {
|
|
2019
|
+
if (!g)
|
|
2020
|
+
return "";
|
|
2021
|
+
const c = Xe[g.status] || g.status;
|
|
2022
|
+
return g.status === "PENDING" ? `${c} · 当前 ${g.currentApproverName}` : c;
|
|
2023
|
+
}
|
|
2024
|
+
if (t === "messages" && O)
|
|
2025
|
+
return O.createTime;
|
|
2026
|
+
if (!n)
|
|
2027
|
+
return "";
|
|
2028
|
+
if (n.kind === "approval") {
|
|
2029
|
+
const c = J === "mine" ? Be[1] : Be[0];
|
|
2030
|
+
return n.total > 0 ? `${n.total} ${c.meta}` : c.empty;
|
|
2031
|
+
}
|
|
2032
|
+
return n.kind === "messages" ? n.unread > 0 ? `${n.unread} 条未读` : "全部已读" : n.kind === "permission" ? n.summary.roles.length > 0 ? `${n.summary.roles.join("、")} · 菜单 ${n.summary.menuCount} · 按钮 ${n.summary.buttonCount}` : "未持有系统角色" : n.kind === "access" ? n.items.length > 0 ? `${n.items.length} 个 AK` : De.access : "";
|
|
2033
|
+
})(), xe = t === "approval" && k !== null, Ye = xe && g ? g.title : O ? O.title : bt[t];
|
|
2034
|
+
return /* @__PURE__ */ r("div", { className: "m-screen m-material", children: [
|
|
2035
|
+
/* @__PURE__ */ r("div", { className: "m-detail-head", children: [
|
|
2036
|
+
/* @__PURE__ */ e(
|
|
2037
|
+
"button",
|
|
2038
|
+
{
|
|
2039
|
+
type: "button",
|
|
2040
|
+
className: "m-back",
|
|
2041
|
+
onClick: () => {
|
|
2042
|
+
xe ? $(null) : O ? b(null) : l();
|
|
2043
|
+
},
|
|
2044
|
+
"aria-label": xe ? "返回审批列表" : O ? "返回消息列表" : "返回我的",
|
|
2045
|
+
children: /* @__PURE__ */ e(w, { name: "chevron-left", size: 18 })
|
|
2046
|
+
}
|
|
2047
|
+
),
|
|
2048
|
+
/* @__PURE__ */ r("div", { className: "m-detail-title", children: [
|
|
2049
|
+
/* @__PURE__ */ e("span", { className: "m-detail-name", children: Ye }),
|
|
2050
|
+
Ae && /* @__PURE__ */ e("span", { className: "m-detail-meta", children: Ae })
|
|
2051
|
+
] })
|
|
2052
|
+
] }),
|
|
2053
|
+
a && t !== "settings" && t !== "approval" && !n && !p && /* @__PURE__ */ e(Ee, {}),
|
|
2054
|
+
a && t !== "settings" && t !== "approval" && p && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => d((c) => c + 1), children: [
|
|
2055
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
2056
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "加载失败,点按重试" }) }),
|
|
2057
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
2058
|
+
] }),
|
|
2059
|
+
t === "approval" && k === null && /* @__PURE__ */ r(H, { children: [
|
|
2060
|
+
/* @__PURE__ */ r("div", { className: "m-search", children: [
|
|
2061
|
+
/* @__PURE__ */ e(w, { name: "search", size: 14 }),
|
|
2062
|
+
/* @__PURE__ */ e(
|
|
2063
|
+
"input",
|
|
2064
|
+
{
|
|
2065
|
+
type: "text",
|
|
2066
|
+
value: v,
|
|
2067
|
+
placeholder: "搜索单号 / 标题 / 申请人",
|
|
2068
|
+
onChange: (c) => Oe(c.target.value)
|
|
2069
|
+
}
|
|
2070
|
+
),
|
|
2071
|
+
v && /* @__PURE__ */ e(
|
|
2072
|
+
"button",
|
|
2073
|
+
{
|
|
2074
|
+
type: "button",
|
|
2075
|
+
className: "m-search-clear",
|
|
2076
|
+
"aria-label": "清除搜索",
|
|
2077
|
+
onClick: () => Oe(""),
|
|
2078
|
+
children: /* @__PURE__ */ e(w, { name: "x", size: 13 })
|
|
2079
|
+
}
|
|
2080
|
+
)
|
|
2081
|
+
] }),
|
|
2082
|
+
/* @__PURE__ */ e("div", { className: "m-scope-tabs", children: Be.map((c) => /* @__PURE__ */ e(
|
|
2083
|
+
"button",
|
|
2084
|
+
{
|
|
2085
|
+
type: "button",
|
|
2086
|
+
className: `m-scope-tab${J === c.key ? " is-active" : ""}`,
|
|
2087
|
+
onClick: () => Ie(c.key),
|
|
2088
|
+
children: c.label
|
|
2089
|
+
},
|
|
2090
|
+
c.key
|
|
2091
|
+
)) }),
|
|
2092
|
+
a && !n && !p && /* @__PURE__ */ e(Ee, {}),
|
|
2093
|
+
a && p && /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => d((c) => c + 1), children: [
|
|
2094
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
2095
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "加载失败,点按重试" }) }),
|
|
2096
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
2097
|
+
] }),
|
|
2098
|
+
(n == null ? void 0 : n.kind) === "approval" && /* @__PURE__ */ r(H, { children: [
|
|
2099
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2100
|
+
ee.length === 0 && /* @__PURE__ */ e("p", { className: "m-list-empty", children: J === "mine" ? xa : De.approval }),
|
|
2101
|
+
ee.map((c) => /* @__PURE__ */ r("button", { type: "button", className: "m-row", onClick: () => $(c.id), children: [
|
|
2102
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2103
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: c.title }),
|
|
2104
|
+
/* @__PURE__ */ r("span", { className: "m-row-meta", children: [
|
|
2105
|
+
c.applicantName,
|
|
2106
|
+
" 申请 · ",
|
|
2107
|
+
c.templateName,
|
|
2108
|
+
c.createTime ? ` · ${c.createTime}` : ""
|
|
2109
|
+
] })
|
|
2110
|
+
] }),
|
|
2111
|
+
J === "mine" ? /* @__PURE__ */ r("span", { className: "m-state-chip", children: [
|
|
2112
|
+
/* @__PURE__ */ e("i", { className: `m-dot ${He(c.status)}` }),
|
|
2113
|
+
Xe[c.status] || c.status
|
|
2114
|
+
] }) : /* @__PURE__ */ e("i", { className: "m-dot m-dot-pending", "aria-label": "待审批" }),
|
|
2115
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
2116
|
+
] }, c.id))
|
|
2117
|
+
] }),
|
|
2118
|
+
ke && !ce && !j && /* @__PURE__ */ e("div", { ref: oe, className: "m-more-sentinel", "aria-hidden": "true" }),
|
|
2119
|
+
ce && /* @__PURE__ */ e("div", { className: "m-more-row", children: "加载中…" }),
|
|
2120
|
+
j && /* @__PURE__ */ e(
|
|
2121
|
+
"button",
|
|
2122
|
+
{
|
|
2123
|
+
type: "button",
|
|
2124
|
+
className: "m-more-row is-failed",
|
|
2125
|
+
onClick: () => ve("approval", !0),
|
|
2126
|
+
children: "加载失败,点按重试"
|
|
2127
|
+
}
|
|
2128
|
+
),
|
|
2129
|
+
!ke && !ce && !j && ee.length > 0 && /* @__PURE__ */ e("div", { className: "m-more-row", children: "已全部加载" })
|
|
2130
|
+
] })
|
|
2131
|
+
] }),
|
|
2132
|
+
t === "approval" && k !== null && /* @__PURE__ */ r(H, { children: [
|
|
2133
|
+
a && !g && !T && /* @__PURE__ */ e(Ee, {}),
|
|
2134
|
+
a && T && /* @__PURE__ */ r(
|
|
2135
|
+
"button",
|
|
2136
|
+
{
|
|
2137
|
+
type: "button",
|
|
2138
|
+
className: "m-row",
|
|
2139
|
+
onClick: () => _((c) => c + 1),
|
|
2140
|
+
children: [
|
|
2141
|
+
/* @__PURE__ */ e("span", { className: "m-row-icon", children: /* @__PURE__ */ e(w, { name: "refresh", size: 16 }) }),
|
|
2142
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "单据加载失败,点按重试" }) }),
|
|
2143
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
2144
|
+
]
|
|
2145
|
+
}
|
|
2146
|
+
),
|
|
2147
|
+
g && /* @__PURE__ */ r(H, { children: [
|
|
2148
|
+
/* @__PURE__ */ r("div", { className: "m-material-meta", children: [
|
|
2149
|
+
/* @__PURE__ */ r("span", { className: "m-state-chip", children: [
|
|
2150
|
+
/* @__PURE__ */ e("i", { className: `m-dot ${He(g.status)}` }),
|
|
2151
|
+
Xe[g.status] || g.status
|
|
2152
|
+
] }),
|
|
2153
|
+
g.code && /* @__PURE__ */ e("span", { className: "m-meta-chip", children: g.code }),
|
|
2154
|
+
/* @__PURE__ */ e("span", { className: "m-meta-chip", children: g.templateName })
|
|
2155
|
+
] }),
|
|
2156
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2157
|
+
/* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2158
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "申请人" }) }),
|
|
2159
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: g.applicantName })
|
|
2160
|
+
] }),
|
|
2161
|
+
g.createTime && /* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2162
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "申请时间" }) }),
|
|
2163
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: g.createTime })
|
|
2164
|
+
] }),
|
|
2165
|
+
g.bizName && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2166
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: "申请事项" }),
|
|
2167
|
+
/* @__PURE__ */ r("span", { className: "m-row-meta", children: [
|
|
2168
|
+
g.bizName,
|
|
2169
|
+
g.bizRole ? ` · ${g.bizRole}` : ""
|
|
2170
|
+
] })
|
|
2171
|
+
] }) }),
|
|
2172
|
+
g.resourceCodes.length > 0 && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2173
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: "申请资源" }),
|
|
2174
|
+
/* @__PURE__ */ e("span", { className: "m-row-meta", children: g.resourceCodes.join("、") })
|
|
2175
|
+
] }) }),
|
|
2176
|
+
g.reason && /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2177
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: "申请理由" }),
|
|
2178
|
+
/* @__PURE__ */ e("span", { className: "m-row-meta", children: g.reason })
|
|
2179
|
+
] }) }),
|
|
2180
|
+
g.finishedAt && /* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2181
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "完成时间" }) }),
|
|
2182
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: g.finishedAt })
|
|
2183
|
+
] })
|
|
2184
|
+
] }),
|
|
2185
|
+
g.nodes.length > 0 && /* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2186
|
+
/* @__PURE__ */ e("p", { className: "m-section-title", children: "审批流程" }),
|
|
2187
|
+
g.nodes.map((c, x) => /* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2188
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2189
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: c.name }),
|
|
2190
|
+
/* @__PURE__ */ r("span", { className: "m-row-meta", children: [
|
|
2191
|
+
c.approverName,
|
|
2192
|
+
c.actedAt ? ` · ${c.actedAt}` : ""
|
|
2193
|
+
] }),
|
|
2194
|
+
c.comment && /* @__PURE__ */ e("span", { className: "m-row-meta", children: c.comment })
|
|
2195
|
+
] }),
|
|
2196
|
+
/* @__PURE__ */ r("span", { className: "m-state-chip", children: [
|
|
2197
|
+
/* @__PURE__ */ e("i", { className: `m-dot ${He(c.state)}` }),
|
|
2198
|
+
za[c.state] || c.state
|
|
2199
|
+
] })
|
|
2200
|
+
] }, `${c.name}-${x}`))
|
|
2201
|
+
] }),
|
|
2202
|
+
g.canApprove && g.status === "PENDING" && /* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2203
|
+
/* @__PURE__ */ e(
|
|
2204
|
+
"input",
|
|
2205
|
+
{
|
|
2206
|
+
type: "text",
|
|
2207
|
+
className: "m-ticket-comment",
|
|
2208
|
+
placeholder: "审批备注(可选)",
|
|
2209
|
+
value: M,
|
|
2210
|
+
onChange: (c) => U(c.target.value)
|
|
2211
|
+
}
|
|
2212
|
+
),
|
|
2213
|
+
E && /* @__PURE__ */ e("p", { className: "m-act-error", children: E }),
|
|
2214
|
+
/* @__PURE__ */ r("div", { className: "m-ticket-actions", children: [
|
|
2215
|
+
/* @__PURE__ */ e(
|
|
2216
|
+
"button",
|
|
2217
|
+
{
|
|
2218
|
+
type: "button",
|
|
2219
|
+
className: "m-ticket-btn is-approve",
|
|
2220
|
+
disabled: C !== null,
|
|
2221
|
+
onClick: () => Ce("approve"),
|
|
2222
|
+
children: C === "approve" ? "提交中…" : "通过"
|
|
2223
|
+
}
|
|
2224
|
+
),
|
|
2225
|
+
/* @__PURE__ */ e(
|
|
2226
|
+
"button",
|
|
2227
|
+
{
|
|
2228
|
+
type: "button",
|
|
2229
|
+
className: "m-ticket-btn is-reject",
|
|
2230
|
+
disabled: C !== null,
|
|
2231
|
+
onClick: () => Ce("reject"),
|
|
2232
|
+
children: C === "reject" ? "提交中…" : "驳回"
|
|
2233
|
+
}
|
|
2234
|
+
)
|
|
2235
|
+
] })
|
|
2236
|
+
] })
|
|
2237
|
+
] })
|
|
2238
|
+
] }),
|
|
2239
|
+
(n == null ? void 0 : n.kind) === "messages" && !O && /* @__PURE__ */ r(H, { children: [
|
|
2240
|
+
a && de > 0 && /* @__PURE__ */ r("div", { className: "m-msg-actions", children: [
|
|
2241
|
+
A && /* @__PURE__ */ e("span", { className: "m-act-error", children: A }),
|
|
2242
|
+
/* @__PURE__ */ e(
|
|
2243
|
+
"button",
|
|
2244
|
+
{
|
|
2245
|
+
type: "button",
|
|
2246
|
+
className: "m-msg-clear",
|
|
2247
|
+
disabled: z,
|
|
2248
|
+
onClick: Ge,
|
|
2249
|
+
children: z ? "清理中…" : "全部已读"
|
|
2250
|
+
}
|
|
2251
|
+
)
|
|
2252
|
+
] }),
|
|
2253
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2254
|
+
me.length === 0 && /* @__PURE__ */ e("p", { className: "m-list-empty", children: De.messages }),
|
|
2255
|
+
me.map((c) => /* @__PURE__ */ r(
|
|
2256
|
+
"button",
|
|
2257
|
+
{
|
|
2258
|
+
type: "button",
|
|
2259
|
+
className: `m-row${c.unread ? " is-unread" : ""}`,
|
|
2260
|
+
onClick: () => ie(c),
|
|
2261
|
+
children: [
|
|
2262
|
+
/* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2263
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: c.title }),
|
|
2264
|
+
c.content && /* @__PURE__ */ e("span", { className: "m-row-meta", children: La(c.content) }),
|
|
2265
|
+
c.createTime && /* @__PURE__ */ e("span", { className: "m-row-meta", children: c.createTime })
|
|
2266
|
+
] }),
|
|
2267
|
+
c.unread && /* @__PURE__ */ e("i", { className: "m-dot m-dot-unread", "aria-label": "未读" }),
|
|
2268
|
+
/* @__PURE__ */ e(w, { name: "chevron-right", size: 15, className: "m-row-arrow" })
|
|
2269
|
+
]
|
|
2270
|
+
},
|
|
2271
|
+
c.id
|
|
2272
|
+
))
|
|
2273
|
+
] }),
|
|
2274
|
+
re && !Z && !se && /* @__PURE__ */ e("div", { ref: oe, className: "m-more-sentinel", "aria-hidden": "true" }),
|
|
2275
|
+
Z && /* @__PURE__ */ e("div", { className: "m-more-row", children: "加载中…" }),
|
|
2276
|
+
se && /* @__PURE__ */ e(
|
|
2277
|
+
"button",
|
|
2278
|
+
{
|
|
2279
|
+
type: "button",
|
|
2280
|
+
className: "m-more-row is-failed",
|
|
2281
|
+
onClick: () => ve("messages", !0),
|
|
2282
|
+
children: "加载失败,点按重试"
|
|
2283
|
+
}
|
|
2284
|
+
),
|
|
2285
|
+
!re && !Z && !se && me.length > 0 && /* @__PURE__ */ e("div", { className: "m-more-row", children: "已全部加载" })
|
|
2286
|
+
] }),
|
|
2287
|
+
t === "messages" && O && /* @__PURE__ */ e("article", { className: "m-article", children: O.content || "(无正文)" }),
|
|
2288
|
+
(n == null ? void 0 : n.kind) === "permission" && /* @__PURE__ */ r(H, { children: [
|
|
2289
|
+
n.summary.roles.length > 0 && /* @__PURE__ */ e("div", { className: "m-material-meta", children: n.summary.roles.map((c) => /* @__PURE__ */ e("span", { className: "m-meta-chip", children: c }, c)) }),
|
|
2290
|
+
/* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2291
|
+
n.summary.menus.length === 0 && /* @__PURE__ */ e("p", { className: "m-list-empty", children: De.permission }),
|
|
2292
|
+
n.summary.menus.map((c) => /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: c }) }) }, c))
|
|
2293
|
+
] })
|
|
2294
|
+
] }),
|
|
2295
|
+
(n == null ? void 0 : n.kind) === "access" && /* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2296
|
+
n.items.length === 0 && /* @__PURE__ */ e("p", { className: "m-list-empty", children: De.access }),
|
|
2297
|
+
n.items.map((c) => /* @__PURE__ */ e("div", { className: "m-row m-row-static", children: /* @__PURE__ */ r("span", { className: "m-row-main", children: [
|
|
2298
|
+
/* @__PURE__ */ e("span", { className: "m-row-title", children: c.akName }),
|
|
2299
|
+
/* @__PURE__ */ r("span", { className: "m-row-meta", children: [
|
|
2300
|
+
c.ownerLabel,
|
|
2301
|
+
" · ",
|
|
2302
|
+
c.akCode,
|
|
2303
|
+
c.createTime ? ` · ${c.createTime}` : ""
|
|
2304
|
+
] })
|
|
2305
|
+
] }) }, c.akCode))
|
|
2306
|
+
] }),
|
|
2307
|
+
(n == null ? void 0 : n.kind) === "settings" && /* @__PURE__ */ r("section", { className: "m-section", children: [
|
|
2308
|
+
/* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2309
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "深色模式" }) }),
|
|
2310
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: "关闭" })
|
|
2311
|
+
] }),
|
|
2312
|
+
/* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2313
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "消息通知" }) }),
|
|
2314
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: "开启" })
|
|
2315
|
+
] }),
|
|
2316
|
+
/* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2317
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "清除缓存" }) }),
|
|
2318
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: "0 KB" })
|
|
2319
|
+
] }),
|
|
2320
|
+
/* @__PURE__ */ r("div", { className: "m-row m-row-static", children: [
|
|
2321
|
+
/* @__PURE__ */ e("span", { className: "m-row-main", children: /* @__PURE__ */ e("span", { className: "m-row-title", children: "关于知识中台" }) }),
|
|
2322
|
+
/* @__PURE__ */ e("span", { className: "m-row-value", children: "v1.0" })
|
|
2323
|
+
] })
|
|
2324
|
+
] })
|
|
2325
|
+
] });
|
|
2326
|
+
}
|
|
2327
|
+
const Pa = {
|
|
2328
|
+
home: "知识中台",
|
|
2329
|
+
library: "知识管理",
|
|
2330
|
+
assistant: "AI 知识助手",
|
|
2331
|
+
profile: "我的"
|
|
2332
|
+
}, Oa = 5;
|
|
2333
|
+
function Fa() {
|
|
2334
|
+
const [t, a] = h("home"), [l, i] = h(null), [n, m] = h(null), [p, f] = h(null), [N, d] = h("probing"), { live: k, patchLive: $ } = ma();
|
|
2335
|
+
q(() => {
|
|
2336
|
+
It();
|
|
2337
|
+
let M = !0;
|
|
2338
|
+
return et().then((U) => {
|
|
2339
|
+
M && d(U);
|
|
2340
|
+
}), () => {
|
|
2341
|
+
M = !1;
|
|
2342
|
+
};
|
|
2343
|
+
}, []);
|
|
2344
|
+
const g = n ? "资料详情" : p ? bt[p] : Pa[t], D = k ? k.unreadCount : Oa, T = (M) => {
|
|
2345
|
+
i(M), a("library");
|
|
2346
|
+
}, F = (M) => {
|
|
2347
|
+
m(M);
|
|
2348
|
+
}, P = (M) => {
|
|
2349
|
+
m(null), f(null), M === "library" && i(null), a(M);
|
|
2350
|
+
}, _ = () => {
|
|
2351
|
+
d("probing"), et().then((M) => d(M));
|
|
2352
|
+
};
|
|
2353
|
+
return N === "guest" ? /* @__PURE__ */ e(Ma, {}) : N === "probing" ? /* @__PURE__ */ e("div", { className: "m-viewport", children: /* @__PURE__ */ e("div", { className: "m-shell", children: /* @__PURE__ */ e("main", { className: "m-body", children: /* @__PURE__ */ e("div", { className: "m-screen m-boot", children: "正在进入知识中台…" }) }) }) }) : /* @__PURE__ */ e("div", { className: "m-viewport", children: /* @__PURE__ */ r("div", { className: "m-shell", children: [
|
|
2354
|
+
/* @__PURE__ */ r("header", { className: "m-header", children: [
|
|
2355
|
+
/* @__PURE__ */ e("span", { className: "m-header-title", children: g }),
|
|
2356
|
+
/* @__PURE__ */ r(
|
|
2357
|
+
"button",
|
|
2358
|
+
{
|
|
2359
|
+
type: "button",
|
|
2360
|
+
className: "m-header-notice",
|
|
2361
|
+
"aria-label": `消息通知,${D} 条未读`,
|
|
2362
|
+
onClick: () => P("profile"),
|
|
2363
|
+
children: [
|
|
2364
|
+
/* @__PURE__ */ e(w, { name: "bell", size: 18 }),
|
|
2365
|
+
D > 0 && /* @__PURE__ */ e("i", { className: "m-badge", children: D > 99 ? "99+" : D })
|
|
2366
|
+
]
|
|
2367
|
+
}
|
|
2368
|
+
)
|
|
2369
|
+
] }),
|
|
2370
|
+
/* @__PURE__ */ e("main", { className: "m-body", children: n ? /* @__PURE__ */ e(
|
|
2371
|
+
Aa,
|
|
2372
|
+
{
|
|
2373
|
+
materialId: n,
|
|
2374
|
+
live: k,
|
|
2375
|
+
onBack: () => m(null)
|
|
2376
|
+
}
|
|
2377
|
+
) : p ? /* @__PURE__ */ e(
|
|
2378
|
+
Da,
|
|
2379
|
+
{
|
|
2380
|
+
kind: p,
|
|
2381
|
+
live: k,
|
|
2382
|
+
onBack: () => f(null),
|
|
2383
|
+
onUnreadChange: (M) => $({ unreadCount: M })
|
|
2384
|
+
}
|
|
2385
|
+
) : /* @__PURE__ */ r(H, { children: [
|
|
2386
|
+
t === "home" && /* @__PURE__ */ e(
|
|
2387
|
+
ga,
|
|
2388
|
+
{
|
|
2389
|
+
onSearch: () => P("assistant"),
|
|
2390
|
+
onOpenKb: T,
|
|
2391
|
+
onOpenMaterial: F,
|
|
2392
|
+
data: k
|
|
2393
|
+
}
|
|
2394
|
+
),
|
|
2395
|
+
t === "library" && /* @__PURE__ */ e(
|
|
2396
|
+
ka,
|
|
2397
|
+
{
|
|
2398
|
+
selectedKbId: l,
|
|
2399
|
+
onSelectKb: i,
|
|
2400
|
+
onBack: () => i(null),
|
|
2401
|
+
onOpenMaterial: F,
|
|
2402
|
+
data: k
|
|
2403
|
+
}
|
|
2404
|
+
),
|
|
2405
|
+
t === "assistant" && /* @__PURE__ */ e($a, { live: !!k }),
|
|
2406
|
+
t === "profile" && /* @__PURE__ */ e(Ia, { live: k, onOpen: f, onLoggedOut: _ })
|
|
2407
|
+
] }) }),
|
|
2408
|
+
/* @__PURE__ */ e(xt, { active: t, onChange: P })
|
|
2409
|
+
] }) });
|
|
2410
|
+
}
|
|
2411
|
+
export {
|
|
2412
|
+
Fa as default
|
|
2413
|
+
};
|