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

@@ -81,7 +81,7 @@ function handleRowCheckboxChange({
}: {
records: SystemDeptApi.Dept[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除部门 */

View File

@@ -78,7 +78,7 @@ function handleRowCheckboxChange({
}: {
records: SystemDictDataApi.DictData[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除字典数据 */

View File

@@ -76,7 +76,7 @@ function handleRowCheckboxChange({
}: {
records: SystemDictTypeApi.DictType[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除字典类型 */

View File

@@ -64,7 +64,7 @@ function handleRowCheckboxChange({
}: {
records: SystemMailAccountApi.MailAccount[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除邮箱账号 */

View File

@@ -76,7 +76,7 @@ function handleRowCheckboxChange({
}: {
records: SystemMailTemplateApi.MailTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除邮件模板 */

View File

@@ -59,15 +59,6 @@ async function handleDelete(row: SystemNoticeApi.Notice) {
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemNoticeApi.Notice[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 批量删除公告 */
async function handleDeleteBatch() {
const hideLoading = message.loading({
@@ -85,6 +76,15 @@ async function handleDeleteBatch() {
}
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemNoticeApi.Notice[];
}) {
checkedIds.value = records.map((item) => item.id as number);
}
/** 推送公告 */
async function handlePush(row: SystemNoticeApi.Notice) {
const hideLoading = message.loading({

View File

@@ -82,7 +82,7 @@ function handleRowCheckboxChange({
}: {
records: SystemNotifyTemplateApi.NotifyTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除站内信模板 */

View File

@@ -71,7 +71,7 @@ function handleRowCheckboxChange({
}: {
records: SystemPostApi.Post[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除岗位 */

View File

@@ -84,7 +84,7 @@ function handleRowCheckboxChange({
}: {
records: SystemRoleApi.Role[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除角色 */

View File

@@ -65,14 +65,13 @@ async function handleDelete(row: SystemSmsChannelApi.SmsChannel) {
}
}
// 选中的短信渠道ID
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: SystemSmsChannelApi.SmsChannel[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除处理 */

View File

@@ -82,7 +82,7 @@ function handleRowCheckboxChange({
}: {
records: SystemSmsTemplateApi.SmsTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除短信模板 */

View File

@@ -83,7 +83,7 @@ function handleRowCheckboxChange({
}: {
records: SystemTenantApi.Tenant[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除租户 */

View File

@@ -64,7 +64,7 @@ function handleRowCheckboxChange({
}: {
records: SystemTenantPackageApi.TenantPackage[];
}) {
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: SystemUserApi.User[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 批量删除用户 */