!132 修复了一些代码生成 review 提到的问题

Merge pull request !132 from puhui999/dev
This commit is contained in:
xingyu
2025-06-06 09:26:43 +00:00
committed by Gitee
16 changed files with 102 additions and 104 deletions

View File

@@ -47,8 +47,7 @@ export function deleteDemo01Contact(id: number) {
}
/** 批量删除示例联系人 */
// TODO @puhui999ByIds这种按照约定是不带的针对 Id 的情况哈。
export function deleteDemo01ContactListByIds(ids: number[]) {
export function deleteDemo01ContactList(ids: number[]) {
return requestClient.delete(
`/infra/demo01-contact/delete-list?ids=${ids.join(',')}`,
);

View File

@@ -62,7 +62,7 @@ export function deleteDemo03Student(id: number) {
}
/** 批量删除学生 */
export function deleteDemo03StudentListByIds(ids: number[]) {
export function deleteDemo03StudentList(ids: number[]) {
return requestClient.delete(
`/infra/demo03-student-erp/delete-list?ids=${ids.join(',')}`,
);
@@ -109,7 +109,7 @@ export function deleteDemo03Course(id: number) {
}
/** 批量删除学生课程 */
export function deleteDemo03CourseListByIds(ids: number[]) {
export function deleteDemo03CourseList(ids: number[]) {
return requestClient.delete(
`/infra/demo03-student-erp/demo03-course/delete-list?ids=${ids.join(',')}`,
);
@@ -155,7 +155,7 @@ export function deleteDemo03Grade(id: number) {
}
/** 批量删除学生班级 */
export function deleteDemo03GradeListByIds(ids: number[]) {
export function deleteDemo03GradeList(ids: number[]) {
return requestClient.delete(
`/infra/demo03-student-erp/demo03-grade/delete-list?ids=${ids.join(',')}`,
);

View File

@@ -64,7 +64,7 @@ export function deleteDemo03Student(id: number) {
}
/** 批量删除学生 */
export function deleteDemo03StudentListByIds(ids: number[]) {
export function deleteDemo03StudentList(ids: number[]) {
return requestClient.delete(
`/infra/demo03-student-inner/delete-list?ids=${ids.join(',')}`,
);

View File

@@ -64,7 +64,7 @@ export function deleteDemo03Student(id: number) {
}
/** 批量删除学生 */
export function deleteDemo03StudentListByIds(ids: number[]) {
export function deleteDemo03StudentList(ids: number[]) {
return requestClient.delete(
`/infra/demo03-student-normal/delete-list?ids=${ids.join(',')}`,
);

View File

@@ -5,14 +5,14 @@ import type { Demo01ContactApi } from '#/api/infra/demo/demo01';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo01Contact,
deleteDemo01ContactListByIds,
deleteDemo01ContactList,
exportDemo01Contact,
getDemo01ContactPage,
} from '#/api/infra/demo/demo01';
@@ -65,7 +65,7 @@ async function handleDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo01ContactListByIds(checkedIds.value);
await deleteDemo01ContactList(checkedIds.value);
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
} finally {
@@ -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>
@@ -153,6 +151,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: '批量删除',
type: 'primary',
danger: true,
disabled: isEmpty(checkedIds),
icon: ACTION_ICON.DELETE,
auth: ['infra:demo01-contact:delete'],
onClick: handleDeleteBatch,

View File

@@ -16,7 +16,7 @@ import { Button, message, Tabs } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/erp';
@@ -75,7 +75,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentListByIds(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

@@ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo03Course,
deleteDemo03CourseListByIds,
deleteDemo03CourseList,
getDemo03CoursePage,
} from '#/api/infra/demo/demo03/erp';
import { $t } from '#/locales';
@@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03CourseListByIds(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

@@ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo03Grade,
deleteDemo03GradeListByIds,
deleteDemo03GradeList,
getDemo03GradePage,
} from '#/api/infra/demo/demo03/erp';
import { $t } from '#/locales';
@@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03GradeListByIds(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

@@ -16,7 +16,7 @@ import { Button, message, Tabs } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/inner';
@@ -74,7 +74,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentListByIds(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

@@ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/normal';
@@ -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 deleteDemo03StudentListByIds(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

@@ -25,7 +25,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo01Contact,
deleteDemo01ContactListByIds,
deleteDemo01ContactList,
exportDemo01Contact,
getDemo01ContactPage,
} from '#/api/infra/demo/demo01';
@@ -122,7 +122,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo01ContactListByIds(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

@@ -26,7 +26,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/erp';
@@ -133,7 +133,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentListByIds(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

@@ -19,7 +19,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo03Course,
deleteDemo03CourseListByIds,
deleteDemo03CourseList,
getDemo03CoursePage,
} from '#/api/infra/demo/demo03/erp';
import { ContentWrap } from '#/components/content-wrap';
@@ -80,7 +80,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03CourseListByIds(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

@@ -19,7 +19,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo03Grade,
deleteDemo03GradeListByIds,
deleteDemo03GradeList,
getDemo03GradePage,
} from '#/api/infra/demo/demo03/erp';
import { ContentWrap } from '#/components/content-wrap';
@@ -80,7 +80,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03GradeListByIds(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

@@ -26,7 +26,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/normal';
@@ -129,7 +129,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentListByIds(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

@@ -25,7 +25,7 @@ import {
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
import {
deleteDemo03Student,
deleteDemo03StudentListByIds,
deleteDemo03StudentList,
exportDemo03Student,
getDemo03StudentPage,
} from '#/api/infra/demo/demo03/normal';
@@ -123,7 +123,7 @@ async function onDeleteBatch() {
key: 'action_process_msg',
});
try {
await deleteDemo03StudentListByIds(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" />