review:【ANTD】批量删除代码

This commit is contained in:
YunaiV
2025-05-19 19:52:25 +08:00
parent 9503ef4b52
commit 241e340c3f
10 changed files with 21 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ export namespace InfraCodegenApi {
createTime: Date;
updateTime: Date;
templateType: number;
// TODO @puhui999使用后端统一配置。因为一般需要批量的团队会一直需要。不需要的一般一直不需要哈。
deleteBatch: boolean;
parentMenuId: number;
}

View File

@@ -47,6 +47,7 @@ export function deleteDemo01Contact(id: number) {
}
// 批量删除示例联系人
// TODO @puhui999注释风格哈。
export function deleteDemo01ContactByIds(ids: number[]) {
return requestClient.delete(
`/infra/demo01-contact/delete-batch?ids=${ids.join(',')}`,

View File

@@ -1,3 +1,4 @@
// TODO @芋艿:是否有更好的组织形式?!
<script lang="ts" setup>
import type { DataNode } from 'ant-design-vue/es/tree';

View File

@@ -33,6 +33,7 @@ import FormDesign from './modules/form-design.vue';
defineOptions({ name: 'BpmModelCreate' });
// TODO 这个常量是不是所有 apps 都可以使用, 放 @utils/constant.ts 不能共享, @芋艿 这些常量放哪里合适!
// TODO @jason/Users/yunai/Java/yudao-ui-admin-vben-v5/apps/web-antd/src/utils/constants.ts先不多个 apps 共享哈;
const BpmModelType = {
BPMN: 10, // BPMN 设计器
SIMPLE: 20, // 简易设计器

View File

@@ -162,6 +162,7 @@ const handleCategorySortSubmit = async () => {
<template>
<Page auto-content-height>
<!-- TODO @jaosn没头像的图标展示文字头像哈 -->
<!-- 流程分类表单弹窗 -->
<CategoryFormModal @success="getList" />
<Card

View File

@@ -159,6 +159,7 @@ export function useGenerationInfoBaseFormSchema(): VbenFormSchema[] {
rules: 'selectRequired',
},
{
// TODO @puhui999使用后端统一配置。因为一般需要批量的团队会一直需要。不需要的一般一直不需要哈。
component: 'RadioGroup',
fieldName: 'deleteBatch',
label: '批量删除?',

View File

@@ -151,6 +151,7 @@ export function useGridColumns(
minWidth: 200,
align: 'center',
fixed: 'right',
// TODO @puhui999headerAlign 要使用 headerAlign: 'center' 么?看着现在分成了 align 和 headerAlign 两种
headerAlign: 'center',
showOverflow: false,
cellRender: {

View File

@@ -61,6 +61,7 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
}
}
// TODO @puhui999:1/** 批量删除示例联系人 */ 是不是放在 deleteIds 上面2showDeleteBatchBtn 是不是直接 disabled 哪里判断哈;
const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
/** 批量删除示例联系人 */

View File

@@ -55,6 +55,7 @@ function onCreate() {
}
/** 删除角色 */
// TODO @星语:要不要改成 handleXXX 风格?貌似看着更多项目是这么写的,不去改变大家的习惯。
async function onDelete(row: SystemRoleApi.Role) {
message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),

View File

@@ -57,16 +57,21 @@ function onEdit(row: SystemTenantApi.Tenant) {
/** 删除租户 */
async function onDelete(row: SystemTenantApi.Tenant) {
message.loading({
const loading = message.loading({
content: $t('ui.actionMessage.deleting', [row.name]),
key: 'action_key_msg',
});
await deleteTenant(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
try {
await deleteTenant(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
key: 'action_key_msg',
});
onRefresh();
} finally {
// TODO @星语:测试了下,这样可以取消 loading测试方式1先把数据库的数据标记删除2点击界面进行删除loading 可以正确消失;
loading();
}
}
const [Grid, gridApi] = useVbenVxeGrid({