fix: 代码生成批量删除相关 setCheckedIds -> handleRowCheckboxChange、deleteIds -> checkedIds 然后注释去掉

pull/132/head
puhui999 2025-06-06 16:03:13 +08:00
parent 2c9032e595
commit 2abe2e21bc
12 changed files with 81 additions and 83 deletions

View File

@ -73,10 +73,8 @@ async function handleDeleteBatch() {
}
}
// TODO @puhui999 handleRowCheckboxChange
// TODO @puhui999deleteIds => checkedIds
const checkedIds = ref<number[]>([]); // ID
function setCheckedIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
@ -121,8 +119,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo01ContactApi.Demo01Contact>,
gridEvents: {
checkboxAll: setCheckedIds,
checkboxChange: setCheckedIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>

View File

@ -75,7 +75,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@ -83,13 +83,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -150,8 +150,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
cellClick: ({ row }: { row: Demo03StudentApi.Demo03Student }) => {
selectDemo03Student.value = row;
},
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
@ -185,7 +185,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03CourseList(deleteIds.value);
await deleteDemo03CourseList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@ -82,13 +82,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 表格操作按钮的回调函数 */
@ -143,8 +143,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo03StudentApi.Demo03Course>,
gridEvents: {
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
@ -184,7 +184,7 @@ watch(
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03GradeList(deleteIds.value);
await deleteDemo03GradeList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@ -82,13 +82,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 表格操作按钮的回调函数 */
@ -143,8 +143,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo03StudentApi.Demo03Grade>,
gridEvents: {
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
@ -184,7 +184,7 @@ watch(
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@ -82,13 +82,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -145,8 +145,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo03StudentApi.Demo03Student>,
gridEvents: {
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
@ -190,7 +190,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@ -61,13 +61,13 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 批量删除学生 */
async function onDeleteBatch() {
@ -77,7 +77,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@ -139,8 +139,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo03StudentApi.Demo03Student>,
gridEvents: {
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
@ -173,7 +173,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>

View File

@ -122,7 +122,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo01ContactList(deleteIds.value);
await deleteDemo01ContactList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -130,13 +130,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -241,7 +241,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo01-contact:delete']"
>
@ -254,8 +254,8 @@ onMounted(() => {
:data="list"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<VxeColumn field="id" title="编号" align="center" />

View File

@ -133,7 +133,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -141,13 +141,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -250,7 +250,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>
@ -269,8 +269,8 @@ onMounted(() => {
}"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<VxeColumn field="id" title="编号" align="center" />

View File

@ -80,7 +80,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03CourseList(deleteIds.value);
await deleteDemo03CourseList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -88,13 +88,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
const loading = ref(true); //
@ -231,7 +231,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>
@ -244,8 +244,8 @@ onMounted(() => {
:data="list"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<VxeColumn field="id" title="编号" align="center" />

View File

@ -80,7 +80,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03GradeList(deleteIds.value);
await deleteDemo03GradeList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -88,13 +88,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
const loading = ref(true); //
@ -231,7 +231,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>
@ -244,8 +244,8 @@ onMounted(() => {
:data="list"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<VxeColumn field="id" title="编号" align="center" />

View File

@ -129,7 +129,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -137,13 +137,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -246,7 +246,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>
@ -259,8 +259,8 @@ onMounted(() => {
:data="list"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<!-- 子表的列表 -->

View File

@ -123,7 +123,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentList(deleteIds.value);
await deleteDemo03StudentList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
await getList();
} finally {
@ -131,13 +131,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]); // ID
function setDeleteIds({
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
/** 导出表格 */
@ -240,7 +240,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['infra:demo03-student:delete']"
>
@ -253,8 +253,8 @@ onMounted(() => {
:data="list"
show-overflow
:loading="loading"
@checkbox-all="setDeleteIds"
@checkbox-change="setDeleteIds"
@checkbox-all="handleRowCheckboxChange"
@checkbox-change="handleRowCheckboxChange"
>
<VxeColumn type="checkbox" width="40" />
<VxeColumn field="id" title="编号" align="center" />