From 43ea8ed755a7003d4e45d004adc4e0837a5b75ab Mon Sep 17 00:00:00 2001 From: ANHE <1983933789@qq.com> Date: Tue, 18 Mar 2025 22:54:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BA=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E6=9D=BF=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=EF=BC=8C=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/template/soy.index.vue.vm | 66 ++++++++++++++----- .../advanced/table-header-operation.vue | 2 +- src/store/modules/auth/index.ts | 5 +- src/views/system/tenant/index.vue | 49 ++++++++++++-- 4 files changed, 97 insertions(+), 25 deletions(-) diff --git a/docs/template/soy.index.vue.vm b/docs/template/soy.index.vue.vm index 03f8c7b5..5ead75f9 100644 --- a/docs/template/soy.index.vue.vm +++ b/docs/template/soy.index.vue.vm @@ -1,8 +1,10 @@ diff --git a/src/components/advanced/table-header-operation.vue b/src/components/advanced/table-header-operation.vue index b9907b00..5a50cbad 100644 --- a/src/components/advanced/table-header-operation.vue +++ b/src/components/advanced/table-header-operation.vue @@ -18,7 +18,7 @@ withDefaults(defineProps(), { itemAlign: undefined, showAdd: true, showDelete: true, - showExport: false + showExport: true }); interface Emits { diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index 0dc51a67..3457e9c7 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -6,7 +6,7 @@ import { SetupStoreId } from '@/enum'; import { useRouterPush } from '@/hooks/common/router'; import { fetchGetUserInfo, fetchLogin, fetchLogout } from '@/service/api'; import { localStg } from '@/utils/storage'; -// import { $t } from '@/locales'; +import { $t } from '@/locales'; import { useRouteStore } from '../route'; import { useTabStore } from '../tab'; import { clearAuthStorage, getToken } from './shared'; @@ -80,10 +80,9 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { if (pass) { await redirectFromLogin(redirect); - window.$notification?.success({ title: $t('page.login.common.loginSuccess'), - content: $t('page.login.common.welcomeBack', { userName: userInfo.userName }), + content: $t('page.login.common.welcomeBack', { userName: userInfo.user?.nickName }), duration: 4500 }); } diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue index 66e7a5a5..6851a52d 100644 --- a/src/views/system/tenant/index.vue +++ b/src/views/system/tenant/index.vue @@ -2,9 +2,12 @@ import { NButton, NPopconfirm } from 'naive-ui'; import { fetchBatchDeleteTenant, fetchGetTenantList } from '@/service/api/system/tenant'; import { $t } from '@/locales'; +import { useAuth } from '@/hooks/business/auth'; import { useAppStore } from '@/store/modules/app'; import { useTable, useTableOperate } from '@/hooks/common/table'; import DictTag from '@/components/custom/dict-tag.vue'; +import { useDownload } from '@/hooks/business/download'; +import { useDict } from '@/hooks/business/dict'; import TenantOperateDrawer from './modules/tenant-operate-drawer.vue'; import TenantSearch from './modules/tenant-search.vue'; @@ -12,7 +15,11 @@ defineOptions({ name: 'TenantList' }); +useDict('sys_normal_disable'); + const appStore = useAppStore(); +const { download } = useDownload(); +const { hasAuth } = useAuth(); const { columns, @@ -92,12 +99,23 @@ const { title: $t('common.operate'), align: 'center', width: 180, - render: row => - row.tenantId !== '000000' ? ( -
+ render: row => { + if (row.tenantId === '000000') return null; + const editBtn = () => { + if (!hasAuth('system:tenant:edit')) { + return null; + } + return ( edit(row.id!)}> {$t('common.edit')} + ); + }; + const syncBtn = () => { + if (!hasAuth('system:tenant:edit')) { + return null; + } + return ( handleDelete(row.id!)}> {{ default: () => `确认同步[${row.companyName}]的套餐吗?`, @@ -108,6 +126,13 @@ const { ) }} + ); + }; + const deleteBtn = () => { + if (!hasAuth('system:tenant:delete')) { + return null; + } + return ( handleDelete(row.id!)}> {{ default: () => $t('common.confirmDelete'), @@ -118,8 +143,16 @@ const { ) }} + ); + }; + return ( +
+ {editBtn()} + {syncBtn()} + {deleteBtn()}
- ) : null + ); + } } ] }); @@ -144,6 +177,10 @@ async function handleDelete(id: CommonType.IdType) { async function edit(id: CommonType.IdType) { handleEdit('id', id); } + +async function handleExport() { + download('/system/tenant/export', searchParams, '租户列表.xlsx'); +}