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
package/src/views/chat/index.tsx
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import './chat.less'
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useEffect } from 'react'
|
|
4
|
-
import { useTranslation } from 'react-i18next'
|
|
5
|
-
import { useNavigate, useOutletContext, useSearchParams } from 'react-router-dom'
|
|
6
|
-
|
|
7
|
-
import { getChatSessionIdAPI } from '@/api/chat'
|
|
8
|
-
import { useSystemConfig } from '@/config/system'
|
|
9
|
-
import { SystemLogoMark } from '@/components/common/system-logo-mark'
|
|
10
|
-
import { useChatContext } from '@/contexts/ChatContext'
|
|
11
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
12
|
-
import type { MainLayoutContext } from '@/hooks/useStickyHeader'
|
|
13
|
-
import { parseNewSessionId } from '@/utils/chatUtils'
|
|
14
|
-
import {
|
|
15
|
-
getChatEnableDataAnalysis,
|
|
16
|
-
getChatEnableKnowledgeBase,
|
|
17
|
-
getChatEnableNetwork,
|
|
18
|
-
} from '@/utils/storage'
|
|
19
|
-
import { resolveAvatarUrl } from '@/utils/url'
|
|
20
|
-
|
|
21
|
-
import ChatInput from './components/chat-input'
|
|
22
|
-
import { useChatCommon } from './hooks/use-chat-common'
|
|
23
|
-
|
|
24
|
-
const ChatNewPage: React.FC = () => {
|
|
25
|
-
const [searchParams] = useSearchParams()
|
|
26
|
-
const navigate = useNavigate()
|
|
27
|
-
const { showToast } = useToast()
|
|
28
|
-
const { t } = useTranslation()
|
|
29
|
-
const { setHeaderTitle } = useOutletContext<MainLayoutContext>()
|
|
30
|
-
const { isStreaming, sendMessage } = useChatContext()
|
|
31
|
-
const { canCreate, handleStop } = useChatCommon()
|
|
32
|
-
const { agentAvatar, systemName } = useSystemConfig()
|
|
33
|
-
|
|
34
|
-
/** 旧链接 ?thread= 重定向到 /chat/:sessionId */
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const legacy = searchParams.get('thread')
|
|
37
|
-
if (legacy) {
|
|
38
|
-
navigate(`/chat/${encodeURIComponent(legacy)}`, { replace: true })
|
|
39
|
-
}
|
|
40
|
-
}, [searchParams, navigate])
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
setHeaderTitle(t('common.chat'))
|
|
44
|
-
return () => setHeaderTitle(null)
|
|
45
|
-
}, [setHeaderTitle, t])
|
|
46
|
-
|
|
47
|
-
const handleSend = useCallback(
|
|
48
|
-
async (
|
|
49
|
-
message: string,
|
|
50
|
-
opts?: {
|
|
51
|
-
enableNetwork?: boolean
|
|
52
|
-
enableKnowledgeBase?: boolean
|
|
53
|
-
enableDataAnalysis?: boolean
|
|
54
|
-
},
|
|
55
|
-
) => {
|
|
56
|
-
let threadId: string
|
|
57
|
-
try {
|
|
58
|
-
const raw = await getChatSessionIdAPI()
|
|
59
|
-
threadId = parseNewSessionId(raw)
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error('[chat-new] getChatSessionIdAPI failed:', err)
|
|
62
|
-
showToast(t('common.error'), 'error')
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const enableNetwork = opts?.enableNetwork ?? getChatEnableNetwork()
|
|
67
|
-
const enableKnowledgeBase =
|
|
68
|
-
opts?.enableKnowledgeBase ?? getChatEnableKnowledgeBase()
|
|
69
|
-
const enableDataAnalysis =
|
|
70
|
-
opts?.enableDataAnalysis ?? getChatEnableDataAnalysis()
|
|
71
|
-
const nav = navigate(`/chat/${encodeURIComponent(threadId)}`)
|
|
72
|
-
await (nav ?? Promise.resolve())
|
|
73
|
-
await sendMessage(message, threadId, {
|
|
74
|
-
enableNetwork,
|
|
75
|
-
enableKnowledgeBase,
|
|
76
|
-
enableDataAnalysis,
|
|
77
|
-
})
|
|
78
|
-
},
|
|
79
|
-
[navigate, sendMessage, showToast, t],
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div className="flex h-full bg-white dark:bg-[#131314]">
|
|
84
|
-
<div className="flex-1 flex flex-col h-full relative">
|
|
85
|
-
<div className="flex-1 flex flex-col items-center justify-center p-8 text-center">
|
|
86
|
-
<div className="mb-8">
|
|
87
|
-
{agentAvatar ? (
|
|
88
|
-
<img
|
|
89
|
-
src={resolveAvatarUrl(agentAvatar) ?? agentAvatar}
|
|
90
|
-
alt=""
|
|
91
|
-
className="w-16 h-16 mx-auto mb-4 rounded-full object-cover"
|
|
92
|
-
onError={(e) => {
|
|
93
|
-
e.currentTarget.style.display = 'none'
|
|
94
|
-
}}
|
|
95
|
-
/>
|
|
96
|
-
) : (
|
|
97
|
-
<SystemLogoMark className="w-16 h-16 mx-auto mb-4" fallbackShape="circle" />
|
|
98
|
-
)}
|
|
99
|
-
<h2 className="text-4xl font-medium mb-2 bg-gradient-to-r from-blue-500 to-purple-600 bg-clip-text text-transparent leading-tight">
|
|
100
|
-
{t('chat.welcome_title', { appName: systemName })}
|
|
101
|
-
</h2>
|
|
102
|
-
<p className="text-xl text-gray-500 dark:text-gray-400">
|
|
103
|
-
{t('chat.welcome_subtitle')}
|
|
104
|
-
</p>
|
|
105
|
-
</div>
|
|
106
|
-
<div className="w-full max-w-7xl">
|
|
107
|
-
{canCreate ? (
|
|
108
|
-
<ChatInput
|
|
109
|
-
onSend={handleSend}
|
|
110
|
-
onStop={handleStop}
|
|
111
|
-
isLoading={false}
|
|
112
|
-
disableSend={isStreaming}
|
|
113
|
-
/>
|
|
114
|
-
) : (
|
|
115
|
-
<div className="p-4 text-center text-gray-500 italic text-sm">
|
|
116
|
-
{t('chat.no_create_permission') ||
|
|
117
|
-
'You do not have permission to start a new chat.'}
|
|
118
|
-
</div>
|
|
119
|
-
)}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export default ChatNewPage
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useNavigate } from 'react-router-dom'
|
|
3
|
-
import { Home, ChevronLeft, ShieldAlert } from 'lucide-react'
|
|
4
|
-
import { useTranslation } from 'react-i18next'
|
|
5
|
-
|
|
6
|
-
const IndexView: React.FC = () => {
|
|
7
|
-
const { t } = useTranslation()
|
|
8
|
-
const navigate = useNavigate()
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="min-h-screen bg-white dark:bg-[#131314] flex items-center justify-center p-6">
|
|
12
|
-
<div className="max-w-md w-full text-center space-y-8 animate-in fade-in zoom-in duration-500">
|
|
13
|
-
<div className="relative">
|
|
14
|
-
<div className="absolute inset-0 bg-amber-500/20 blur-3xl rounded-full" />
|
|
15
|
-
<div className="relative flex flex-col items-center">
|
|
16
|
-
<div className="w-24 h-24 bg-gradient-to-br from-amber-500 to-orange-600 rounded-3xl flex items-center justify-center shadow-2xl mb-6 transform rotate-12 hover:rotate-0 transition-transform duration-300">
|
|
17
|
-
<ShieldAlert size={48} className="text-white" />
|
|
18
|
-
</div>
|
|
19
|
-
<h1 className="text-8xl font-black text-transparent bg-clip-text bg-gradient-to-b from-gray-900 to-gray-600 dark:from-white dark:to-gray-400">
|
|
20
|
-
401
|
|
21
|
-
</h1>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div className="space-y-3">
|
|
26
|
-
<h2 className="text-2xl font-bold text-gray-900 dark:text-white">
|
|
27
|
-
{t('common.page_error.401.title')}
|
|
28
|
-
</h2>
|
|
29
|
-
<p className="text-gray-500 dark:text-gray-400 leading-relaxed">
|
|
30
|
-
{t('common.page_error.401.message')}
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div className="flex flex-col sm:flex-row items-center justify-center gap-4 pt-4">
|
|
35
|
-
<button
|
|
36
|
-
onClick={() => navigate(-1)}
|
|
37
|
-
className="w-full sm:w-auto flex items-center justify-center gap-2 px-6 py-3 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 rounded-xl font-semibold hover:bg-gray-200 dark:hover:bg-gray-700 transition-all active:scale-95"
|
|
38
|
-
>
|
|
39
|
-
<ChevronLeft size={20} />
|
|
40
|
-
{t('common.cancel')}
|
|
41
|
-
</button>
|
|
42
|
-
<button
|
|
43
|
-
onClick={() => navigate('/chat')}
|
|
44
|
-
className="w-full sm:w-auto flex items-center justify-center gap-2 px-8 py-3 bg-blue-600 text-white rounded-xl font-semibold shadow-lg shadow-blue-500/25 hover:bg-blue-700 hover:shadow-blue-500/40 transition-all active:scale-95"
|
|
45
|
-
>
|
|
46
|
-
<Home size={20} />
|
|
47
|
-
{t('common.page_error.back_home')}
|
|
48
|
-
</button>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default IndexView
|
|
56
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useNavigate } from 'react-router-dom'
|
|
3
|
-
import { Home, ChevronLeft, AlertCircle } from 'lucide-react'
|
|
4
|
-
import { useTranslation } from 'react-i18next'
|
|
5
|
-
|
|
6
|
-
const IndexView: React.FC = () => {
|
|
7
|
-
const { t } = useTranslation()
|
|
8
|
-
const navigate = useNavigate()
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="min-h-screen bg-white dark:bg-[#131314] flex items-center justify-center p-6">
|
|
12
|
-
<div className="max-w-md w-full text-center space-y-8 animate-in fade-in zoom-in duration-500">
|
|
13
|
-
<div className="relative">
|
|
14
|
-
<div className="absolute inset-0 bg-blue-500/20 blur-3xl rounded-full" />
|
|
15
|
-
<div className="relative flex flex-col items-center">
|
|
16
|
-
<div className="w-24 h-24 bg-gradient-to-br from-blue-500 to-purple-600 rounded-3xl flex items-center justify-center shadow-2xl mb-6 transform rotate-12 hover:rotate-0 transition-transform duration-300">
|
|
17
|
-
<AlertCircle size={48} className="text-white" />
|
|
18
|
-
</div>
|
|
19
|
-
<h1 className="text-8xl font-black text-transparent bg-clip-text bg-gradient-to-b from-gray-900 to-gray-600 dark:from-white dark:to-gray-400">
|
|
20
|
-
404
|
|
21
|
-
</h1>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div className="space-y-3">
|
|
26
|
-
<h2 className="text-2xl font-bold text-gray-900 dark:text-white">
|
|
27
|
-
{t('common.page_error.404.title')}
|
|
28
|
-
</h2>
|
|
29
|
-
<p className="text-gray-500 dark:text-gray-400 leading-relaxed">
|
|
30
|
-
{t('common.page_error.404.message')}
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div className="flex flex-col sm:flex-row items-center justify-center gap-4 pt-4">
|
|
35
|
-
<button
|
|
36
|
-
onClick={() => navigate(-1)}
|
|
37
|
-
className="w-full sm:w-auto flex items-center justify-center gap-2 px-6 py-3 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 rounded-xl font-semibold hover:bg-gray-200 dark:hover:bg-gray-700 transition-all active:scale-95"
|
|
38
|
-
>
|
|
39
|
-
<ChevronLeft size={20} />
|
|
40
|
-
{t('common.cancel')}
|
|
41
|
-
</button>
|
|
42
|
-
<button
|
|
43
|
-
onClick={() => navigate('/chat')}
|
|
44
|
-
className="w-full sm:w-auto flex items-center justify-center gap-2 px-8 py-3 bg-blue-600 text-white rounded-xl font-semibold shadow-lg shadow-blue-500/25 hover:bg-blue-700 hover:shadow-blue-500/40 transition-all active:scale-95"
|
|
45
|
-
>
|
|
46
|
-
<Home size={20} />
|
|
47
|
-
{t('common.page_error.back_home')}
|
|
48
|
-
</button>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default IndexView
|
|
56
|
-
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useRef, useState } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
approveBusinessRuleAPI,
|
|
6
|
-
deleteBusinessRulesTermAPI,
|
|
7
|
-
disableBusinessRulesTermAPI,
|
|
8
|
-
enableBusinessRulesTermAPI,
|
|
9
|
-
getBusinessRulesTermPageAPI,
|
|
10
|
-
rejectBusinessRuleAPI,
|
|
11
|
-
} from '@/api/menus/business-rules'
|
|
12
|
-
import { DetailLink } from '@/components/common/detail-link'
|
|
13
|
-
import ConfirmDialog from '@/components/common/modal/confirm-dialog'
|
|
14
|
-
import ListPageView, { createListPageConfig } from '@/components/table-view'
|
|
15
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
16
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
17
|
-
import { ALIGN, ENUM_DATA } from '@/meta'
|
|
18
|
-
import { CxButton, CxTag } from '@cx-ui'
|
|
19
|
-
import { SlidersHorizontal } from 'lucide-react'
|
|
20
|
-
|
|
21
|
-
import DetailModal from './modal/detail-modal.tsx'
|
|
22
|
-
import ScopeModal from './modal/scope-modal.tsx'
|
|
23
|
-
import SubmitModal from './modal/submit-modal'
|
|
24
|
-
|
|
25
|
-
const AUDIT_STATUS = {
|
|
26
|
-
DRAFT: 10,
|
|
27
|
-
PENDING: 20,
|
|
28
|
-
APPROVED: 30,
|
|
29
|
-
REJECTED: 40,
|
|
30
|
-
} as const
|
|
31
|
-
|
|
32
|
-
function ruleAuditStatus(record: any): number | undefined {
|
|
33
|
-
const v = record?.auditStatus ?? record?.reviewStatus
|
|
34
|
-
if (v === undefined || v === null) return undefined
|
|
35
|
-
const n = Number(v)
|
|
36
|
-
return Number.isNaN(n) ? undefined : n
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function ruleAuditStatusOrDraft(record: any): number {
|
|
40
|
-
return ruleAuditStatus(record) ?? AUDIT_STATUS.DRAFT
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function ruleStatusEnabled(record: any): boolean {
|
|
44
|
-
return Number(record?.status) === 1
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function canRuleEdit(record: any): boolean {
|
|
48
|
-
const aud = ruleAuditStatusOrDraft(record)
|
|
49
|
-
if (aud === AUDIT_STATUS.PENDING) return false
|
|
50
|
-
if (aud === AUDIT_STATUS.APPROVED) return false
|
|
51
|
-
return true
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function canRuleDelete(record: any): boolean {
|
|
55
|
-
const aud = ruleAuditStatusOrDraft(record)
|
|
56
|
-
const on = ruleStatusEnabled(record)
|
|
57
|
-
if (aud === AUDIT_STATUS.PENDING) return false
|
|
58
|
-
if (aud === AUDIT_STATUS.APPROVED && on) return false
|
|
59
|
-
return true
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function canRuleEnable(record: any): boolean {
|
|
63
|
-
const aud = ruleAuditStatusOrDraft(record)
|
|
64
|
-
const on = ruleStatusEnabled(record)
|
|
65
|
-
return aud === AUDIT_STATUS.APPROVED && !on
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function canRuleDisable(record: any): boolean {
|
|
69
|
-
const aud = ruleAuditStatusOrDraft(record)
|
|
70
|
-
const on = ruleStatusEnabled(record)
|
|
71
|
-
return aud === AUDIT_STATUS.APPROVED && on
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function canRuleApprove(record: any): boolean {
|
|
75
|
-
return ruleAuditStatusOrDraft(record) === AUDIT_STATUS.PENDING
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function canRuleReject(record: any): boolean {
|
|
79
|
-
return ruleAuditStatusOrDraft(record) === AUDIT_STATUS.PENDING
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function canRuleSetScope(record: any): boolean {
|
|
83
|
-
return ruleAuditStatusOrDraft(record) === AUDIT_STATUS.APPROVED
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function ruleDisplayName(data: any) {
|
|
87
|
-
return String(data?.term ?? '').trim() || '-'
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const useListPageConfig = createListPageConfig({
|
|
91
|
-
tableAPI: getBusinessRulesTermPageAPI,
|
|
92
|
-
deleteAPI: deleteBusinessRulesTermAPI,
|
|
93
|
-
updateStatusAPI: ({ id, status }) =>
|
|
94
|
-
Number(status) === 1 ? enableBusinessRulesTermAPI(id) : disableBusinessRulesTermAPI(id),
|
|
95
|
-
pageInfo: {
|
|
96
|
-
title: 'menus.business_rules.page_title',
|
|
97
|
-
subTitle: 'menus.business_rules.page_subtitle',
|
|
98
|
-
},
|
|
99
|
-
searchFields: [
|
|
100
|
-
{
|
|
101
|
-
prop: 'keyword',
|
|
102
|
-
label: 'menus.business_rules.fields.term',
|
|
103
|
-
placeholder: 'menus.business_rules.search_placeholder',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
prop: 'status',
|
|
107
|
-
label: 'common.status',
|
|
108
|
-
type: 'select',
|
|
109
|
-
placeholder: 'common.status',
|
|
110
|
-
options: ENUM_DATA.commonStatus.option,
|
|
111
|
-
width: '120px',
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
prop: 'auditStatus',
|
|
115
|
-
label: 'menus.business_rules.col_audit_status',
|
|
116
|
-
type: 'select',
|
|
117
|
-
placeholder: 'menus.business_rules.col_audit_status',
|
|
118
|
-
// 不显示草稿状态
|
|
119
|
-
options: ENUM_DATA.auditStatus.option.filter((item: any) => item.value !== AUDIT_STATUS.DRAFT),
|
|
120
|
-
width: '140px',
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
statusToggle: {
|
|
124
|
-
dangerOnDisable: true,
|
|
125
|
-
disableConfirm: {
|
|
126
|
-
cancelText: 'common.cancel',
|
|
127
|
-
content: 'menus.business_rules.disable_confirm_content',
|
|
128
|
-
okText: 'common.confirm',
|
|
129
|
-
title: 'menus.business_rules.disable_confirm_title',
|
|
130
|
-
},
|
|
131
|
-
enableConfirm: {
|
|
132
|
-
cancelText: 'common.cancel',
|
|
133
|
-
content: 'menus.business_rules.enable_confirm_content',
|
|
134
|
-
okText: 'common.confirm',
|
|
135
|
-
title: 'menus.business_rules.enable_confirm_title',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
submitAction: {
|
|
139
|
-
permission: 'business-rules:add',
|
|
140
|
-
submitType: 'modal',
|
|
141
|
-
labelKey: 'menus.business_rules.add',
|
|
142
|
-
},
|
|
143
|
-
detailAction: {
|
|
144
|
-
detailType: 'modal',
|
|
145
|
-
labelKey: 'common.view',
|
|
146
|
-
},
|
|
147
|
-
table: {
|
|
148
|
-
scrollX: false,
|
|
149
|
-
},
|
|
150
|
-
deleteConfirm: {
|
|
151
|
-
title: 'menus.business_rules.delete_confirm_title',
|
|
152
|
-
content: 'menus.business_rules.delete_confirm_content',
|
|
153
|
-
okText: 'common.delete',
|
|
154
|
-
cancelText: 'common.cancel',
|
|
155
|
-
},
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
function IndexView() {
|
|
159
|
-
const { t, i18n } = useTranslation()
|
|
160
|
-
const { hasPermission } = useAuth()
|
|
161
|
-
const { showToast } = useToast()
|
|
162
|
-
const pageConfig = useListPageConfig()
|
|
163
|
-
const auditStatusTagWidth = i18n.language?.startsWith('en') ? 90 : 80
|
|
164
|
-
|
|
165
|
-
const scopeModalRef = useRef<{ open: (p?: any) => void; close: () => void } | null>(null)
|
|
166
|
-
|
|
167
|
-
const [auditDialog, setAuditDialog] = useState<null | { kind: 'approve' | 'reject'; record: any }>(
|
|
168
|
-
null,
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
const runAuditConfirm = useCallback(async () => {
|
|
172
|
-
if (!auditDialog) return
|
|
173
|
-
const { kind, record } = auditDialog
|
|
174
|
-
const id = record?.id ?? record?._id
|
|
175
|
-
if (id === undefined || id === null) {
|
|
176
|
-
setAuditDialog(null)
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
try {
|
|
180
|
-
if (kind === 'approve') {
|
|
181
|
-
await approveBusinessRuleAPI(id)
|
|
182
|
-
showToast(t('menus.business_rules.approve_success'), 'success')
|
|
183
|
-
} else {
|
|
184
|
-
await rejectBusinessRuleAPI(id)
|
|
185
|
-
showToast(t('menus.business_rules.reject_success'), 'success')
|
|
186
|
-
}
|
|
187
|
-
await pageConfig.fetchTableData?.()
|
|
188
|
-
} catch (e: any) {
|
|
189
|
-
console.log(e?.message)
|
|
190
|
-
} finally {
|
|
191
|
-
setAuditDialog(null)
|
|
192
|
-
}
|
|
193
|
-
}, [auditDialog, pageConfig, showToast, t])
|
|
194
|
-
|
|
195
|
-
const columns = useMemo(
|
|
196
|
-
() => [
|
|
197
|
-
{
|
|
198
|
-
title: 'menus.business_rules.fields.term',
|
|
199
|
-
key: 'term',
|
|
200
|
-
align: ALIGN.LEFT,
|
|
201
|
-
minWidth: 160,
|
|
202
|
-
render: (value: unknown, data: any) => (
|
|
203
|
-
<DetailLink
|
|
204
|
-
text={String(value ?? data?.term ?? '-')}
|
|
205
|
-
onClick={() =>
|
|
206
|
-
pageConfig.onDetail?.({
|
|
207
|
-
type: 'detail',
|
|
208
|
-
data,
|
|
209
|
-
config: pageConfig.detailAction,
|
|
210
|
-
})
|
|
211
|
-
}
|
|
212
|
-
/>
|
|
213
|
-
),
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
title: 'menus.business_rules.fields.definition',
|
|
217
|
-
key: 'definition',
|
|
218
|
-
align: ALIGN.LEFT,
|
|
219
|
-
minWidth: 220,
|
|
220
|
-
ellipsis: true,
|
|
221
|
-
render: (value: unknown) => value ?? '-',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
title: 'menus.business_rules.col_audit_status',
|
|
225
|
-
key: 'auditStatus',
|
|
226
|
-
align: ALIGN.CENTER,
|
|
227
|
-
minWidth: 110,
|
|
228
|
-
render: (_: unknown, record: any) => {
|
|
229
|
-
const a = ruleAuditStatus(record)
|
|
230
|
-
if (a === undefined) return <span className="text-gray-400">-</span>
|
|
231
|
-
return (
|
|
232
|
-
<div style={{ width: auditStatusTagWidth, display: 'inline-block' }} className="text-center">
|
|
233
|
-
<CxTag.Enum value={a} enumKey="auditStatus" />
|
|
234
|
-
</div>
|
|
235
|
-
)
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
title: 'common.status',
|
|
240
|
-
key: 'status',
|
|
241
|
-
align: ALIGN.CENTER,
|
|
242
|
-
minWidth: 100,
|
|
243
|
-
render: (value: unknown) => <CxTag.Enabled value={value} />,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
title: 'menus.business_rules.fields.create_time',
|
|
247
|
-
key: 'createTime',
|
|
248
|
-
align: ALIGN.CENTER,
|
|
249
|
-
minWidth: 180,
|
|
250
|
-
render: (v: unknown) => (v != null && String(v) !== '' ? String(v) : '-'),
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
title: 'common.actions',
|
|
254
|
-
key: 'action',
|
|
255
|
-
align: ALIGN.LEFT,
|
|
256
|
-
width: 200,
|
|
257
|
-
render: (_: unknown, data: any) => {
|
|
258
|
-
const showEnable = hasPermission('business-rules:enable') && canRuleEnable(data)
|
|
259
|
-
const showDisable = hasPermission('business-rules:disable') && canRuleDisable(data)
|
|
260
|
-
const showEdit = hasPermission('business-rules:edit') && canRuleEdit(data)
|
|
261
|
-
const showApprove = hasPermission('business-rules:approve') && canRuleApprove(data)
|
|
262
|
-
const showReject = hasPermission('business-rules:reject') && canRuleReject(data)
|
|
263
|
-
const showDelete = hasPermission('business-rules:delete') && canRuleDelete(data)
|
|
264
|
-
const showScope = hasPermission('business-rules:scope-set') && canRuleSetScope(data)
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<div className="flex flex-wrap gap-2">
|
|
268
|
-
<CxButton.IconView
|
|
269
|
-
onClick={() =>
|
|
270
|
-
pageConfig.onDetail?.({
|
|
271
|
-
type: 'detail',
|
|
272
|
-
data,
|
|
273
|
-
config: pageConfig.detailAction,
|
|
274
|
-
})
|
|
275
|
-
}
|
|
276
|
-
/>
|
|
277
|
-
{showEdit && (
|
|
278
|
-
<CxButton.IconEdit
|
|
279
|
-
onClick={() =>
|
|
280
|
-
pageConfig.onEdit?.({
|
|
281
|
-
type: 'edit',
|
|
282
|
-
data,
|
|
283
|
-
config: pageConfig.submitAction,
|
|
284
|
-
})
|
|
285
|
-
}
|
|
286
|
-
/>
|
|
287
|
-
)}
|
|
288
|
-
{showScope && (
|
|
289
|
-
<CxButton.Icon
|
|
290
|
-
title={t('menus.business_rules.actions.scope')}
|
|
291
|
-
icon={<SlidersHorizontal size={16} />}
|
|
292
|
-
onClick={() => scopeModalRef.current?.open({ opeType: 'edit', data })}
|
|
293
|
-
/>
|
|
294
|
-
)}
|
|
295
|
-
{showEnable && (
|
|
296
|
-
<CxButton.IconEnable
|
|
297
|
-
onClick={() =>
|
|
298
|
-
pageConfig.onStatusToggle?.({
|
|
299
|
-
nextStatus: 1,
|
|
300
|
-
data,
|
|
301
|
-
})
|
|
302
|
-
}
|
|
303
|
-
/>
|
|
304
|
-
)}
|
|
305
|
-
{showDisable && (
|
|
306
|
-
<CxButton.IconDisable
|
|
307
|
-
onClick={() =>
|
|
308
|
-
pageConfig.onStatusToggle?.({
|
|
309
|
-
nextStatus: 0,
|
|
310
|
-
data,
|
|
311
|
-
})
|
|
312
|
-
}
|
|
313
|
-
/>
|
|
314
|
-
)}
|
|
315
|
-
{showApprove && (
|
|
316
|
-
<CxButton.IconAccept
|
|
317
|
-
title={t('menus.business_rules.action_approve')}
|
|
318
|
-
onClick={() => setAuditDialog({ kind: 'approve', record: data })}
|
|
319
|
-
/>
|
|
320
|
-
)}
|
|
321
|
-
{showReject && (
|
|
322
|
-
<CxButton.IconReject
|
|
323
|
-
title={t('menus.business_rules.action_reject')}
|
|
324
|
-
onClick={() => setAuditDialog({ kind: 'reject', record: data })}
|
|
325
|
-
/>
|
|
326
|
-
)}
|
|
327
|
-
{showDelete && <CxButton.IconDelete onClick={() => pageConfig.onDelete?.(data)} />}
|
|
328
|
-
</div>
|
|
329
|
-
)
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
[hasPermission, pageConfig, t, auditStatusTagWidth],
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
const auditDialogTitle =
|
|
337
|
-
auditDialog == null
|
|
338
|
-
? ''
|
|
339
|
-
: auditDialog.kind === 'approve'
|
|
340
|
-
? t('menus.business_rules.approve_confirm_title')
|
|
341
|
-
: t('menus.business_rules.reject_confirm_title')
|
|
342
|
-
const auditDialogMessage =
|
|
343
|
-
auditDialog == null
|
|
344
|
-
? ''
|
|
345
|
-
: auditDialog.kind === 'approve'
|
|
346
|
-
? t('menus.business_rules.approve_confirm_content', { name: ruleDisplayName(auditDialog.record) })
|
|
347
|
-
: t('menus.business_rules.reject_confirm_content', { name: ruleDisplayName(auditDialog.record) })
|
|
348
|
-
|
|
349
|
-
return (
|
|
350
|
-
<>
|
|
351
|
-
<ListPageView
|
|
352
|
-
columns={columns}
|
|
353
|
-
pageConfig={pageConfig}
|
|
354
|
-
submitModalComponent={SubmitModal as any}
|
|
355
|
-
detailModalComponent={DetailModal as any}
|
|
356
|
-
/>
|
|
357
|
-
<ScopeModal
|
|
358
|
-
ref={scopeModalRef}
|
|
359
|
-
onOk={async () => {
|
|
360
|
-
await pageConfig.fetchTableData?.()
|
|
361
|
-
}}
|
|
362
|
-
/>
|
|
363
|
-
<ConfirmDialog
|
|
364
|
-
overlayClassName="z-[2000]"
|
|
365
|
-
isOpen={auditDialog != null}
|
|
366
|
-
title={auditDialogTitle}
|
|
367
|
-
message={auditDialogMessage}
|
|
368
|
-
danger={auditDialog?.kind === 'reject'}
|
|
369
|
-
onClose={() => setAuditDialog(null)}
|
|
370
|
-
onConfirm={() => void runAuditConfirm()}
|
|
371
|
-
/>
|
|
372
|
-
</>
|
|
373
|
-
)
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export default IndexView
|