Commit ec29937c by lijiabin

【需求 25171】feat: 每日抽奖配置新增批量删除功能

复用了已有的 deleteLotteryPrize(本来就接收 idList,不需要新加接口),加了
选择列,"本期奖品"那一行编辑/删除本来就是禁用的,复选框也跟着一起禁用,
避免勾进批量删除里。
parent a41bd5c7
......@@ -26,13 +26,23 @@
<el-icon class="mr-2"><IEpSetting /></el-icon>
抽奖配置
</el-button>
<el-button type="danger" @click="handleBatchDelete" :disabled="selectedRows.length === 0">
批量删除
</el-button>
</div>
<!-- 表格区域 -->
<div class="table-section">
<!-- 表格 -->
<div class="table-wrapper">
<el-table v-loading="loading" :data="list" height="100%">
<el-table
v-loading="loading"
:data="list"
height="100%"
@selection-change="handleSelectionChange"
>
<!-- 本期奖品不能编辑/删除,选择框也一并禁用,避免勾进批量删除里 -->
<el-table-column type="selection" width="55" :selectable="(row) => !row.isCurrent" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="imageUrl" label="图片">
<template #default="{ row }">
......@@ -224,6 +234,25 @@ const lotteryConfigRef = ref<InstanceType<typeof LotteryConfig>>()
const handleLotteryConfig = () => {
lotteryConfigRef.value?.open()
}
const selectedRows = ref<BackendAddOrUpdateLotteryPrizeDto[]>([])
// 选择
const handleSelectionChange = (selection: BackendAddOrUpdateLotteryPrizeDto[]) => {
selectedRows.value = selection
}
// 批量删除:deleteLotteryPrize 本来就接收 idList,不用新加接口
const handleBatchDelete = async () => {
await confirm({
title: '提示',
message: `确定要删除选中的 ${selectedRows.value.length} 个奖品吗?`,
type: 'danger',
})
await deleteLotteryPrize(selectedRows.value.map((item) => item.id!))
refresh()
push.success('删除成功')
}
</script>
<style scoped lang="scss">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment