增加大哥导出并删除

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

@@ -4,8 +4,8 @@ NODE_ENV=development
VITE_DEV=true VITE_DEV=true
# 请求路径 # 请求路径
# VITE_BASE_URL='http://192.168.2.21:48080' VITE_BASE_URL='http://192.168.2.21:48080'
VITE_BASE_URL='https://backstageapi.yolozs.com' # VITE_BASE_URL='https://backstageapi.yolozs.com'
# VITE_BASE_URL='https://testapi.tknb.net' # VITE_BASE_URL='https://testapi.tknb.net'
# 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务 # 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务

View File

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

View File

@@ -127,6 +127,10 @@
<el-button @click="dialogAllocation = true"> <el-button @click="dialogAllocation = true">
<Icon icon="ep:refresh" class="mr-5px" /> {{ t('newHosts.allocation') }} <Icon icon="ep:refresh" class="mr-5px" /> {{ t('newHosts.allocation') }}
</el-button> </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"> <el-button @click="exportAi">
<Icon icon="ep:copy-document" class="mr-5px" /> {{ $t('employee.exportAi') }} <Icon icon="ep:copy-document" class="mr-5px" /> {{ $t('employee.exportAi') }}
</el-button> </el-button>

View File

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