去掉导出日志功能

This commit is contained in:
caojia
2026-11-17 10:37:05 +08:00
parent b76b26b2b1
commit cce123890e
+5 -91
View File
@@ -150,11 +150,6 @@
@click="openCommissionRates"
>提成比例设置</el-button>
-->
<el-button
v-hasPermi="['report:profit:export']"
icon="Tickets"
@click="openExportLogs"
>导出日志</el-button>
<el-button
type="primary"
plain
@@ -207,36 +202,6 @@
/>
</el-card>
<el-dialog v-model="exportLogVisible" title="毛利分析导出日志" width="1000px" append-to-body>
<el-table v-loading="exportLogLoading" :data="exportLogs" border stripe>
<el-table-column prop="fileName" label="文件名" min-width="280" show-overflow-tooltip />
<el-table-column prop="dimension" label="导出维度" width="120" align="center">
<template #default="{ row }">{{ exportDimensionLabel(row.dimension) }}</template>
</el-table-column>
<el-table-column prop="rowCount" label="数据条数" width="100" align="right" />
<el-table-column prop="exportStatus" label="状态" width="100" align="center">
<template #default="{ row }"><el-tag :type="exportStatusType(row.exportStatus)">{{ exportStatusLabel(row.exportStatus) }}</el-tag></template>
</el-table-column>
<el-table-column prop="remark" label="失败原因" min-width="180" show-overflow-tooltip />
<el-table-column prop="exportBy" label="导出人" width="120" />
<el-table-column prop="exportTime" label="导出时间" width="170" align="center"><template #default="{ row }">{{ parseTime(row.exportTime) }}</template></el-table-column>
<el-table-column label="操作" width="90" fixed="right" align="center">
<template #default="{ row }">
<el-button v-if="row.exportStatus === 'SUCCESS'" link type="primary" @click="handleDownloadExport(row)">下载</el-button>
</template>
</el-table-column>
<template #empty><el-empty description="暂无导出记录" /></template>
</el-table>
<pagination
v-show="exportLogTotal > 0"
v-model:page="exportLogPageNum"
v-model:limit="exportLogPageSize"
:total="exportLogTotal"
@pagination="loadExportLogs"
/>
<template #footer><el-button @click="exportLogVisible = false">关闭</el-button></template>
</el-dialog>
<!-- 提成设置与编辑弹窗暂停使用。
<el-dialog v-model="commissionDialogVisible" title="业务员固定提成比例" width="760px" append-to-body>
<div class="commission-toolbar">
@@ -275,7 +240,7 @@
</template>
<script setup name="ProfitReport">
import { downloadProfitExport, exportProfitOrders, listProfitAreaRules, listProfitCustomerOptions, listProfitExports, listProfitOrders, listProfitSummary } from '@/api/report/profit'
import { downloadProfitExport, exportProfitOrders, listProfitAreaRules, listProfitCustomerOptions, listProfitOrders, listProfitSummary } from '@/api/report/profit'
// 提成功能暂停使用:import { deleteProfitCommissionRate, listProfitCommissionRates, saveProfitCommissionRate } from '@/api/report/profit'
import { parseTime } from '@/utils/bms'
import { ElMessage } from 'element-plus'
@@ -310,12 +275,6 @@ let rowsRequestVersion = 0
const loading = ref(false)
const hasSearched = ref(false)
const exporting = ref(false)
const exportLogVisible = ref(false)
const exportLogLoading = ref(false)
const exportLogs = ref([])
const exportLogPageNum = ref(1)
const exportLogPageSize = ref(10)
const exportLogTotal = ref(0)
const pageNum = ref(1)
const pageSize = ref(10)
const total = ref(0)
@@ -488,63 +447,18 @@ async function handleExport() {
exporting.value = true
try {
const response = await exportProfitOrders(buildQuery(false))
const exportLog = response.data
const file = await downloadProfitExport(exportLog.exportId)
const exportResult = response.data
const file = await downloadProfitExport(exportResult.exportId)
if (file.type?.includes('json')) {
const error = JSON.parse(await file.text())
throw new Error(error.msg || '下载导出文件失败')
}
saveAs(file, exportLog.fileName)
ElMessage.success('报表已导出,记录已保存到导出日志')
saveAs(file, exportResult.fileName)
ElMessage.success('报表已导出')
} catch (error) {
ElMessage.error(error?.message || '报表导出失败')
} finally {
exporting.value = false
if (exportLogVisible.value) loadExportLogs()
}
}
function openExportLogs() {
exportLogPageNum.value = 1
exportLogVisible.value = true
loadExportLogs()
}
function loadExportLogs() {
exportLogLoading.value = true
listProfitExports({ pageNum: exportLogPageNum.value, pageSize: exportLogPageSize.value }).then(response => {
exportLogs.value = response.rows || []
exportLogTotal.value = response.total || 0
}).catch(() => {
exportLogs.value = []
exportLogTotal.value = 0
}).finally(() => {
exportLogLoading.value = false
})
}
function exportDimensionLabel(value) {
return value === 'PRODUCT' ? '产品维度' : value === 'ORDER' ? '订单维度' : value || '-'
}
function exportStatusLabel(value) {
return value === 'PROCESSING' ? '生成中' : value === 'SUCCESS' ? '成功' : value === 'FAILED' ? '失败' : value || '-'
}
function exportStatusType(value) {
return value === 'SUCCESS' ? 'success' : value === 'FAILED' ? 'danger' : 'info'
}
async function handleDownloadExport(row) {
try {
const file = await downloadProfitExport(row.exportId)
if (file.type?.includes('json')) {
const error = JSON.parse(await file.text())
throw new Error(error.msg || '下载导出文件失败')
}
saveAs(file, row.fileName)
} catch (error) {
ElMessage.error(error?.message || '下载导出文件失败')
}
}