review:【ANTD】批量删除代码
parent
9503ef4b52
commit
241e340c3f
|
@ -21,6 +21,7 @@ export namespace InfraCodegenApi {
|
|||
createTime: Date;
|
||||
updateTime: Date;
|
||||
templateType: number;
|
||||
// TODO @puhui999:使用后端统一配置。因为一般需要批量的团队,会一直需要。不需要的,一般一直不需要哈。
|
||||
deleteBatch: boolean;
|
||||
parentMenuId: number;
|
||||
}
|
||||
|
|
|
@ -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(',')}`,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// TODO @芋艿:是否有更好的组织形式?!
|
||||
<script lang="ts" setup>
|
||||
import type { DataNode } from 'ant-design-vue/es/tree';
|
||||
|
||||
|
|
|
@ -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, // 简易设计器
|
||||
|
|
|
@ -162,6 +162,7 @@ const handleCategorySortSubmit = async () => {
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<!-- TODO @jaosn:没头像的图标,展示文字头像哈 -->
|
||||
<!-- 流程分类表单弹窗 -->
|
||||
<CategoryFormModal @success="getList" />
|
||||
<Card
|
||||
|
|
|
@ -159,6 +159,7 @@ export function useGenerationInfoBaseFormSchema(): VbenFormSchema[] {
|
|||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
// TODO @puhui999:使用后端统一配置。因为一般需要批量的团队,会一直需要。不需要的,一般一直不需要哈。
|
||||
component: 'RadioGroup',
|
||||
fieldName: 'deleteBatch',
|
||||
label: '批量删除?',
|
||||
|
|
|
@ -151,6 +151,7 @@ export function useGridColumns(
|
|||
minWidth: 200,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
// TODO @puhui999:headerAlign 要使用 headerAlign: 'center' 么?看着现在分成了 align 和 headerAlign 两种
|
||||
headerAlign: 'center',
|
||||
showOverflow: false,
|
||||
cellRender: {
|
||||
|
|
|
@ -61,6 +61,7 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO @puhui999::1)/** 批量删除示例联系人 */ 是不是放在 deleteIds 上面;2)showDeleteBatchBtn 是不是直接 disabled 哪里判断哈;
|
||||
const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID
|
||||
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
|
||||
/** 批量删除示例联系人 */
|
||||
|
|
|
@ -55,6 +55,7 @@ function onCreate() {
|
|||
}
|
||||
|
||||
/** 删除角色 */
|
||||
// TODO @星语:要不要改成 handleXXX 风格?貌似看着更多项目是这么写的,不去改变大家的习惯。
|
||||
async function onDelete(row: SystemRoleApi.Role) {
|
||||
message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue