Commit a4df63ff by lijiabin

【需求 25171】 feat: 新增后台案例库删除功能

parent f5a5dc76
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
<el-icon><IEpDownload /></el-icon>下载导入模板</el-button <el-icon><IEpDownload /></el-icon>下载导入模板</el-button
> >
<ImportExcelBtn :api="importCaseExcel" @success="refresh" @error="handleError" /> <ImportExcelBtn :api="importCaseExcel" @success="refresh" @error="handleError" />
<el-button type="primary" @click="handleBatchPublish"> 批量发布/隐藏 </el-button>
<el-button type="danger" @click="handleBatchDelete"> 批量删除 </el-button>
</div> </div>
<!-- 表格区域 --> <!-- 表格区域 -->
...@@ -248,10 +246,10 @@ ...@@ -248,10 +246,10 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="100" fixed="right"> <el-table-column label="操作" width="130" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link @click="handleEdit(row)">编辑</el-button> <el-button type="primary" link @click="handleEdit(row)">编辑</el-button>
<!-- <el-button type="danger" link @click="handleDelete(row)">删除</el-button> --> <el-button type="danger" link @click="handleDelete(row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -280,11 +278,10 @@ ...@@ -280,11 +278,10 @@
import { usePageSearch } from '@/hooks' import { usePageSearch } from '@/hooks'
import { import {
getCaseList, getCaseList,
deleteColumn,
hideColumn,
changeUsageStatus, changeUsageStatus,
auditCase, auditCase,
importCaseExcel, importCaseExcel,
deleteCase,
} from '@/api/backend' } from '@/api/backend'
import type { BackendCaseListItemDto } from '@/api/backend' import type { BackendCaseListItemDto } from '@/api/backend'
import { import {
...@@ -332,22 +329,6 @@ const handleSelectionChange = (selection: BackendCaseListItemDto[]) => { ...@@ -332,22 +329,6 @@ const handleSelectionChange = (selection: BackendCaseListItemDto[]) => {
selectedRows.value = selection selectedRows.value = selection
} }
// 批量发布/隐藏
const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
push.success('发布/隐藏成功')
}
// 批量删除
const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
push.success('删除成功')
}
const handleContent = (row: BackendCaseListItemDto) => { const handleContent = (row: BackendCaseListItemDto) => {
ElMessageBox.alert(row.content, '案例全部文本内容', { ElMessageBox.alert(row.content, '案例全部文本内容', {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -383,6 +364,19 @@ const handleError = (list: BackendCaseListItemDto[]) => { ...@@ -383,6 +364,19 @@ const handleError = (list: BackendCaseListItemDto[]) => {
errorList.value = list errorList.value = list
} }
const handleDelete = async (row: BackendCaseListItemDto) => {
await confirm({
title: '提示',
message: '确定要删除该案例吗?',
confirmText: '确定',
cancelText: '取消',
type: 'danger',
})
await deleteCase(row.id)
push.success('删除案例库成功')
refresh()
}
const downloadImportTemplate = () => { const downloadImportTemplate = () => {
window.open( window.open(
'https://soundasia.oss-cn-shenzhen.aliyuncs.com/OA/readName/xlsx/2026/03/11/Common/1773219970707.xlsx', 'https://soundasia.oss-cn-shenzhen.aliyuncs.com/OA/readName/xlsx/2026/03/11/Common/1773219970707.xlsx',
......
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