@gientech/modual 1.2.7 → 1.2.8

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.
Files changed (312) hide show
  1. package/.editorconfig +38 -0
  2. package/.prettierignore +16 -0
  3. package/.prettierrc +17 -0
  4. package/README.md +129 -129
  5. package/USAGE.md +191 -0
  6. package/bash.exe.stackdump +40 -0
  7. package/components.json +21 -0
  8. package/dist/README.md +129 -0
  9. package/dist/assets/circle-alert-g2Y6zAjt.js +6 -0
  10. package/{assets → dist/assets}/database.svg +11 -11
  11. package/{assets → dist/assets}/database_add.svg +53 -53
  12. package/{assets → dist/assets}/database_connect.svg +66 -66
  13. package/{assets → dist/assets}/database_upload.svg +29 -29
  14. package/{assets → dist/assets}/defaultWeLogo.svg +14 -14
  15. package/dist/assets/index-97TKgPKE.js +1284 -0
  16. package/dist/assets/index-CEK88UzR.js +26 -0
  17. package/dist/assets/index-DIm7RgkM.js +1709 -0
  18. package/{assets/MySQL.svg → dist/assets/mysql.svg} +14 -14
  19. package/{assets/plus-fNg4vmeA.js → dist/assets/plus-omCUN0e3.js} +1 -1
  20. package/dist/assets/style.css +1 -0
  21. package/dist/assets/style3.css +1 -0
  22. package/{assets/x-tMUaBf0a.js → dist/assets/x-vPcWt3fC.js} +1 -1
  23. package/dist/chat.js +648 -0
  24. package/dist/database.js +20 -0
  25. package/dist/databaseId.js +11 -0
  26. package/{databaseTable.js → dist/databaseTable.js} +2 -2
  27. package/dist/modelManage.js +1 -0
  28. package/dist/package.json +56 -0
  29. package/dist/sensitive.js +1 -0
  30. package/{streamFilesReader.js → dist/streamFilesReader.js} +16 -16
  31. package/{worker → dist/worker}/pdf.worker.min.js +21 -21
  32. package/doc_assets/2.png +0 -0
  33. package/doc_assets/demo.md +27 -0
  34. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +2 -0
  35. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +23699 -0
  36. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +1 -0
  37. package/doc_assets/demos/dist-app/index.html +14 -0
  38. package/doc_assets/demos/dist-app/vite.svg +1 -0
  39. package/doc_assets/images/1.png +0 -0
  40. package/doc_assets/images/3.png +0 -0
  41. package/doc_assets/images/component-screenshot.png +1 -0
  42. package/doc_assets/install.md +5 -0
  43. package/eslint.config.js +92 -0
  44. package/index.html +13 -0
  45. package/package.json +99 -56
  46. package/postcss.config.cjs +19 -0
  47. package/public/vite.svg +1 -0
  48. package/public/worker/pdf.worker.min.js +22 -0
  49. package/scripts/README.md +133 -0
  50. package/scripts/build-demo.js +88 -0
  51. package/scripts/demo-selector.js +216 -0
  52. package/scripts/dev-demo.js +76 -0
  53. package/scripts/preview-demo.js +130 -0
  54. package/scripts/run-demo.bat +34 -0
  55. package/src/assets/img/downArrow.png +0 -0
  56. package/src/assets/img/excel.png +0 -0
  57. package/src/assets/img/img.png +0 -0
  58. package/src/assets/img/pdf.png +0 -0
  59. package/src/assets/img/ppt.png +0 -0
  60. package/src/assets/img/txt.png +0 -0
  61. package/src/assets/img/word.png +0 -0
  62. package/src/assets/login/homeBg.png +0 -0
  63. package/src/assets/login/left.jpg +0 -0
  64. package/src/assets/login/logoImg.png +0 -0
  65. package/src/examples/LoginPage/index.tsx +18 -0
  66. package/src/examples/chat/index.tsx +140 -0
  67. package/src/examples/gientechStreamFilesReader/index.tsx +1016 -0
  68. package/src/examples/ragDatabaseDataPage/index.tsx +36 -0
  69. package/src/examples/ragDatabaseIdPage/index.tsx +44 -0
  70. package/src/examples/ragDatabasePage/index.tsx +36 -0
  71. package/src/examples/ragModelManagePage/index.tsx +37 -0
  72. package/src/examples/ragSearchPage/index.tsx +0 -0
  73. package/src/examples/ragSensitiveWordsPage/index.tsx +32 -0
  74. package/src/examples/streamFiles/index.tsx +384 -0
  75. package/src/lib_enter.ts +38 -0
  76. package/src/main.tsx +5 -0
  77. package/src/main.tsx.backup +5 -0
  78. package/src/modules/chat/Conversations/Item.tsx +167 -0
  79. package/src/modules/chat/Conversations/List.tsx +143 -0
  80. package/src/modules/chat/Conversations/groupByTime.ts +39 -0
  81. package/src/modules/chat/Conversations/index.tsx +212 -0
  82. package/src/modules/chat/constants.tsx +33 -0
  83. package/src/modules/chat/index.tsx +1837 -0
  84. package/src/modules/chat/types.ts +17 -0
  85. package/src/modules/database/CreateModal.tsx +398 -0
  86. package/src/modules/database/assets/Doris.png +0 -0
  87. package/src/modules/database/assets/PostgreSQL.png +0 -0
  88. package/src/modules/database/assets/SQLServer.png +0 -0
  89. package/src/modules/database/assets/database.svg +11 -0
  90. package/src/modules/database/assets/database_add.svg +53 -0
  91. package/src/modules/database/assets/database_connect.svg +66 -0
  92. package/src/modules/database/assets/database_upload.svg +29 -0
  93. package/src/modules/database/assets/empty.png +0 -0
  94. package/src/modules/database/assets/mysql.svg +14 -0
  95. package/src/modules/database/index.tsx +466 -0
  96. package/src/modules/database/server.ts +196 -0
  97. package/src/modules/databaseId/CustomCom.tsx +156 -0
  98. package/src/modules/databaseId/EditConfig.tsx +268 -0
  99. package/src/modules/databaseId/UploadDrawer.tsx +520 -0
  100. package/src/modules/databaseId/assets/aiOptimize.svg +10 -0
  101. package/src/modules/databaseId/assets/empty.png +0 -0
  102. package/src/modules/databaseId/assets/template.svg +6 -0
  103. package/src/modules/databaseId/assets/upload.svg +9 -0
  104. package/src/modules/databaseId/assets/useTemp.svg +6 -0
  105. package/src/modules/databaseId/index.tsx +734 -0
  106. package/src/modules/databaseId/server.ts +286 -0
  107. package/src/modules/databaseId/style.css +5 -0
  108. package/src/modules/databaseTable/EditRowDrawer.tsx +119 -0
  109. package/src/modules/databaseTable/index.tsx +357 -0
  110. package/src/modules/databaseTable/server.ts +180 -0
  111. package/src/modules/headlessChat/constants.tsx +32 -0
  112. package/src/modules/headlessChat/index.tsx +1065 -0
  113. package/src/modules/headlessChat/types.ts +23 -0
  114. package/src/modules/login/components/Login/LoginBox/index.tsx +102 -0
  115. package/src/modules/login/components/Login/RegisterBox/index.tsx +180 -0
  116. package/src/modules/login/components/Login/index.tsx +100 -0
  117. package/src/modules/login/index.tsx +106 -0
  118. package/src/modules/login/style.css +3 -0
  119. package/src/modules/login/useServices.ts +53 -0
  120. package/src/modules/login/utils.ts +42 -0
  121. package/src/modules/modelManage/ConfigDrawer.tsx +249 -0
  122. package/src/modules/modelManage/assets/empty.png +0 -0
  123. package/src/modules/modelManage/const.ts +50 -0
  124. package/src/modules/modelManage/index.tsx +439 -0
  125. package/src/modules/modelManage/server.ts +185 -0
  126. package/src/modules/search/assets/Icon-history.svg +8 -0
  127. package/src/modules/search/assets/answerAwartar.png +0 -0
  128. package/src/modules/search/assets/doc.png +0 -0
  129. package/src/modules/search/assets/genera.gif +0 -0
  130. package/src/modules/search/assets/icon-robot.svg +9 -0
  131. package/src/modules/search/assets/icon-search-bar.svg +14 -0
  132. package/src/modules/search/assets/icon-sub-title.svg +3 -0
  133. package/src/modules/search/assets/icon-title.svg +9 -0
  134. package/src/modules/search/assets/icon-zoomOut.svg +9 -0
  135. package/src/modules/search/assets/iconAi.svg +9 -0
  136. package/src/modules/search/assets/pdf.png +0 -0
  137. package/src/modules/search/assets/ppt.png +0 -0
  138. package/src/modules/search/assets/search.svg +3 -0
  139. package/src/modules/search/assets/selected.svg +4 -0
  140. package/src/modules/search/assets/txt.png +0 -0
  141. package/src/modules/search/assets/xls.png +0 -0
  142. package/src/modules/search/components/AssisSelect.tsx +137 -0
  143. package/src/modules/search/components/Editor/ChatViewEditor.tsx +261 -0
  144. package/src/modules/search/components/Editor/aichat.css +1 -0
  145. package/src/modules/search/components/Editor/constant.ts +13 -0
  146. package/src/modules/search/components/Editor/index.tsx +113 -0
  147. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +332 -0
  148. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +20 -0
  149. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +38 -0
  150. package/src/modules/search/components/Editor/plugins/displayer.ts +298 -0
  151. package/src/modules/search/components/Editor/plugins/imageClick.tsx +32 -0
  152. package/src/modules/search/components/Editor/plugins/myplugin.tsx +98 -0
  153. package/src/modules/search/components/Editor/ui/avatar.tsx +19 -0
  154. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +21 -0
  155. package/src/modules/search/components/Editor/ui/button.tsx +58 -0
  156. package/src/modules/search/components/Editor/ui/calendar.tsx +68 -0
  157. package/src/modules/search/components/Editor/ui/caption.tsx +46 -0
  158. package/src/modules/search/components/Editor/ui/checkbox.tsx +27 -0
  159. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +188 -0
  160. package/src/modules/search/components/Editor/ui/code-block-element.css +434 -0
  161. package/src/modules/search/components/Editor/ui/code-block-element.tsx +39 -0
  162. package/src/modules/search/components/Editor/ui/code-leaf.tsx +24 -0
  163. package/src/modules/search/components/Editor/ui/code-line-element.tsx +10 -0
  164. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +21 -0
  165. package/src/modules/search/components/Editor/ui/column-element.tsx +30 -0
  166. package/src/modules/search/components/Editor/ui/column-group-element.tsx +94 -0
  167. package/src/modules/search/components/Editor/ui/command.tsx +75 -0
  168. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +22 -0
  169. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +37 -0
  170. package/src/modules/search/components/Editor/ui/comment-item.tsx +74 -0
  171. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +49 -0
  172. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +42 -0
  173. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +22 -0
  174. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +32 -0
  175. package/src/modules/search/components/Editor/ui/comment-value.tsx +34 -0
  176. package/src/modules/search/components/Editor/ui/comments-popover.tsx +63 -0
  177. package/src/modules/search/components/Editor/ui/date-element.tsx +83 -0
  178. package/src/modules/search/components/Editor/ui/dialog.tsx +63 -0
  179. package/src/modules/search/components/Editor/ui/draggable.tsx +177 -0
  180. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +180 -0
  181. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +85 -0
  182. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +28 -0
  183. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +76 -0
  184. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +8 -0
  185. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +51 -0
  186. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +77 -0
  187. package/src/modules/search/components/Editor/ui/heading-element.tsx +48 -0
  188. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +17 -0
  189. package/src/modules/search/components/Editor/ui/hr-element.tsx +30 -0
  190. package/src/modules/search/components/Editor/ui/icons.tsx +267 -0
  191. package/src/modules/search/components/Editor/ui/image-element.tsx +74 -0
  192. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +368 -0
  193. package/src/modules/search/components/Editor/ui/input.tsx +25 -0
  194. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +218 -0
  195. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +20 -0
  196. package/src/modules/search/components/Editor/ui/link-element.tsx +29 -0
  197. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +161 -0
  198. package/src/modules/search/components/Editor/ui/list-element.tsx +30 -0
  199. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +24 -0
  200. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +133 -0
  201. package/src/modules/search/components/Editor/ui/media-popover.tsx +97 -0
  202. package/src/modules/search/components/Editor/ui/mention-element.tsx +43 -0
  203. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +141 -0
  204. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +93 -0
  205. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +67 -0
  206. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +4 -0
  207. package/src/modules/search/components/Editor/ui/placeholder.tsx +52 -0
  208. package/src/modules/search/components/Editor/ui/popover.tsx +32 -0
  209. package/src/modules/search/components/Editor/ui/resizable.tsx +66 -0
  210. package/src/modules/search/components/Editor/ui/separator.tsx +25 -0
  211. package/src/modules/search/components/Editor/ui/style.less +12 -0
  212. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +143 -0
  213. package/src/modules/search/components/Editor/ui/table-element.tsx +243 -0
  214. package/src/modules/search/components/Editor/ui/table-row-element.tsx +22 -0
  215. package/src/modules/search/components/Editor/ui/tableValue.tsx +135 -0
  216. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +43 -0
  217. package/src/modules/search/components/Editor/ui/toggle-element.tsx +31 -0
  218. package/src/modules/search/components/Editor/ui/toolbar.tsx +157 -0
  219. package/src/modules/search/components/Editor/ui/tooltip.tsx +65 -0
  220. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +160 -0
  221. package/src/modules/search/components/Editor/ui/with-draggables.tsx +175 -0
  222. package/src/modules/search/components/FileList.tsx +287 -0
  223. package/src/modules/search/components/ImageGroupView/index.tsx +85 -0
  224. package/src/modules/search/components/ResultContent.tsx +232 -0
  225. package/src/modules/search/components/SearchInput.tsx +232 -0
  226. package/src/modules/search/components/SearchLanding.tsx +74 -0
  227. package/src/modules/search/components/SearchView.tsx +563 -0
  228. package/src/modules/search/components/SimpleEditor.tsx +158 -0
  229. package/src/modules/search/components/SimpleFileList.tsx +215 -0
  230. package/src/modules/search/index.tsx +10 -0
  231. package/src/modules/search/reademe.md +1 -0
  232. package/src/modules/search/servers/apis.tsx +19 -0
  233. package/src/modules/search/servers/index.ts +184 -0
  234. package/src/modules/search/style.less +503 -0
  235. package/src/modules/search/type.ts +22 -0
  236. package/src/modules/search/utils.ts +34 -0
  237. package/src/modules/sensitive/index.tsx +313 -0
  238. package/src/modules/sensitive/server.ts +122 -0
  239. package/src/modules/streamFilesReader/GientechStreamReader.tsx +1555 -0
  240. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  241. package/src/modules/streamFilesReader/components/Header/index.tsx +297 -0
  242. package/src/modules/streamFilesReader/index.tsx +3 -0
  243. package/src/style.css +6 -0
  244. package/src/type.d.ts +0 -0
  245. package/src/utils/commonFn.tsx +111 -0
  246. package/src/utils/gientechCommon/components/AppError.tsx +32 -0
  247. package/src/utils/gientechCommon/components/AppLoading.tsx +75 -0
  248. package/src/utils/gientechCommon/components/DeleteModal.tsx +75 -0
  249. package/src/utils/gientechCommon/components/DisplayError.tsx +33 -0
  250. package/src/utils/gientechCommon/components/DisplayLoading.tsx +38 -0
  251. package/src/utils/gientechCommon/components/FeedBackModal.tsx +310 -0
  252. package/src/utils/gientechCommon/components/FileCardCommon.tsx +82 -0
  253. package/src/utils/gientechCommon/components/FileManager/index.tsx +390 -0
  254. package/src/utils/gientechCommon/components/FileManager/style.css +5 -0
  255. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +296 -0
  256. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +339 -0
  257. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +245 -0
  258. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +209 -0
  259. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  260. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +148 -0
  261. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +14 -0
  262. package/src/utils/gientechCommon/components/RenameModal.tsx +86 -0
  263. package/src/utils/gientechCommon/components/style.less +11 -0
  264. package/src/utils/gientechCommon/configs/commonConfig.ts +2 -0
  265. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  266. package/src/utils/gientechCommon/configs/stylesConfig.ts +142 -0
  267. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +339 -0
  268. package/src/utils/gientechCommon/slate/converters/deserializers.ts +763 -0
  269. package/src/utils/gientechCommon/slate/converters/mockData.ts +232 -0
  270. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +258 -0
  271. package/src/utils/gientechCommon/slate/richElements/index.tsx +499 -0
  272. package/src/utils/gientechCommon/utils/request.ts +37 -0
  273. package/src/utils/gientechCommon/utils/serverFn.ts +172 -0
  274. package/src/utils/index.tsx +126 -0
  275. package/src/utils/testconfigs/demologin/index.tsx +32 -0
  276. package/src/utils/testconfigs/index.ts +53 -0
  277. package/src/vite-env.d.ts +11 -0
  278. package/stats.html +4949 -0
  279. package/tailwind.config.js +170 -0
  280. package/tsconfig.app.json +30 -0
  281. package/tsconfig.app.tsbuildinfo +11 -0
  282. package/tsconfig.json +13 -0
  283. package/tsconfig.node.json +22 -0
  284. package/tsconfig.node.tsbuildinfo +1 -0
  285. package/vite.config.ts +178 -0
  286. package/workflows/release.yml +60 -0
  287. package/assets/index--DG-fVvc.js +0 -26
  288. package/assets/index-BfureYPx.js +0 -1505
  289. package/assets/index-CXwV5fAx.js +0 -1230
  290. package/assets/style.css +0 -1
  291. package/assets/style3.css +0 -1
  292. package/chat.js +0 -893
  293. package/database.js +0 -20
  294. package/databaseId.js +0 -21
  295. package/modelManage.js +0 -1
  296. package/sensitive.js +0 -1
  297. /package/{assets → dist/assets}/Doris.png +0 -0
  298. /package/{assets → dist/assets}/PostgreSQL.png +0 -0
  299. /package/{assets → dist/assets}/SQLServer.png +0 -0
  300. /package/{assets → dist/assets}/_commonjsHelpers-gnU0ypJ3.js +0 -0
  301. /package/{assets → dist/assets}/empty.png +0 -0
  302. /package/{assets → dist/assets}/index-CpW6Dhpp.js +0 -0
  303. /package/{assets → dist/assets}/style2.css +0 -0
  304. /package/{assets → dist/assets}/styled-components.browser.esm-DPkS13KC.js +0 -0
  305. /package/{chat.d.ts → dist/chat.d.ts} +0 -0
  306. /package/{database.d.ts → dist/database.d.ts} +0 -0
  307. /package/{databaseId.d.ts → dist/databaseId.d.ts} +0 -0
  308. /package/{databaseTable.d.ts → dist/databaseTable.d.ts} +0 -0
  309. /package/{modelManage.d.ts → dist/modelManage.d.ts} +0 -0
  310. /package/{sensitive.d.ts → dist/sensitive.d.ts} +0 -0
  311. /package/{streamFilesReader.d.ts → dist/streamFilesReader.d.ts} +0 -0
  312. /package/{vite.svg → dist/vite.svg} +0 -0
package/database.js DELETED
@@ -1,20 +0,0 @@
1
- import{jsxs as Z,jsx as l,Fragment as de}from"react/jsx-runtime";import{useState as y,useMemo as T,useRef as q,useEffect as De}from"react";import{k as K,J as Q,i as me,F as ge}from"./assets/index-BfureYPx.js";import"./assets/index--DG-fVvc.js";import{d as be}from"./assets/styled-components.browser.esm-DPkS13KC.js";import{Modal as $,Tooltip as ye,message as H}from"antd";import Fe from"axios";/* empty css */import"react-dom";const Ee=({url:m,token:z,role:B,eventsEmit:E})=>{const c=Fe.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=z;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(E&&E("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],r=e.data;if(t.some(p=>e.config.url&&e.config.url.includes(p))||r.size&&r.type)return r;const{success:u,errorMsg:g,errorCode:D}=r;return u?r:(E&&E("request:error_business",{errorCode:D,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},async e=>{var t,r,u,g,D,p,C,h,N;if(e.message==="canceled")return Promise.reject(e);if(E){let d="request:error_network",v={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",v={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.errorCode)==="30013"||((D=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",v={errorCode:(C=(p=e==null?void 0:e.response)==null?void 0:p.data)==null?void 0:C.errorCode,errorMsg:((N=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:N.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),E(d,v)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const r=O(t);try{const u=await c.delete(`/${r}/deleteDB/${e}`),{success:g,data:D}=u;if(g)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const r=O(t);try{const u=await c.post(`/${r}/saveDBInfo`,e),{success:g,data:D}=u;if(g)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:r,data:u}=t;if(r)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("syncSchema error:",t)}}}},O=m=>m=="DataTable"?"dataTable":"directDB",pe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDEyQzE0IDEwLjg5NTQgMTQuODk1NCAxMCAxNiAxMEgyOUMzMS4yMDkxIDEwIDMzIDExLjc5MDkgMzMgMTRWMjZDMzMgMzAuNDE4MyAyOS40MTgzIDM0IDI1IDM0SDE2QzE0Ljg5NTQgMzQgMTQgMzMuMTA0NiAxNCAzMlYxMloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyKSIvPgo8Zm9yZWlnbk9iamVjdCB4PSItMSIgeT0iLTEiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzNiI+PGRpdiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCIgc3R5bGU9ImJhY2tkcm9wLWZpbHRlcjpibHVyKDJweCk7Y2xpcC1wYXRoOnVybCgjYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgpO2hlaWdodDoxMDAlO3dpZHRoOjEwMCUiPjwvZGl2PjwvZm9yZWlnbk9iamVjdD48ZyBkYXRhLWZpZ21hLWJnLWJsdXItcmFkaXVzPSI0Ij4KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4KPHBhdGggZD0iTTcgMy4yNUgyM0MyNS4wNzExIDMuMjUgMjYuNzUgNC45Mjg5MyAyNi43NSA3VjE5QzI2Ljc1IDI1LjQ4OTMgMjEuNDg5MyAzMC43NSAxNSAzMC43NUg3QzQuOTI4OTMgMzAuNzUgMy4yNSAyOS4wNzExIDMuMjUgMjdWN0MzLjI1IDQuOTI4OTMgNC45Mjg5MyAzLjI1IDcgMy4yNVoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjM0IiBzdHJva2Utd2lkdGg9IjAuNSIvPgo8L2c+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPgo8cGF0aCBkPSJNMTQgMTlWMTEuNjY2NyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjgzOTcyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTExIDE0TDEyIDEzTDE0IDExTDE2IDEzTDE3IDE0IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+CjwvY2xpcFBhdGg+PGZpbHRlciBpZD0iZmlsdGVyMV9kXzQ0NzJfMTgwNTIiIHg9IjUiIHk9IjYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIyMSIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0Lz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIvPgo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAuMzk2MDc4IDAgMCAwIDAgMC45ODQzMTQgMCAwIDAgMC40IDAiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNDQ3Ml8xODA1MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+CjwvZmlsdGVyPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNDQ3Ml8xODA1MiIgeDE9IjIzLjUiIHkxPSIxMCIgeDI9IjIzLjUiIHkyPSIzNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzAxNUFGRiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=",Ie=""+new URL("assets/database_connect.svg",import.meta.url).href,Me=""+new URL("assets/MySQL.svg",import.meta.url).href,fe=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,Ce=""+new URL("assets/Doris.png",import.meta.url).href,he=[{label:"MySQL",value:"MySQL",icon:Me},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:fe},{label:"Doris",value:"Doris",icon:Ce}],Be=({drawerTitle:m,drawerVisible:z,isConnectSuccess:B,handleDrawerClose:E,dbInfo:c,dbType:n,eventsEmit:M})=>{const[G,W]=y(!1),[R,w]=y(!1),[e,t]=y({}),[r,u]=y(!1),g=T(()=>({id:n,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[n,c]),D=T(()=>({id:n,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:he.map(a=>{const{label:i,value:I,icon:x}=a;return{label:i,value:I,render:()=>Z("div",{className:"flex items-center gap-2",children:[l("img",{src:x,width:24}),l("span",{children:i})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:r?!1:!!c}]}]}),[n,c,r]),p=q(null),C=(a,i,I)=>{switch(console.log("[Form] eventsEmit:",a,i,I),a){case"form:ready":i.formRef&&(p.current=i.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",i),t(x=>({...x,[i.fieldId]:i.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",i);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,i)}M==null||M(a,i,I)},h=async()=>{try{W(!0);const a=await p.current.getAllData();a.isValid&&(console.log(a,"==="),n=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r&&(a.fields=a.fields.filter(i=>i.name=="name"||i.name=="description")),await M("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{W(!1)}},N=async()=>{try{w(!0);const a=await p.current.getAllData();if(a.isValid){const i=a.fields.reduce((I,x)=>(I[x.name]=x.value,I),{});await M("form:connect_test",i,void 0)}}catch{w(!1)}finally{w(!1)}},d=T(()=>{const a=n=="DataTable"?g:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(i,I)=>{C("form_field_change",{fieldId:i,value:I},void 0)},onValidationError:i=>{C("form_validation_error",i,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[n,g,D,z,c]),v=T(()=>n=="DirectDB"?c?r&&!B:!B:!1,[n,B,r,z]);return Z($,{title:m,width:620,onCancel:()=>{E(),u(!1)},open:z,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end gap-3",children:[l(Q,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{E(),u(!1)}}),l(Q,{mode:"primary",label:"\u786E\u8BA4",loading:G,disabled:v,onClick:h})]}),children:[l(K,{...d},"example-form"),n==="DirectDB"&&l(de,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r?l(Q,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),p.current.setValues({dbPassword:void 0})}}):l(ye,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:l(Q,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:R,onClick:N})})})]})},we=""+new URL("assets/empty.png",import.meta.url).href,{confirm:Ne}=$,ve=be.div`
2
- width: 282px;
3
- height: 81px;
4
- display: flex;
5
- flex-direction: row;
6
- justify-space:between;
7
- align-items: center;
8
- border-radius: 4px;
9
- padding:12px;
10
-
11
- flexD
12
- color: #2a2a2a;
13
- background-color: #ffffff;
14
- &:hover {
15
- color: #055aff;
16
- border: 1px solid #2b69ff;
17
- background-color: #F1F5FF;
18
- };
19
- border: 1px solid #EBEBEB
20
- `,xe=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:pe},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Ie}],Re=m=>{const{url:z,token:B,role:E,CustomComponents:c,getBtnDisabled:n}=m,[M,G]=y("my-db"),[W,R]=y({app:"ready",container:"ready",content:"ready"}),[w,e]=y(!1),[t,r]=y([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=q(null),[g,D]=y(!1),[p,C]=y(""),[h,N]=y("DataTable"),[d,v]=y(),[a,i]=y(!1),{getDatabaseList:I,delDatabaseById:x,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te,syncSchema:ae}=Ee({url:z,token:B,role:E,eventsEmit:m.eventsEmit}),J=T(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>l(me,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:xe.map(o=>({key:o.key,component:l(ve,{children:Z("div",{className:"flex flex-grow",children:[l("div",{className:"mr-[6px]",children:l("img",{src:o.icon})}),Z("div",{children:[l("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),l("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:_})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);De(()=>{R(o=>({...o,content:"loading"})),se()},[]);const se=async()=>{var o,s,f,b;try{const[A,j]=await Promise.allSettled([I({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let L=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const S=Y((s=A.value)==null?void 0:s.records);L.push({id:"my-db",data:S||[]})}if(j.status==="fulfilled"&&j.value&&(f=j.value)!=null&&f.records){const S=Y((b=j.value)==null?void 0:b.records);L.push({id:"shared-db",data:S||[]})}r(L),R(S=>({...S,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},Y=o=>(o||[]).map(s=>{const f=U("shared-db").map((b,A)=>({...b,key:b.type==="divider"?`${b.key}_${s.id}`:b.key,disabled:n&&n(b.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:n&&n(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),re="admin",ie=()=>Z("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:we,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=J.find(b=>b.id===o);return(s==null?void 0:s.actions)||[]},oe=T(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===M))==null?void 0:s.data)||[];return w?[]:o},[M,t,w]),X=()=>{D(!1),i(!1),v(void 0)},ce=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await ue(o);return s&&(i(!0),H.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function _(o,s,f){var b,A,j,L,S;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":Ne({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await x(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),N(s.datasourceType),delete s.render,v(s);break;case"select":G(s.id);break;case"filesDir_clicked":G(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?N("DataTable"):N("DirectDB");break;case"form_submitted":try{const k=s.fields.reduce((P,F)=>(P[F.name]=F.value,P),{}),le=d?{id:d==null?void 0:d.id,...k}:k,V=await ee(le,h);if(V){if(d){const P={...d,...k,datasourceType:h,actions:U("my-db").map((F,ne)=>({...F,key:F.type==="divider"?`${F.key}_${V}`:F.key,allow:!0}))};(A=(b=u==null?void 0:u.current)==null?void 0:b.appFn)==null||A.updateItem(P,d==null?void 0:d.id),H.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const P={...k,...V,createBy:re,datasourceType:h,actions:U("my-db").map((F,ne)=>({...F,key:F.type==="divider"?`${F.key}_${V}`:F.key,allow:!0}))};(L=(j=u==null?void 0:u.current)==null?void 0:j.appFn)==null||L.addItem(P,{animate:!0,position:"start"}),H.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return V}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}finally{X()}break;case"form:connect_test":return await ce(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!w);break;case"card_sync_schema":await ae(s.id)&&(i(!0),H.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(S=m.eventsEmit)==null||S.call(m,o,s);break}}return Z(ge,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[l(K,{ref:u,label:"",model:"tabs",defaultActiveId:M,views:J,dataSource:oe,eventsEmit:_,status:W,CustomComponents:{EmptyData:ie,...c},styles:m.styles},"db"),l(Be,{drawerTitle:p,drawerVisible:g,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:X,eventsEmit:_})]})};export{Re as default};
package/databaseId.js DELETED
@@ -1,21 +0,0 @@
1
- import{jsx as e,jsxs as v,Fragment as Ce}from"react/jsx-runtime";import{useMemo as J,useState as C,useRef as Fe,useCallback as j,useEffect as De}from"react";import{message as X,Drawer as be,Modal as fe,Tooltip as pe,Switch as Se,Popover as Me,Badge as Ee,Tag as ze}from"antd";import{u as Le}from"./assets/index-CpW6Dhpp.js";import{k as Ae,J as $,C as _e,F as Ve}from"./assets/index-BfureYPx.js";import{c as ue}from"./assets/index--DG-fVvc.js";/* empty css */import{T as Be}from"./assets/index-CXwV5fAx.js";import Ne from"axios";import{X as me}from"./assets/x-tMUaBf0a.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";/**
2
- * @license lucide-react v0.456.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ue=ue("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
7
- * @license lucide-react v0.456.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Re=ue("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
12
- * @license lucide-react v0.456.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const xe=ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
17
- * @license lucide-react v0.456.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const He=ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),Ge="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",$e="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42%2022C43.1046%2022%2044%2022.8954%2044%2024V42C44%2043.1046%2043.1046%2044%2042%2044H6C4.89543%2044%204%2043.1046%204%2042V24.0088C4%2022.9042%204.89543%2022.0078%206%2022.0078C7.10457%2022.0078%208%2022.9042%208%2024.0088V40H40V24C40%2022.8954%2040.8954%2022%2042%2022ZM24.0293%204.00195C24.0808%204.00272%2024.1322%204.00504%2024.1836%204.00977C24.1904%204.01042%2024.1973%204.011%2024.2041%204.01172C24.2673%204.01819%2024.3301%204.02757%2024.3926%204.04004C24.3939%204.04031%2024.3952%204.04075%2024.3965%204.04102C24.7693%204.11623%2025.125%204.29691%2025.4141%204.58594L34.4141%2013.5859C35.1951%2014.367%2035.1951%2015.633%2034.4141%2016.4141C33.633%2017.1951%2032.367%2017.1951%2031.5859%2016.4141L25.9922%2010.8203V32C25.9922%2033.1046%2025.0968%2034%2023.9922%2034C22.8876%2034%2021.9922%2033.1046%2021.9922%2032V10.8359L16.4141%2016.4141C15.633%2017.1951%2014.367%2017.1951%2013.5859%2016.4141C12.8049%2015.633%2012.8049%2014.367%2013.5859%2013.5859L22.498%204.67285C22.8016%204.33138%2023.2194%204.09559%2023.6924%204.02441C23.7122%204.02135%2023.732%204.01809%2023.752%204.01562C23.7862%204.01152%2023.8207%204.00919%2023.8555%204.00684C23.8887%204.00446%2023.9218%204.00268%2023.9551%204.00195C23.9674%204.00173%2023.9798%204%2023.9922%204C24.0046%204%2024.0169%204.00173%2024.0293%204.00195Z'%20fill='url(%23paint0_linear_4072_34663)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4072_34663'%20x1='4'%20y1='-7.25'%20x2='54.4707'%20y2='1.556'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232B69FF'/%3e%3cstop%20offset='1'%20stop-color='%238F91FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",we=({url:a,token:A,role:F,eventsEmit:m})=>{const o=Ne.create({baseURL:a,timeout:1e6});return o.interceptors.request.use(t=>{let s=A;return!s&&!["user/login","user/kaptcha","user/regist"].some(l=>t.url.includes(l))?(m&&m("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(t.headers.Authorization=s||"",t.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,t)}),o.interceptors.response.use(t=>{const s=["user/kaptcha"],i=t.data;if(s.some(L=>t.config.url&&t.config.url.includes(L))||i.size&&i.type)return i;const{success:l,errorMsg:h,errorCode:c}=i;if(l)return i;m&&m("request:error_business",{errorCode:c,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:i})},t=>{var s,i,l,h,c,L,p,_,Y;if(t.message==="canceled")return Promise.reject(t);if(m){let q="request:error_network",Z={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:t};((s=t==null?void 0:t.response)==null?void 0:s.status)===401?(q="request:error_auth",Z={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:t,redirect:"/login"}):(((l=(i=t==null?void 0:t.response)==null?void 0:i.data)==null?void 0:l.errorCode)==="30013"||((c=(h=t==null?void 0:t.response)==null?void 0:h.data)==null?void 0:c.errorCode)==="30023")&&(q="request:error_business",Z={errorCode:(p=(L=t==null?void 0:t.response)==null?void 0:L.data)==null?void 0:p.errorCode,errorMsg:((Y=(_=t==null?void 0:t.response)==null?void 0:_.data)==null?void 0:Y.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:t}),m(q,Z)}return Promise.reject(t)}),{getTableList:async t=>{try{const s=await o.get(`/directDB/queryTableList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableList error:",s)}},getTableTreeList:async t=>{try{const s=await o.get(`/dataTable/queryTableFileTreeList/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableTreeList error:",s)}},getDBDetailById:async(t,s)=>{const i=ge(s);try{const l=await o.get(`/${i}/queryDBInfo/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("getDBDetailById error:",l)}},delTableById:async(t,s)=>{const i=ge(s);try{const l=await o.delete(`/${i}/deleteTable/${t}`),{success:h,data:c}=l;if(h)return c}catch(l){console.log("delTableById error:",l)}},delFileById:async t=>{try{const s=await o.delete(`/dataTable/deleteTableFileData/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("delFileById",s)}},parseFiles:async({fileIds:t,isGenDescription:s,tableDescriptionMap:i})=>{try{const l=await o.post("/dataTable/parseFiles",{fileIds:t,isGenDescription:s,tableDescriptionMap:i}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("parseFiles error:",l)}},reParseFile:async t=>{try{const s=await o.post(`/dataTable/reParseFile/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("reParseFile error:",s)}},parseAppendFile:async({fileIds:t,tableId:s})=>{try{const i=await o.post("/dataTable/parseAppendFiles",{fileIds:t,tableId:s}),{success:l,data:h}=i;if(l)return h}catch(i){console.log("parseAppendFile error:",i)}},deleteUploadedFiles:async t=>{try{const s=await o.post("/dataTable/cancelUploadFile",{fileIds:t}),{success:i,data:l}=s;if(i)return l}catch(s){console.log("deleteUploadedFiles error:",s)}},getTableInfoById:async t=>{try{const s=await o.get(`/dataTable/queryTableMeta/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("getTableInfoById error:",s)}},updateTableInfo:async({tableId:t,description:s,businessName:i})=>{try{const l=await o.post("/dataTable/updateTableInfo",{tableId:t,businessName:i,description:s}),{success:h,data:c}=l;if(h)return c}catch(l){console.log("updateTableInfo error:",l)}},optimizeDesc:async t=>{try{const s=await o.get(`/genTableDescription/${t}`),{success:i,data:l}=s;if(i)return l}catch(s){console.log("optimizeDesc error:",s)}}}},ge=a=>a=="DataTable"?"dataTable":"directDB",re='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',We={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},qe=({drawerTitle:a,drawerVisible:A,handleDrawerClose:F,dbId:m,tableInfo:o,token:k,url:O,role:E})=>{const z=J(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!o,accept:".csv,.xlsx,.xls",maxFiles:o?1:20,url:"http://10.15.12.13:8888/index/database/dataTable/uploadFile",autoUpload:!0,headers:{Authorization:k},queryParams:{databaseId:m,...o&&{tableId:o.tableId}},placeholder:v("div",{children:[e("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),v("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[e("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",style:{width:"580px"},children:"\u683C\u5F0F\uFF1A.xlsx / .xls / .csv /\uFF08\u7B2C\u4E00\u884C\u662F\u8868\u5934\uFF0C\u5176\u4ED6\u884C\u662F\u6570\u636E\uFF1BCSV \u652F\u6301 UTF-8/GBK/GB2312\u2026\uFF09"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u5355\u6587\u4EF6\u9650\u5236\uFF1A \u226410\u4E07\u884C\uFF0C\u226460\u5217\uFF08\u8D85\u51FA\u81EA\u52A8\u5FFD\u7565\uFF09\uFF1B \u6BCF\u6587\u4EF6 \u22641\u4E2ASheet"}),e("div",{className:"text-[#888888] font-[12px]",children:"\u4E0A\u4F20\u7684\u6587\u4EF6\uFF0C\u5982\u679C\u6709\u4E0D\u7B26\u5408\u6587\u672C\u683C\u5F0F\u7684\u6570\u636E\u7CFB\u7EDF\u81EA\u52A8\u5FFD\u7565"})]})]}),listName:o?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:e("img",{src:$e,width:40}),itemStatus:{pending:e("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:e("span",{style:{fontSize:"12px",color:"#007bff"}}),success:e("span",{style:{fontSize:"12px",color:"#10b981"}}),error:e("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:e(Ue,{size:20,style:{color:"#6b7280"}})}},...!o&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:e("img",{src:Ge}),mode:"text",onClick:()=>{i(!0)}}]},...!o&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[o]),[S,g]=C(!1),[f,U]=C({}),G=Fe(null),[W,R]=C(!1),[B,t]=C([]),[s,i]=C(!1),[l,h]=C(re),[c,L]=C(null),[p,_]=C(re),[Y,q]=C(0),{parseFiles:Z,parseAppendFile:te,deleteUploadedFiles:ae}=we({url:O,token:k,role:E}),K=j(async(d,r,I)=>{var D;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",d,r),d){case"form:ready":r.formRef?G.current=r.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":P();break;case"form_field_change":U(b=>({...b,[r.fieldId]:r.value}));break;case"uploader:error":(D=r.item)!=null&&D.id?t(b=>[{id:r.item.id,status:r.item.status},...b]):X.error(r==null?void 0:r.message);break;case"uploader:success":t(b=>[{id:r.item.id,status:r.item.status},...b]);break;case"uploader:remove":const V=r.item.status;t(b=>b.filter(n=>n.id!==r.item.id)),V=="success"&&await ee([r.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",d)}},[]),se=J(()=>({label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:"form-view",model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:"form-view",type:"form",size:"md",formWidth:z.formWidth,formConfig:{layout:z.layout,showReset:!1,showSubmit:!1,formWidth:z.formWidth,getFormData:()=>({...f,timestamp:new Date().toISOString(),formId:z.id}),onFieldChange:(d,r)=>{K("form_field_change",{fieldId:d,value:r},void 0)},onValidationError:d=>{K("form_validation_error",d,void 0)}}}],dataSource:[{id:z.id,fields:z.fields,defaultValues:{}}],eventsEmit:K,styles:{theme:We}}),[o,z]),P=async()=>{var d;try{g(!0);const r=await G.current.getAllData();if(r.isValid){const I=(d=r.fields.find(D=>D.name=="fileIds"))==null?void 0:d.value;if(Array.isArray(I)&&(I==null?void 0:I.length)>0){let D;if(o)D=await te({fileIds:I.map(V=>V.uploadApiRes),tableId:o.id});else{const V={fileIds:I.map(b=>b.uploadApiRes),tableDescriptionMap:I.reduce((b,n)=>(b[n.uploadApiRes]=n.formData.description,b),{}),isGenDescription:W};D=await Z(V)}D&&F("refresh")}}}catch(r){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",r)}finally{F(),g(!1),R(!1)}},Q=async d=>{var r;try{const I=await G.current.getAllData();if(I.isValid){const D=(r=I.fields.find(V=>V.name=="fileIds"))==null?void 0:r.value;if(D&&Array.isArray(D)&&(D==null?void 0:D.length)>0){const V=D.map(n=>n.uploadApiRes),b=await ee(V)}}}catch(I){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",I)}finally{F(),R(!1)}},ee=async d=>{try{const r=await ae(d);if(r)return r}catch(r){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",r)}},ie=d=>{R(d)},le=j(d=>{h(d),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",d)},[]),ne=j(d=>{L(()=>d),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),oe=j(async()=>{try{if(!c){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const d=c("pure_string");await navigator.clipboard.writeText(d),X.success("\u5DF2\u590D\u5236",1)}catch(d){console.error("\u590D\u5236\u5931\u8D25:",d)}finally{i(!1)}},[c]);return v(be,{title:a,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:()=>Q(),className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:v("div",{className:`flex ${o?"justify-end":"justify-between"} items-center`,children:[!o&&v("div",{className:"flex gap-2 items-center",children:[e("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",e(pe,{title:"\u81EA\u52A8\u751F\u6210\u5F00\u542F\u65F6\u5C06\u57FA\u4E8E\u6570\u636E\u667A\u80FD\u751F\u6210\u63CF\u8FF0\uFF1B\u82E5\u5F00\u542F\u6B64\u529F\u80FD\u5E76\u624B\u52A8\u586B\u5199\u63CF\u8FF0\uFF0C\u5C06\u4F18\u5148\u91C7\u7528\u7528\u6237\u586B\u5199\u7684\u5185\u5BB9\u3002",children:e(_e,{size:14})}),e(Se,{onChange:ie})]}),v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:Q}),e($,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:S,disabled:B.some(d=>d.status=="error"),onClick:async()=>{await P()}})]})]}),children:[e(Ae,{...se},"upload-file"),e(fe,{title:v("div",{children:["\u6A21\u7248",e("span",{className:"text-[12px] text-[#888888] ml-[8px]",children:"\u5B8C\u6210\u7F16\u8F91\u540E\uFF0C\u53EF\u5C06\u6587\u672C\u590D\u5236\u7C98\u8D34\u5230\u76F8\u5E94\u63CF\u8FF0\u6846\u4E2D\u3002"})]}),width:672,destroyOnHidden:!0,open:s,onCancel:()=>i(!1),footer:v("div",{className:"flex justify-end items-center gap-3",children:[e($,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{_(re),q(d=>d+1)}}),e($,{mode:"primary",label:"\u590D\u5236",onClick:oe})]}),children:e(Be,{data:p,onChange:le,onGetData:ne,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},Y)})]})},Ze="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",je="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4199_8826)'%3e%3cpath%20d='M15.5554%2012.4444C14.9626%2013.0373%2014.6666%2013.6293%2014.6666%2014.2222C14.6666%2014.8151%2014.9626%2015.4071%2015.5554%2016C14.9626%2015.4071%2014.3706%2015.1111%2013.7777%2015.1111C13.1848%2015.1111%2012.5928%2015.4071%2011.9999%2016C12.5928%2015.4071%2012.8888%2014.8151%2012.8888%2014.2222C12.8888%2013.6293%2012.5928%2013.0373%2011.9999%2012.4444C12.5928%2013.0373%2013.1848%2013.3333%2013.7777%2013.3333C14.3706%2013.3333%2014.9626%2013.0373%2015.5554%2012.4444ZM14.6488%204.01778C15.1905%204.55954%2015.4948%205.29431%2015.4948%206.06044C15.4948%206.82658%2015.1905%207.56135%2014.6488%208.10311L7.735%2015.0169C7.46766%2015.2892%207.14901%2015.5058%206.79746%2015.6543C6.44592%2015.8028%206.06844%2015.8801%205.68684%2015.8819C5.30523%2015.8836%204.92706%2015.8097%204.57417%2015.6645C4.22127%2015.5193%203.90065%2015.3056%203.63081%2015.0357C3.36097%2014.7659%203.14727%2014.4453%203.00205%2014.0924C2.85682%2013.7395%202.78295%2013.3613%202.7847%2012.9797C2.78646%2012.5981%202.8638%2012.2206%203.01226%2011.8691C3.16072%2011.5176%203.37736%2011.1989%203.64967%2010.9316L3.95545%2010.6249L3.85145%2010.5244C3.30922%2010.0267%202.76522%209.77778%202.22211%209.77778C1.62923%209.77778%201.03722%2010.0738%200.444336%2010.6667C1.03722%2010.0738%201.33322%209.48178%201.33322%208.88889C1.33322%208.296%201.03722%207.704%200.444336%207.11111C1.03722%207.704%201.62923%208%202.22211%208C2.815%208%203.407%207.704%203.99989%207.11111C3.407%207.704%203.111%208.296%203.111%208.88889C3.111%209.46667%203.39278%2010.0444%203.95545%2010.6222L10.5634%204.01778C11.1052%203.47606%2011.84%203.17173%2012.6061%203.17173C13.3723%203.17173%2014.107%203.47606%2014.6488%204.01778ZM9.55189%206.91378L4.59189%2011.8738C4.30004%2012.1655%204.13603%2012.5612%204.13594%2012.9739C4.1359%2013.1782%204.17611%2013.3806%204.25426%2013.5694C4.33242%2013.7582%204.44699%2013.9297%204.59145%2014.0742C4.7359%2014.2187%204.9074%2014.3334%205.09617%2014.4116C5.28493%2014.4898%205.48725%2014.5301%205.69158%2014.5302C6.10424%2014.5303%206.50004%2014.3664%206.79189%2014.0747L11.7519%209.11378L9.55189%206.91378ZM11.5066%204.96089L10.495%205.97156L12.695%208.17156L13.7057%207.16C13.9846%206.86582%2014.1377%206.47437%2014.1323%206.069C14.1269%205.66364%2013.9635%205.27639%2013.6768%204.98973C13.3902%204.70306%2013.0029%204.53964%2012.5976%204.53425C12.1922%204.52887%2011.8007%204.68194%2011.5066%204.96089ZM9.59545%200C8.85589%200.740444%208.48434%201.48178%208.48434%202.22222C8.48434%202.96267%208.85589%203.704%209.59545%204.44444C8.85589%203.704%208.11456%203.33333%207.37322%203.33333C6.63367%203.33333%205.89234%203.704%205.151%204.44444C5.89234%203.704%206.26211%202.96267%206.26211%202.22222C6.26211%201.48178%205.89322%200.740444%205.15189%200C5.89322%200.740444%206.63456%201.11111%207.37411%201.11111C8.11545%201.11111%208.85678%200.740444%209.59634%200H9.59545Z'%20fill='%23055AFF'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_4199_8826'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",{confirm:Oe}=fe,Ye='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Xe=({drawerTitle:a,drawerVisible:A,tableInfo:F,handleDrawerClose:m,optimizeDesc:o,eventsEmit:k})=>{const O=J(()=>(F==null?void 0:F.data.find(p=>p.columnId=="name").value)||"-",[F]),[E,z]=C(""),[S,g]=C(null),[f,U]=C(""),[G,W]=C(0),[R,B]=C(!1),[t,s]=C(!1);De(()=>{const p=(F==null?void 0:F.data.find(_=>_.columnId=="description").value)||"-";U(p)},[F]);const i=()=>{Oe({title:"\u4F60\u786E\u5B9A\u8981\u4F7F\u7528\u6A21\u677F\u5417\uFF1F",content:"\u8FD9\u5C06\u66FF\u6362\u4F60\u5F53\u524D\u5DF2\u586B\u5199\u7684\u5185\u5BB9\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002",okText:"\u786E\u8BA4\u66FF\u6362",cancelText:"\u53D6\u6D88",onOk(){U(Ye),W(p=>p+1)},onCancel(){console.log("Cancel")}})},l=j(p=>{z(p),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",p)},[]),h=j(p=>{g(()=>p),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),c=async()=>{try{B(!0);const p=await o(F.tableId);p&&(U(p),W(_=>_+1),B(!1))}catch{X.error("AI \u4F18\u5316\u5931\u8D25")}},L=j(()=>{if(!S){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const p=S("pure_string");k("table_info:update",p)},[S,k]);return v(be,{title:a,placement:"right",width:720,onClose:m,closeIcon:!1,extra:e(me,{size:20,color:"#888888",onClick:m,className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:e("div",{className:"flex justify-end items-center",children:v("div",{className:"flex self-end gap-3",children:[e($,{mode:"default",label:"\u53D6\u6D88",onClick:m}),e($,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>L(),disabled:R})]})}),children:[e("div",{className:"mb-[10px] font-bold",children:O}),v("div",{className:"mb-[10px]",children:[e("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),e("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),e("span",{className:"text-[#888888] ml-[4px]",children:"(\u8BF7\u51C6\u786E\u586B\u5199\u8868\u683C\u7684\u5E94\u7528\u573A\u666F\u63CF\u8FF0\uFF0C\u5927\u6A21\u578B\u5C06\u4F9D\u8D56\u6B64\u4FE1\u606F\u8BC6\u522B\u5E76\u6B63\u786E\u8C03\u7528\u8BE5\u6570\u636E\u8868\u3002)"})]}),e(Be,{data:f,onChange:l,onGetData:h,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},G),v("div",{children:[e(Me,{open:t,onOpenChange:p=>s(!!p),content:e("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:i,className:"hover:bg-gray-100 h-[80px] cursor-pointer rounded",children:"______\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86______\u573A\u666F\u7684\u6570\u636E\uFF0C\u5305\u542B______\u3001______\u3001______\u7B49\u4E3B\u8981\u5B57\u6BB5\uFF0C\u652F\u6301\u7528\u6237\u67E5\u8BE2______\u95EE\u9898(\u5927\u6982\u4ECB\u7ECD)\u5982\u679C\u6D89\u53CA\u591A\u8868\u5173\u8054\u67E5\u8BE2\uFF0C\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7______\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A______\u8868\u683C\u3002"}),title:v("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[e("div",{className:"text-[16px]",children:"\u6A21\u7248"}),e(me,{size:20,color:"#888888",onClick:()=>s(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:p=>p,children:e("span",{children:e($,{mode:"text",icon:e("img",{src:Ze}),children:"\u4F7F\u7528\u6A21\u7248"})})}),e($,{onClick:c,mode:"text",icon:e("img",{src:je}),loading:R,children:"AI\u4F18\u5316"})]})]})},Ke=""+new URL("assets/empty.png",import.meta.url).href;var H=(a=>(a[a.DATE=0]="DATE",a[a.VIEW=1]="VIEW",a[a.ERROR=2]="ERROR",a[a.AUTHORIZE=3]="AUTHORIZE",a[a.DELETE=4]="DELETE",a[a.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",a[a.DOWNLOAD=6]="DOWNLOAD",a[a.EDIT=7]="EDIT",a[a.ADD=8]="ADD",a[a.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",a[a.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",a))(H||{}),ve=(a=>(a.GENERATING="generating",a.SUCCESS="success",a.FAIL="fail",a))(ve||{});const ce={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},Je=a=>typeof a=="string"&&a in ce?ce[a]:ce.default,de=a=>{const{value:A,cell:F}=a;switch(F.columnId){case"importstatus":return A?e(pe,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:e(ze,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):e(Ce,{});case"status":const m=Je(a.cell.statusType);return A=="\u5BFC\u5165\u5931\u8D25"?e(pe,{title:F.errorMsg,children:v("div",{className:"flex items-center gap-2",children:[e(Ee,{color:m,text:A}),e(xe,{size:14,color:"red"})]})}):e(Ee,{color:m,text:A});default:return e(Ce,{})}},he=[{statusType:"success",value:"\u5BFC\u5165\u6210\u529F",status:"30"},{statusType:"error",value:"\u5BFC\u5165\u5931\u8D25",status:"00"},{statusType:"default",value:"\u5F85\u5BFC\u5165",status:"10"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"20"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"11"}],Pe=a=>{var m,o;const{cell:A,value:F}=a;return typeof F=="string"?e("div",{title:F,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:F}):(m=A.tableMeta)!=null&&m.isGenDescription&&((o=A.tableMeta)==null?void 0:o.generateDescriptionStatus)=="generating"?v("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[e("span",{children:"\u751F\u6210\u4E2D"}),e(Re,{size:14})]}):"-"},Qe=({dbInfo:a,setDrawerTitle:A,setDrawerVisible:F,getBtnDisabled:m})=>v("div",{className:"flex flex-col items-center justify-center h-full",children:[e("div",{className:"text-xl font-semibold mb-3",children:e("img",{src:Ke,width:120})}),e("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),e("div",{className:"flex gap-3",children:e($,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:m&&m(8,a==null?void 0:a.permission),onClick:()=>{A("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),F(!0)}})})]}),{confirm:ye}=fe,Fu=a=>{const{url:A,token:F,role:m,id:o,dbType:k,CustomComponents:O,getBtnDisabled:E}=a,[z,S]=C({container:"ready",content:"ready"}),g=Fe(null),f=Fe(null),[U,G]=C(),[W,R]=C({}),[B,t]=C(),[s,i]=C(!1),[l,h]=C(""),[c,L]=C(),[p,_]=C(!1),[Y,q]=C(""),{getTableList:Z,delTableById:te,delFileById:ae,updateTableInfo:K,optimizeDesc:se,getTableTreeList:P,reParseFile:Q,getDBDetailById:ee}=we({url:A,token:F,role:m,eventsEmit:a.eventsEmit});De(()=>(o&&k&&(S(n=>({...n,container:"loading"})),ie()),()=>{f.current&&(clearTimeout(f.current),f.current=null)}),[o,k]);const ie=async()=>{try{const n=await ee(o,k);n&&(t(n),S(u=>({...u,container:"ready",content:"loading"})))}catch(n){console.log("[TableApiError] getDBInfo:",n)}await b()},le=async()=>{try{if(k=="DirectDB"){const n=await Z(o);if(n){const u=oe(n);return G(u||[]),S(w=>({...w,content:"ready"})),u||[]}else S(u=>({...u,content:"error"}))}else{const n=await P(o);if(n){const u=ne(n);return G(u||[]),S(w=>({...w,content:"ready"})),u||[]}else S(u=>({...u,content:"error"}))}}catch(n){console.log("[TableApiError] getTableList:",n)}};function ne(n){return(n||[]).map((u,w)=>{var M,N;let y=he.find(x=>x.status==u.status);const T=u.children.some(x=>x.status=="00");return{id:u.fileId.toString(),tableId:u.tableId,data:[{columnId:"name",value:(u==null?void 0:u.originalFilename)||"-",type:"label"},{columnId:"description",value:(M=u==null?void 0:u.tableMeta)==null?void 0:M.description,type:"customized",tableMeta:u==null?void 0:u.tableMeta},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:u.errorMsg},{columnId:"importstatus",value:T,type:"customized"},{columnId:"createdAt",value:u.gmtCreate,type:"date"},{columnId:"updatedAt",value:u.gmtModified,type:"date"},...u.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,u.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:E&&E(H.EDIT,u.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:E&&E(H.EDIT,u.permission)}]:[],...u.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,u.permission)}],expanded:!1,...u.children&&((N=u.children)==null?void 0:N.length)>0&&{children:[...(u.children||[]).map(x=>{const ke=he.find(Te=>Te.status==x.status),Ie=[{columnId:"name",value:x.originalFilename,type:"text"},{columnId:"count",value:`${x.rowCount}\u884C\uFF0C${x.columnCount}\u5217`,type:"text"},{columnId:"status",...ke,errorMsg:x.errorMsg,type:"customized"},{columnId:"createdAt",value:x.gmtCreate,type:"date"},{columnId:"updatedAt",value:x.gmtModified,type:"date"},...x.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(H.VIEW,x.permission)}]:[],...x.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:E&&E(H.ADD,x.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:E&&E(H.DELETE,x.permission)}];return{id:x.fileId.toString(),tableId:x.tableId,data:Ie}})]}}})}function oe(n){return(n||[]).map((u,w)=>({id:u.id||Le(8),data:[{columnId:"name",value:u.physicalName},{columnId:"cnname",value:u.businessName},{columnId:"colcount",value:u.columnCount},{columnId:"count",value:`${u.rowCount}\u884C\uFF0C${u.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:E&&E(H.VIEW,u.permission)}]}))}async function d(n,u,w){switch(console.log("[adopter] mergedEventsEmit",n,u,w),n){case"table_action_delete":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",icon:e(xe,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await te(u.tableId,k)&&(g!=null&&g.current)&&(g==null||g.current.appFn.removeItem(u.id),X.success("\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"table_action_edit":{q("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),_(!0),L(u);break}case"toolbar_upload":{h("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),i(!0);break}case"table_action_addData":{h("\u8FFD\u52A0\u6570\u636E"),i(!0),L(u);break}case"table_action_reValidate":{await Q(u.id)&&(f.current&&(clearTimeout(f.current),f.current=null),await b());break}case"table_info:update":{try{if(c!=null&&c.id){const y=(c==null?void 0:c.data.find(M=>M.columnId=="name").value)||"-";if(await K({tableId:c.tableId,description:u,businessName:y})&&(g!=null&&g.current)){const M={...c,data:c.data.map(N=>N.columnId=="description"?{...N,value:u}:N)};g==null||g.current.appFn.updateItem(M,c.id),X.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{D()}break}case"table_action_delete_sub":{try{ye({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){const{id:y,tableId:T}=u;await ae(u.id)&&(g!=null&&g.current)&&(R(N=>({...N,[T]:[...N[T]||[],y]})),u.data.find(N=>N.status=="00")&&(f.current&&(clearTimeout(f.current),f.current=null),b()),w.removeItem(y,T),X.success("\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"toolbar_auth":{typeof a.eventsEmit=="function"&&a.eventsEmit("toolbar_auth",B);break}default:typeof a.eventsEmit=="function"&&a.eventsEmit(n,u);break}}const r=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"direct-table-view",views:[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"direct-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,columns:[{id:"name",title:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",type:"label"},{id:"cnname",title:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",type:"label"},{id:"colcount",title:"\u5B57\u6BB5\u6570",type:"text"},{id:"count",title:"\u6570\u636E\u91CF",type:"text"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}]}),[U,k]),I=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"data-table-view",views:[{label:"\u4E0A\u4F20\u6570\u636E\u5217\u8868",id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:"\u6587\u4EF6\u540D",type:"label",tip:"\u6587\u4EF6\u540D"},{id:"description",title:"\u63CF\u8FF0",type:"customized",component:e(Pe,{}),helpText:"\u6253\u5F00\u81EA\u52A8\u751F\u6210\u63CF\u8FF0\u5F00\u5173\u540E\uFF0C\u82E5\u63CF\u8FF0\u672A\u6B63\u5E38\u751F\u6210\uFF0C\u5219\u63CF\u8FF0\u5185\u5BB9\u4E3A\u7A7A\uFF0C\u5982\u60A8\u4ECD\u7136\u9700\u8981\u63CF\u8FF0\uFF0C\u5219\u9700\u8981\u624B\u52A8\u6DFB\u52A0"},{id:"count",title:"\u6570\u636E\u91CF",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",component:e(de,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:e(de,{})},{id:"createdAt",title:"\u521B\u5EFA\u65F6\u95F4",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{id:"updatedAt",title:"\u66F4\u65B0\u65F6\u95F4",type:"date",tip:"\u66F4\u65B0\u65F6\u95F4"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"button",key:"upload",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",btnType:"primary",disabled:E&&E(H.ADD,B==null?void 0:B.permission),icon:e(He,{size:12})},{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:"\u8FFD\u52A0\u6587\u4EF6\u540D",id:"name",type:"text",tip:"\u8FFD\u52A0\u6587\u4EF6\u540D"},{title:"\u6570\u636E\u91CF",id:"count",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",tip:"\u5BFC\u5165\u72B6\u6001",component:e(de,{})},{title:"\u521B\u5EFA\u65F6\u95F4",id:"createdAt",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{title:"\u66F4\u6539\u65F6\u95F4",id:"updatedAt",type:"date",tip:"\u66F4\u6539\u65F6\u95F4"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}]},subTablePendingIds:W,onSubTableRowAnimationComplete:(n,u)=>{R(w=>({...w,[n]:(w[n]||[]).filter(y=>y!==u)}))}}),[W,U,k,B]),D=n=>{i(!1),_(!1),L(void 0),n=="refresh"&&(f.current&&(clearTimeout(f.current),f.current=null),b())};function V(n){var u;if(!Array.isArray(n))return!0;for(const w of n){if(w.data){const y=w.data.find(M=>M.columnId==="status"),T=w.data.find(M=>M.columnId==="description");if(y&&(y.status==="20"||y.status==="11"||((u=T==null?void 0:T.tableMeta)==null?void 0:u.generateDescriptionStatus)==ve.GENERATING))return!1}if(Array.isArray(w.children)){for(const y of w.children)if(y.data){const T=y.data.find(M=>M.columnId==="status");if(T&&(T.status==="20"||T.status==="11"))return!1}}}return!0}const b=async()=>{const n=await le();V(n||[])?f.current&&(clearTimeout(f.current),f.current=null):(f.current&&(clearTimeout(f.current),f.current=null),f.current=setTimeout(()=>{b()},5e3))};return v(Ve,{title:B==null?void 0:B.name,description:(B==null?void 0:B.description)||"-",goBack:()=>{var n;(n=a.eventsEmit)==null||n.call(a,"goBack",{})},children:[e(Ae,{dataSource:U,ref:g,eventsEmit:d,status:z,CustomComponents:{EmptyData:()=>e(Qe,{dbInfo:B,setDrawerTitle:h,setDrawerVisible:i,getBtnDisabled:E}),...O},...k=="DataTable"?I:r}),e(qe,{drawerTitle:l,drawerVisible:s,handleDrawerClose:D,dbId:o,token:F,url:A,role:m,tableInfo:c}),e(Xe,{drawerTitle:Y,drawerVisible:p,handleDrawerClose:D,tableInfo:c,optimizeDesc:se,eventsEmit:d})]})};export{Fu as default};
package/modelManage.js DELETED
@@ -1 +0,0 @@
1
- import{jsx as l,jsxs as Z}from"react/jsx-runtime";import{useState as w,useMemo as P,useRef as Y,useEffect as ae}from"react";import{Drawer as le,Modal as re,Tooltip as X,message as j,Badge as G}from"antd";import{k as O,J as z,F as ne}from"./assets/index-BfureYPx.js";import"./assets/index--DG-fVvc.js";import ie from"axios";import{X as ce}from"./assets/x-tMUaBf0a.js";/* empty css */import{P as de}from"./assets/plus-fNg4vmeA.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";const me=""+new URL("assets/empty.png",import.meta.url).href,pe=({url:u,token:C,role:p,eventsEmit:F})=>{const y=ie.create({baseURL:u,timeout:1e6});return y.interceptors.request.use(e=>{let t=C;return!t&&!["user/login","user/kaptcha","user/regist"].some(i=>e.url.includes(i))?(F&&F("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=p==="\u672A\u767B\u5F55\u7528\u6237"?"":p,e)}),y.interceptors.response.use(e=>{const t=["user/kaptcha"],o=e.data;if(t.some(m=>e.config.url&&e.config.url.includes(m))||o.size&&o.type)return o;const{success:i,errorMsg:h,errorCode:a}=o;return i?o:(F&&F("request:error_business",{errorCode:a,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:o}),!1)},e=>{var t,o,i,h,a,m,E,M,B;if(e.message==="canceled")return Promise.reject(e);if(F){let S="request:error_network",R={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(S="request:error_auth",R={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((i=(o=e==null?void 0:e.response)==null?void 0:o.data)==null?void 0:i.errorCode)==="30013"||((a=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:a.errorCode)==="30023")&&(S="request:error_business",R={errorCode:(E=(m=e==null?void 0:e.response)==null?void 0:m.data)==null?void 0:E.errorCode,errorMsg:((B=(M=e==null?void 0:e.response)==null?void 0:M.data)==null?void 0:B.message)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),F(S,R)}return Promise.reject(e)}),{getModelList:async e=>{try{const t=await y.get(`/allPage?${new URLSearchParams(e).toString()}`),{success:o,data:i}=t;if(o)return i}catch(t){return console.log("getModelList error:",t),!1}},delModelById:async e=>{try{const t=await y.delete(`/delete?id=${e}`),{success:o,data:i}=t;if(o)return i}catch(t){console.log("delModelById error:",t)}},createModel:async e=>{try{const t=await y.post("/create",e),{success:o,data:i}=t;if(o)return i}catch(t){console.log("createModel error:",t)}},updateModelById:async e=>{try{const t=await y.put("/update",e),{success:o,data:i}=t;if(o)return i}catch(t){console.log("updateModelById error:",t)}},getUseTypeList:async()=>{try{const e=await y.get("/getModelTypes"),{success:t,data:o}=e;if(t)return o}catch(e){return console.log("getUseTypeList error:",e),!1}},getModelProtocolsList:async()=>{try{const e=await y.get("/getModelProtocols"),{success:t,data:o}=e;if(t)return o}catch(e){return console.log("getModelProtocolsList error:",e),!1}}}},Fe=({drawerTitle:u,drawerVisible:C,modelInfo:p,handleDrawerClose:F,modelUseTypeOpt:y,modelProtocolsOpt:x,eventsEmit:g})=>{const[q,L]=w(!1),[d,k]=w(!1),e=P(()=>({id:"config-model",layout:"vertical",formWidth:"550px",fields:[{id:"modelName",name:"modelName",label:"\u6A21\u578B\u540D\u79F0",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578B\u540D\u79F0",counter:30},{id:"modelIde",name:"modelIde",label:"\u6A21\u578BID",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578BID",defaultValue:""},{id:"apiKey",name:"apiKey",label:"APIKey",type:"input",required:!1,placeholder:"\u8BF7\u8F93\u5165APIKey",defaultValue:""},{id:"url",name:"url",label:"\u8BF7\u6C42URL",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u8BF7\u6C42URL",defaultValue:""},{id:"modelProtocol",name:"modelProtocol",label:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"select",required:!0,options:x},{id:"type",name:"type",label:"\u4F7F\u7528\u7C7B\u578B",type:"select",required:!0,options:y,defaultValue:1,controlledItems:{1:["thinking"]}},{id:"dec",name:"dec",label:"\u8BF4\u660E",type:"textarea",required:!1},{id:"thinking",name:"thinking",label:"\u63A8\u7406\u601D\u8003\u5F00\u5173",type:"switch",required:!1,helpText:"\u5982\u679C\u60A8\u90E8\u7F72\u7684\u6A21\u578B\u672C\u8EAB\u5177\u6709\u63A8\u7406\u601D\u8003\u7684\u5F00\u5173\uFF0C\u60A8\u53EF\u4EE5\u6253\u5F00\u5F53\u524D\u5F00\u5173\u652F\u6301\u63A8\u7406\u601D\u8003\u80FD\u529B\uFF0C\u5982Qwen3"}]}),[p,y,x]),t=Y(null),o=async(a,m,E)=>{var M;switch(console.log("[Form] eventsEmit:",a,m,E),a){case"form:ready":m.formRef&&(t.current=m.formRef);break;case"form:change":if(!((M=t.current)!=null&&M.getValue)){console.log("\u8868\u5355\u5F15\u7528\u672A\u5C31\u7EEA\uFF0C\u8DF3\u8FC7 formdata_onchange \u4E8B\u4EF6");return}const B=await t.current.getValue("type");B==2||B==3?k(!0):k(!1);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,m)}g==null||g(a,m,E)},i=async()=>{try{L(!0);const a=await t.current.getAllData();a.isValid&&(p!=null&&p.id?await g("form_submitted_edit",a,void 0):await g("form_submitted_add",a,void 0))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{L(!1)}},h=P(()=>{const a=p==null?void 0:p.data.reduce((m,E)=>(m[E.columnId]=E.value,m),{});return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:e.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:e.id,type:"form",size:"md",formWidth:e.formWidth,formConfig:{layout:e.layout,showReset:!1,showSubmit:!1,formWidth:e.formWidth}}],dataSource:[{id:e.id,fields:e.fields,defaultValues:a||{}}],eventsEmit:o}},[p,d,e]);return l(le,{title:u,placement:"right",width:560,onClose:F,closeIcon:!1,extra:l(ce,{size:20,color:"#888888",onClick:F,className:"cursor-pointer"}),open:C,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end items-center gap-3",children:[l(z,{mode:"default",label:"\u53D6\u6D88",onClick:F}),l(z,{mode:"primary",label:"\u786E\u8BA4",loading:q,onClick:i})]}),children:l(O,{...h},"example-form")})},N={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},K=[{statusType:"success",value:"\u53EF\u7528",status:1},{statusType:"error",value:"\u4E0D\u53EF\u7528",status:0}],fe=u=>typeof u=="string"&&u in N?N[u]:N.default;var V=(u=>(u[u.DATE=0]="DATE",u[u.VIEW=1]="VIEW",u[u.ERROR=2]="ERROR",u[u.AUTHORIZE=3]="AUTHORIZE",u[u.DELETE=4]="DELETE",u[u.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",u[u.DOWNLOAD=6]="DOWNLOAD",u[u.EDIT=7]="EDIT",u[u.ADD=8]="ADD",u[u.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",u[u.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",u))(V||{});const{confirm:ye}=re,ge={pageNum:1,pageSize:1e3},Ae=u=>{const{value:C,cell:p}=u,F=fe(u.cell.statusType);return C=="\u4E0D\u53EF\u7528"?l(X,{title:p.errorMsg,children:l("div",{className:"flex items-center gap-2",children:l(G,{color:F,text:C})})}):l(G,{color:F,text:C})};function ke(u){const{url:C,token:p,role:F,CustomComponents:y,eventsEmit:x,getBtnDisabled:g}=u,[q,L]=w({container:"ready",content:"ready"}),d=Y(null),[k,e]=w(),[t,o]=w(!1),[i,h]=w(""),[a,m]=w(),[E,M]=w([]),[B,S]=w([]),{getModelList:R,delModelById:J,createModel:Q,updateModelById:_,getUseTypeList:T,getModelProtocolsList:ee}=pe({url:C,token:p,role:F,eventsEmit:x});ae(()=>{L(n=>({...n,content:"loading"})),te()},[]);const ue=n=>(n||[]).map((s,b)=>{let r=K.find(A=>A.status==s.status);return{id:s.id,data:[{columnId:"modelName",value:s.modelName},{columnId:"modelProtocol",value:s.modelProtocol,type:"customized"},{columnId:"type",value:s.type,type:"customized"},{columnId:"dec",value:s.dec},{columnId:"status",...r,type:"customized",errorMsg:s.errorMsg},{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action",disabled:g&&g(V.EDIT,s.permission)},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action",disabled:g&&g(V.AUTHORIZE,s.permission)},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:g&&g(V.AUTHORIZE,s.permission)},{columnId:"url",value:s.url},{columnId:"apiKey",value:s.apiKey},{columnId:"modelIde",value:s.modelIde},{columnId:"thinking",value:s.thinking}]}}),te=async()=>{try{const[n,s,b]=await Promise.allSettled([R(ge),T(),ee()]);if(n.status==="fulfilled"&&n.value){const r=ue(n.value.records);e(r||[]),L(A=>({...A,content:"ready"}))}s.status==="fulfilled"&&s.value&&M((s.value||[]).map(r=>({...r,value:Number(r.value)}))),b.status==="fulfilled"&&b.value&&S((b.value||[]).map(r=>({...r,value:Number(r.value)})))}catch(n){console.error("[TableApiError] getTableList:",n)}},se=P(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"model-table",model:null,views:[{label:"\u6A21\u578B",id:"model-table",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"modelName",title:"\u6A21\u578B\u540D\u79F0",type:"label"},{id:"modelProtocol",title:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"customized",component:n=>{var r;const{value:s}=n,b=(r=B.find(A=>A.value==s))==null?void 0:r.label;return l("span",{children:b})}},{id:"type",title:"\u4F7F\u7528\u7C7B\u578B",type:"customized",component:n=>{var r;const{value:s}=n,b=(r=E.find(A=>A.value==s))==null?void 0:r.label;return l("span",{children:b})}},{id:"dec",title:"\u8BF4\u660E",type:"paragraph"},{id:"status",title:"\u72B6\u6001",type:"customized",component:l(Ae,{}),helpText:"\u5F53\u524D\u6A21\u578B\u72B6\u6001\u4E3A\u521D\u6B21\u65B0\u589E\u6821\u9A8C\u72B6\u6001\uFF0C\u82E5\u6A21\u578B\u4E0B\u7EBF\uFF0C\u6B64\u72B6\u6001\u4E0D\u4F1A\u4E3B\u52A8\u66F4\u65B0\uFF0C\u9700\u624B\u52A8\u6267\u884C\u6A21\u578B\u5220\u9664"},{id:"actions",title:"\u64CD\u4F5C",type:"customized",component:n=>{const{value:s,cell:b,row:r}=n,{disabled:A,label:U}=b;return A?l(X,{title:"\u89D2\u8272\u65E0\u6743\u9650\u64CD\u4F5C",children:l(z,{mode:"text",label:U,disabled:A})}):l(z,{mode:"text",label:U,onClick:()=>H(`table_action_${s}`,r,void 0)})}}],toolbar:[{type:"button",btnType:"primary",key:"add",label:"\u65B0\u5EFA",icon:l(de,{})}]}]}),[k,E,B]),oe=()=>Z("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:me,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u65B0\u5EFA\u6A21\u578B"}),l("div",{className:"flex gap-3",children:l(z,{mode:"primary",label:"\u65B0\u5EFA\u6A21\u578B",onClick:()=>{h("\u65B0\u5EFA"),o(!0)}})})]});async function H(n,s,b){var r,A,U,$;switch(console.log("[adopter] mergedEventsEmit",n,s,b),n){case"toolbar_add":{h("\u65B0\u5EFA"),o(!0);break}case"table_action_delete":{try{const D=s.data.find(f=>f.columnId=="modelName").value;ye({title:"\u786E\u8BA4\u5220\u9664\uFF1F",content:`\u786E\u5B9A\u8981\u5220\u9664\u6A21\u578B \u201C${D}\u201D \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`,okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await J(s.id)&&(d!=null&&d.current)&&(d==null||d.current.appFn.removeItem(s.id),j.success("\u5220\u9664\u6210\u529F"))}})}catch(D){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25",D)}break}case"table_action_edit":{h("\u7F16\u8F91"),o(!0),m(s);break}case"form_submitted_add":{try{const D=s.fields.reduce((v,I)=>(v[I.name]=I.value,v),{}),f=await Q({...D});if(f){let v=K.find(c=>c.status==f.status);const I={id:f.id,data:[...(Object.keys(f)||[]).map(c=>({columnId:c,value:f[c],...(c=="modelProtocol"||c=="type")&&{type:"customized"},...c=="status"&&{...v,type:"customized",errorMsg:f.errorMsg}})),{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action"},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action"},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action"}]};(A=(r=d==null?void 0:d.current)==null?void 0:r.appFn)==null||A.addItem(I,{animate:!0,position:"start"}),j.success("\u6A21\u578B\u65B0\u589E\u6210\u529F\uFF01")}}catch(D){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",D)}finally{W()}break}case"form_submitted_edit":{try{const D=s.fields.reduce((v,I)=>(v[I.name]=I.value,v),{}),f=await _({...D,id:a.id});if(f){let v=K.find(c=>c.status==f.status);const I={...a,data:a.data.map(c=>{if(f[c.columnId]!==null&&f[c.columnId]!==void 0){if(c.columnId=="status")return{...c,...v};c.value=f[c.columnId]}return c})};($=(U=d==null?void 0:d.current)==null?void 0:U.appFn)==null||$.updateItem(I,a==null?void 0:a.id),j.success("\u6A21\u578B\u7F16\u8F91\u6210\u529F\uFF01")}}catch(D){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",D)}finally{W()}break}default:typeof u.eventsEmit=="function"&&u.eventsEmit(n,s);break}}const W=()=>{o(!1),m(void 0)};return Z(ne,{title:"\u6A21\u578B\u7BA1\u7406",children:[l(O,{dataSource:k,ref:d,eventsEmit:H,status:q,CustomComponents:{EmptyData:oe,...y},...se}),l(Fe,{drawerTitle:i,drawerVisible:t,handleDrawerClose:W,modelInfo:a,modelUseTypeOpt:E,modelProtocolsOpt:B,eventsEmit:H})]})}export{ke as default};
package/sensitive.js DELETED
@@ -1 +0,0 @@
1
- import{jsx as c,jsxs as A}from"react/jsx-runtime";import{useState as E,useRef as z,useEffect as _,useMemo as N}from"react";import{message as F,Modal as I,Form as h,Input as P}from"antd";import{F as T,k as W,J as L}from"./assets/index-BfureYPx.js";import"./assets/index--DG-fVvc.js";import j from"axios";/* empty css */import{P as q}from"./assets/plus-fNg4vmeA.js";import"./assets/styled-components.browser.esm-DPkS13KC.js";import"react-dom";const U=["10014"],$=({url:D,token:B,role:m})=>{const i=j.create({baseURL:D,timeout:1e6});return i.interceptors.request.use(e=>{let t=B;if(!t&&!["user/login","user/kaptcha","user/regist"].some(a=>e.url.includes(a))){window.location.pathname="/login";return}return e.headers.Authorization=t||"",e.headers.userName=m==="\u672A\u767B\u5F55\u7528\u6237"?"":m,e}),i.interceptors.response.use(e=>{const t=["user/kaptcha"],u=e.data;if(t.some(d=>e.config.url&&e.config.url.includes(d))||u.size&&u.type)return u;const{success:a,errorMsg:r,errorCode:o}=u;return U.includes(o)||a?u:(F.error(r||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),!1)},e=>{var t,u,a,r,o,d,y,g,f,C;e.message!=="canceled"&&((((u=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:u.errorCode)==="30013"||((r=(a=e==null?void 0:e.response)==null?void 0:a.data)==null?void 0:r.errorCode)==="30023")&&F.error((((o=e==null?void 0:e.response)==null?void 0:o.data)||{}).errorMsg||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),((d=e==null?void 0:e.response)==null?void 0:d.status)===401&&(console.log("Error url:",(y=e==null?void 0:e.request)==null?void 0:y.responseURL),F.error((((g=e==null?void 0:e.response)==null?void 0:g.data)||{}).errorMsg||"\u6CA1\u6709\u8DB3\u591F\u6743\u9650")),console.log("Error occurs",e),(((f=e==null?void 0:e.response)==null?void 0:f.data)||{}).errorMsg!="\u672A\u8BBE\u7F6E\u9ED8\u8BA4\u914D\u7F6E\uFF01"&&F.error((((C=e==null?void 0:e.response)==null?void 0:C.data)||{}).errorMsg||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"))}),{getLibraryList:async e=>{try{const t=await i.get(`/library?${new URLSearchParams(e).toString()}`),{success:u,data:a}=t;return u?a:!1}catch(t){return console.log("e",t),!1}},createLibrary:async e=>{try{const t=await i.post("/library",e),{success:u,data:a}=t;return u?a:!1}catch(t){return console.log("e",t),!1}},deleteLibrary:async e=>{try{const t=await i.delete(`/library/${e}`),{success:u,data:a}=t;return u?a:!1}catch(t){return console.log("e",t),!1}}}},{confirm:O}=I,V={pageNo:1,pageSize:999},te=({url:D,token:B,role:m,eventsEmit:i,CustomComponents:v})=>{const[w,b]=E({container:"ready",content:"ready"}),e=z(null),[t,u]=E(),[a]=h.useForm(),[r,o]=E(!1),{getLibraryList:d,deleteLibrary:y,createLibrary:g}=$({url:D,token:B,role:m});_(()=>{b(s=>({...s,content:"loading"})),f()},[]);const f=async()=>{try{const s=await d({...V});if(s){const n=C(s.records);u(n||[]),b(l=>({...l,content:"ready"}))}}catch(s){console.log("[DatabaseApiError] getSensitiveList:",s)}},C=s=>(s||[]).map(n=>({id:n.id,data:[{columnId:"name",value:n.name,type:"label"},{columnId:"sensitiveWords",value:n.words,type:"tag"},{columnId:"createDate",value:n.gmtCreate,type:"date"},{columnId:"count",value:n.count,type:"text"},{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action"},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action"}]})),k=N(()=>({label:"\u654F\u611F\u8BCD\u914D\u7F6E",model:null,defaultActiveId:"sensitive-table",views:[{id:"sensitive-table",label:"\u654F\u611F\u8BCD\u5E93\u5217\u8868",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{title:"\u540D\u79F0",id:"name",type:"label"},{title:"\u654F\u611F\u8BCD",id:"sensitiveWords",type:"tag"},{title:"\u521B\u5EFA\u65E5\u671F",id:"createDate",type:"date"},{title:"\u6570\u91CF",id:"count",type:"text"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}],toolbar:[{type:"button",key:"create",label:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",btnType:"primary",icon:c(q,{size:16})},{type:"fuzzy_search",key:"search",label:"\u8BF7\u8F93\u5165\u5185\u5BB9",searchKeys:["name","sensitiveWords"],position:"right"}]}]}),[t]),x=async()=>{var s,n;try{const l=await a.validateFields();if(l){console.log("===val",l);const p=await g({...l,words:[]});if(p&&(e!=null&&e.current)){const M={id:p,data:[{columnId:"name",value:l.name,type:"label"},{columnId:"sensitiveWords",value:[],type:"tag"},{columnId:"createDate",value:new Date().toLocaleString("zh-CN",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),type:"date"},{columnId:"count",value:0,type:"text"},{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action"},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action"}]};(n=(s=e==null?void 0:e.current)==null?void 0:s.appFn)==null||n.addItem(M,{animate:!0,position:"start"}),F.success("\u65B0\u589E\u654F\u611F\u8BCD\u6210\u529F!")}}}catch{console.error("\u65B0\u589E\u654F\u611F\u8BCD\u5931\u8D25!")}finally{o(!1),a.resetFields()}};async function S(s,n,l){switch(console.log("[SensitiveView] \u4E8B\u4EF6\u89E6\u53D1:",s,n),s){case"toolbar_create":o(!0);break;case"table_action_delete":{try{O({title:"\u786E\u8BA4\u5220\u9664\u654F\u611F\u8BCD\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u654F\u611F\u8BCD\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await y(n.id)&&(e!=null&&e.current)&&(console.log("=====",e==null?void 0:e.current.appFn),e==null||e.current.appFn.removeItem(n.id),F.success("\u5220\u9664\u6210\u529F"))},onCancel(){console.log("Cancel")}})}catch(p){console.error("\u5220\u9664\u654F\u611F\u8BCD\u5E93\u5931\u8D25",p)}break}default:typeof i=="function"&&i(s,n);break}}return A(T,{title:"\u654F\u611F\u8BCD\u5E93\u7BA1\u7406",children:[c(W,{dataSource:t,ref:e,eventsEmit:S,status:w,CustomComponents:{...v},...k}),c(I,{title:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",open:r,width:520,destroyOnHidden:!0,onCancel:()=>{o(!1),a.resetFields()},footer:A("div",{className:"w-full flex flex-row",style:{justifyContent:"end",gap:"10px"},children:[c(L,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{o(!1),a.resetFields()}}),c(L,{mode:"primary",label:"\u786E\u8BA4",onClick:x})]}),children:c(h,{form:a,children:c(h.Item,{label:null,name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u654F\u611F\u8BCD\u5E93\u540D\u79F0!"}],children:c(P,{placeholder:"\u8BF7\u8F93\u5165"})})})})]})};export{te as default};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes