增加大哥导出并删除

This commit is contained in:
2025-12-29 16:05:32 +08:00
parent 12d79aa3f9
commit c976dd52cd
4 changed files with 34 additions and 8 deletions

View File

@@ -271,6 +271,7 @@ const queryParams = reactive({
createTimeStart: '',
createTimeEnd: '',
countryName: undefined,
deleteFlag: false, //导出 是否删除
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
@@ -352,12 +353,32 @@ const handleDelete = async (id: number) => {
/** 导出按钮操作 */
const handleExport = async () => {
try {
// 导出的二次确认
await message.exportConfirm()
// 发起导出
exportLoading.value = true
const data = await BigBrotherApi.exportBigBrother(queryParams)
download.excel(data, '大哥数据.xls')
// 先确认是否删除导出的数据
await ElMessageBox.confirm(
'导出后是否删除导出的数据?',
'删除确认',
{
distinguishCancelAndClose: true,
confirmButtonText: '删除并导出',
cancelButtonText: '仅导出',
type: 'warning',
}
).then(async () => {
queryParams.deleteFlag = true
exportLoading.value = true
const data = await BigBrotherApi.exportBigBrother(queryParams)
download.excel(data, '主播数据管理.xls')
}).catch(async (err) => {
if (err === 'cancel' || err?.action === 'cancel') {
queryParams.deleteFlag = false
exportLoading.value = true
const data = await BigBrotherApi.exportBigBrother(queryParams)
download.excel(data, '主播数据管理.xls')
}
});
} catch {
} finally {
exportLoading.value = false

View File

@@ -127,6 +127,10 @@
<el-button @click="dialogAllocation = true">
<Icon icon="ep:refresh" class="mr-5px" /> {{ t('newHosts.allocation') }}
</el-button>
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
<Icon icon="ep:download" class="mr-5px" /> {{ t('newHosts.export') }}
</el-button>
<el-button @click="exportAi">
<Icon icon="ep:copy-document" class="mr-5px" /> {{ $t('employee.exportAi') }}
</el-button>

View File

@@ -518,6 +518,7 @@ const handleExport = async () => {
download.excel(data, '主播数据管理.xls')
}).catch(async (err) => {
if (err === 'cancel' || err?.action === 'cancel') {
queryParams.deleteFlag = false
exportLoading.value = true
const data = await NewHostsApi.exportNewHosts(queryParams)
download.excel(data, '主播数据管理.xls')