reactor:优化批量删除的代码,从 as number 变成 !

This commit is contained in:
YunaiV
2025-09-02 09:28:19 +08:00
parent 67da079606
commit c25ea731fd
73 changed files with 102 additions and 97 deletions

View File

@@ -90,7 +90,7 @@ function handleRowCheckboxChange({
}: {
records: InfraCodegenApi.CodegenTable[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除代码生成配置 */

View File

@@ -66,15 +66,6 @@ async function handleDelete(row: InfraConfigApi.Config) {
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraConfigApi.Config[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 批量删除参数 */
async function handleDeleteBatch() {
const hideLoading = message.loading({
@@ -92,6 +83,15 @@ async function handleDeleteBatch() {
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: InfraConfigApi.Config[];
}) {
checkedIds.value = records.map((item) => item.id!);
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),

View File

@@ -80,7 +80,7 @@ function handleRowCheckboxChange({
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -90,7 +90,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -89,7 +89,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 表格操作按钮的回调函数 */

View File

@@ -77,7 +77,7 @@ async function onDeleteBatch() {
await deleteDemo03GradeList(checkedIds.value);
checkedIds.value = [];
message.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
await onRefresh();
} finally {
hideLoading();
}
@@ -89,7 +89,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 表格操作按钮的回调函数 */

View File

@@ -89,7 +89,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -67,7 +67,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除学生 */
async function onDeleteBatch() {

View File

@@ -137,7 +137,7 @@ function handleRowCheckboxChange({
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -148,7 +148,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id)!;
}
/** 导出表格 */

View File

@@ -95,7 +95,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
const loading = ref(true); // 列表的加载中

View File

@@ -95,7 +95,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
const loading = ref(true); // 列表的加载中

View File

@@ -144,7 +144,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -138,7 +138,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Student[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

@@ -72,7 +72,7 @@ function handleRowCheckboxChange({
}: {
records: InfraFileApi.File[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除文件 */

View File

@@ -106,7 +106,7 @@ function handleRowCheckboxChange({
}: {
records: InfraFileConfigApi.FileConfig[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除文件配置 */

View File

@@ -118,7 +118,7 @@ async function handleDelete(row: InfraJobApi.Job) {
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({ records }: { records: InfraJobApi.Job[] }) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除任务 */