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

pull/209/head
YunaiV 2025-09-02 09:28:19 +08:00
parent 67da079606
commit c25ea731fd
73 changed files with 102 additions and 97 deletions

View File

@ -34,6 +34,7 @@ function onRefresh() {
gridApi.query();
}
// TODO @Xuzhiqiang
const checkedIds = ref<number[]>([]);
/** 详情 */

View File

@ -35,16 +35,6 @@ function onRefresh() {
gridApi.query();
}
// TODO @nehc handleRowCheckboxChange
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: ErpPurchaseOrderApi.PurchaseOrder[];
}) {
checkedIds.value = records.map((item) => item.id);
}
/** 详情 */
function handleDetail(row: ErpPurchaseOrderApi.PurchaseOrder) {
formModalApi.setData({ type: 'detail', id: row.id }).open();
@ -104,6 +94,16 @@ async function handleBatchDelete() {
}
}
// TODO @Xuzhiqiang
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: ErpPurchaseOrderApi.PurchaseOrder[];
}) {
checkedIds.value = records.map((item) => item.id!);
}
/** 审批/反审批操作 */
function handleUpdateStatus(
row: ErpPurchaseOrderApi.PurchaseOrder,

View File

@ -34,6 +34,7 @@ function onRefresh() {
gridApi.query();
}
// TODO @Xuzhiqiang
const checkedIds = ref<number[]>([]);
/** 详情 */

View File

@ -34,6 +34,7 @@ function onRefresh() {
gridApi.query();
}
// TODO @Xuzhiqiang
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,

View File

@ -34,6 +34,7 @@ function onRefresh() {
gridApi.query();
}
// TODO @Xuzhiqiang
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,

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!);
}
/** 批量删除任务 */

View File

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

@ -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!);
}
/** 批量删除用户 */

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!);
}
/** 重置密码 */