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,163 +0,0 @@
|
|
|
1
|
-
import { DetailLink } from '@/components/common/detail-link'
|
|
2
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
3
|
-
import { ALIGN } from '@/meta'
|
|
4
|
-
import { deleteRoleAPI, getRolePageAPI } from '@api/system/role'
|
|
5
|
-
import ListPageView, { createListPageConfig } from '@components/table-view'
|
|
6
|
-
import { CxButton, CxEmptyState } from '@cx-ui'
|
|
7
|
-
import { KeyRound } from 'lucide-react'
|
|
8
|
-
import { useMemo, useRef } from 'react'
|
|
9
|
-
import { useTranslation } from 'react-i18next'
|
|
10
|
-
import DetailModal from './modal/detail-modal'
|
|
11
|
-
import PermissionModal from './modal/permission-modal'
|
|
12
|
-
import SubmitModal from './modal/submit-modal'
|
|
13
|
-
|
|
14
|
-
const useListPageConfig = createListPageConfig({
|
|
15
|
-
tableAPI: getRolePageAPI,
|
|
16
|
-
deleteAPI: deleteRoleAPI,
|
|
17
|
-
pageInfo: {
|
|
18
|
-
title: 'system.role.page_title',
|
|
19
|
-
subTitle: 'system.role.page_subtitle',
|
|
20
|
-
},
|
|
21
|
-
searchFields: [
|
|
22
|
-
{
|
|
23
|
-
prop: 'name',
|
|
24
|
-
label: 'system.role.name',
|
|
25
|
-
placeholder: 'system.role.search_placeholder',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
prop: 'permissionName',
|
|
29
|
-
label: 'system.role.search_permission_label',
|
|
30
|
-
placeholder: 'system.role.search_permission_placeholder',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
submitAction: {
|
|
34
|
-
permission: 'role:add',
|
|
35
|
-
submitType: 'modal', // 新增/编辑:基于当前路由跳转 /submit /submit?id=xx
|
|
36
|
-
labelKey: 'system.role.add',
|
|
37
|
-
},
|
|
38
|
-
detailAction: {
|
|
39
|
-
detailType: 'modal', // 详情:基于当前路由跳转 /detail?id=xx
|
|
40
|
-
labelKey: 'common.view',
|
|
41
|
-
permission: 'role:detail',
|
|
42
|
-
},
|
|
43
|
-
deleteConfirm: {
|
|
44
|
-
title: 'system.role.delete_confirm_title',
|
|
45
|
-
content: 'system.role.delete_confirm_content',
|
|
46
|
-
okText: 'common.delete',
|
|
47
|
-
cancelText: 'common.cancel',
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
function IndexView() {
|
|
52
|
-
const { t } = useTranslation()
|
|
53
|
-
const { hasPermission } = useAuth()
|
|
54
|
-
const permissionModalRef = useRef<{
|
|
55
|
-
open: (p: { record: { id: string | number; name?: string } }) => void
|
|
56
|
-
close: () => void
|
|
57
|
-
} | null>(null)
|
|
58
|
-
|
|
59
|
-
const pageConfig = useListPageConfig()
|
|
60
|
-
const canViewRolePage = hasPermission('role:page')
|
|
61
|
-
|
|
62
|
-
if (!canViewRolePage) {
|
|
63
|
-
return <CxEmptyState message={t('common.page_error.401.message')} />
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const columns = useMemo(
|
|
67
|
-
() => [
|
|
68
|
-
{
|
|
69
|
-
title: 'system.role.name',
|
|
70
|
-
key: 'name',
|
|
71
|
-
align: ALIGN.CENTER,
|
|
72
|
-
render: (value: string, data: any) => (
|
|
73
|
-
<DetailLink
|
|
74
|
-
text={value}
|
|
75
|
-
extra={
|
|
76
|
-
data.editFlag === 1 && (
|
|
77
|
-
<span className="ml-2 px-2 py-0.5 text-xs bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">
|
|
78
|
-
{t('system.role.system_role_badge')}
|
|
79
|
-
</span>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
onClick={() =>
|
|
83
|
-
pageConfig.onDetail?.({
|
|
84
|
-
type: 'detail',
|
|
85
|
-
data,
|
|
86
|
-
config: pageConfig.detailAction,
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
/>
|
|
90
|
-
),
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
title: 'common.description',
|
|
94
|
-
key: 'description',
|
|
95
|
-
align: ALIGN.CENTER,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
title: 'common.actions',
|
|
99
|
-
key: 'action',
|
|
100
|
-
width: 250,
|
|
101
|
-
align: ALIGN.CENTER,
|
|
102
|
-
render: (_: any, data: any) =>
|
|
103
|
-
data.editFlag === 0? (
|
|
104
|
-
<div className="flex justify-center gap-2">
|
|
105
|
-
{hasPermission('role:edit') && (
|
|
106
|
-
<CxButton.IconEdit
|
|
107
|
-
onClick={() =>
|
|
108
|
-
pageConfig.onEdit?.({
|
|
109
|
-
type: 'edit',
|
|
110
|
-
data,
|
|
111
|
-
config: pageConfig.submitAction,
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
{hasPermission('role:permission-edit') && (
|
|
117
|
-
<CxButton.Icon
|
|
118
|
-
title={t('system.role.permissions_assignment')}
|
|
119
|
-
tooltipTone="primary"
|
|
120
|
-
icon={<KeyRound size={18} />}
|
|
121
|
-
onClick={() =>
|
|
122
|
-
permissionModalRef.current?.open({
|
|
123
|
-
record: {
|
|
124
|
-
id: data.id,
|
|
125
|
-
name: data.name,
|
|
126
|
-
},
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
/>
|
|
130
|
-
)}
|
|
131
|
-
{hasPermission('role:delete') && (
|
|
132
|
-
<CxButton.IconDelete
|
|
133
|
-
onClick={() => pageConfig.onDelete?.(data)}
|
|
134
|
-
/>
|
|
135
|
-
)}
|
|
136
|
-
</div>
|
|
137
|
-
) : (
|
|
138
|
-
<span className="text-xs text-gray-400 italic">
|
|
139
|
-
{t('system.role.protected_role')}
|
|
140
|
-
</span>
|
|
141
|
-
),
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
[t, hasPermission, pageConfig],
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<>
|
|
149
|
-
<ListPageView
|
|
150
|
-
columns={columns}
|
|
151
|
-
pageConfig={pageConfig}
|
|
152
|
-
submitModalComponent={SubmitModal}
|
|
153
|
-
detailModalComponent={DetailModal}
|
|
154
|
-
/>
|
|
155
|
-
<PermissionModal
|
|
156
|
-
ref={permissionModalRef}
|
|
157
|
-
onSaved={() => void pageConfig.fetchTableData?.()}
|
|
158
|
-
/>
|
|
159
|
-
</>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export default IndexView
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { getRoleDetailAPI } from '@/api/system/role'
|
|
2
|
-
import { CxModal, useCxModal } from '@cx-ui'
|
|
3
|
-
import { Form, Spin } from 'antd'
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
useCallback,
|
|
7
|
-
useImperativeHandle,
|
|
8
|
-
useRef,
|
|
9
|
-
useState
|
|
10
|
-
} from 'react'
|
|
11
|
-
import { useTranslation } from 'react-i18next'
|
|
12
|
-
import { roleModalShellStyles } from './role-modal-shell-styles'
|
|
13
|
-
import RolePermissionAssignPanel, {
|
|
14
|
-
type RolePermissionAssignPanelHandle,
|
|
15
|
-
} from './role-permission-assign-panel'
|
|
16
|
-
|
|
17
|
-
interface OpenPayload {
|
|
18
|
-
opeId?: string | number
|
|
19
|
-
record?: any
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const DetailModal = forwardRef<any, unknown>(function DetailModal(_props, ref) {
|
|
23
|
-
const { t } = useTranslation()
|
|
24
|
-
const [loading, setLoading] = useState(false)
|
|
25
|
-
const assignPanelRef = useRef<RolePermissionAssignPanelHandle>(null)
|
|
26
|
-
const [assignBootstrapKey, setAssignBootstrapKey] = useState(0)
|
|
27
|
-
|
|
28
|
-
const modal = useCxModal({
|
|
29
|
-
onOpen: async (payload) => {
|
|
30
|
-
const opeId = payload.opeId ?? payload.data?.id
|
|
31
|
-
|
|
32
|
-
setAssignBootstrapKey((k) => k + 1)
|
|
33
|
-
assignPanelRef.current?.reset()
|
|
34
|
-
setLoading(true)
|
|
35
|
-
modal.setFormData({})
|
|
36
|
-
|
|
37
|
-
if (opeId != null && opeId !== '') {
|
|
38
|
-
try {
|
|
39
|
-
const res = await getRoleDetailAPI(opeId)
|
|
40
|
-
modal.setFormData({
|
|
41
|
-
id: opeId,
|
|
42
|
-
name: res?.data?.name ?? '',
|
|
43
|
-
description: res?.data?.description ?? '',
|
|
44
|
-
editFlag: res?.data?.editFlag,
|
|
45
|
-
})
|
|
46
|
-
} finally {
|
|
47
|
-
setLoading(false)
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
setLoading(false)
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
onClose: () => {
|
|
54
|
-
assignPanelRef.current?.reset()
|
|
55
|
-
},
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const { isOpen, close } = modal
|
|
59
|
-
const detailData = modal.formData ?? {}
|
|
60
|
-
|
|
61
|
-
useImperativeHandle(ref, () => ({
|
|
62
|
-
open: modal.open,
|
|
63
|
-
close,
|
|
64
|
-
}), [modal.open, close])
|
|
65
|
-
|
|
66
|
-
const modalWidth = 1104
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<CxModal
|
|
70
|
-
title={t('system.role.detail_title')}
|
|
71
|
-
isOpen={isOpen}
|
|
72
|
-
onClose={close}
|
|
73
|
-
opeType="detail"
|
|
74
|
-
modalConfig={{
|
|
75
|
-
width: modalWidth,
|
|
76
|
-
styles: roleModalShellStyles,
|
|
77
|
-
rootClassName: 'cx-modal-role-assign',
|
|
78
|
-
}}>
|
|
79
|
-
{loading ? (
|
|
80
|
-
<div className="flex justify-center py-20">
|
|
81
|
-
<Spin size="large" />
|
|
82
|
-
</div>
|
|
83
|
-
) : (
|
|
84
|
-
<Form className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
|
|
85
|
-
<div className="grid shrink-0 grid-cols-1 gap-4 md:grid-cols-2">
|
|
86
|
-
<Form.Item label={t('system.role.name')}>
|
|
87
|
-
<div className="flex items-center gap-2 text-sm text-gray-900 dark:text-gray-100">
|
|
88
|
-
{detailData.name || '-'}
|
|
89
|
-
{detailData.editFlag === 1 && (
|
|
90
|
-
<span className="px-2 py-0.5 text-xs bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">
|
|
91
|
-
{t('system.role.system_role_badge')}
|
|
92
|
-
</span>
|
|
93
|
-
)}
|
|
94
|
-
</div>
|
|
95
|
-
</Form.Item>
|
|
96
|
-
|
|
97
|
-
<Form.Item label={t('common.description')}>
|
|
98
|
-
<div className="text-sm text-gray-900 dark:text-gray-100 break-words">
|
|
99
|
-
{detailData.description || '-'}
|
|
100
|
-
</div>
|
|
101
|
-
</Form.Item>
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
<div className="flex min-h-0 flex-1 flex-col gap-2 overflow-hidden">
|
|
105
|
-
<h3 className="shrink-0 text-sm font-semibold text-gray-900 dark:text-gray-100">
|
|
106
|
-
{t('system.role.permissions_assignment')}
|
|
107
|
-
</h3>
|
|
108
|
-
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
|
|
109
|
-
<RolePermissionAssignPanel
|
|
110
|
-
ref={assignPanelRef}
|
|
111
|
-
active={isOpen}
|
|
112
|
-
bootstrapKey={assignBootstrapKey}
|
|
113
|
-
maxHeightClass="h-full min-h-0 w-full flex-1 overflow-hidden"
|
|
114
|
-
roleId={detailData.id ?? null}
|
|
115
|
-
readOnly
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
</Form>
|
|
120
|
-
)}
|
|
121
|
-
</CxModal>
|
|
122
|
-
)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
DetailModal.displayName = 'DetailModal'
|
|
126
|
-
|
|
127
|
-
export default DetailModal
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 角色「分配权限」面板:带多段 `:` 的权限码分支配置。
|
|
3
|
-
* - 仅当 **code 首段** 在本表有配置时,才按 `prefix` 拆成多个「分组」;否则整菜单一块、标题只跟菜单走。
|
|
4
|
-
* - `prefix` 按 **从长到短** 匹配(先 `system+file`,再 `system+chat`)。
|
|
5
|
-
* - `system` 第二段非 `file`/`chat`/`auth` 且未命中分支时走 `defaultSuffixI18nKey`(「公共」);码段仅按 `:` 拆分,首段须为字面 `system`/`dict` 才走本表。
|
|
6
|
-
* - `dict`:`dict:cate:*` 与第二段 `cate-*`(如 `dict:cate-add`)归为「数据字典分类」;`dict:add` 等为默认组,标题为「挂载菜单一级父 > 二级菜单名」。
|
|
7
|
-
*
|
|
8
|
-
* i18n:`suffixI18nKey` / `menuBaseOverrideI18nKey` 为 `system.permission` 下的相对键(见 runtime 里拼接)。
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export type PermissionAssignCodeBranch = {
|
|
12
|
-
readonly prefix: readonly string[]
|
|
13
|
-
/** `system.permission.${suffixI18nKey}` */
|
|
14
|
-
readonly suffixI18nKey: string
|
|
15
|
-
/** 分支排序权重,越小越靠前(用于控制分组显示顺序) */
|
|
16
|
-
readonly sortOrder?: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type PermissionAssignFirstSegmentConfig = {
|
|
20
|
-
/**
|
|
21
|
-
* 有 code 分支时,左侧菜单文案用该 i18n 键,**不再**用树算出的菜单 base。
|
|
22
|
-
* 例:`system` → 固定「系统」。
|
|
23
|
-
*/
|
|
24
|
-
readonly menuBaseOverrideI18nKey?: string
|
|
25
|
-
/**
|
|
26
|
-
* `dict`:左侧只显示 **挂载菜单的一级父级** 名称(如「系统管理」),与文案示例一致。
|
|
27
|
-
*/
|
|
28
|
-
readonly menuBaseUseParentOfAnchor?: boolean
|
|
29
|
-
readonly branches: readonly PermissionAssignCodeBranch[]
|
|
30
|
-
/**
|
|
31
|
-
* 命中首段且已配置本表,但未命中任一 `prefix` 时(如 `system:xxx` 两段、`dict:add` 两段)。
|
|
32
|
-
* `system` 下两段且非 file/chat/auth → 公共;`dict` 下非 dict:cate 前缀 → 数据字典。
|
|
33
|
-
*/
|
|
34
|
-
readonly defaultSuffixI18nKey?: string
|
|
35
|
-
/**
|
|
36
|
-
* default 分支的排序权重,越小越靠前。默认为 500(中间值)。
|
|
37
|
-
*/
|
|
38
|
-
readonly defaultSortOrder?: number
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** key = permission code 首段小写 */
|
|
42
|
-
export const PERMISSION_ASSIGN_CODE_BY_FIRST_SEGMENT: Readonly<
|
|
43
|
-
Record<string, PermissionAssignFirstSegmentConfig>
|
|
44
|
-
> = {
|
|
45
|
-
system: {
|
|
46
|
-
menuBaseOverrideI18nKey: 'assign_panel_code.system_left',
|
|
47
|
-
branches: [
|
|
48
|
-
{
|
|
49
|
-
prefix: ['system', 'file'],
|
|
50
|
-
suffixI18nKey: 'assign_panel_code.suffix_system_file',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
prefix: ['system', 'chat'],
|
|
54
|
-
suffixI18nKey: 'assign_panel_code.suffix_system_chat',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
prefix: ['system', 'auth'],
|
|
58
|
-
suffixI18nKey: 'assign_panel_code.suffix_system_auth',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
defaultSuffixI18nKey: 'assign_panel_code.suffix_system_public',
|
|
62
|
-
},
|
|
63
|
-
dict: {
|
|
64
|
-
menuBaseUseParentOfAnchor: true,
|
|
65
|
-
branches: [
|
|
66
|
-
{
|
|
67
|
-
prefix: ['dict', 'cate'],
|
|
68
|
-
suffixI18nKey: 'assign_panel_code.suffix_dict_cate',
|
|
69
|
-
sortOrder: 1, // 数据字典分类排在前面
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
defaultSuffixI18nKey: 'assign_panel_code.suffix_dict_default',
|
|
73
|
-
},
|
|
74
|
-
knowledge: {
|
|
75
|
-
menuBaseUseParentOfAnchor: true,
|
|
76
|
-
branches: [
|
|
77
|
-
{
|
|
78
|
-
prefix: ['knowledge', 'doc'],
|
|
79
|
-
suffixI18nKey: 'assign_panel_code.suffix_knowledge_doc',
|
|
80
|
-
sortOrder: 999, // 知识库文档排在后面
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
defaultSuffixI18nKey: 'assign_panel_code.suffix_knowledge_default',
|
|
84
|
-
defaultSortOrder: 100, // 知识库默认分支排在前面
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { editRolePermissionAPI } from '@/api/system/role'
|
|
2
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
3
|
-
import { CxModal, useCxModal } from '@cx-ui'
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
useImperativeHandle,
|
|
7
|
-
useRef,
|
|
8
|
-
useState
|
|
9
|
-
} from 'react'
|
|
10
|
-
import { useTranslation } from 'react-i18next'
|
|
11
|
-
import { roleModalShellStyles } from './role-modal-shell-styles'
|
|
12
|
-
import RolePermissionAssignPanel, {
|
|
13
|
-
type RolePermissionAssignPanelHandle,
|
|
14
|
-
} from './role-permission-assign-panel'
|
|
15
|
-
|
|
16
|
-
export type PermissionModalOpenPayload = {
|
|
17
|
-
record: { id: string | number; name?: string }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const PermissionModal = forwardRef<
|
|
21
|
-
{ open: (p: PermissionModalOpenPayload) => void; close: () => void },
|
|
22
|
-
{ onSaved?: () => void | Promise<void> }
|
|
23
|
-
>(function PermissionModal({ onSaved }, ref) {
|
|
24
|
-
const { t } = useTranslation()
|
|
25
|
-
const { showToast } = useToast()
|
|
26
|
-
const panelRef = useRef<RolePermissionAssignPanelHandle>(null)
|
|
27
|
-
const [assignBootstrapKey, setAssignBootstrapKey] = useState(0)
|
|
28
|
-
const [roleRecord, setRoleRecord] = useState<PermissionModalOpenPayload['record'] | null>(null)
|
|
29
|
-
|
|
30
|
-
const modal = useCxModal({
|
|
31
|
-
onOpen: (payload) => {
|
|
32
|
-
const record = payload.data?.record
|
|
33
|
-
if (record) {
|
|
34
|
-
setRoleRecord(record)
|
|
35
|
-
setAssignBootstrapKey((k) => k + 1)
|
|
36
|
-
panelRef.current?.reset()
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
onClose: () => {
|
|
40
|
-
setRoleRecord(null)
|
|
41
|
-
panelRef.current?.reset()
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const { isOpen, close } = modal
|
|
46
|
-
|
|
47
|
-
const handleSave = async () => {
|
|
48
|
-
if (!roleRecord) return
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
const payload = panelRef.current?.getPayload()
|
|
52
|
-
if (!payload) {
|
|
53
|
-
showToast(t('common.error'), 'error')
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
const { menuId, apiId } = payload.rolePermissionCreateDTO
|
|
57
|
-
await editRolePermissionAPI(roleRecord.id, { menuId, apiId })
|
|
58
|
-
showToast(t('common.saved'), 'success')
|
|
59
|
-
await onSaved?.()
|
|
60
|
-
close()
|
|
61
|
-
} catch (e: any) {
|
|
62
|
-
console.log(e?.message || t('common.error'))
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
useImperativeHandle(
|
|
67
|
-
ref,
|
|
68
|
-
() => ({
|
|
69
|
-
open: (payload: PermissionModalOpenPayload) => {
|
|
70
|
-
modal.open({ opeType: 'edit', data: { record: payload.record } })
|
|
71
|
-
},
|
|
72
|
-
close,
|
|
73
|
-
}),
|
|
74
|
-
[modal.open, close],
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
const title =
|
|
78
|
-
t('system.role.permissions_assignment') +
|
|
79
|
-
(roleRecord?.name ? ` — ${roleRecord.name}` : '')
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<CxModal
|
|
83
|
-
isOpen={isOpen}
|
|
84
|
-
title={title}
|
|
85
|
-
onClose={close}
|
|
86
|
-
opeType="edit"
|
|
87
|
-
onSubmit={handleSave}
|
|
88
|
-
modalConfig={{
|
|
89
|
-
width: 1104,
|
|
90
|
-
styles: roleModalShellStyles,
|
|
91
|
-
rootClassName: 'cx-modal-role-assign',
|
|
92
|
-
}}>
|
|
93
|
-
<div className="flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden">
|
|
94
|
-
{roleRecord ? (
|
|
95
|
-
<RolePermissionAssignPanel
|
|
96
|
-
ref={panelRef}
|
|
97
|
-
key={String(roleRecord.id)}
|
|
98
|
-
active={isOpen}
|
|
99
|
-
bootstrapKey={assignBootstrapKey}
|
|
100
|
-
maxHeightClass="h-full min-h-0 w-full flex-1 overflow-hidden"
|
|
101
|
-
roleId={roleRecord.id}
|
|
102
|
-
/>
|
|
103
|
-
) : null}
|
|
104
|
-
</div>
|
|
105
|
-
</CxModal>
|
|
106
|
-
)
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
PermissionModal.displayName = 'PermissionModal'
|
|
110
|
-
|
|
111
|
-
export default PermissionModal
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CxModal `styles`:与 less 中 `cx-modal-role-assign` 一起用。
|
|
3
|
-
* `container` 必须写明 height/maxHeight,否则会沿用 CxModal 默认的 85vh,与角色弹窗期望高度不一致。
|
|
4
|
-
*/
|
|
5
|
-
export const roleModalShellStyles = {
|
|
6
|
-
container: {
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column' as const,
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
height: 'min(95dvh, 95vh)',
|
|
11
|
-
maxHeight: 'min(95dvh, 95vh)',
|
|
12
|
-
},
|
|
13
|
-
body: {
|
|
14
|
-
/* 0% 基础高度,避免与 maxHeight 双重约束把内容区压短后裁切 */
|
|
15
|
-
flex: '1 1 0%',
|
|
16
|
-
minHeight: 0,
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'column' as const,
|
|
19
|
-
overflow: 'hidden',
|
|
20
|
-
},
|
|
21
|
-
}
|