feat: 添加同步租户套餐的功能,并更新租户选择器逻辑。

This commit is contained in:
AN
2025-05-18 01:21:22 +08:00
parent 0c40aa32db
commit d587ce4338
4 changed files with 35 additions and 8 deletions

View File

@ -1,7 +1,12 @@
<script setup lang="tsx">
import { computed } from 'vue';
import { NButton, NDivider } from 'naive-ui';
import { fetchBatchDeleteTenant, fetchGetTenantList, fetchSyncTenantDict } from '@/service/api/system/tenant';
import {
fetchBatchDeleteTenant,
fetchGetTenantList,
fetchSyncTenantDict,
fetchSyncTenantPackage
} from '@/service/api/system/tenant';
import { useAppStore } from '@/store/modules/app';
import { useAuthStore } from '@/store/modules/auth';
import { useAuth } from '@/hooks/business/auth';
@ -129,7 +134,7 @@ const {
icon="material-symbols:sync-outline"
tooltipContent="同步套餐"
popconfirmContent={`确认同步[${row.companyName}]的套餐吗?`}
onPositiveClick={() => handleSyncTenantDict()}
onPositiveClick={() => handleSyncTenantPackage(row)}
/>
);
};
@ -196,6 +201,17 @@ async function handleSyncTenantDict() {
await getData();
}
async function handleSyncTenantPackage(row: Api.System.Tenant) {
const params: Api.System.SyncTenantPackageParams = {
tenantId: row.tenantId,
packageId: row.packageId
};
const { error } = await fetchSyncTenantPackage(params);
if (error) return;
window.$message?.success('同步租户套餐成功');
await getData();
}
async function handleExport() {
download('/system/tenant/export', searchParams, `租户列表_${new Date().getTime()}.xlsx`);
}