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

@@ -159,7 +159,7 @@ function handleRowCheckboxChange({
}: {
records: InfraCodegenApi.CodegenTable[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
const [Grid, gridApi] = useVbenVxeGrid({

View File

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

View File

@@ -59,7 +59,7 @@ async function onDeleteBatch() {
await deleteDataSourceConfigList(checkedIds.value);
checkedIds.value = [];
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
onRefresh();
await onRefresh();
}
const checkedIds = ref<number[]>([]);
@@ -68,7 +68,7 @@ function handleRowCheckboxChange({
}: {
records: InfraDataSourceConfigApi.DataSourceConfig[];
}) {
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: Demo01ContactApi.Demo01Contact[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
/** 导出表格 */

View File

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

View File

@@ -83,7 +83,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Course[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
const [Grid, gridApi] = useVbenVxeGrid({

View File

@@ -83,7 +83,7 @@ function handleRowCheckboxChange({
}: {
records: Demo03StudentApi.Demo03Grade[];
}) {
checkedIds.value = records.map((item) => item.id);
checkedIds.value = records.map((item) => item.id!);
}
const [Grid, gridApi] = useVbenVxeGrid({

View File

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

View File

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

View File

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

View File

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

View File

@@ -91,7 +91,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

@@ -91,7 +91,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

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

View File

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

View File

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

View File

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

View File

@@ -129,7 +129,7 @@ async function onDeleteBatch() {
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!);
}
/** 表格操作按钮的回调函数 */

View File

@@ -63,7 +63,7 @@ function handleRowCheckboxChange({
}: {
records: MallCouponTemplateApi.CouponTemplate[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 优惠券模板状态修改 */

View File

@@ -47,7 +47,7 @@ function onRefresh() {
/** 设置选中 ID */
const checkedIds = ref<number[]>([]);
function setCheckedIds({ records }: { records: MemberUserApi.User[] }) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 发送优惠券 */

View File

@@ -87,7 +87,7 @@ function handleRowCheckboxChange({
}: {
records: SystemDictDataApi.DictData[];
}) {
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: SystemDictTypeApi.DictType[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 表格操作按钮回调 */

View File

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

View File

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

View File

@@ -35,6 +35,7 @@ function onRefresh() {
}
/** 创建公告 */
// TODO @霖:【规范讨论】方法名,要不要都换成 handleXXX 开头,和 ep 保持一致;
function onCreate() {
formModalApi.setData(null).open();
}
@@ -74,7 +75,7 @@ function handleRowCheckboxChange({
}: {
records: SystemNoticeApi.Notice[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 推送公告 */
@@ -173,6 +174,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
]"
/>
</template>
<!-- TODO @规范讨论要不要类似 antd 一样改成 TableAction可见 /apps/web-ele/src/views/system/notice/index.vue 167 195 -->
</Grid>
</Page>
</template>

View File

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

View File

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

View File

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

View File

@@ -94,7 +94,7 @@ function handleRowCheckboxChange({
}: {
records: SystemRoleApi.Role[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 分配角色的数据权限 */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -111,7 +111,7 @@ function handleRowCheckboxChange({
}: {
records: SystemUserApi.User[];
}) {
checkedIds.value = records.map((item) => item.id as number);
checkedIds.value = records.map((item) => item.id!);
}
/** 重置密码 */