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

This commit is contained in:
puhui999 2025-06-06 16:06:31 +08:00
parent 7c4859b5c6
commit b7ab10305f
4 changed files with 28 additions and 28 deletions

View File

@ -167,7 +167,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await delete${simpleClassName}ListByIds(deleteIds.value);
await delete${simpleClassName}ListByIds(checkedIds.value);
message.success( $t('ui.actionMessage.deleteSuccess') );
await getList();
} finally {
@ -175,13 +175,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]) // 待删除${table.classComment} ID
function setDeleteIds({
const checkedIds = ref<number[]>([])
function handleRowCheckboxChange({
records,
}: {
records: ${simpleClassName}Api.${simpleClassName}[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
#end
@ -336,7 +336,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']"
>
@ -368,8 +368,8 @@ onMounted(() => {
show-overflow
:loading="loading"
#if ($table.templateType != 2 && $deleteBatchEnable)
@checkboxAll="setDeleteIds"
@checkboxChange="setDeleteIds"
@checkboxAll="handleRowCheckboxChange"
@checkboxChange="handleRowCheckboxChange"
#end
>
#if ($table.templateType != 2 && $deleteBatchEnable)

View File

@ -91,7 +91,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await delete${subSimpleClassName}ListByIds(deleteIds.value);
await delete${subSimpleClassName}ListByIds(checkedIds.value);
message.success( $t('ui.actionMessage.deleteSuccess') );
await getList();
} finally {
@ -99,13 +99,13 @@ async function onDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]) // 待删除${subTable.classComment} ID
function setDeleteIds({
const checkedIds = ref<number[]>([])
function handleRowCheckboxChange({
records,
}: {
records: ${simpleClassName}Api.${subSimpleClassName}[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
#end
#end
@ -310,7 +310,7 @@ onMounted(() => {
type="primary"
danger
class="ml-2"
:disabled="isEmpty(deleteIds)"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']"
>
@ -325,8 +325,8 @@ onMounted(() => {
show-overflow
:loading="loading"
#if ($deleteBatchEnable)
@checkboxAll="setDeleteIds"
@checkboxChange="setDeleteIds"
@checkboxAll="handleRowCheckboxChange"
@checkboxChange="handleRowCheckboxChange"
#end
>
#if ($deleteBatchEnable)

View File

@ -101,7 +101,7 @@ async function handleDeleteBatch() {
key: 'action_key_msg',
});
try {
await delete${simpleClassName}ListByIds(deleteIds.value);
await delete${simpleClassName}ListByIds(checkedIds.value);
message.success({
content: $t('ui.actionMessage.deleteSuccess'),
key: 'action_key_msg',
@ -112,13 +112,13 @@ async function handleDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]) // 待删除${table.classComment} ID
function setDeleteIds({
const checkedIds = ref<number[]>([])
function handleRowCheckboxChange({
records,
}: {
records: ${simpleClassName}Api.${simpleClassName}[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
#end
@ -192,8 +192,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
#end
#if($deleteBatchEnable)
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
#end
}
#end
@ -254,7 +254,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'primary',
danger: true,
icon: ACTION_ICON.DELETE,
disabled: isEmpty(deleteIds),
disabled: isEmpty(checkedIds),
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
onClick: handleDeleteBatch,
},

View File

@ -81,7 +81,7 @@ async function handleDeleteBatch() {
key: 'action_key_msg',
});
try {
await delete${subSimpleClassName}ListByIds(deleteIds.value);
await delete${subSimpleClassName}ListByIds(checkedIds.value);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
key: 'action_key_msg',
@ -92,13 +92,13 @@ async function handleDeleteBatch() {
}
}
const deleteIds = ref<number[]>([]) // 待删除${subTable.classComment} ID
function setDeleteIds({
const checkedIds = ref<number[]>([])
function handleRowCheckboxChange({
records,
}: {
records: ${simpleClassName}Api.${subSimpleClassName}[];
}) {
deleteIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id);
}
#end
@ -151,8 +151,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
} as VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>,
#if (${table.templateType} == 11 && $deleteBatchEnable)
gridEvents:{
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
}
#end
});
@ -204,7 +204,7 @@ watch(
type: 'primary',
danger: true,
icon: ACTION_ICON.DELETE,
disabled: isEmpty(deleteIds),
disabled: isEmpty(checkedIds),
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
onClick: handleDeleteBatch,
},