mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-13 15:12:10 +08:00
refactor(antdv-next): 将message组件调用统一改为window.message
将项目中直接导入的antdv-next的message组件调用改为通过window.message调用,提升代码一致性 移除不再需要的message组件导入 新增api-switch组件用于统一处理状态切换逻辑
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
userRemove,
|
||||
userStatusChange,
|
||||
} from '#/api/system/user';
|
||||
import { TableSwitch } from '#/components/table';
|
||||
import ApiSwitch from '#/components/global/api-switch.vue';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
@@ -199,6 +199,14 @@ function handleMenuClick(key: string, row: any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function handleChangeStatus(checked: boolean, row: User) {
|
||||
console.log(checked);
|
||||
await userStatusChange({
|
||||
userId: row.userId,
|
||||
status: checked ? '0' : '1',
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -248,9 +256,10 @@ function handleMenuClick(key: string, row: any) {
|
||||
<Avatar :src="row.avatar || preferences.app.defaultAvatar" />
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<TableSwitch
|
||||
v-model:value="row.status"
|
||||
:api="() => userStatusChange(row)"
|
||||
<!-- value只能接收boolean值 -->
|
||||
<ApiSwitch
|
||||
:value="row.status === '0'"
|
||||
:api="(checked) => handleChangeStatus(checked, row)"
|
||||
:disabled="
|
||||
row.userId === 1 || !hasAccessByCodes(['system:user:edit'])
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user