reactor:优化批量删除的代码,从 as number 变成 !
This commit is contained in:
@@ -90,7 +90,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: InfraCodegenApi.CodegenTable[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 批量删除代码生成配置 */
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -80,7 +80,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo01ContactApi.Demo01Contact[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -90,7 +90,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Grade[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -89,7 +89,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Course[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
|
||||
@@ -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!);
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
|
||||
@@ -89,7 +89,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Student[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -137,7 +137,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo01ContactApi.Demo01Contact[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -148,7 +148,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Student[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id)!;
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -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); // 列表的加载中
|
||||
|
||||
@@ -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); // 列表的加载中
|
||||
|
||||
@@ -144,7 +144,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Student[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -138,7 +138,7 @@ function handleRowCheckboxChange({
|
||||
}: {
|
||||
records: Demo03StudentApi.Demo03Student[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
|
||||
@@ -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!);
|
||||
}
|
||||
|
||||
/** 批量删除文件 */
|
||||
|
||||
@@ -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!);
|
||||
}
|
||||
|
||||
/** 批量删除文件配置 */
|
||||
|
||||
@@ -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!);
|
||||
}
|
||||
|
||||
/** 批量删除任务 */
|
||||
|
||||
Reference in New Issue
Block a user