@pubinfo/module-rbac 2.0.0-beta.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/package.json +53 -0
- package/src/api/modules/assist/gonggaofuwu.ts +109 -0
- package/src/api/modules/assist/index.ts +5 -0
- package/src/api/modules/assist/qunzujiekou.ts +95 -0
- package/src/api/modules/assist/quyujiekou.ts +97 -0
- package/src/api/modules/assist/typings.d.ts +364 -0
- package/src/api/modules/configData/heibaimingdanfuwu.ts +95 -0
- package/src/api/modules/configData/index.ts +5 -0
- package/src/api/modules/configData/typings.d.ts +347 -0
- package/src/api/modules/configData/xitongpeizhifuwu.ts +322 -0
- package/src/api/modules/configData/zidianfuwu.ts +151 -0
- package/src/api/modules/log/caozuorizhifuwu.ts +37 -0
- package/src/api/modules/log/denglurizhifuwu.ts +37 -0
- package/src/api/modules/log/index.ts +4 -0
- package/src/api/modules/log/typings.d.ts +179 -0
- package/src/api/modules/rbac/gangweijiekou.ts +93 -0
- package/src/api/modules/rbac/index.ts +13 -0
- package/src/api/modules/rbac/jiaosejiekou.ts +124 -0
- package/src/api/modules/rbac/pubJiaosezukongzhiqi.ts +113 -0
- package/src/api/modules/rbac/shujuquanxianzhubiaokongzhiqi.ts +186 -0
- package/src/api/modules/rbac/typings.d.ts +2001 -0
- package/src/api/modules/rbac/yonghujiekou.ts +225 -0
- package/src/api/modules/rbac/yonghushoucangbiaojiekou.ts +93 -0
- package/src/api/modules/rbac/yonghuzuijinchangyongbiaojiekou.ts +72 -0
- package/src/api/modules/rbac/ziyuanjiekou.ts +223 -0
- package/src/api/modules/rbac/zuhuguanlijiekou.ts +91 -0
- package/src/api/modules/rbac/zuzhijiaosebiaokongzhiqi.ts +76 -0
- package/src/api/modules/rbac/zuzhijiekou.ts +171 -0
- package/src/api/request.ts +3 -0
- package/src/assets/icons/403.svg +1 -0
- package/src/assets/icons/403_dark.svg +1 -0
- package/src/assets/icons/404.svg +1 -0
- package/src/assets/icons/404_dark.svg +1 -0
- package/src/assets/icons/add-child.svg +1 -0
- package/src/assets/icons/authority.svg +1 -0
- package/src/assets/icons/authorize.svg +1 -0
- package/src/assets/icons/blacklist-disable.svg +1 -0
- package/src/assets/icons/blacklist-enable.svg +1 -0
- package/src/assets/icons/browser-360.svg +1 -0
- package/src/assets/icons/browser-chrome.svg +1 -0
- package/src/assets/icons/browser-edge.svg +1 -0
- package/src/assets/icons/browser-ie.svg +1 -0
- package/src/assets/icons/browser-other.svg +1 -0
- package/src/assets/icons/browser-qq.svg +1 -0
- package/src/assets/icons/browser-safari.svg +1 -0
- package/src/assets/icons/browser-uc.svg +1 -0
- package/src/assets/icons/change-org.svg +1 -0
- package/src/assets/icons/edit.svg +1 -0
- package/src/assets/icons/empty-data.svg +1 -0
- package/src/assets/icons/favorites.svg +1 -0
- package/src/assets/icons/icard.svg +1 -0
- package/src/assets/icons/icon_animation.svg +1 -0
- package/src/assets/icons/icon_breadcrumb.svg +1 -0
- package/src/assets/icons/icon_copyright.svg +1 -0
- package/src/assets/icons/icon_jt.svg +1 -0
- package/src/assets/icons/icon_layout.svg +1 -0
- package/src/assets/icons/icon_mainpage.svg +1 -0
- package/src/assets/icons/icon_menu.svg +1 -0
- package/src/assets/icons/icon_page_size.svg +1 -0
- package/src/assets/icons/icon_position_type.svg +1 -0
- package/src/assets/icons/icon_safe_manage.svg +1 -0
- package/src/assets/icons/icon_screen_scale.svg +6 -0
- package/src/assets/icons/icon_system_manage.svg +1 -0
- package/src/assets/icons/icon_tabbar.svg +1 -0
- package/src/assets/icons/icon_toolbar.svg +1 -0
- package/src/assets/icons/icon_topbar.svg +1 -0
- package/src/assets/icons/icon_watermark.svg +1 -0
- package/src/assets/icons/image-load-fail.svg +1 -0
- package/src/assets/icons/log-center.svg +1 -0
- package/src/assets/icons/logo-sig.svg +1 -0
- package/src/assets/icons/logo.svg +1 -0
- package/src/assets/icons/mima.svg +1 -0
- package/src/assets/icons/not-data.svg +1 -0
- package/src/assets/icons/org-main.svg +1 -0
- package/src/assets/icons/org-unmain.svg +1 -0
- package/src/assets/icons/process-management.svg +1 -0
- package/src/assets/icons/project-management.svg +1 -0
- package/src/assets/icons/rbac.svg +1 -0
- package/src/assets/icons/remove.svg +1 -0
- package/src/assets/icons/resource-app.svg +1 -0
- package/src/assets/icons/resource-btn.svg +1 -0
- package/src/assets/icons/resource-index.svg +1 -0
- package/src/assets/icons/resource-menu.svg +1 -0
- package/src/assets/icons/resource-nonmenu.svg +1 -0
- package/src/assets/icons/setting-manage.svg +1 -0
- package/src/assets/icons/test.svg +1 -0
- package/src/assets/icons/theme-check-mark.svg +1 -0
- package/src/assets/icons/theme-title.svg +1 -0
- package/src/assets/icons/toolbar-collapse.svg +1 -0
- package/src/assets/icons/tree_icon.svg +1 -0
- package/src/assets/icons/tree_icon_checked.svg +1 -0
- package/src/assets/icons/view.svg +1 -0
- package/src/assets/icons/workbench.svg +1 -0
- package/src/assets/icons/zddata.svg +1 -0
- package/src/assets/icons/zy_checked.svg +1 -0
- package/src/assets/icons/zy_default.svg +1 -0
- package/src/assets/images/layout/item1.webp +0 -0
- package/src/assets/images/layout/item1_dark.webp +0 -0
- package/src/assets/images/layout/item2.webp +0 -0
- package/src/assets/images/layout/item2_dark.webp +0 -0
- package/src/assets/images/layout/item3.webp +0 -0
- package/src/assets/images/layout/item3_dark.webp +0 -0
- package/src/assets/images/layout/item4.webp +0 -0
- package/src/assets/images/layout/item4_dark.webp +0 -0
- package/src/assets/images/layout/item5.webp +0 -0
- package/src/assets/images/layout/item5_dark.webp +0 -0
- package/src/assets/images/page-width/anto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/auto.webp +0 -0
- package/src/assets/images/page-width/auto_dark.webp +0 -0
- package/src/assets/images/page-width/auto_min_w.webp +0 -0
- package/src/assets/images/page-width/auto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/icon_auto.webp +0 -0
- package/src/assets/images/page-width/icon_auto_dark.webp +0 -0
- package/src/assets/images/page-width/icon_auto_min_w.webp +0 -0
- package/src/assets/images/page-width/icon_auto_min_w_dark.webp +0 -0
- package/src/assets/images/page-width/icon_middle.webp +0 -0
- package/src/assets/images/page-width/icon_middle_dark.webp +0 -0
- package/src/assets/images/page-width/icon_middle_max_w.webp +0 -0
- package/src/assets/images/page-width/icon_middle_max_w_dark.webp +0 -0
- package/src/assets/images/page-width/middle.webp +0 -0
- package/src/assets/images/page-width/middle_dark.webp +0 -0
- package/src/assets/images/page-width/middle_max_w.webp +0 -0
- package/src/assets/images/page-width/middle_max_w_dark.webp +0 -0
- package/src/assets/lottie/breadcrumb/dark/enable.json +1 -0
- package/src/assets/lottie/breadcrumb/dark/enableMainMenu.json +1 -0
- package/src/assets/lottie/breadcrumb/dark/style.json +1 -0
- package/src/assets/lottie/breadcrumb/light/enable.json +1 -0
- package/src/assets/lottie/breadcrumb/light/enableMainMenu.json +1 -0
- package/src/assets/lottie/breadcrumb/light/style.json +1 -0
- package/src/assets/lottie/layout/data-test.json +1 -0
- package/src/assets/lottie/layout/data.json +1 -0
- package/src/assets/lottie/menu/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/menu/dark/enableSubMenuCollapseButton.json +1 -0
- package/src/assets/lottie/menu/dark/isRounded.json +1 -0
- package/src/assets/lottie/menu/dark/menuActiveStyle.json +1 -0
- package/src/assets/lottie/menu/dark/subMenuCollapse.json +1 -0
- package/src/assets/lottie/menu/dark/subMenuUniqueOpened.json +1 -0
- package/src/assets/lottie/menu/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/menu/light/enableSubMenuCollapseButton.json +1 -0
- package/src/assets/lottie/menu/light/isRounded.json +1 -0
- package/src/assets/lottie/menu/light/menuActiveStyle.json +1 -0
- package/src/assets/lottie/menu/light/subMenuCollapse.json +1 -0
- package/src/assets/lottie/menu/light/subMenuUniqueOpened.json +1 -0
- package/src/assets/lottie/other/dark/enableCopyright.json +1 -0
- package/src/assets/lottie/other/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/other/dark/switchTabbarAndToolbar.json +1 -0
- package/src/assets/lottie/other/light/enableCopyright.json +1 -0
- package/src/assets/lottie/other/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/other/light/switchTabbarAndToolbar.json +1 -0
- package/src/assets/lottie/page_animation/dark/fadeinout.json +1 -0
- package/src/assets/lottie/page_animation/dark/fadeinout_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/tobottom.json +1 -0
- package/src/assets/lottie/page_animation/dark/tobottom_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/toleft.json +1 -0
- package/src/assets/lottie/page_animation/dark/toleft_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/toright.json +1 -0
- package/src/assets/lottie/page_animation/dark/toright_old.json +1 -0
- package/src/assets/lottie/page_animation/dark/totop.json +1 -0
- package/src/assets/lottie/page_animation/dark/totop_old.json +1 -0
- package/src/assets/lottie/page_animation/light/fadeinout.json +1 -0
- package/src/assets/lottie/page_animation/light/tobottom.json +1 -0
- package/src/assets/lottie/page_animation/light/toleft.json +1 -0
- package/src/assets/lottie/page_animation/light/toright.json +1 -0
- package/src/assets/lottie/page_animation/light/totop.json +1 -0
- package/src/assets/lottie/tabbar/dark/enable.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableHotkeys.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableIcon.json +1 -0
- package/src/assets/lottie/tabbar/dark/enableMemory.json +1 -0
- package/src/assets/lottie/tabbar/dark/style.json +1 -0
- package/src/assets/lottie/tabbar/light/enable.json +1 -0
- package/src/assets/lottie/tabbar/light/enableHotkeys.json +1 -0
- package/src/assets/lottie/tabbar/light/enableIcon.json +1 -0
- package/src/assets/lottie/tabbar/light/enableMemory.json +1 -0
- package/src/assets/lottie/tabbar/light/style.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableColorScheme.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableFullscreen.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableI18n.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableNotification.json +1 -0
- package/src/assets/lottie/toolbar/dark/enablePageReload.json +1 -0
- package/src/assets/lottie/toolbar/dark/enableUserPreferences.json +1 -0
- package/src/assets/lottie/toolbar/dark/navSearchEnable.json +1 -0
- package/src/assets/lottie/toolbar/dark/navSearchEnableHotkeys.json +1 -0
- package/src/assets/lottie/toolbar/light/enableColorScheme.json +1 -0
- package/src/assets/lottie/toolbar/light/enableFullscreen.json +1 -0
- package/src/assets/lottie/toolbar/light/enableI18n.json +1 -0
- package/src/assets/lottie/toolbar/light/enableNotification.json +1 -0
- package/src/assets/lottie/toolbar/light/enablePageReload.json +1 -0
- package/src/assets/lottie/toolbar/light/enableUserPreferences.json +1 -0
- package/src/assets/lottie/toolbar/light/navSearchEnable.json +1 -0
- package/src/assets/lottie/toolbar/light/navSearchEnableHotkeys.json +1 -0
- package/src/assets/lottie/watermark/dark/enableWatermark.json +1 -0
- package/src/assets/lottie/watermark/light/enableWatermark.json +1 -0
- package/src/assets/styles/vxe-table.css +13 -0
- package/src/components/GroupSelector/index.vue +311 -0
- package/src/components/OrgTree/index.vue +91 -0
- package/src/components/OrgUserSelector/OrgSelector.vue +135 -0
- package/src/components/OrgUserSelector/UserSelector.vue +164 -0
- package/src/components/OrgUserSelector/index.ts +47 -0
- package/src/components/OrgUserSelector/provider.ts +373 -0
- package/src/components/ResourceSelector/enum.ts +5 -0
- package/src/components/ResourceSelector/hooks/useAppAndResource.ts +96 -0
- package/src/components/ResourceSelector/index.vue +432 -0
- package/src/composables/useLottie.ts +65 -0
- package/src/index.ts +31 -0
- package/src/interface.ts +54 -0
- package/src/routes/index.ts +156 -0
- package/src/routes/modules/authority.manage.menu.ts +105 -0
- package/src/routes/modules/log.manage.menu.ts +45 -0
- package/src/routes/modules/safe.manage.menu.ts +71 -0
- package/src/routes/modules/stylesetting.manage.menu.ts +130 -0
- package/src/routes/modules/system.manage.menu.ts +92 -0
- package/src/stores/index.ts +1 -0
- package/src/views/blackWhiteList/components/drawerBlackWhiteList.vue +132 -0
- package/src/views/blackWhiteList/enum.ts +7 -0
- package/src/views/blackWhiteList/index.vue +309 -0
- package/src/views/blackWhiteList/types.ts +4 -0
- package/src/views/breadcrumb_setting/animationData.ts +15 -0
- package/src/views/breadcrumb_setting/index.vue +147 -0
- package/src/views/components/HCheckList.vue +47 -0
- package/src/views/components/animation_item.vue +37 -0
- package/src/views/components/setItem.vue +126 -0
- package/src/views/data-permission/components/createAndEditDataPermission.vue +354 -0
- package/src/views/data-permission/enum.ts +59 -0
- package/src/views/data-permission/index.vue +190 -0
- package/src/views/dictionary/components/drawerDictionary.vue +108 -0
- package/src/views/dictionary/components/drawerDictionaryItem.vue +115 -0
- package/src/views/dictionary/enum.ts +8 -0
- package/src/views/dictionary/index.vue +194 -0
- package/src/views/dictionary/itemlist.vue +164 -0
- package/src/views/group/components/drawerGroup.vue +177 -0
- package/src/views/group/enum.ts +25 -0
- package/src/views/group/index.vue +207 -0
- package/src/views/layout_setting/index.vue +306 -0
- package/src/views/log_center/components/browserType.vue +35 -0
- package/src/views/log_center/components/loginHistoryDetail.vue +71 -0
- package/src/views/log_center/components/operateHistoryDetail.vue +80 -0
- package/src/views/log_center/login_history.vue +239 -0
- package/src/views/log_center/operate_history.vue +233 -0
- package/src/views/menu_setting/animationData.ts +27 -0
- package/src/views/menu_setting/index.vue +207 -0
- package/src/views/organization/components/drawerOrganization.vue +161 -0
- package/src/views/organization/components/drawerRole.vue +159 -0
- package/src/views/organization/components/roleSelect.vue +258 -0
- package/src/views/organization/enum.ts +26 -0
- package/src/views/organization/index.vue +516 -0
- package/src/views/other_setting/animationData.ts +15 -0
- package/src/views/other_setting/index.vue +250 -0
- package/src/views/other_setting/interface.ts +26 -0
- package/src/views/page_animation_setting/animationData.ts +23 -0
- package/src/views/page_animation_setting/index.vue +200 -0
- package/src/views/page_w_setting/index.vue +238 -0
- package/src/views/position/components/drawerPosition.vue +131 -0
- package/src/views/position/enum.ts +8 -0
- package/src/views/position/index.vue +167 -0
- package/src/views/region/components/drawerRegion.vue +143 -0
- package/src/views/region/enum.ts +24 -0
- package/src/views/region/index.vue +246 -0
- package/src/views/resource/components/ResourceEdit.vue +209 -0
- package/src/views/resource/components/RoleRelation.vue +100 -0
- package/src/views/resource/enum.ts +35 -0
- package/src/views/resource/index.vue +237 -0
- package/src/views/resource/interface.ts +6 -0
- package/src/views/role/components/ResourceRelation.vue +113 -0
- package/src/views/role/components/drawerRole.vue +191 -0
- package/src/views/role/enum.ts +26 -0
- package/src/views/role/index.vue +183 -0
- package/src/views/role/interface.ts +6 -0
- package/src/views/role_group/components/ResourceRelation.vue +91 -0
- package/src/views/role_group/components/drawerRole.vue +153 -0
- package/src/views/role_group/components/roleSelect.vue +224 -0
- package/src/views/role_group/enum.ts +22 -0
- package/src/views/role_group/index.vue +170 -0
- package/src/views/role_group/interface.ts +6 -0
- package/src/views/safe_setting/index.vue +237 -0
- package/src/views/tabbar_setting/animationData.ts +23 -0
- package/src/views/tabbar_setting/index.vue +186 -0
- package/src/views/tenant/components/TenantEdit.vue +226 -0
- package/src/views/tenant/index.vue +192 -0
- package/src/views/tenant/interface.ts +4 -0
- package/src/views/theme_setting/index.vue +465 -0
- package/src/views/toolbar_setting/animationData.ts +42 -0
- package/src/views/toolbar_setting/index.vue +189 -0
- package/src/views/user/components/OrgAndPosition.vue +156 -0
- package/src/views/user/components/UserAuthorization.vue +260 -0
- package/src/views/user/components/UserEdit.vue +267 -0
- package/src/views/user/components/roleSelect.vue +258 -0
- package/src/views/user/enum.ts +13 -0
- package/src/views/user/index.vue +266 -0
- package/src/views/user/interface.ts +43 -0
- package/src/views/watermark_setting/animationData.ts +7 -0
- package/src/views/watermark_setting/index.vue +236 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Rule } from 'ant-design-vue/es/form';
|
|
3
|
+
import type { FormExpose } from 'ant-design-vue/es/form/Form';
|
|
4
|
+
import type { AddForm, EditForm, Form, RecordData } from '../interface';
|
|
5
|
+
import { getRbacResourceTenantAddResourceTree, getRbacTenantPubTenantInfo, postRbacTenantPubTenantAdd, postRbacTenantPubTenantUpdate } from '@/api/modules/rbac';
|
|
6
|
+
import { useToggle } from '@vueuse/core';
|
|
7
|
+
import { message } from 'ant-design-vue';
|
|
8
|
+
import { cloneDeep } from 'lodash-es';
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
name: 'TenantEdit',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const emit = defineEmits(['submit']);
|
|
15
|
+
|
|
16
|
+
enum ACTION {
|
|
17
|
+
ADD = '新增',
|
|
18
|
+
/** 编辑 */
|
|
19
|
+
EDIT = '修改',
|
|
20
|
+
/** 删除 */
|
|
21
|
+
REMOVE = '删除',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const rules: Record<string, Rule[]> = {
|
|
25
|
+
name: [
|
|
26
|
+
{ required: true, message: '请输入名称', trigger: 'blur' },
|
|
27
|
+
{ min: 2, max: 32, message: '租户名称长度不能少于2位,不能超过32位', trigger: 'change' },
|
|
28
|
+
],
|
|
29
|
+
tenantCode: [
|
|
30
|
+
{ required: true, message: '请输入编码', trigger: 'blur' },
|
|
31
|
+
{ min: 2, max: 64, message: '租户编码长度不能少于2位,不能超过64位', trigger: 'change' },
|
|
32
|
+
],
|
|
33
|
+
pubUserAdmin: [
|
|
34
|
+
{ required: true, message: '请输入租户管理员', trigger: 'blur' },
|
|
35
|
+
{ min: 2, max: 32, message: '租户管理员长度不能少于2位,不能超过32位', trigger: 'change' },
|
|
36
|
+
],
|
|
37
|
+
resourceIds: [
|
|
38
|
+
{ type: 'array', required: true, message: '请选择所属资源', trigger: 'change' },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const state = reactive<{
|
|
43
|
+
title: string
|
|
44
|
+
record: RecordData
|
|
45
|
+
initData: Partial<Form>
|
|
46
|
+
}>({
|
|
47
|
+
title: '',
|
|
48
|
+
record: {},
|
|
49
|
+
initData: {
|
|
50
|
+
enable: true,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const [open, setOpen] = useToggle(false);
|
|
55
|
+
const formRef = ref<FormExpose>();
|
|
56
|
+
const form = ref<Partial<Form>>({ enable: true });
|
|
57
|
+
|
|
58
|
+
async function onOpen(key: ACTION, record?: RecordData) {
|
|
59
|
+
state.title = key;
|
|
60
|
+
form.value = cloneDeep(state.initData);
|
|
61
|
+
|
|
62
|
+
if (key === ACTION.EDIT) {
|
|
63
|
+
const res = await getRbacTenantPubTenantInfo({ id: record!.id! });
|
|
64
|
+
if (res.success) {
|
|
65
|
+
const { tenantStartTime, tenantEndTime, ...rest } = res?.data ?? {};
|
|
66
|
+
form.value = {
|
|
67
|
+
...rest,
|
|
68
|
+
tenantTime: [tenantStartTime, tenantEndTime],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setOpen(true);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const [loading, setLoading] = useToggle(false);
|
|
77
|
+
function onSubmit() {
|
|
78
|
+
const request = state.title === ACTION.EDIT ? postRbacTenantPubTenantUpdate : postRbacTenantPubTenantAdd;
|
|
79
|
+
formRef.value?.validate().then(() => {
|
|
80
|
+
const { tenantTime, resourceIds = [], ...rest } = form.value;
|
|
81
|
+
const params: AddForm | EditForm = {
|
|
82
|
+
...rest,
|
|
83
|
+
tenantStartTime: tenantTime?.[0],
|
|
84
|
+
tenantEndTime: tenantTime?.[1],
|
|
85
|
+
pubTenantResourcelist: resourceIds.map(resourceId => ({ resourceId })),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
setLoading(true);
|
|
89
|
+
request(params)
|
|
90
|
+
.then((res) => {
|
|
91
|
+
if (res.success) {
|
|
92
|
+
message.success(`${state.title}成功!`);
|
|
93
|
+
setOpen(false);
|
|
94
|
+
emit('submit');
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.finally(() => setLoading(false));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const resourceRef = ref();
|
|
102
|
+
const resourceTree = ref<API.PubResourceTreeBo[]>([]);
|
|
103
|
+
const selectedResources = computed(() => {
|
|
104
|
+
return form.value.resourceIds?.map((id) => {
|
|
105
|
+
const item = toList(resourceTree.value).find(item => item.id === id);
|
|
106
|
+
return { name: item?.name ?? '' };
|
|
107
|
+
}) ?? [];
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
function onOpenResource() {
|
|
111
|
+
const selectedIds = form.value.resourceIds ?? [];
|
|
112
|
+
const tree = resourceTree.value;
|
|
113
|
+
const treeMap = toList(tree).reduce((map, item) => {
|
|
114
|
+
map[item.id as string] = item.name;
|
|
115
|
+
return map;
|
|
116
|
+
}, {} as any);
|
|
117
|
+
|
|
118
|
+
resourceRef.value.open(selectedIds, tree, treeMap);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function onSelectResource(selected: Array<{ id: string, name: string }> = []) {
|
|
122
|
+
form.value.resourceIds = selected.map(item => item.id);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function getTenantResourceList() {
|
|
126
|
+
getRbacResourceTenantAddResourceTree().then((res) => {
|
|
127
|
+
if (res.success) {
|
|
128
|
+
resourceTree.value = res.data ?? [];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function toList<T extends { children?: T[] }>(tree: T[]) {
|
|
134
|
+
const list = cloneDeep(tree);
|
|
135
|
+
for (let i = 0; i < list.length; i++) {
|
|
136
|
+
if (!list[i].children) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
list.splice(i + 1, 0, ...list[i].children as T[]);
|
|
140
|
+
list[i].children = undefined;
|
|
141
|
+
}
|
|
142
|
+
return list;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
getTenantResourceList();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
defineExpose({
|
|
150
|
+
open: onOpen,
|
|
151
|
+
});
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<template>
|
|
155
|
+
<a-drawer
|
|
156
|
+
v-model:open="open"
|
|
157
|
+
:title="`${state.title}租户`"
|
|
158
|
+
placement="right"
|
|
159
|
+
:width="600"
|
|
160
|
+
destroy-on-close
|
|
161
|
+
:footer-style="{ textAlign: 'right' }"
|
|
162
|
+
>
|
|
163
|
+
<a-form
|
|
164
|
+
ref="formRef"
|
|
165
|
+
:model="form"
|
|
166
|
+
:rules="rules"
|
|
167
|
+
:label-col="{ span: 6 }"
|
|
168
|
+
>
|
|
169
|
+
<a-form-item label="租户名称" name="name">
|
|
170
|
+
<a-input v-model:value="form.name" :maxlength="32" placeholder="请输入租户名称" />
|
|
171
|
+
</a-form-item>
|
|
172
|
+
|
|
173
|
+
<a-form-item label="租户编码" name="tenantCode">
|
|
174
|
+
<a-input v-model:value="form.tenantCode" :disabled="state.title === ACTION.EDIT" :maxlength="64" placeholder="请输入租户编码" />
|
|
175
|
+
</a-form-item>
|
|
176
|
+
|
|
177
|
+
<a-form-item label="开始至到期时间" name="tenantTime">
|
|
178
|
+
<a-range-picker v-model:value="form.tenantTime" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
|
|
179
|
+
</a-form-item>
|
|
180
|
+
|
|
181
|
+
<a-form-item label="二级域名" name="subDomain">
|
|
182
|
+
<a-input v-model:value="form.subDomain" :maxlength="64" placeholder="请输入二级域名" />
|
|
183
|
+
</a-form-item>
|
|
184
|
+
|
|
185
|
+
<a-form-item label="租户管理员" name="pubUserAdmin">
|
|
186
|
+
<a-input v-model:value="form.pubUserAdmin" :disabled="state.title === ACTION.EDIT" :maxlength="32" placeholder="请输入租户管理员" />
|
|
187
|
+
</a-form-item>
|
|
188
|
+
|
|
189
|
+
<a-form-item label="是否启用">
|
|
190
|
+
<a-switch v-model:checked="form.enable" />
|
|
191
|
+
</a-form-item>
|
|
192
|
+
|
|
193
|
+
<a-form-item label="所属资源" name="resourceIds">
|
|
194
|
+
<a-button type="primary" @click="onOpenResource()">
|
|
195
|
+
选择资源
|
|
196
|
+
</a-button>
|
|
197
|
+
(已选{{ form.resourceIds?.length ?? 0 }}条数据)
|
|
198
|
+
<ResourceSelector ref="resourceRef" @select="onSelectResource" />
|
|
199
|
+
|
|
200
|
+
<div class="pt-10px">
|
|
201
|
+
<template v-for="item in selectedResources" :key="item">
|
|
202
|
+
<a-tooltip v-if="item.name?.length > 20" :title="item.name">
|
|
203
|
+
<span class="inline-block mb-6px mr-6px bg-[#E8F3FF] rounded-2px px-8px py-3px whitespace-nowrap dark:bg-[#141414]">
|
|
204
|
+
{{ `${item.name?.slice(0, 20)}...` }}
|
|
205
|
+
</span>
|
|
206
|
+
</a-tooltip>
|
|
207
|
+
<span v-else class="inline-block mb-6px mr-6px bg-[#E8F3FF] rounded-2px px-8px py-3px whitespace-nowrap dark:bg-[#141414]">
|
|
208
|
+
{{ item.name }}
|
|
209
|
+
</span>
|
|
210
|
+
</template>
|
|
211
|
+
</div>
|
|
212
|
+
</a-form-item>
|
|
213
|
+
</a-form>
|
|
214
|
+
|
|
215
|
+
<template #footer>
|
|
216
|
+
<a-space>
|
|
217
|
+
<a-button @click="setOpen(false)">
|
|
218
|
+
取消
|
|
219
|
+
</a-button>
|
|
220
|
+
<a-button type="primary" :loading="loading" @click="onSubmit()">
|
|
221
|
+
提交
|
|
222
|
+
</a-button>
|
|
223
|
+
</a-space>
|
|
224
|
+
</template>
|
|
225
|
+
</a-drawer>
|
|
226
|
+
</template>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script setup lang="tsx">
|
|
2
|
+
import type { ProColumns } from '@pubinfo/pro-components';
|
|
3
|
+
import type { RecordData } from './interface';
|
|
4
|
+
import { getRbacTenantPubTenantDelete, postRbacTenantPubTenantPage } from '@/api/modules/rbac';
|
|
5
|
+
import { ProTable } from '@pubinfo/pro-components';
|
|
6
|
+
import { Badge, message, Modal } from 'ant-design-vue';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import TenantEdit from './components/TenantEdit.vue';
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
name: 'Tenant',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
enum ACTION {
|
|
15
|
+
ADD = '新增',
|
|
16
|
+
/** 编辑 */
|
|
17
|
+
EDIT = '修改',
|
|
18
|
+
/** 删除 */
|
|
19
|
+
REMOVE = '删除',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { auth } = useAuth();
|
|
23
|
+
const tableRef = ref();
|
|
24
|
+
const drawerRef = ref();
|
|
25
|
+
|
|
26
|
+
function getTableData() {
|
|
27
|
+
tableRef.value.reload();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function formatDate(date?: string) {
|
|
31
|
+
return date ? dayjs(date).format('YYYY-MM-DD') : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function request(params: any) {
|
|
35
|
+
const { current, pageSize, tenantStartTime, tenantEndTime, ...rest } = params;
|
|
36
|
+
const res = await postRbacTenantPubTenantPage({
|
|
37
|
+
currentPage: current,
|
|
38
|
+
pageSize,
|
|
39
|
+
tenantStartTime: formatDate(tenantStartTime?.[0]),
|
|
40
|
+
tenantStartTimeEnd: formatDate(tenantStartTime?.[1]),
|
|
41
|
+
tenantEndTimeStart: formatDate(tenantEndTime?.[0]),
|
|
42
|
+
tenantEndTimeEnd: formatDate(tenantEndTime?.[1]),
|
|
43
|
+
...rest,
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
success: res.success,
|
|
47
|
+
data: res.data?.records ?? [],
|
|
48
|
+
total: res.data?.total ?? 0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const columns: ProColumns<RecordData> = [
|
|
52
|
+
{
|
|
53
|
+
valueType: 'a-input',
|
|
54
|
+
minWidth: 200,
|
|
55
|
+
title: '租户名称',
|
|
56
|
+
dataIndex: 'name',
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
fieldProps: {
|
|
59
|
+
placeholder: '请输入租户名称',
|
|
60
|
+
allowClear: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
valueType: 'a-input',
|
|
65
|
+
minWidth: 200,
|
|
66
|
+
title: '租户编码',
|
|
67
|
+
dataIndex: 'tenantCode',
|
|
68
|
+
ellipsis: true,
|
|
69
|
+
fieldProps: {
|
|
70
|
+
placeholder: '请输入租户编码',
|
|
71
|
+
allowClear: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
valueType: 'a-range-picker',
|
|
76
|
+
minWidth: 200,
|
|
77
|
+
title: '开始时间',
|
|
78
|
+
dataIndex: 'tenantStartTime',
|
|
79
|
+
ellipsis: true,
|
|
80
|
+
fieldProps: {
|
|
81
|
+
allowClear: true,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
valueType: 'a-range-picker',
|
|
86
|
+
minWidth: 200,
|
|
87
|
+
title: '到期时间',
|
|
88
|
+
dataIndex: 'tenantEndTime',
|
|
89
|
+
ellipsis: true,
|
|
90
|
+
fieldProps: {
|
|
91
|
+
allowClear: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
minWidth: 200,
|
|
96
|
+
title: '二级域名',
|
|
97
|
+
dataIndex: 'subDomain',
|
|
98
|
+
ellipsis: true,
|
|
99
|
+
hideInSearch: true,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
hideInSearch: true,
|
|
103
|
+
minWidth: 80,
|
|
104
|
+
title: '状态',
|
|
105
|
+
dataIndex: 'enable',
|
|
106
|
+
customRender: ({ text }: { text: boolean }) => {
|
|
107
|
+
return (
|
|
108
|
+
text
|
|
109
|
+
? <Badge status="success" text="正常" />
|
|
110
|
+
: <Badge status="error" text="关闭" />
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
hideInSearch: true,
|
|
116
|
+
width: 160,
|
|
117
|
+
title: '操作',
|
|
118
|
+
dataIndex: 'action',
|
|
119
|
+
fixed: 'right',
|
|
120
|
+
hideInTable() {
|
|
121
|
+
return !auth([
|
|
122
|
+
'tenant_edit',
|
|
123
|
+
'tenant_remove',
|
|
124
|
+
]);
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
function onAction(key: string, record?: RecordData) {
|
|
129
|
+
switch (key) {
|
|
130
|
+
case ACTION.EDIT:
|
|
131
|
+
drawerRef.value.open(key, record);
|
|
132
|
+
break;
|
|
133
|
+
case ACTION.ADD:
|
|
134
|
+
drawerRef.value.open(key);
|
|
135
|
+
break;
|
|
136
|
+
case ACTION.REMOVE:
|
|
137
|
+
Modal.confirm({
|
|
138
|
+
title: '删除',
|
|
139
|
+
content: '确定要删除该租户吗?',
|
|
140
|
+
onOk() {
|
|
141
|
+
getRbacTenantPubTenantDelete({ id: record?.id as string }).then((res) => {
|
|
142
|
+
if (res.success) {
|
|
143
|
+
message.success('删除成功');
|
|
144
|
+
getTableData();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<template>
|
|
155
|
+
<div
|
|
156
|
+
py-10px
|
|
157
|
+
px-10px
|
|
158
|
+
w-full
|
|
159
|
+
h-full
|
|
160
|
+
>
|
|
161
|
+
<ProTable
|
|
162
|
+
ref="tableRef"
|
|
163
|
+
row-key="id"
|
|
164
|
+
:request="request"
|
|
165
|
+
:columns="columns"
|
|
166
|
+
auto-height
|
|
167
|
+
:scroll="{ x: 1100 }"
|
|
168
|
+
>
|
|
169
|
+
<template #toolbar>
|
|
170
|
+
<a-button v-auth="'tenant_add'" type="primary" @click="onAction(ACTION.ADD)">
|
|
171
|
+
<PlusCircleOutlined />
|
|
172
|
+
{{ ACTION.ADD }}
|
|
173
|
+
</a-button>
|
|
174
|
+
</template>
|
|
175
|
+
<template #bodyCell="{ column, record }">
|
|
176
|
+
<template v-if="column.dataIndex === 'action'">
|
|
177
|
+
<a-space>
|
|
178
|
+
<a v-auth="'tenant_edit'" class="flex items-center" @click="onAction(ACTION.EDIT, record)">
|
|
179
|
+
<PubinfoIcon name="edit" class="text-base" />
|
|
180
|
+
<span class="ml-4px">{{ ACTION.EDIT }}</span>
|
|
181
|
+
</a>
|
|
182
|
+
<span v-auth="'tenant_remove'" class="flex items-center text-red-500 hover:cursor-pointer hover:opacity-80" @click="onAction(ACTION.REMOVE, record)">
|
|
183
|
+
<PubinfoIcon name="remove" class="text-base" />
|
|
184
|
+
<span class="ml-4px">{{ ACTION.REMOVE }}</span>
|
|
185
|
+
</span>
|
|
186
|
+
</a-space>
|
|
187
|
+
</template>
|
|
188
|
+
</template>
|
|
189
|
+
</ProTable>
|
|
190
|
+
<TenantEdit ref="drawerRef" @submit="getTableData()" />
|
|
191
|
+
</div>
|
|
192
|
+
</template>
|