cx-chat 0.0.1 → 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 -264
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { Form } from 'antd'
|
|
2
|
-
import dayjs from 'dayjs'
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react'
|
|
4
|
-
import { useTranslation } from 'react-i18next'
|
|
5
|
-
|
|
6
|
-
import { getBusinessRulesTermDetailAPI } from '@/api/menus/business-rules'
|
|
7
|
-
import { getDepartmentTreeAPI } from '@/api/system/department'
|
|
8
|
-
import { CxModal, CxTag, useCxModal } from '@cx-ui'
|
|
9
|
-
|
|
10
|
-
type OpenPayload = {
|
|
11
|
-
opeType?: string
|
|
12
|
-
opeId?: string | number
|
|
13
|
-
data?: any
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type Props = {
|
|
17
|
-
onCancel?: () => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function unwrapTree(res: unknown): any[] {
|
|
21
|
-
const body = (res as any)?.data?.data ?? (res as any)?.data ?? res
|
|
22
|
-
if (Array.isArray(body)) return body
|
|
23
|
-
if (body && typeof body === 'object' && Array.isArray((body as any).children)) {
|
|
24
|
-
return [(body as any)]
|
|
25
|
-
}
|
|
26
|
-
return []
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function idToNameMap(nodes: any[]): Map<string, string> {
|
|
30
|
-
const m = new Map<string, string>()
|
|
31
|
-
const walk = (list: any[]) => {
|
|
32
|
-
for (const n of list) {
|
|
33
|
-
const id = n?.id ?? n?.key
|
|
34
|
-
if (id != null && id !== '') {
|
|
35
|
-
m.set(String(id), String(n?.name ?? n?.label ?? n?.title ?? id))
|
|
36
|
-
}
|
|
37
|
-
if (Array.isArray(n?.children) && n.children.length) walk(n.children)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
walk(nodes)
|
|
41
|
-
return m
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** 术语详情弹窗 */
|
|
45
|
-
const DetailModal = forwardRef<
|
|
46
|
-
{ close: () => void; open: (payload?: OpenPayload) => void },
|
|
47
|
-
Props
|
|
48
|
-
>(function DetailModal(props, ref) {
|
|
49
|
-
const { onCancel } = props
|
|
50
|
-
const { t } = useTranslation()
|
|
51
|
-
|
|
52
|
-
const [fetchId, setFetchId] = useState<string | null>(null)
|
|
53
|
-
const [detail, setDetail] = useState<any | null>(null)
|
|
54
|
-
const [idNames, setIdNames] = useState<Map<string, string>>(() => new Map())
|
|
55
|
-
const [loading, setLoading] = useState(false)
|
|
56
|
-
|
|
57
|
-
const modal = useCxModal({
|
|
58
|
-
onOpen: (payload) => {
|
|
59
|
-
const id = payload?.opeId ?? payload?.data?.id
|
|
60
|
-
setFetchId(id != null && String(id) !== '' ? String(id) : null)
|
|
61
|
-
setDetail(null)
|
|
62
|
-
},
|
|
63
|
-
onClose: () => {
|
|
64
|
-
setFetchId(null)
|
|
65
|
-
setDetail(null)
|
|
66
|
-
onCancel?.()
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const { isOpen, close } = modal
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (!isOpen || !fetchId) return
|
|
74
|
-
let cancelled = false
|
|
75
|
-
;(async () => {
|
|
76
|
-
setLoading(true)
|
|
77
|
-
try {
|
|
78
|
-
const [dRes, treeRes] = await Promise.all([
|
|
79
|
-
getBusinessRulesTermDetailAPI(fetchId),
|
|
80
|
-
getDepartmentTreeAPI(),
|
|
81
|
-
])
|
|
82
|
-
if (cancelled) return
|
|
83
|
-
const raw = (dRes as any)?.data?.data ?? (dRes as any)?.data
|
|
84
|
-
setDetail(raw)
|
|
85
|
-
setIdNames(idToNameMap(unwrapTree(treeRes)))
|
|
86
|
-
} catch {
|
|
87
|
-
if (!cancelled) setDetail(null)
|
|
88
|
-
} finally {
|
|
89
|
-
if (!cancelled) setLoading(false)
|
|
90
|
-
}
|
|
91
|
-
})()
|
|
92
|
-
return () => {
|
|
93
|
-
cancelled = true
|
|
94
|
-
}
|
|
95
|
-
}, [isOpen, fetchId])
|
|
96
|
-
|
|
97
|
-
const title = useMemo(() => t('menus.business_rules.detail'), [t])
|
|
98
|
-
|
|
99
|
-
useImperativeHandle(
|
|
100
|
-
ref,
|
|
101
|
-
() => ({
|
|
102
|
-
open: modal.open,
|
|
103
|
-
close,
|
|
104
|
-
}),
|
|
105
|
-
[modal.open, close],
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
const record = detail
|
|
109
|
-
const departmentIds: string[] = Array.isArray(record?.departmentIds)
|
|
110
|
-
? record.departmentIds.map((x: any) => String(x))
|
|
111
|
-
: []
|
|
112
|
-
const createTimeStr = record?.createTime
|
|
113
|
-
? dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss')
|
|
114
|
-
: '-'
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<CxModal
|
|
118
|
-
isOpen={isOpen}
|
|
119
|
-
modalConfig={{ width: 640 }}
|
|
120
|
-
opeType="detail"
|
|
121
|
-
submitting={loading}
|
|
122
|
-
title={title}
|
|
123
|
-
onClose={close}
|
|
124
|
-
actions={[]}
|
|
125
|
-
>
|
|
126
|
-
{loading && !record ? (
|
|
127
|
-
<div className="py-8 text-center text-sm text-gray-500">{t('common.loading')}</div>
|
|
128
|
-
) : !record ? (
|
|
129
|
-
<div className="py-8 text-center text-sm text-gray-500">
|
|
130
|
-
{t('menus.business_rules.detail_load_failed')}
|
|
131
|
-
</div>
|
|
132
|
-
) : (
|
|
133
|
-
<div className="grid grid-cols-1 md:grid-cols-2">
|
|
134
|
-
<Form.Item label={t('menus.business_rules.fields.term')} className="!mb-0">
|
|
135
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">{record?.term ?? '-'}</div>
|
|
136
|
-
</Form.Item>
|
|
137
|
-
|
|
138
|
-
<Form.Item label={t('menus.business_rules.fields.create_time')} className="!mb-0">
|
|
139
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">{createTimeStr}</div>
|
|
140
|
-
</Form.Item>
|
|
141
|
-
|
|
142
|
-
<Form.Item label={t('menus.business_rules.col_audit_status')} className="!mb-0">
|
|
143
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
144
|
-
{record?.auditStatus == null ? (
|
|
145
|
-
<span className="text-gray-400">-</span>
|
|
146
|
-
) : (
|
|
147
|
-
<CxTag.Enum value={Number(record.auditStatus)} enumKey="auditStatus" />
|
|
148
|
-
)}
|
|
149
|
-
</div>
|
|
150
|
-
</Form.Item>
|
|
151
|
-
|
|
152
|
-
<Form.Item label={t('common.status')} className="!mb-0">
|
|
153
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
154
|
-
{record?.status == null ? '-' : <CxTag.Enabled value={record.status} />}
|
|
155
|
-
</div>
|
|
156
|
-
</Form.Item>
|
|
157
|
-
|
|
158
|
-
<Form.Item
|
|
159
|
-
label={t('menus.business_rules.fields.definition')}
|
|
160
|
-
className="!mb-0 md:col-span-2"
|
|
161
|
-
>
|
|
162
|
-
<div className="whitespace-pre-wrap break-words text-sm text-gray-900 dark:text-gray-100">
|
|
163
|
-
{record?.definition ?? '-'}
|
|
164
|
-
</div>
|
|
165
|
-
</Form.Item>
|
|
166
|
-
|
|
167
|
-
<Form.Item label={t('menus.business_rules.fields.scope')} className="!mb-0 md:col-span-2">
|
|
168
|
-
{departmentIds.length ? (
|
|
169
|
-
<div className="flex flex-wrap gap-2">
|
|
170
|
-
{departmentIds.map((did) => (
|
|
171
|
-
<CxTag key={did} color="blue">
|
|
172
|
-
{idNames.get(did) ?? did}
|
|
173
|
-
</CxTag>
|
|
174
|
-
))}
|
|
175
|
-
</div>
|
|
176
|
-
) : (
|
|
177
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">-</div>
|
|
178
|
-
)}
|
|
179
|
-
</Form.Item>
|
|
180
|
-
</div>
|
|
181
|
-
)}
|
|
182
|
-
</CxModal>
|
|
183
|
-
)
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
export default DetailModal
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useState } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { Spin } from 'antd'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
getBusinessRuleScopeAPI,
|
|
7
|
-
updateBusinessRulesTermScopeAPI,
|
|
8
|
-
} from '@/api/menus/business-rules'
|
|
9
|
-
import { getDepartmentTreeAPI } from '@/api/system/department'
|
|
10
|
-
import { normalizeTreeAPIResult } from '@/components/table-view/components/tree-api-normalize'
|
|
11
|
-
import { useModalSubmit } from '@/hooks/useModalSubmit'
|
|
12
|
-
import { CxModal, CxTree, useCxModal } from '@cx-ui'
|
|
13
|
-
|
|
14
|
-
type OpenPayload = {
|
|
15
|
-
opeType?: string
|
|
16
|
-
data?: any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type Props = {
|
|
20
|
-
onCancel?: () => void
|
|
21
|
-
onOk?: (values: any) => void | Promise<void>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** 与部门管理 / ListPageView 左侧树一致 */
|
|
25
|
-
const DEPT_TREE_FIELD_NAMES = {
|
|
26
|
-
id: 'id',
|
|
27
|
-
label: 'name',
|
|
28
|
-
children: 'children',
|
|
29
|
-
} as const
|
|
30
|
-
|
|
31
|
-
const SCOPE_MODAL_WIDTH = 640
|
|
32
|
-
const SCOPE_MODAL_HEIGHT = 'min(85dvh, 85vh)'
|
|
33
|
-
|
|
34
|
-
const scopeModalShellStyles = {
|
|
35
|
-
container: {
|
|
36
|
-
display: 'flex',
|
|
37
|
-
flexDirection: 'column' as const,
|
|
38
|
-
overflow: 'hidden',
|
|
39
|
-
height: SCOPE_MODAL_HEIGHT,
|
|
40
|
-
maxHeight: SCOPE_MODAL_HEIGHT,
|
|
41
|
-
},
|
|
42
|
-
body: {
|
|
43
|
-
flex: '1 1 0%',
|
|
44
|
-
minHeight: 0,
|
|
45
|
-
display: 'flex',
|
|
46
|
-
flexDirection: 'column' as const,
|
|
47
|
-
overflow: 'hidden',
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function unwrapScopeIds(res: unknown): string[] {
|
|
52
|
-
const body = (res as any)?.data?.data ?? (res as any)?.data
|
|
53
|
-
if (Array.isArray(body)) return body.map((x) => String(x))
|
|
54
|
-
return []
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function collectAllTreeNodeKeys(
|
|
58
|
-
nodes: any[] | undefined,
|
|
59
|
-
idKey: string,
|
|
60
|
-
childrenKey: string,
|
|
61
|
-
): (string | number)[] {
|
|
62
|
-
const keys: (string | number)[] = []
|
|
63
|
-
const walk = (list: any[]) => {
|
|
64
|
-
for (const n of list) {
|
|
65
|
-
const id = n?.[idKey]
|
|
66
|
-
if (id !== undefined && id !== null) keys.push(id)
|
|
67
|
-
const children = n?.[childrenKey]
|
|
68
|
-
if (Array.isArray(children) && children.length) walk(children)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (Array.isArray(nodes)) walk(nodes)
|
|
72
|
-
return keys
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function normalizeTreeIdsToString(
|
|
76
|
-
nodes: any[] | undefined,
|
|
77
|
-
idKey: string,
|
|
78
|
-
childrenKey: string,
|
|
79
|
-
): any[] {
|
|
80
|
-
if (!Array.isArray(nodes)) return []
|
|
81
|
-
return nodes.map((n) => {
|
|
82
|
-
const id = n?.[idKey]
|
|
83
|
-
const children = n?.[childrenKey]
|
|
84
|
-
return {
|
|
85
|
-
...n,
|
|
86
|
-
[idKey]: id != null ? String(id) : id,
|
|
87
|
-
[childrenKey]: Array.isArray(children)
|
|
88
|
-
? normalizeTreeIdsToString(children, idKey, childrenKey)
|
|
89
|
-
: children,
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const ScopeModal = forwardRef<
|
|
95
|
-
{ close: () => void; open: (payload?: OpenPayload) => void },
|
|
96
|
-
Props
|
|
97
|
-
>(function ScopeModal(props, ref) {
|
|
98
|
-
const { onCancel, onOk } = props
|
|
99
|
-
const { t } = useTranslation()
|
|
100
|
-
const { submitting, handleSubmit } = useModalSubmit()
|
|
101
|
-
const [record, setRecord] = useState<any>(null)
|
|
102
|
-
const [treeData, setTreeData] = useState<any[]>([])
|
|
103
|
-
const [expandedKeys, setExpandedKeys] = useState<Set<string | number>>(new Set())
|
|
104
|
-
const [departmentIds, setDepartmentIds] = useState<string[]>([])
|
|
105
|
-
const [scopeLoadState, setScopeLoadState] = useState('')
|
|
106
|
-
|
|
107
|
-
const idKey = DEPT_TREE_FIELD_NAMES.id
|
|
108
|
-
const childrenKey = DEPT_TREE_FIELD_NAMES.children
|
|
109
|
-
|
|
110
|
-
const loadScopeAndTree = useCallback(async (businessRuleId: string) => {
|
|
111
|
-
setScopeLoadState('loading')
|
|
112
|
-
const [scopeRes, treeRes] = await Promise.all([
|
|
113
|
-
getBusinessRuleScopeAPI(businessRuleId),
|
|
114
|
-
getDepartmentTreeAPI(),
|
|
115
|
-
])
|
|
116
|
-
const raw = normalizeTreeAPIResult(treeRes)
|
|
117
|
-
const normalized = normalizeTreeIdsToString(
|
|
118
|
-
Array.isArray(raw) ? raw : [],
|
|
119
|
-
idKey,
|
|
120
|
-
childrenKey,
|
|
121
|
-
)
|
|
122
|
-
setTreeData(normalized)
|
|
123
|
-
if (normalized.length) {
|
|
124
|
-
setExpandedKeys(new Set(collectAllTreeNodeKeys(normalized, idKey, childrenKey)))
|
|
125
|
-
} else {
|
|
126
|
-
setExpandedKeys(new Set())
|
|
127
|
-
}
|
|
128
|
-
const ids = unwrapScopeIds(scopeRes).map((x) => String(x))
|
|
129
|
-
setDepartmentIds(ids)
|
|
130
|
-
setScopeLoadState('done')
|
|
131
|
-
}, [childrenKey, idKey])
|
|
132
|
-
|
|
133
|
-
const modal = useCxModal({
|
|
134
|
-
onOpen: (payload) => {
|
|
135
|
-
const r = payload?.data ?? null
|
|
136
|
-
setRecord(r)
|
|
137
|
-
setTreeData([])
|
|
138
|
-
setDepartmentIds([])
|
|
139
|
-
setExpandedKeys(new Set())
|
|
140
|
-
const id = r?.id != null ? String(r.id) : ''
|
|
141
|
-
if (!id) {
|
|
142
|
-
setScopeLoadState('error')
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
setScopeLoadState('loading')
|
|
146
|
-
void loadScopeAndTree(id).catch(() => {
|
|
147
|
-
setScopeLoadState('error')
|
|
148
|
-
setDepartmentIds([])
|
|
149
|
-
})
|
|
150
|
-
},
|
|
151
|
-
onClose: () => {
|
|
152
|
-
setRecord(null)
|
|
153
|
-
setTreeData([])
|
|
154
|
-
setDepartmentIds([])
|
|
155
|
-
setScopeLoadState('')
|
|
156
|
-
onCancel?.()
|
|
157
|
-
},
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
const { isOpen, close: hideModal } = modal
|
|
161
|
-
|
|
162
|
-
const title = useMemo(() => t('menus.business_rules.actions.scope'), [t])
|
|
163
|
-
|
|
164
|
-
const close = () => {
|
|
165
|
-
hideModal()
|
|
166
|
-
setRecord(null)
|
|
167
|
-
setTreeData([])
|
|
168
|
-
setDepartmentIds([])
|
|
169
|
-
setScopeLoadState('')
|
|
170
|
-
onCancel?.()
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const toggleExpand = useCallback((key: string | number, e?: React.MouseEvent) => {
|
|
174
|
-
if (e) e.stopPropagation()
|
|
175
|
-
setExpandedKeys((prev) => {
|
|
176
|
-
const next = new Set(prev)
|
|
177
|
-
if (next.has(key)) next.delete(key)
|
|
178
|
-
else next.add(key)
|
|
179
|
-
return next
|
|
180
|
-
})
|
|
181
|
-
}, [])
|
|
182
|
-
|
|
183
|
-
const onTreeCheck = useCallback((key: string | number, checked: boolean) => {
|
|
184
|
-
const k = String(key)
|
|
185
|
-
setDepartmentIds((prev) => {
|
|
186
|
-
const s = new Set(prev.map(String))
|
|
187
|
-
if (checked) s.add(k)
|
|
188
|
-
else s.delete(k)
|
|
189
|
-
return Array.from(s)
|
|
190
|
-
})
|
|
191
|
-
}, [])
|
|
192
|
-
|
|
193
|
-
const renderDeptLabel = useCallback((node: any) => {
|
|
194
|
-
return String(node?.[DEPT_TREE_FIELD_NAMES.label] ?? node?.name ?? node?.label ?? '-')
|
|
195
|
-
}, [])
|
|
196
|
-
|
|
197
|
-
const onOkClick = async () => {
|
|
198
|
-
if (scopeLoadState === 'loading' || !record?.id) return
|
|
199
|
-
const result = await handleSubmit({
|
|
200
|
-
opeType: 'edit',
|
|
201
|
-
validate: async () => ({ departmentIds }),
|
|
202
|
-
editAPI: updateBusinessRulesTermScopeAPI,
|
|
203
|
-
transform: (values) => ({
|
|
204
|
-
id: record.id,
|
|
205
|
-
departmentIds: values.departmentIds ?? [],
|
|
206
|
-
}),
|
|
207
|
-
onSuccess: async ({ payload }) => {
|
|
208
|
-
await onOk?.(payload)
|
|
209
|
-
},
|
|
210
|
-
})
|
|
211
|
-
if (result) close()
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
useImperativeHandle(
|
|
215
|
-
ref,
|
|
216
|
-
() => ({
|
|
217
|
-
open: modal.open,
|
|
218
|
-
close,
|
|
219
|
-
}),
|
|
220
|
-
[modal.open, close],
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
const bodyLoading = scopeLoadState === 'loading'
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<CxModal
|
|
227
|
-
isOpen={isOpen}
|
|
228
|
-
opeType="edit"
|
|
229
|
-
submitting={submitting || bodyLoading}
|
|
230
|
-
title={title}
|
|
231
|
-
onClose={close}
|
|
232
|
-
onSubmit={onOkClick}
|
|
233
|
-
modalConfig={{
|
|
234
|
-
width: SCOPE_MODAL_WIDTH,
|
|
235
|
-
styles: {
|
|
236
|
-
...scopeModalShellStyles,
|
|
237
|
-
},
|
|
238
|
-
rootClassName: 'cx-modal-content-fill',
|
|
239
|
-
}}
|
|
240
|
-
>
|
|
241
|
-
<div className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
|
|
242
|
-
{bodyLoading ? (
|
|
243
|
-
<div className="flex flex-1 items-center justify-center py-16">
|
|
244
|
-
<Spin size="large" />
|
|
245
|
-
</div>
|
|
246
|
-
) : (
|
|
247
|
-
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
|
|
248
|
-
<div className="min-h-0 flex-1 overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800/30">
|
|
249
|
-
<div className="h-full min-h-[320px] overflow-y-auto p-2 custom-scrollbar">
|
|
250
|
-
<CxTree
|
|
251
|
-
treeData={treeData}
|
|
252
|
-
fieldNames={{ id: idKey, children: childrenKey }}
|
|
253
|
-
expandedKeys={expandedKeys}
|
|
254
|
-
selectedKey={null}
|
|
255
|
-
onSelect={() => {}}
|
|
256
|
-
onToggleExpand={toggleExpand}
|
|
257
|
-
checkable
|
|
258
|
-
checkedKeys={departmentIds}
|
|
259
|
-
onCheck={onTreeCheck}
|
|
260
|
-
renderLabel={renderDeptLabel}
|
|
261
|
-
emptyText={t('common.no_data')}
|
|
262
|
-
/>
|
|
263
|
-
</div>
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
)}
|
|
267
|
-
</div>
|
|
268
|
-
</CxModal>
|
|
269
|
-
)
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
export default ScopeModal
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle, useMemo, useState } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
|
|
4
|
-
import { useModalSubmit } from '@/hooks/useModalSubmit'
|
|
5
|
-
import {
|
|
6
|
-
addBusinessRulesTermAPI,
|
|
7
|
-
editBusinessRulesTermAPI,
|
|
8
|
-
} from '@/api/menus/business-rules'
|
|
9
|
-
import { CxForm, CxFormItem, CxInput, CxModal, useCxModal } from '@cx-ui'
|
|
10
|
-
|
|
11
|
-
type OpenPayload = {
|
|
12
|
-
opeType?: string
|
|
13
|
-
opeId?: string | number
|
|
14
|
-
data?: any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type Props = {
|
|
18
|
-
onCancel?: () => void
|
|
19
|
-
onOk?: (values: any) => void | Promise<void>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** 新增/编辑术语弹窗 */
|
|
23
|
-
const SubmitModal = forwardRef<{ close: () => void; open: (payload?: OpenPayload) => void }, Props>(
|
|
24
|
-
function SubmitModal(props, ref) {
|
|
25
|
-
const { onCancel, onOk } = props
|
|
26
|
-
const { t } = useTranslation()
|
|
27
|
-
const [opeId, setOpeId] = useState<string | number | undefined>(undefined)
|
|
28
|
-
|
|
29
|
-
const modal = useCxModal({
|
|
30
|
-
onOpen: (payload) => {
|
|
31
|
-
setOpeId(payload?.opeId)
|
|
32
|
-
form.resetFields()
|
|
33
|
-
const type = payload?.opeType ?? 'add'
|
|
34
|
-
if (type === 'edit' && payload?.data) {
|
|
35
|
-
form.setFieldsValue({
|
|
36
|
-
term: payload.data.term,
|
|
37
|
-
definition: payload.data.definition,
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
onClose: () => {
|
|
42
|
-
setOpeId(undefined)
|
|
43
|
-
onCancel?.()
|
|
44
|
-
},
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const { isOpen, close: hideModal, form, opeType } = modal
|
|
48
|
-
const { submitting, handleSubmit } = useModalSubmit()
|
|
49
|
-
|
|
50
|
-
const title = useMemo(
|
|
51
|
-
() =>
|
|
52
|
-
opeType === 'add'
|
|
53
|
-
? t('menus.business_rules.add')
|
|
54
|
-
: t('menus.business_rules.edit'),
|
|
55
|
-
[opeType, t],
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
const close = () => {
|
|
59
|
-
hideModal()
|
|
60
|
-
form.resetFields()
|
|
61
|
-
setOpeId(undefined)
|
|
62
|
-
onCancel?.()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const onOkClick = async () => {
|
|
66
|
-
const result = await handleSubmit({
|
|
67
|
-
opeType,
|
|
68
|
-
validate: () => form.validateFields(),
|
|
69
|
-
addAPI: addBusinessRulesTermAPI,
|
|
70
|
-
editAPI: editBusinessRulesTermAPI,
|
|
71
|
-
transform: (values) => ({
|
|
72
|
-
...(opeType === 'edit' ? { id: opeId } : {}),
|
|
73
|
-
term: values.term,
|
|
74
|
-
definition: values.definition,
|
|
75
|
-
}),
|
|
76
|
-
onSuccess: async ({ payload }) => {
|
|
77
|
-
await onOk?.(payload)
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
if (result) close()
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
useImperativeHandle(
|
|
84
|
-
ref,
|
|
85
|
-
() => ({
|
|
86
|
-
open: modal.open,
|
|
87
|
-
close,
|
|
88
|
-
}),
|
|
89
|
-
[modal.open],
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<CxModal
|
|
94
|
-
isOpen={isOpen}
|
|
95
|
-
modalConfig={{ width: 640 }}
|
|
96
|
-
opeType={opeType}
|
|
97
|
-
submitting={submitting}
|
|
98
|
-
title={title}
|
|
99
|
-
onClose={close}
|
|
100
|
-
onSubmit={onOkClick}
|
|
101
|
-
>
|
|
102
|
-
<CxForm
|
|
103
|
-
form={form}
|
|
104
|
-
layout="vertical"
|
|
105
|
-
initialValues={{ term: '', definition: '' }}
|
|
106
|
-
>
|
|
107
|
-
<CxFormItem
|
|
108
|
-
label={t('menus.business_rules.fields.term')}
|
|
109
|
-
name="term"
|
|
110
|
-
rules={[
|
|
111
|
-
{ required: true, message: t('menus.business_rules.rules.term_required') },
|
|
112
|
-
{ whitespace: true, message: t('menus.business_rules.rules.term_required') },
|
|
113
|
-
]}
|
|
114
|
-
>
|
|
115
|
-
<CxInput placeholder={t('menus.business_rules.placeholders.term')} />
|
|
116
|
-
</CxFormItem>
|
|
117
|
-
<CxFormItem
|
|
118
|
-
label={t('menus.business_rules.fields.definition')}
|
|
119
|
-
name="definition"
|
|
120
|
-
rules={[
|
|
121
|
-
{
|
|
122
|
-
required: true,
|
|
123
|
-
message: t('menus.business_rules.rules.definition_required'),
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
whitespace: true,
|
|
127
|
-
message: t('menus.business_rules.rules.definition_required'),
|
|
128
|
-
},
|
|
129
|
-
]}
|
|
130
|
-
>
|
|
131
|
-
<CxInput.Textarea
|
|
132
|
-
rows={5}
|
|
133
|
-
placeholder={t('menus.business_rules.placeholders.definition')}
|
|
134
|
-
/>
|
|
135
|
-
</CxFormItem>
|
|
136
|
-
</CxForm>
|
|
137
|
-
</CxModal>
|
|
138
|
-
)
|
|
139
|
-
},
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
export default SubmitModal
|