@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,132 @@
|
|
|
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 { postBlackWhiteListAddBlackWhiteList, postBlackWhiteListUpdateBlackWhiteList } from '@/api/modules/configData';
|
|
5
|
+
import { useToggle } from '@vueuse/core';
|
|
6
|
+
import { message } from 'ant-design-vue';
|
|
7
|
+
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: 'DrawerBlackWhiteList',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
type: number
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits(['submit']);
|
|
17
|
+
|
|
18
|
+
const rules: Record<string, Rule[]> = {
|
|
19
|
+
ip: [{ required: true, validator: checkIP, trigger: ['blur', 'change'] }],
|
|
20
|
+
enable: [{ required: true, message: '请选择是否开启', trigger: ['blur', 'change'] }],
|
|
21
|
+
};
|
|
22
|
+
const dialogTitle = ref('');
|
|
23
|
+
const [open, setOpen] = useToggle(false);
|
|
24
|
+
const formRef = ref<FormExpose>();
|
|
25
|
+
const defaultFormData = {
|
|
26
|
+
enable: true,
|
|
27
|
+
};
|
|
28
|
+
const form = ref<Partial<API.PubBlackWhiteList>>({});
|
|
29
|
+
const isEdit = ref(false);
|
|
30
|
+
|
|
31
|
+
function checkIP(rule: any, value: any, callback: any) {
|
|
32
|
+
const ipReg = /^(25[0-5]|2[0-4]\d|[01]?\d{1,2})\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})$/;
|
|
33
|
+
if (!value) {
|
|
34
|
+
callback(new Error('请输入ip地址'));
|
|
35
|
+
}
|
|
36
|
+
else if (!ipReg.test(value)) {
|
|
37
|
+
callback(new Error('ip地址格式不正确'));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
callback();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function onOpen(title: string, edit: boolean, record?: API.PubBlackWhiteList) {
|
|
45
|
+
dialogTitle.value = title;
|
|
46
|
+
|
|
47
|
+
setOpen(true);
|
|
48
|
+
|
|
49
|
+
if (edit) {
|
|
50
|
+
isEdit.value = true;
|
|
51
|
+
form.value = { ...record ?? {} };
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
isEdit.value = false;
|
|
55
|
+
form.value = { ...defaultFormData };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const [loading, setLoading] = useToggle(false);
|
|
60
|
+
function onSubmit() {
|
|
61
|
+
formRef.value?.validate().then(() => {
|
|
62
|
+
setLoading(true);
|
|
63
|
+
const submitFn = isEdit.value ? postBlackWhiteListUpdateBlackWhiteList : postBlackWhiteListAddBlackWhiteList;
|
|
64
|
+
const params: any = {
|
|
65
|
+
...form.value,
|
|
66
|
+
type: props.type,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
submitFn(params)
|
|
70
|
+
.then((res: API.ResponseDataBoolean) => {
|
|
71
|
+
if (res.success) {
|
|
72
|
+
message.success(`${dialogTitle.value}成功!`);
|
|
73
|
+
setOpen(false);
|
|
74
|
+
emit('submit');
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
.finally(() => setLoading(false));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function close() {
|
|
82
|
+
setOpen(false);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
defineExpose({
|
|
86
|
+
open: onOpen,
|
|
87
|
+
});
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<a-drawer
|
|
92
|
+
v-model:open="open"
|
|
93
|
+
:title="`${dialogTitle}信息`"
|
|
94
|
+
placement="right"
|
|
95
|
+
:width="600"
|
|
96
|
+
destroy-on-close
|
|
97
|
+
:footer-style="{ textAlign: 'right' }"
|
|
98
|
+
@close="close"
|
|
99
|
+
>
|
|
100
|
+
<a-form
|
|
101
|
+
ref="formRef"
|
|
102
|
+
:model="form"
|
|
103
|
+
:rules="rules"
|
|
104
|
+
:label-col="{ span: 4 }"
|
|
105
|
+
>
|
|
106
|
+
<a-form-item label="来源ip地址" name="ip">
|
|
107
|
+
<a-input v-model:value="form.ip" :maxlength="20" />
|
|
108
|
+
</a-form-item>
|
|
109
|
+
<a-form-item label="状态" name="enable">
|
|
110
|
+
<a-switch v-model:checked="form.enable" />
|
|
111
|
+
</a-form-item>
|
|
112
|
+
<a-form-item label="描述" name="description">
|
|
113
|
+
<a-textarea
|
|
114
|
+
v-model:value="form.description"
|
|
115
|
+
:rows="3"
|
|
116
|
+
show-count
|
|
117
|
+
:maxlength="200"
|
|
118
|
+
/>
|
|
119
|
+
</a-form-item>
|
|
120
|
+
</a-form>
|
|
121
|
+
<template #footer>
|
|
122
|
+
<a-space>
|
|
123
|
+
<a-button @click="close">
|
|
124
|
+
取消
|
|
125
|
+
</a-button>
|
|
126
|
+
<a-button type="primary" :loading="loading" @click="onSubmit()">
|
|
127
|
+
提交
|
|
128
|
+
</a-button>
|
|
129
|
+
</a-space>
|
|
130
|
+
</template>
|
|
131
|
+
</a-drawer>
|
|
132
|
+
</template>
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
<script setup lang="tsx">
|
|
2
|
+
import type { ProColumns } from '@pubinfo/pro-components';
|
|
3
|
+
import { getBlackWhiteListDeleteById, postBlackWhiteListGetBlackWhiteListPageList, postBlackWhiteListUpdateBlackWhiteList } from '@/api/modules/configData';
|
|
4
|
+
import { ProTable } from '@pubinfo/pro-components';
|
|
5
|
+
import { useToggle } from '@vueuse/core';
|
|
6
|
+
import { message, Modal } from 'ant-design-vue';
|
|
7
|
+
import DrawerBlackWhiteList from './components/drawerBlackWhiteList.vue';
|
|
8
|
+
import { ACTION } from './enum';
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
name: 'BlackWhiteList',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const route = useRoute();
|
|
15
|
+
const isBlacklistMode = ref(route.meta.type === 'black');
|
|
16
|
+
|
|
17
|
+
// 黑名单0,白名单1
|
|
18
|
+
const currentType = computed(() => {
|
|
19
|
+
if (isBlacklistMode.value) {
|
|
20
|
+
return 0; // 黑名单
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return 1; // 白名单
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const isblank = computed(() => {
|
|
28
|
+
if (isBlacklistMode.value) {
|
|
29
|
+
return 'blacklist';
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return 'whitelist';
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// rights
|
|
37
|
+
const addRights = computed(() => `${isblank.value}_add`);
|
|
38
|
+
const editRights = computed(() => `${isblank.value}_edit`);
|
|
39
|
+
const deleteRights = computed(() => `${isblank.value}_delete`);
|
|
40
|
+
const enableRights = computed(() => `${isblank.value}_enable`);
|
|
41
|
+
const disableRights = computed(() => `${isblank.value}_disable`);
|
|
42
|
+
|
|
43
|
+
const { auth } = useAuth();
|
|
44
|
+
const tableRef = ref();
|
|
45
|
+
const drawerRef = ref();
|
|
46
|
+
const statusOptions = [
|
|
47
|
+
{ label: '启用', value: 1 },
|
|
48
|
+
{ label: '停用', value: 0 },
|
|
49
|
+
];
|
|
50
|
+
const columns: ProColumns<API.PubBlackWhiteList> = [
|
|
51
|
+
{
|
|
52
|
+
valueType: 'a-input',
|
|
53
|
+
minWidth: 60,
|
|
54
|
+
hideInTable: false,
|
|
55
|
+
title: 'IP地址',
|
|
56
|
+
dataIndex: 'ip',
|
|
57
|
+
fieldProps: {
|
|
58
|
+
placeholder: '请输入',
|
|
59
|
+
allowClear: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
hideInSearch: true,
|
|
64
|
+
minWidth: 200,
|
|
65
|
+
title: '描述',
|
|
66
|
+
dataIndex: 'description',
|
|
67
|
+
ellipsis: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
valueType: 'a-select',
|
|
71
|
+
minWidth: 100,
|
|
72
|
+
title: '状态',
|
|
73
|
+
dataIndex: 'enable',
|
|
74
|
+
fieldProps: {
|
|
75
|
+
placeholder: '请选择',
|
|
76
|
+
allowClear: true,
|
|
77
|
+
options: statusOptions,
|
|
78
|
+
},
|
|
79
|
+
ellipsis: true,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
hideInSearch: true,
|
|
83
|
+
title: '操作',
|
|
84
|
+
dataIndex: 'action',
|
|
85
|
+
width: 200,
|
|
86
|
+
fixed: 'right',
|
|
87
|
+
hideInTable() {
|
|
88
|
+
return !auth([
|
|
89
|
+
addRights.value,
|
|
90
|
+
editRights.value,
|
|
91
|
+
deleteRights.value,
|
|
92
|
+
enableRights.value,
|
|
93
|
+
disableRights.value,
|
|
94
|
+
]);
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
async function request(params: any) {
|
|
100
|
+
const { current, pageSize, ip, enable } = params;
|
|
101
|
+
const ps: any = {
|
|
102
|
+
ip,
|
|
103
|
+
pageSize,
|
|
104
|
+
currentPage: current,
|
|
105
|
+
doSearchTotal: true,
|
|
106
|
+
type: currentType.value,
|
|
107
|
+
};
|
|
108
|
+
if (enable !== undefined) {
|
|
109
|
+
// 为1时代表启用,传true, 否则传false
|
|
110
|
+
ps.enable = enable;
|
|
111
|
+
}
|
|
112
|
+
const res = await postBlackWhiteListGetBlackWhiteListPageList(ps);
|
|
113
|
+
return {
|
|
114
|
+
success: res.success,
|
|
115
|
+
data: res.data?.records ?? [],
|
|
116
|
+
total: res.data?.total ?? 0,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getListData() {
|
|
121
|
+
tableRef.value.reload();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const [loading, setLoading] = useToggle(false);
|
|
125
|
+
|
|
126
|
+
function actionRemove(subKey: string, record?: API.PubBlackWhiteList) {
|
|
127
|
+
Modal.confirm({
|
|
128
|
+
title: '删除',
|
|
129
|
+
content: `确定要删除该条${subKey}数据吗?`,
|
|
130
|
+
async onOk() {
|
|
131
|
+
setLoading(true);
|
|
132
|
+
getBlackWhiteListDeleteById({ id: record?.id as string })
|
|
133
|
+
.then((res: API.ResponseDataBoolean) => {
|
|
134
|
+
if (res.success) {
|
|
135
|
+
message.success('删除成功');
|
|
136
|
+
getListData();
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
.finally(() => setLoading(false));
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function actionDisable(record?: API.PubBlackWhiteList) {
|
|
145
|
+
setLoading(true);
|
|
146
|
+
postBlackWhiteListUpdateBlackWhiteList(
|
|
147
|
+
{ id: record?.id, enable: !record?.enable } as any)
|
|
148
|
+
.then((res: API.ResponseDataBoolean) => {
|
|
149
|
+
if (res.success) {
|
|
150
|
+
let msg = '';
|
|
151
|
+
if (!record?.enable) {
|
|
152
|
+
msg = '启用成功!';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
msg = '停用成功!';
|
|
156
|
+
}
|
|
157
|
+
message.success(msg);
|
|
158
|
+
getListData();
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
.finally(() =>
|
|
162
|
+
setLoading(false),
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function onAction(key: string, record?: API.PubBlackWhiteList): void {
|
|
167
|
+
if (loading.value) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
let subKey = '';
|
|
171
|
+
|
|
172
|
+
if (isBlacklistMode.value) {
|
|
173
|
+
subKey = '黑名单';
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
subKey = '白名单';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
switch (key) {
|
|
180
|
+
case ACTION.ADD:
|
|
181
|
+
drawerRef.value.open(key + subKey, false);
|
|
182
|
+
break;
|
|
183
|
+
case ACTION.EDIT:
|
|
184
|
+
drawerRef.value.open(key + subKey, true, record);
|
|
185
|
+
break;
|
|
186
|
+
case ACTION.REMOVE:
|
|
187
|
+
actionRemove(subKey, record);
|
|
188
|
+
break;
|
|
189
|
+
case ACTION.ENABLE:
|
|
190
|
+
case ACTION.DISABLE:
|
|
191
|
+
actionDisable(record);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<div
|
|
199
|
+
w-full
|
|
200
|
+
h-full
|
|
201
|
+
py-10px
|
|
202
|
+
px-10px
|
|
203
|
+
flex
|
|
204
|
+
flex-col
|
|
205
|
+
class="page-black-white-list"
|
|
206
|
+
>
|
|
207
|
+
<ProTable
|
|
208
|
+
ref="tableRef"
|
|
209
|
+
row-key="id"
|
|
210
|
+
:request="request"
|
|
211
|
+
:columns="columns"
|
|
212
|
+
auto-height
|
|
213
|
+
:scroll="{ x: 1000 }"
|
|
214
|
+
>
|
|
215
|
+
<template #toolbar>
|
|
216
|
+
<a-button
|
|
217
|
+
v-auth="addRights"
|
|
218
|
+
type="primary"
|
|
219
|
+
@click="onAction(ACTION.ADD)"
|
|
220
|
+
>
|
|
221
|
+
<PlusCircleOutlined />
|
|
222
|
+
{{ ACTION.ADD }}
|
|
223
|
+
</a-button>
|
|
224
|
+
</template>
|
|
225
|
+
<template #bodyCell="{ column, record }">
|
|
226
|
+
<template v-if="column.dataIndex === 'enable'">
|
|
227
|
+
<div class="flex items-center">
|
|
228
|
+
<i class="status-mark" :class="[{ active: record.enable }]" />
|
|
229
|
+
<span class="ml-4px">{{ record.enable ? '启用' : '停用' }}</span>
|
|
230
|
+
</div>
|
|
231
|
+
</template>
|
|
232
|
+
<template v-if="column.dataIndex === 'action'">
|
|
233
|
+
<a-space>
|
|
234
|
+
<a
|
|
235
|
+
v-auth="editRights"
|
|
236
|
+
class="flex items-center hover:opacity-80"
|
|
237
|
+
@click="onAction(ACTION.EDIT, record)"
|
|
238
|
+
>
|
|
239
|
+
<PubinfoIcon name="edit" class="text-base" />
|
|
240
|
+
<span class="ml-4px">{{ ACTION.EDIT }}</span>
|
|
241
|
+
</a>
|
|
242
|
+
<a
|
|
243
|
+
v-auth="deleteRights"
|
|
244
|
+
flex
|
|
245
|
+
items-center
|
|
246
|
+
text-red-500
|
|
247
|
+
hover:cursor-pointer
|
|
248
|
+
hover:text-red-500
|
|
249
|
+
hover:opacity-80
|
|
250
|
+
@click="onAction(ACTION.REMOVE, record)"
|
|
251
|
+
>
|
|
252
|
+
<PubinfoIcon name="remove" class="text-base" />
|
|
253
|
+
<span class="ml-4px">{{ ACTION.REMOVE }}</span>
|
|
254
|
+
</a>
|
|
255
|
+
<a
|
|
256
|
+
v-if="record.enable"
|
|
257
|
+
v-auth="disableRights"
|
|
258
|
+
flex
|
|
259
|
+
items-center
|
|
260
|
+
class="text-#1D2129"
|
|
261
|
+
hover:cursor-pointer
|
|
262
|
+
hover:opacity-80
|
|
263
|
+
@click="onAction(ACTION.DISABLE, record)"
|
|
264
|
+
>
|
|
265
|
+
<PubinfoIcon name="blacklist-disable" class="text-20px" />
|
|
266
|
+
<span class="ml-4px">{{ ACTION.DISABLE }}</span>
|
|
267
|
+
</a>
|
|
268
|
+
<a
|
|
269
|
+
v-else
|
|
270
|
+
v-auth="enableRights"
|
|
271
|
+
class="flex items-center"
|
|
272
|
+
@click="onAction(ACTION.ENABLE, record)"
|
|
273
|
+
>
|
|
274
|
+
<PubinfoIcon name="blacklist-enable" class="text-20px" />
|
|
275
|
+
<span class="ml-4px">{{ ACTION.ENABLE }}</span>
|
|
276
|
+
</a>
|
|
277
|
+
</a-space>
|
|
278
|
+
</template>
|
|
279
|
+
</template>
|
|
280
|
+
</ProTable>
|
|
281
|
+
<DrawerBlackWhiteList
|
|
282
|
+
ref="drawerRef"
|
|
283
|
+
:type="currentType"
|
|
284
|
+
@submit="getListData()"
|
|
285
|
+
/>
|
|
286
|
+
</div>
|
|
287
|
+
</template>
|
|
288
|
+
|
|
289
|
+
<style lang="scss">
|
|
290
|
+
.page-black-white-list {
|
|
291
|
+
.ant-card.pro-table {
|
|
292
|
+
border-top-left-radius: 0;
|
|
293
|
+
border-top-right-radius: 0;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.status-mark {
|
|
297
|
+
display: inline-block;
|
|
298
|
+
width: 8px;
|
|
299
|
+
height: 8px;
|
|
300
|
+
margin-right: 4px;
|
|
301
|
+
background-color: #aeaeae;
|
|
302
|
+
border-radius: 50%;
|
|
303
|
+
|
|
304
|
+
&.active {
|
|
305
|
+
background: #01d689;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import darkEnableData from '@/assets/lottie/breadcrumb/dark/enable.json?url';
|
|
2
|
+
import darkEnableMainMenuData from '@/assets/lottie/breadcrumb/dark/enableMainMenu.json?url';
|
|
3
|
+
import darkStyleData from '@/assets/lottie/breadcrumb/dark/style.json?url';
|
|
4
|
+
import lightEnableData from '@/assets/lottie/breadcrumb/light/enable.json?url';
|
|
5
|
+
import lightEnableMainMenuData from '@/assets/lottie/breadcrumb/light/enableMainMenu.json?url';
|
|
6
|
+
import lightStyleData from '@/assets/lottie/breadcrumb/light/style.json?url';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
darkEnableData,
|
|
10
|
+
darkEnableMainMenuData,
|
|
11
|
+
darkStyleData,
|
|
12
|
+
lightEnableData,
|
|
13
|
+
lightEnableMainMenuData,
|
|
14
|
+
lightStyleData,
|
|
15
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { postSysconfigAddOrEidtSysThemeStyleConfig } from '@/api/modules/configData';
|
|
3
|
+
import { useSettingsStore } from '@/stores';
|
|
4
|
+
|
|
5
|
+
import { message } from 'ant-design-vue';
|
|
6
|
+
import SetItem from '../components/setItem.vue';
|
|
7
|
+
import {
|
|
8
|
+
darkEnableData,
|
|
9
|
+
darkEnableMainMenuData,
|
|
10
|
+
darkStyleData,
|
|
11
|
+
lightEnableData,
|
|
12
|
+
lightEnableMainMenuData,
|
|
13
|
+
lightStyleData,
|
|
14
|
+
} from './animationData.ts';
|
|
15
|
+
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: 'BreadcrumbSetting',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const settingsStore = useSettingsStore();
|
|
21
|
+
type Val = Exclude<Settings.breadcrumb['style'], undefined>;
|
|
22
|
+
|
|
23
|
+
const styleOptions = [
|
|
24
|
+
{ label: '默认', value: '' },
|
|
25
|
+
{ label: '现代', value: 'modern' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const breadcrumbList = reactive<
|
|
29
|
+
{
|
|
30
|
+
name: string
|
|
31
|
+
type: string
|
|
32
|
+
descripe: string
|
|
33
|
+
open: boolean
|
|
34
|
+
activeStyle: Val
|
|
35
|
+
styleOptions?: typeof styleOptions
|
|
36
|
+
lightData: string
|
|
37
|
+
darkData: string
|
|
38
|
+
}[]
|
|
39
|
+
>([
|
|
40
|
+
{
|
|
41
|
+
name: '是否启用',
|
|
42
|
+
type: 'switch',
|
|
43
|
+
descripe: '',
|
|
44
|
+
open: settingsStore.globalSettings.breadcrumb.enable,
|
|
45
|
+
activeStyle: '',
|
|
46
|
+
lightData: lightEnableData,
|
|
47
|
+
darkData: darkEnableData,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: '风格',
|
|
51
|
+
type: 'check',
|
|
52
|
+
descripe: '',
|
|
53
|
+
open: true,
|
|
54
|
+
activeStyle: settingsStore.globalSettings.breadcrumb.style,
|
|
55
|
+
styleOptions,
|
|
56
|
+
lightData: lightStyleData,
|
|
57
|
+
darkData: darkStyleData,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: '是否显示主导航',
|
|
61
|
+
type: 'switch',
|
|
62
|
+
descripe: '',
|
|
63
|
+
open: settingsStore.globalSettings.breadcrumb.enableMainMenu,
|
|
64
|
+
activeStyle: '',
|
|
65
|
+
lightData: lightEnableMainMenuData,
|
|
66
|
+
darkData: darkEnableMainMenuData,
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
let jsonStr = '';
|
|
71
|
+
|
|
72
|
+
function onChange(index: number, ck: boolean | Val) {
|
|
73
|
+
switch (index) {
|
|
74
|
+
case 0:
|
|
75
|
+
settingsStore.globalSettings.breadcrumb.enable = ck as boolean;
|
|
76
|
+
jsonStr = JSON.stringify({
|
|
77
|
+
breadcrumb: {
|
|
78
|
+
enable: ck,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
break;
|
|
82
|
+
case 1:
|
|
83
|
+
settingsStore.globalSettings.breadcrumb.style = ck as Val;
|
|
84
|
+
jsonStr = JSON.stringify({
|
|
85
|
+
breadcrumb: {
|
|
86
|
+
style: ck,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
case 2:
|
|
91
|
+
settingsStore.globalSettings.breadcrumb.enableMainMenu = ck as boolean;
|
|
92
|
+
jsonStr = JSON.stringify({
|
|
93
|
+
breadcrumb: {
|
|
94
|
+
enableMainMenu: ck,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
setStyle(jsonStr);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function setStyle(jsonStr: string) {
|
|
103
|
+
postSysconfigAddOrEidtSysThemeStyleConfig({ content: jsonStr }).then((res: API.ResponseDataBoolean) => {
|
|
104
|
+
if (res.success) {
|
|
105
|
+
message.success('设置成功');
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<template>
|
|
112
|
+
<div
|
|
113
|
+
w-full
|
|
114
|
+
h-full
|
|
115
|
+
p-10px
|
|
116
|
+
>
|
|
117
|
+
<div class="w-full h-full bg-white overflow-y-auto p-10px flex flex-col box-border dark:bg-[#141414]">
|
|
118
|
+
<div class="h-[38px] pl-[16px] flex flex-row items-center bar-header">
|
|
119
|
+
<PubinfoIcon name="icon_breadcrumb" class="text-base mr-[6px]" :size="22" />
|
|
120
|
+
<span class="text-[16px] text-[#1d2129] dark:text-[#C9CDD4]">面包屑导航</span>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="mt-[22px] grid grid-cols-3 gap-[20px] px-30px w-full h-0 max-w-1500px" aspect="[3/2] ">
|
|
123
|
+
<SetItem
|
|
124
|
+
v-for="(item, index) in breadcrumbList"
|
|
125
|
+
:key="item.name"
|
|
126
|
+
class="mb-20px"
|
|
127
|
+
aspect="[9/6]"
|
|
128
|
+
:name="item.name"
|
|
129
|
+
:descripe="item.descripe"
|
|
130
|
+
:open="item.open"
|
|
131
|
+
:type="item.type"
|
|
132
|
+
:active-style="item.activeStyle"
|
|
133
|
+
:style-options="item.styleOptions"
|
|
134
|
+
:light-animation-data="item.lightData"
|
|
135
|
+
:dark-animation-data="item.darkData"
|
|
136
|
+
@change="(val) => onChange(index, val)"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
|
|
143
|
+
<style lang="scss" scoped>
|
|
144
|
+
.bar-header {
|
|
145
|
+
background: var(--g-bg);
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
modelValue: string | number | undefined
|
|
5
|
+
options: {
|
|
6
|
+
label?: string | number
|
|
7
|
+
icon?: string
|
|
8
|
+
value: string | number
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
}[]
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
disabled: false,
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<{
|
|
19
|
+
'update:modelValue': [string | number]
|
|
20
|
+
'change': [string | number | undefined]
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
watch(() => props.modelValue, (val) => {
|
|
24
|
+
emit('change', val);
|
|
25
|
+
});
|
|
26
|
+
function update(value: string | number) {
|
|
27
|
+
emit('update:modelValue', value);
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div class="inline-flex select-none items-center justify-center of-hidden rounded-md bg-stone-3 dark:bg-stone-7">
|
|
33
|
+
<button
|
|
34
|
+
v-for="option in options"
|
|
35
|
+
:key="option.value"
|
|
36
|
+
:disabled="disabled || option.disabled"
|
|
37
|
+
class="flex cursor-pointer items-center truncate border-size-0 bg-inherit px-2 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50 hover:not-disabled:(bg-ui-primary text-ui-text)"
|
|
38
|
+
:class="{ 'text-ui-text bg-ui-primary': modelValue === option.value }"
|
|
39
|
+
@click="update(option.value)"
|
|
40
|
+
>
|
|
41
|
+
<PubinfoIcon v-if="option.icon" :name="option.icon" />
|
|
42
|
+
<template v-else>
|
|
43
|
+
{{ option.label }}
|
|
44
|
+
</template>
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useLottie } from '@/composables/useLottie';
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
name: 'AnimationItem',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
lightAnimationData: string
|
|
11
|
+
darkAnimationData: string
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
lightAnimationData: () => { return ''; },
|
|
15
|
+
darkAnimationData: () => { return ''; },
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const AnimationRef = ref<HTMLElement | null>(null);
|
|
20
|
+
|
|
21
|
+
const { play, stop } = useLottie(
|
|
22
|
+
AnimationRef,
|
|
23
|
+
{
|
|
24
|
+
lightAnimationData: props.lightAnimationData,
|
|
25
|
+
darkAnimationData: props.darkAnimationData,
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
defineExpose({
|
|
30
|
+
play,
|
|
31
|
+
stop,
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<div ref="AnimationRef" class="w-[70%]" />
|
|
37
|
+
</template>
|