fix: 统一状态切换函数参数类型为 SwitchProps['checked']

修复多个系统管理页面及全局组件中状态切换函数参数类型不一致的问题,将原先的 `boolean` 类型统一为 `SwitchProps['checked']` 类型,确保与 antdv-next 组件库的类型定义保持一致,提高类型安全性和代码一致性。
This commit is contained in:
dap
2026-02-02 13:27:49 +08:00
parent 41f0e043e9
commit 17aefd5568
7 changed files with 34 additions and 12 deletions

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
@@ -115,7 +117,10 @@ async function handleExport() {
}
const { hasAccessByCodes } = useAccess();
async function handleChangeStatus(checked: boolean, row: Client) {
async function handleChangeStatus(
checked: SwitchProps['checked'],
row: Client,
) {
await clientChangeStatus({
clientId: row.id,
status: checked ? EnableStatus.Enable : EnableStatus.Disable,

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
@@ -101,7 +103,10 @@ function handleMultiDelete() {
}
const { hasAccessByCodes } = useAccess();
async function handleChangeStatus(checked: boolean, row: OssConfig) {
async function handleChangeStatus(
checked: SwitchProps['checked'],
row: OssConfig,
) {
await ossConfigChangeStatus({
ossConfigId: row.ossConfigId,
configKey: row.configKey,

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
@@ -147,7 +149,7 @@ function handleAssignRole(record: Role) {
router.push(`/system/role-auth/user/${record.roleId}`);
}
async function handleChangeStatus(checked: boolean, row: Role) {
async function handleChangeStatus(checked: SwitchProps['checked'], row: Role) {
await roleChangeStatus({
roleId: row.roleId,
status: checked ? EnableStatus.Enable : EnableStatus.Disable,

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { DropdownEmits, MenuItemType } from 'antdv-next';
import type { DropdownEmits, MenuItemType, SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
@@ -164,7 +164,10 @@ function handleSyncTenantConfig() {
});
}
async function handleChangeStatus(checked: boolean, row: Tenant) {
async function handleChangeStatus(
checked: SwitchProps['checked'],
row: Tenant,
) {
await tenantStatusChange({
id: row.id,
tenantId: row.tenantId,

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
@@ -124,7 +126,10 @@ const isSuperAdmin = computed(() => {
return hasAccessByRoles(['superadmin']);
});
async function handleChangeStatus(checked: boolean, row: TenantPackage) {
async function handleChangeStatus(
checked: SwitchProps['checked'],
row: TenantPackage,
) {
await packageChangeStatus({
packageId: row.packageId,
status: checked ? EnableStatus.Enable : EnableStatus.Disable,

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { MenuProps } from 'antdv-next';
import type { MenuProps, SwitchProps } from 'antdv-next';
import type { VbenFormProps } from '@vben/common-ui';
@@ -205,7 +205,7 @@ function handleMenuClick(key: string, row: any) {
}
}
async function handleChangeStatus(checked: boolean, row: User) {
async function handleChangeStatus(checked: SwitchProps['checked'], row: User) {
await userStatusChange({
userId: row.userId,
status: checked ? EnableStatus.Enable : EnableStatus.Disable,