cx-chat 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cx-chat.css +1 -0
- package/dist/cx-chat.es.js +97326 -0
- package/dist/cx-chat.umd.js +734 -0
- package/package.json +21 -1
- package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
- package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
- package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
- package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
- package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
- package/.docker/Dockerfile +0 -7
- package/.env +0 -9
- package/.env.development +0 -7
- package/.env.production +0 -7
- package/.gitlab-ci/docker-build.yaml +0 -28
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
- package/.gitlab-ci/npm-build.yaml +0 -17
- package/.gitlab-ci.yml +0 -8
- package/.k8s/0-namespace.yaml +0 -6
- package/.k8s/1-configmap-web.yaml +0 -7
- package/.k8s/1-nginx-conf-dev.yaml +0 -110
- package/.k8s/2-deployment.yaml +0 -27
- package/.k8s/3-service.yaml +0 -16
- package/.k8s/4-ingress-dev.yaml +0 -30
- package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
- package/.nginx/nginx.conf +0 -52
- package/.prettierrc +0 -9
- package/eslint.config.js +0 -32
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -96
- package/src/_doc/0.docs-overview.md +0 -28
- package/src/_doc/cx-ui/0.docs-overview.md +0 -30
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
- package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
- package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
- package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
- package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
- package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
- package/src/_doc/meta/0.docs-overview.md +0 -24
- package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
- package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
- package/src/_doc/router/0.docs-overview.md +0 -14
- package/src/_doc/router/guide.1.menu-component-config.md +0 -181
- package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
- package/src/_doc/table-view/0.docs-overview.md +0 -30
- package/src/_doc/table-view/comp.1.table-view.md +0 -542
- package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
- package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
- package/src/api/_mock/README.md +0 -340
- package/src/api/_mock/api.ts +0 -1642
- package/src/api/_mock/bundle-shim.ts +0 -16
- package/src/api/_mock/handler-shim.ts +0 -6
- package/src/api/_mock/handler.ts +0 -458
- package/src/api/_mock/index.ts +0 -711
- package/src/api/_mock/interceptor.ts +0 -15
- package/src/api/_mock/mod.ts +0 -12
- package/src/api/_mock/utils.ts +0 -65
- package/src/api/base/memory.js +0 -24
- package/src/api/chat.js +0 -210
- package/src/api/common/auth.js +0 -70
- package/src/api/menus/business-rules.js +0 -76
- package/src/api/menus/feedback.js +0 -102
- package/src/api/menus/knowledge.js +0 -159
- package/src/api/menus/model-metadata/manage.js +0 -70
- package/src/api/menus/model-metadata/role.js +0 -50
- package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
- package/src/api/menus/model-metadata/training.js +0 -28
- package/src/api/menus/skill.js +0 -40
- package/src/api/system/agent-config.js +0 -16
- package/src/api/system/department.js +0 -94
- package/src/api/system/dict.js +0 -86
- package/src/api/system/menu.js +0 -37
- package/src/api/system/permission.js +0 -26
- package/src/api/system/role.js +0 -34
- package/src/api/system/sys-config.js +0 -16
- package/src/api/system/sys-log.js +0 -17
- package/src/api/system/user.js +0 -75
- package/src/api/upload.js +0 -39
- package/src/assets/react.svg +0 -1
- package/src/components/auth/current-user-avatar.tsx +0 -77
- package/src/components/common/code-view.tsx +0 -149
- package/src/components/common/detail-link.tsx +0 -67
- package/src/components/common/error-boundary.tsx +0 -98
- package/src/components/common/language-switcher.tsx +0 -91
- package/src/components/common/lite-table/index.tsx +0 -135
- package/src/components/common/md-editor.tsx +0 -126
- package/src/components/common/modal/confirm-dialog.tsx +0 -113
- package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
- package/src/components/common/modal/dep-user-select.tsx +0 -249
- package/src/components/common/modal/user-select-multi.tsx +0 -266
- package/src/components/common/pagination.tsx +0 -472
- package/src/components/common/path.tsx +0 -175
- package/src/components/common/system-logo-mark.tsx +0 -48
- package/src/components/cx-ui/button/index.less +0 -208
- package/src/components/cx-ui/button/index.tsx +0 -611
- package/src/components/cx-ui/checkbox/index.tsx +0 -78
- package/src/components/cx-ui/date-picker/index.less +0 -17
- package/src/components/cx-ui/date-picker/index.tsx +0 -193
- package/src/components/cx-ui/drawer/index.tsx +0 -47
- package/src/components/cx-ui/empty-state/index.tsx +0 -20
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
- package/src/components/cx-ui/form/CxForm.tsx +0 -15
- package/src/components/cx-ui/form/index.tsx +0 -20
- package/src/components/cx-ui/form-item/index.less +0 -26
- package/src/components/cx-ui/form-item/index.tsx +0 -36
- package/src/components/cx-ui/index.ts +0 -70
- package/src/components/cx-ui/input/auto-complete.tsx +0 -134
- package/src/components/cx-ui/input/index.tsx +0 -259
- package/src/components/cx-ui/input-number/index.jsx +0 -66
- package/src/components/cx-ui/modal/index.jsx +0 -212
- package/src/components/cx-ui/modal/index.less +0 -144
- package/src/components/cx-ui/modal/useCxModal.ts +0 -125
- package/src/components/cx-ui/multi-select/index.jsx +0 -74
- package/src/components/cx-ui/multi-select/index.less +0 -40
- package/src/components/cx-ui/multi-select/index2.tsx +0 -361
- package/src/components/cx-ui/radio/index.tsx +0 -33
- package/src/components/cx-ui/range-picker/index.less +0 -65
- package/src/components/cx-ui/range-picker/index.tsx +0 -219
- package/src/components/cx-ui/select/index.less +0 -34
- package/src/components/cx-ui/select/index.tsx +0 -196
- package/src/components/cx-ui/skeleton/index.tsx +0 -12
- package/src/components/cx-ui/steps/index.tsx +0 -14
- package/src/components/cx-ui/styles/_tokens.less +0 -79
- package/src/components/cx-ui/styles/index.less +0 -246
- package/src/components/cx-ui/switch/index.less +0 -106
- package/src/components/cx-ui/switch/index.tsx +0 -120
- package/src/components/cx-ui/table/index.less +0 -160
- package/src/components/cx-ui/table/index.tsx +0 -152
- package/src/components/cx-ui/tabs/index.less +0 -15
- package/src/components/cx-ui/tabs/index.tsx +0 -34
- package/src/components/cx-ui/tag/index.less +0 -51
- package/src/components/cx-ui/tag/index.tsx +0 -140
- package/src/components/cx-ui/timeline/index.tsx +0 -14
- package/src/components/cx-ui/tooltip/index.tsx +0 -67
- package/src/components/cx-ui/tree/index.tsx +0 -193
- package/src/components/cx-ui/tree-select/index.jsx +0 -91
- package/src/components/cx-ui/tree-select/index.less +0 -27
- package/src/components/cx-ui/upload-file/index.less +0 -223
- package/src/components/cx-ui/upload-file/index.tsx +0 -640
- package/src/components/cx-ui/upload-img/index.tsx +0 -291
- package/src/components/layout/components/Header.tsx +0 -216
- package/src/components/layout/components/Sidebar.tsx +0 -717
- package/src/components/layout/index.tsx +0 -95
- package/src/components/table-view/components/search-area.tsx +0 -411
- package/src/components/table-view/components/table-view-config.tsx +0 -528
- package/src/components/table-view/components/table-view.types.ts +0 -478
- package/src/components/table-view/components/tree-api-normalize.ts +0 -38
- package/src/components/table-view/components/tree-data-annotate.ts +0 -31
- package/src/components/table-view/components/tree-sidebar.tsx +0 -74
- package/src/components/table-view/index.tsx +0 -61
- package/src/components/table-view/list-page-view.tsx +0 -1049
- package/src/components/table-view/select-table-view.tsx +0 -1094
- package/src/components/table-view/styles/select-table-view.less +0 -51
- package/src/config/default-system-name.ts +0 -9
- package/src/config/system.ts +0 -165
- package/src/constants/countryCodes.ts +0 -3
- package/src/contexts/AuthContext.tsx +0 -256
- package/src/contexts/ChatContext.tsx +0 -839
- package/src/contexts/MenuContext.tsx +0 -62
- package/src/contexts/ToastContext.tsx +0 -181
- package/src/hooks/useCopyToClipboard.ts +0 -47
- package/src/hooks/useModalSubmit.ts +0 -104
- package/src/hooks/useRouter.ts +0 -240
- package/src/hooks/useStepForm.ts +0 -46
- package/src/hooks/useStickyHeader.ts +0 -42
- package/src/hooks/useThreadActions.ts +0 -105
- package/src/hooks/useUserPreferences.ts +0 -101
- package/src/http/axios.js +0 -372
- package/src/http/mock.interceptor.ts +0 -9
- package/src/http/obfuscationKey.ts +0 -41
- package/src/i18n.ts +0 -60
- package/src/index.js +0 -1
- package/src/index.less +0 -169
- package/src/locales/en/auth.ts +0 -70
- package/src/locales/en/base/memory.ts +0 -28
- package/src/locales/en/base/settings.ts +0 -41
- package/src/locales/en/chat.ts +0 -40
- package/src/locales/en/common.ts +0 -173
- package/src/locales/en/enum.ts +0 -27
- package/src/locales/en/menus/business-rules.ts +0 -48
- package/src/locales/en/menus/feedback.ts +0 -62
- package/src/locales/en/menus/knowledge.ts +0 -120
- package/src/locales/en/menus/model-metadata/index.ts +0 -10
- package/src/locales/en/menus/model-metadata/manage.ts +0 -151
- package/src/locales/en/menus/model-metadata/role.ts +0 -48
- package/src/locales/en/menus/model-metadata/training.ts +0 -65
- package/src/locales/en/menus/skill.ts +0 -34
- package/src/locales/en/system/agent-config.ts +0 -34
- package/src/locales/en/system/department.ts +0 -68
- package/src/locales/en/system/dict.ts +0 -44
- package/src/locales/en/system/menu.ts +0 -45
- package/src/locales/en/system/permission.ts +0 -89
- package/src/locales/en/system/role.ts +0 -25
- package/src/locales/en/system/sys-config.ts +0 -33
- package/src/locales/en/system/sys-log.ts +0 -38
- package/src/locales/en/system/user.ts +0 -113
- package/src/locales/en.ts +0 -68
- package/src/locales/zh/auth.ts +0 -70
- package/src/locales/zh/base/memory.ts +0 -29
- package/src/locales/zh/base/settings.ts +0 -41
- package/src/locales/zh/chat.ts +0 -47
- package/src/locales/zh/common.ts +0 -178
- package/src/locales/zh/enum.ts +0 -28
- package/src/locales/zh/menus/business-rules.ts +0 -47
- package/src/locales/zh/menus/feedback.ts +0 -62
- package/src/locales/zh/menus/knowledge.ts +0 -117
- package/src/locales/zh/menus/model-metadata/index.ts +0 -10
- package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
- package/src/locales/zh/menus/model-metadata/role.ts +0 -47
- package/src/locales/zh/menus/model-metadata/training.ts +0 -64
- package/src/locales/zh/menus/skill.ts +0 -34
- package/src/locales/zh/system/agent-config.ts +0 -33
- package/src/locales/zh/system/department.ts +0 -69
- package/src/locales/zh/system/dict.ts +0 -44
- package/src/locales/zh/system/menu.ts +0 -47
- package/src/locales/zh/system/permission.ts +0 -94
- package/src/locales/zh/system/role.ts +0 -25
- package/src/locales/zh/system/sys-config.ts +0 -32
- package/src/locales/zh/system/sys-log.ts +0 -38
- package/src/locales/zh/system/user.ts +0 -114
- package/src/locales/zh.ts +0 -67
- package/src/main.tsx +0 -50
- package/src/meta/const/index.ts +0 -40
- package/src/meta/index-dict.ts +0 -56
- package/src/meta/index-enum.ts +0 -95
- package/src/meta/index.ts +0 -14
- package/src/meta/module/dict-data/runtime.ts +0 -199
- package/src/meta/module/dict-data/types.ts +0 -17
- package/src/meta/module/enum-data/runtime.ts +0 -75
- package/src/meta/module/enum-data/types.ts +0 -18
- package/src/router/index.tsx +0 -312
- package/src/styles/AntdThemeProvider.tsx +0 -40
- package/src/styles/antd-theme.ts +0 -20
- package/src/styles/global.less +0 -107
- package/src/styles/variable.less +0 -103
- package/src/types/feedback.ts +0 -43
- package/src/types/index.ts +0 -85
- package/src/types/menu.ts +0 -43
- package/src/utils/aesUtil.ts +0 -123
- package/src/utils/chatUtils.ts +0 -524
- package/src/utils/cn.ts +0 -6
- package/src/utils/crypto.ts +0 -164
- package/src/utils/date.ts +0 -72
- package/src/utils/file-icons.tsx +0 -79
- package/src/utils/index.ts +0 -168
- package/src/utils/markdown-math-plugins.ts +0 -21
- package/src/utils/menuI18n.ts +0 -305
- package/src/utils/menuRouteRegistry.ts +0 -78
- package/src/utils/permission-crud.ts +0 -147
- package/src/utils/routeConfig.ts +0 -350
- package/src/utils/storage.ts +0 -135
- package/src/utils/toastBridge.ts +0 -26
- package/src/utils/url.ts +0 -38
- package/src/utils/validation.ts +0 -16
- package/src/views/auth/auth-code/index.less +0 -169
- package/src/views/auth/auth-code/index.module.less +0 -174
- package/src/views/auth/auth-code/index.tsx +0 -233
- package/src/views/auth/login.tsx +0 -498
- package/src/views/auth/register.tsx +0 -388
- package/src/views/base/memory/index.tsx +0 -136
- package/src/views/base/memory/modal/detail-modal.tsx +0 -89
- package/src/views/base/memory/modal/submit-modal.tsx +0 -134
- package/src/views/base/settings/index.tsx +0 -657
- package/src/views/chat/chat.less +0 -323
- package/src/views/chat/components/chat-input.tsx +0 -298
- package/src/views/chat/components/header-thread-title.tsx +0 -210
- package/src/views/chat/components/message-list/content-answer.tsx +0 -100
- package/src/views/chat/components/message-list/content-question.tsx +0 -18
- package/src/views/chat/components/message-list/index.tsx +0 -520
- package/src/views/chat/components/message-list/message-item.tsx +0 -199
- package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
- package/src/views/chat/components/message-list/toolbar.tsx +0 -224
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/chat/components/references-knowledge/context.tsx +0 -57
- package/src/views/chat/components/references-knowledge/index.ts +0 -9
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
- package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
- package/src/views/chat/hooks/use-chat-common.ts +0 -19
- package/src/views/chat/index-session.tsx +0 -647
- package/src/views/chat/index.tsx +0 -127
- package/src/views/page-error/401.tsx +0 -56
- package/src/views/page-error/404.tsx +0 -56
- package/src/views/page-menus/business-rules/index.tsx +0 -376
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
- package/src/views/page-menus/feedback/index.tsx +0 -166
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
- package/src/views/page-menus/knowledge/detail.tsx +0 -600
- package/src/views/page-menus/knowledge/index.tsx +0 -337
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
- package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
- package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
- package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
- package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
- package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
- package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
- package/src/views/page-menus/skill/index.tsx +0 -201
- package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
- package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
- package/src/views/page-system/agent-config/index.tsx +0 -370
- package/src/views/page-system/department/departmentFormShared.ts +0 -36
- package/src/views/page-system/department/index.tsx +0 -541
- package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
- package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
- package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
- package/src/views/page-system/dict/index.tsx +0 -440
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
- package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
- package/src/views/page-system/logs/components/index.ts +0 -3
- package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
- package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
- package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
- package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
- package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/page-system/logs/components/message-modal.tsx +0 -239
- package/src/views/page-system/logs/index.tsx +0 -132
- package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
- package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
- package/src/views/page-system/menu/index.less +0 -12
- package/src/views/page-system/menu/index.tsx +0 -410
- package/src/views/page-system/menu/modal/icon-modal.less +0 -51
- package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
- package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
- package/src/views/page-system/permission/index.tsx +0 -562
- package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
- package/src/views/page-system/permission/modal/submit-modal.less +0 -146
- package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
- package/src/views/page-system/role/index.tsx +0 -163
- package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
- package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
- package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
- package/src/views/page-system/sys-config/index.tsx +0 -294
- package/src/views/page-system/user/components/user-role-column.tsx +0 -87
- package/src/views/page-system/user/index.tsx +0 -439
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
- package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
- package/src/views/page-system/user/userFormShared.ts +0 -51
- package/tailwind.config.js +0 -17
- package/tsconfig.app.json +0 -48
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -272
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
2
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
3
|
-
import { ALIGN } from '@/meta'
|
|
4
|
-
import {
|
|
5
|
-
getModelMetadataTrainingPageAPI,
|
|
6
|
-
syncModelMetadataTrainingAPI,
|
|
7
|
-
} from '@api/menus/model-metadata/training'
|
|
8
|
-
import { DetailLink } from '@components/common/detail-link'
|
|
9
|
-
import ConfirmDialog from '@components/common/modal/confirm-dialog'
|
|
10
|
-
import ListPageView, { createListPageConfig } from '@components/table-view'
|
|
11
|
-
import { CxButton, CxTag } from '@cx-ui'
|
|
12
|
-
import { GraduationCap } from 'lucide-react'
|
|
13
|
-
import { useCallback, useMemo, useState } from 'react'
|
|
14
|
-
import { useTranslation } from 'react-i18next'
|
|
15
|
-
import { useLocation } from 'react-router-dom'
|
|
16
|
-
|
|
17
|
-
const useListPageConfig = createListPageConfig({
|
|
18
|
-
tableAPI: (params) => {
|
|
19
|
-
const next = { ...params } as Record<string, unknown>
|
|
20
|
-
if (next.syncStatus === '' || next.syncStatus === undefined || next.syncStatus === null) {
|
|
21
|
-
delete next.syncStatus
|
|
22
|
-
}
|
|
23
|
-
return getModelMetadataTrainingPageAPI(next)
|
|
24
|
-
},
|
|
25
|
-
pageInfo: {
|
|
26
|
-
title: 'menus.model_metadata.training.page_title',
|
|
27
|
-
subTitle: 'menus.model_metadata.training.page_subtitle',
|
|
28
|
-
},
|
|
29
|
-
searchFields: [
|
|
30
|
-
{
|
|
31
|
-
prop: 'syncStatus',
|
|
32
|
-
label: 'menus.model_metadata.training.fields.syncStatus',
|
|
33
|
-
type: 'select',
|
|
34
|
-
placeholder: 'menus.model_metadata.training.sync_status_placeholder',
|
|
35
|
-
options: [
|
|
36
|
-
{ label: 'menus.model_metadata.training.sync_status_0', value: 0 },
|
|
37
|
-
{ label: 'menus.model_metadata.training.sync_status_1', value: 1 },
|
|
38
|
-
],
|
|
39
|
-
width: '140px',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
prop: 'createTime',
|
|
43
|
-
label: 'menus.model_metadata.training.fields.batchCreateTime',
|
|
44
|
-
type: 'dateRange',
|
|
45
|
-
rangeStartProp: 'createTimeStart',
|
|
46
|
-
rangeEndProp: 'createTimeEnd',
|
|
47
|
-
showTime: true,
|
|
48
|
-
format: 'YYYY-MM-DD HH:mm:ss',
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
detailAction: {
|
|
52
|
-
detailType: 'page',
|
|
53
|
-
labelKey: 'common.view',
|
|
54
|
-
},
|
|
55
|
-
table: {
|
|
56
|
-
scrollX: 'max-content',
|
|
57
|
-
operationWidth: 200,
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
function TrainingListView() {
|
|
62
|
-
const { t } = useTranslation()
|
|
63
|
-
const { showToast } = useToast()
|
|
64
|
-
const { hasPermission } = useAuth()
|
|
65
|
-
const location = useLocation()
|
|
66
|
-
|
|
67
|
-
const pageConfig = useListPageConfig()
|
|
68
|
-
const subjectFromNav = (location.state as { subject?: string } | null)?.subject
|
|
69
|
-
|
|
70
|
-
const [syncDialogOpen, setSyncDialogOpen] = useState(false)
|
|
71
|
-
/** 确认同步时使用的 metadataId,仅来自当前点击行 */
|
|
72
|
-
const [syncMetadataId, setSyncMetadataId] = useState('')
|
|
73
|
-
|
|
74
|
-
const closeSyncDialog = useCallback(() => {
|
|
75
|
-
setSyncDialogOpen(false)
|
|
76
|
-
setSyncMetadataId('')
|
|
77
|
-
}, [])
|
|
78
|
-
|
|
79
|
-
const runSync = useCallback(async () => {
|
|
80
|
-
const metadataId = String(syncMetadataId).trim()
|
|
81
|
-
if (!metadataId) {
|
|
82
|
-
showToast(t('menus.model_metadata.training.sync_missing_metadata_id'), 'error')
|
|
83
|
-
closeSyncDialog()
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
await syncModelMetadataTrainingAPI(metadataId)
|
|
88
|
-
showToast(t('menus.model_metadata.training.sync_success'), 'success')
|
|
89
|
-
await pageConfig.fetchTableData?.()
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.error(e)
|
|
92
|
-
showToast(t('menus.model_metadata.training.sync_failed'), 'error')
|
|
93
|
-
} finally {
|
|
94
|
-
closeSyncDialog()
|
|
95
|
-
}
|
|
96
|
-
}, [closeSyncDialog, pageConfig, showToast, syncMetadataId, t])
|
|
97
|
-
|
|
98
|
-
const titleExtra = useMemo(() => {
|
|
99
|
-
const sub = String(subjectFromNav ?? '').trim()
|
|
100
|
-
if (!sub) return null
|
|
101
|
-
return (
|
|
102
|
-
<span className="text-lg font-normal text-gray-600 dark:text-gray-300 ml-2 truncate max-w-xl" title={sub}>
|
|
103
|
-
({sub})
|
|
104
|
-
</span>
|
|
105
|
-
)
|
|
106
|
-
}, [subjectFromNav])
|
|
107
|
-
|
|
108
|
-
const columns = useMemo(
|
|
109
|
-
() => [
|
|
110
|
-
{
|
|
111
|
-
title: 'menus.model_metadata.training.fields.subject',
|
|
112
|
-
key: 'subject',
|
|
113
|
-
align: ALIGN.LEFT,
|
|
114
|
-
minWidth: 140,
|
|
115
|
-
ellipsis: true,
|
|
116
|
-
render: (value: unknown, data: any) => (
|
|
117
|
-
<DetailLink
|
|
118
|
-
text={String(value ?? data?.subject ?? '-')}
|
|
119
|
-
disabled={!hasPermission('model-metadata-training:detail')}
|
|
120
|
-
onClick={() =>
|
|
121
|
-
pageConfig.onDetail?.({
|
|
122
|
-
type: 'detail',
|
|
123
|
-
data,
|
|
124
|
-
config: pageConfig.detailAction,
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
/>
|
|
128
|
-
),
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
title: 'menus.model_metadata.training.fields.schemaVersion',
|
|
132
|
-
key: 'schemaVersion',
|
|
133
|
-
align: ALIGN.CENTER,
|
|
134
|
-
minWidth: 120,
|
|
135
|
-
render: (value: unknown) => value ?? '-',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
title: 'menus.model_metadata.training.fields.syncStatus',
|
|
139
|
-
key: 'syncStatus',
|
|
140
|
-
align: ALIGN.CENTER,
|
|
141
|
-
width: 110,
|
|
142
|
-
render: (value: unknown) => {
|
|
143
|
-
const n = Number(value)
|
|
144
|
-
if (n === 1) {
|
|
145
|
-
return <CxTag color="green">{t('menus.model_metadata.training.sync_status_1')}</CxTag>
|
|
146
|
-
}
|
|
147
|
-
return <CxTag color="default">{t('menus.model_metadata.training.sync_status_0')}</CxTag>
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
title: 'menus.model_metadata.training.fields.syncTime',
|
|
152
|
-
key: 'syncTime',
|
|
153
|
-
align: ALIGN.LEFT,
|
|
154
|
-
width: 170,
|
|
155
|
-
render: (value: unknown) => value ?? '-',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
title: 'menus.model_metadata.training.fields.detailCount',
|
|
159
|
-
key: 'detailCount',
|
|
160
|
-
align: ALIGN.CENTER,
|
|
161
|
-
width: 100,
|
|
162
|
-
render: (value: unknown) => value ?? 0,
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
title: 'common.creator',
|
|
166
|
-
key: 'createBy',
|
|
167
|
-
align: ALIGN.LEFT,
|
|
168
|
-
width: 120,
|
|
169
|
-
render: (value: unknown) => value ?? '-',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
title: 'common.create_time',
|
|
173
|
-
key: 'createTime',
|
|
174
|
-
align: ALIGN.LEFT,
|
|
175
|
-
width: 170,
|
|
176
|
-
render: (value: unknown) => value ?? '-',
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
title: 'common.actions',
|
|
180
|
-
key: 'action',
|
|
181
|
-
align: ALIGN.LEFT,
|
|
182
|
-
width: 200,
|
|
183
|
-
render: (_: unknown, data: any) => (
|
|
184
|
-
<div className="flex flex-wrap gap-2">
|
|
185
|
-
{hasPermission('model-metadata-training:detail') && (
|
|
186
|
-
<CxButton.IconView
|
|
187
|
-
onClick={() =>
|
|
188
|
-
pageConfig.onDetail?.({
|
|
189
|
-
type: 'detail',
|
|
190
|
-
data,
|
|
191
|
-
config: pageConfig.detailAction,
|
|
192
|
-
})
|
|
193
|
-
}
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
{hasPermission('model-metadata-training:sync') && Number(data?.syncStatus) !== 1 && (
|
|
197
|
-
<CxButton.Icon
|
|
198
|
-
className="!text-blue-600"
|
|
199
|
-
icon={<GraduationCap size={18} />}
|
|
200
|
-
title={t('menus.model_metadata.training.action_sync')}
|
|
201
|
-
tooltipTone="default"
|
|
202
|
-
type="default"
|
|
203
|
-
onClick={() => {
|
|
204
|
-
setSyncMetadataId(String(data?.metadataId ?? '').trim())
|
|
205
|
-
setSyncDialogOpen(true)
|
|
206
|
-
}}
|
|
207
|
-
/>
|
|
208
|
-
)}
|
|
209
|
-
</div>
|
|
210
|
-
),
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
[hasPermission, pageConfig, t],
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
return (
|
|
217
|
-
<>
|
|
218
|
-
<ListPageView
|
|
219
|
-
columns={columns}
|
|
220
|
-
pageConfig={pageConfig}
|
|
221
|
-
titleIcon={<GraduationCap className="text-blue-400" size={32} aria-hidden />}
|
|
222
|
-
titleExtra={titleExtra}
|
|
223
|
-
/>
|
|
224
|
-
<ConfirmDialog
|
|
225
|
-
isOpen={syncDialogOpen}
|
|
226
|
-
title={t('menus.model_metadata.training.sync_confirm_title')}
|
|
227
|
-
message={t('menus.model_metadata.training.sync_confirm_content')}
|
|
228
|
-
overlayClassName="z-[1200]"
|
|
229
|
-
onClose={closeSyncDialog}
|
|
230
|
-
onConfirm={() => void runSync()}
|
|
231
|
-
/>
|
|
232
|
-
</>
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export default TrainingListView
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { CxModal, CxTabs } from '@cx-ui'
|
|
2
|
-
import type { CxModalOpenPayload, CxModalRef } from '@cx-ui/modal/useCxModal'
|
|
3
|
-
import { useCxModal } from '@cx-ui/modal/useCxModal'
|
|
4
|
-
import { Spin } from 'antd'
|
|
5
|
-
import { forwardRef, useImperativeHandle, useMemo, useState } from 'react'
|
|
6
|
-
import { useTranslation } from 'react-i18next'
|
|
7
|
-
import SummaryList from '../components/detail-records/summary-list'
|
|
8
|
-
import { flattenOneCategory, parseTrainingRowContent, type TrainingDetailItem } from '../components/detail-records/types'
|
|
9
|
-
|
|
10
|
-
/** 与知识库文档详情弹框一致:视口高度约 95% */
|
|
11
|
-
const TRAINING_UPDATE_DETAIL_MODAL_HEIGHT = 'min(95dvh, 95vh)'
|
|
12
|
-
|
|
13
|
-
const trainingUpdateDetailModalShellStyles = {
|
|
14
|
-
container: {
|
|
15
|
-
display: 'flex',
|
|
16
|
-
flexDirection: 'column' as const,
|
|
17
|
-
overflow: 'hidden',
|
|
18
|
-
height: TRAINING_UPDATE_DETAIL_MODAL_HEIGHT,
|
|
19
|
-
maxHeight: TRAINING_UPDATE_DETAIL_MODAL_HEIGHT,
|
|
20
|
-
},
|
|
21
|
-
body: {
|
|
22
|
-
flex: '1 1 0%',
|
|
23
|
-
minHeight: 0,
|
|
24
|
-
display: 'flex',
|
|
25
|
-
flexDirection: 'column' as const,
|
|
26
|
-
overflow: 'hidden',
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function FullTabsPanels({ row }: { row: TrainingDetailItem }) {
|
|
31
|
-
const { t } = useTranslation()
|
|
32
|
-
const c = useMemo(() => parseTrainingRowContent(row), [row])
|
|
33
|
-
const meta = useMemo(
|
|
34
|
-
() => ({
|
|
35
|
-
schemaVersion: row.schemaVersion,
|
|
36
|
-
updateTime: row.updateTime,
|
|
37
|
-
updateBy: row.updateBy,
|
|
38
|
-
detailId: row.id,
|
|
39
|
-
}),
|
|
40
|
-
[row],
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
const tableRows = useMemo(() => flattenOneCategory(c, 'tables', meta), [c, meta])
|
|
44
|
-
const documentRows = useMemo(() => flattenOneCategory(c, 'documents', meta), [c, meta])
|
|
45
|
-
const exampleSqlRows = useMemo(() => flattenOneCategory(c, 'exampleSql', meta), [c, meta])
|
|
46
|
-
|
|
47
|
-
const tabItems = useMemo(() => {
|
|
48
|
-
const empty = (
|
|
49
|
-
<div className="rounded border border-dashed border-gray-200 py-4 text-center text-xs text-gray-400 dark:border-gray-600">
|
|
50
|
-
{t('menus.model_metadata.training.detail_empty_section')}
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
const wrapList = (rows: typeof tableRows) =>
|
|
55
|
-
rows.length ? <SummaryList rows={rows} showScope={false} /> : empty
|
|
56
|
-
|
|
57
|
-
return [
|
|
58
|
-
{
|
|
59
|
-
key: 'tables',
|
|
60
|
-
label: t('menus.model_metadata.manage.step2_title'),
|
|
61
|
-
children: wrapList(tableRows),
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
key: 'documents',
|
|
65
|
-
label: t('menus.model_metadata.training.change_section_documents'),
|
|
66
|
-
children: wrapList(documentRows),
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: 'exampleSql',
|
|
70
|
-
label: t('menus.model_metadata.training.change_section_example_sql'),
|
|
71
|
-
children: wrapList(exampleSqlRows),
|
|
72
|
-
},
|
|
73
|
-
]
|
|
74
|
-
}, [t, tableRows, documentRows, exampleSqlRows])
|
|
75
|
-
|
|
76
|
-
const defaultTabKey =
|
|
77
|
-
tableRows.length > 0 ? 'tables' : documentRows.length > 0 ? 'documents' : exampleSqlRows.length > 0 ? 'exampleSql' : 'tables'
|
|
78
|
-
|
|
79
|
-
const tabsMountKey = String(row.id ?? `${row.schemaVersion ?? ''}-${row.updateTime ?? ''}`)
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
|
|
83
|
-
<CxTabs
|
|
84
|
-
key={tabsMountKey}
|
|
85
|
-
size="small"
|
|
86
|
-
defaultActiveKey={defaultTabKey}
|
|
87
|
-
items={tabItems}
|
|
88
|
-
className="flex min-h-0 flex-1 flex-col [&_.ant-tabs]:flex [&_.ant-tabs]:min-h-0 [&_.ant-tabs]:flex-1 [&_.ant-tabs]:flex-col [&_.ant-tabs-content]:min-h-0 [&_.ant-tabs-content]:flex-1 [&_.ant-tabs-content-holder]:min-h-0 [&_.ant-tabs-content-holder]:flex-1 [&_.ant-tabs-content-holder]:overflow-auto [&_.ant-tabs-nav]:mb-2 [&_.ant-tabs-nav]:!mt-0 [&_.ant-tabs-tabpane]:min-h-0 [&_.ant-tabs-tabpane]:min-w-0"
|
|
89
|
-
/>
|
|
90
|
-
</div>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const UpdateDetailModal = forwardRef<CxModalRef>(function UpdateDetailModal(_props, ref) {
|
|
95
|
-
const { t } = useTranslation()
|
|
96
|
-
const [loading, setLoading] = useState(false)
|
|
97
|
-
|
|
98
|
-
const modal = useCxModal({
|
|
99
|
-
onOpen: async (payload: CxModalOpenPayload) => {
|
|
100
|
-
const r = payload?.data?.row as TrainingDetailItem | undefined
|
|
101
|
-
setLoading(true)
|
|
102
|
-
modal.setFormData(undefined)
|
|
103
|
-
try {
|
|
104
|
-
await Promise.resolve()
|
|
105
|
-
modal.setFormData(r)
|
|
106
|
-
} finally {
|
|
107
|
-
setLoading(false)
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
useImperativeHandle(
|
|
113
|
-
ref,
|
|
114
|
-
() => ({
|
|
115
|
-
open: (p?: CxModalOpenPayload) => modal.open({ ...p, opeType: 'detail' }),
|
|
116
|
-
close: modal.close,
|
|
117
|
-
}),
|
|
118
|
-
[modal.open, modal.close],
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
const row = modal.formData as TrainingDetailItem | undefined
|
|
122
|
-
const titleBase = t('menus.model_metadata.training.change_batch_detail_title')
|
|
123
|
-
const title = row?.schemaVersion ? `${titleBase} · ${row.schemaVersion}` : titleBase
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<CxModal
|
|
127
|
-
{...modal.modalBind}
|
|
128
|
-
title={title}
|
|
129
|
-
opeType="detail"
|
|
130
|
-
modalConfig={{
|
|
131
|
-
width: 960,
|
|
132
|
-
styles: {
|
|
133
|
-
...trainingUpdateDetailModalShellStyles,
|
|
134
|
-
},
|
|
135
|
-
rootClassName: 'cx-modal-content-fill',
|
|
136
|
-
}}
|
|
137
|
-
onClose={modal.close}
|
|
138
|
-
>
|
|
139
|
-
{loading ? (
|
|
140
|
-
<div className="flex justify-center py-16">
|
|
141
|
-
<Spin />
|
|
142
|
-
</div>
|
|
143
|
-
) : row ? (
|
|
144
|
-
<div className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
|
|
145
|
-
<FullTabsPanels row={row} />
|
|
146
|
-
</div>
|
|
147
|
-
) : null}
|
|
148
|
-
</CxModal>
|
|
149
|
-
)
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
UpdateDetailModal.displayName = 'UpdateDetailModal'
|
|
153
|
-
|
|
154
|
-
export default UpdateDetailModal
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
deleteSkillAPI,
|
|
3
|
-
disableSkillAPI,
|
|
4
|
-
enableSkillAPI,
|
|
5
|
-
getSkillPageAPI,
|
|
6
|
-
} from '@/api/menus/skill'
|
|
7
|
-
import { DetailLink } from '@/components/common/detail-link'
|
|
8
|
-
import ListPageView, { createListPageConfig } from '@/components/table-view'
|
|
9
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
10
|
-
import { ALIGN, ENUM_DATA } from '@/meta'
|
|
11
|
-
import { CxButton, CxTag } from '@cx-ui'
|
|
12
|
-
import { useMemo } from 'react'
|
|
13
|
-
import { useTranslation } from 'react-i18next'
|
|
14
|
-
|
|
15
|
-
import DetailModal from './modal/detail-modal'
|
|
16
|
-
import SubmitModal from './modal/submit-modal'
|
|
17
|
-
|
|
18
|
-
const useListPageConfig = createListPageConfig({
|
|
19
|
-
tableAPI: getSkillPageAPI,
|
|
20
|
-
deleteAPI: deleteSkillAPI,
|
|
21
|
-
updateStatusAPI: ({ id, status }) =>
|
|
22
|
-
Number(status) === 1 ? enableSkillAPI(id) : disableSkillAPI(id),
|
|
23
|
-
pageInfo: {
|
|
24
|
-
title: 'menus.skill.page_title',
|
|
25
|
-
subTitle: 'menus.skill.page_subtitle',
|
|
26
|
-
},
|
|
27
|
-
searchFields: [
|
|
28
|
-
{
|
|
29
|
-
prop: 'keyword',
|
|
30
|
-
label: 'menus.skill.fields.name',
|
|
31
|
-
placeholder: 'menus.skill.search_placeholder',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
prop: 'status',
|
|
35
|
-
label: 'common.status',
|
|
36
|
-
type: 'select',
|
|
37
|
-
options: ENUM_DATA.commonStatus.option,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
listQuery: { sort: 'updateTime', order: 'desc' },
|
|
41
|
-
submitAction: {
|
|
42
|
-
permission: 'skill:add',
|
|
43
|
-
submitType: 'modal',
|
|
44
|
-
labelKey: 'menus.skill.add',
|
|
45
|
-
},
|
|
46
|
-
detailAction: {
|
|
47
|
-
detailType: 'modal',
|
|
48
|
-
labelKey: 'common.view',
|
|
49
|
-
},
|
|
50
|
-
table: {
|
|
51
|
-
scrollX: 'max-content',
|
|
52
|
-
operationWidth: 220,
|
|
53
|
-
},
|
|
54
|
-
deleteConfirm: {
|
|
55
|
-
title: 'menus.skill.delete_confirm_title',
|
|
56
|
-
content: 'menus.skill.delete_confirm_content',
|
|
57
|
-
okText: 'common.delete',
|
|
58
|
-
cancelText: 'common.cancel',
|
|
59
|
-
},
|
|
60
|
-
statusToggle: {
|
|
61
|
-
dangerOnDisable: true,
|
|
62
|
-
disableConfirm: {
|
|
63
|
-
cancelText: 'common.cancel',
|
|
64
|
-
content: 'menus.skill.disable_confirm_content',
|
|
65
|
-
contentFields: 'name',
|
|
66
|
-
okText: 'common.confirm',
|
|
67
|
-
title: 'menus.skill.disable_confirm_title',
|
|
68
|
-
},
|
|
69
|
-
enableConfirm: {
|
|
70
|
-
cancelText: 'common.cancel',
|
|
71
|
-
content: 'menus.skill.enable_confirm_content',
|
|
72
|
-
contentFields: 'name',
|
|
73
|
-
okText: 'common.confirm',
|
|
74
|
-
title: 'menus.skill.enable_confirm_title',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
function IndexView() {
|
|
80
|
-
const { t } = useTranslation()
|
|
81
|
-
const { hasPermission } = useAuth()
|
|
82
|
-
const pageConfig = useListPageConfig()
|
|
83
|
-
|
|
84
|
-
const columns = useMemo(
|
|
85
|
-
() => [
|
|
86
|
-
{
|
|
87
|
-
title: 'menus.skill.fields.name',
|
|
88
|
-
key: 'name',
|
|
89
|
-
align: ALIGN.LEFT,
|
|
90
|
-
minWidth: 160,
|
|
91
|
-
render: (value: unknown, data: any) => (
|
|
92
|
-
<DetailLink
|
|
93
|
-
text={String(value ?? data?.name ?? '-')}
|
|
94
|
-
onClick={() =>
|
|
95
|
-
pageConfig.onDetail?.({
|
|
96
|
-
type: 'detail',
|
|
97
|
-
data,
|
|
98
|
-
config: pageConfig.detailAction,
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
title: 'menus.skill.fields.code',
|
|
106
|
-
key: 'code',
|
|
107
|
-
align: ALIGN.LEFT,
|
|
108
|
-
width: 200,
|
|
109
|
-
ellipsis: true,
|
|
110
|
-
render: (value: unknown) => value ?? '-',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
title: 'menus.skill.fields.description',
|
|
114
|
-
key: 'description',
|
|
115
|
-
align: ALIGN.LEFT,
|
|
116
|
-
minWidth: 200,
|
|
117
|
-
ellipsis: true,
|
|
118
|
-
render: (value: unknown) => value ?? '-',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
title: 'common.status',
|
|
122
|
-
key: 'status',
|
|
123
|
-
align: ALIGN.CENTER,
|
|
124
|
-
width: 90,
|
|
125
|
-
render: (value: unknown) => <CxTag.Enabled value={value} />,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
title: 'common.actions',
|
|
129
|
-
key: 'action',
|
|
130
|
-
align: ALIGN.LEFT,
|
|
131
|
-
width: 220,
|
|
132
|
-
render: (_: unknown, data: any) => {
|
|
133
|
-
const isEnabled = Number(data?.status) === 1
|
|
134
|
-
return (
|
|
135
|
-
<div className="flex flex-wrap gap-2">
|
|
136
|
-
<CxButton.IconView
|
|
137
|
-
onClick={() =>
|
|
138
|
-
pageConfig.onDetail?.({
|
|
139
|
-
type: 'detail',
|
|
140
|
-
data,
|
|
141
|
-
config: pageConfig.detailAction,
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
/>
|
|
145
|
-
{!isEnabled && hasPermission('skill:edit') && (
|
|
146
|
-
<CxButton.IconEdit
|
|
147
|
-
onClick={() =>
|
|
148
|
-
pageConfig.onEdit?.({
|
|
149
|
-
type: 'edit',
|
|
150
|
-
data,
|
|
151
|
-
config: pageConfig.submitAction,
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
/>
|
|
155
|
-
)}
|
|
156
|
-
{(hasPermission('skill:enable') || hasPermission('skill:disable')) && (
|
|
157
|
-
<>
|
|
158
|
-
{!isEnabled && hasPermission('skill:enable') ? (
|
|
159
|
-
<CxButton.IconEnable
|
|
160
|
-
onClick={() =>
|
|
161
|
-
pageConfig.onStatusToggle?.({
|
|
162
|
-
nextStatus: 1,
|
|
163
|
-
data,
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
/>
|
|
167
|
-
) : null}
|
|
168
|
-
{isEnabled && hasPermission('skill:disable') ? (
|
|
169
|
-
<CxButton.IconDisable
|
|
170
|
-
onClick={() =>
|
|
171
|
-
pageConfig.onStatusToggle?.({
|
|
172
|
-
nextStatus: 0,
|
|
173
|
-
data,
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
/>
|
|
177
|
-
) : null}
|
|
178
|
-
</>
|
|
179
|
-
)}
|
|
180
|
-
{hasPermission('skill:delete') && !isEnabled && (
|
|
181
|
-
<CxButton.IconDelete onClick={() => pageConfig.onDelete?.(data)} />
|
|
182
|
-
)}
|
|
183
|
-
</div>
|
|
184
|
-
)
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
[hasPermission, pageConfig],
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<ListPageView
|
|
193
|
-
columns={columns}
|
|
194
|
-
pageConfig={pageConfig}
|
|
195
|
-
submitModalComponent={SubmitModal as any}
|
|
196
|
-
detailModalComponent={DetailModal as any}
|
|
197
|
-
/>
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export default IndexView
|