|
|
@ -63,8 +63,8 @@ |
|
|
|
|
|
|
|
|
<el-button type="primary" class="search-btn-small" @click="handleTableSearch">搜索</el-button> |
|
|
<el-button type="primary" class="search-btn-small" @click="handleTableSearch">搜索</el-button> |
|
|
<el-button type="primary" class="reset-btn-small" @click="handleTableReset">重置</el-button> |
|
|
<el-button type="primary" class="reset-btn-small" @click="handleTableReset">重置</el-button> |
|
|
<el-button type="danger" class="export-btn-small">数据导出</el-button> |
|
|
|
|
|
<el-button type="danger" class="export-list-btn">查看导出列表</el-button> |
|
|
|
|
|
|
|
|
<el-button type="danger" class="export-btn-small" @click="handleExport">数据导出</el-button> |
|
|
|
|
|
<el-button type="danger" class="export-list-btn" @click="handleShowExportList">查看导出列表</el-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<el-table :data="tableData" style="width: 100%" :header-cell-style="headerCellStyle"> |
|
|
<el-table :data="tableData" style="width: 100%" :header-cell-style="headerCellStyle"> |
|
|
@ -95,6 +95,51 @@ |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 导出列表弹窗 --> |
|
|
|
|
|
<el-dialog |
|
|
|
|
|
v-model="exportDialogVisible" |
|
|
|
|
|
title="导出记录" |
|
|
|
|
|
width="800px" |
|
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
|
> |
|
|
|
|
|
<el-table :data="exportList" style="width: 100%" border v-loading="exportListLoading"> |
|
|
|
|
|
<el-table-column prop="index" label="序号" width="80" align="center" /> |
|
|
|
|
|
<el-table-column prop="type" label="导出类型" width="150" align="center" /> |
|
|
|
|
|
<el-table-column prop="created_at" label="导出时间" width="180" align="center" /> |
|
|
|
|
|
<el-table-column prop="status" label="执行状态" width="100" align="center"> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<el-tag v-if="scope.row.status === 2" type="success">成功</el-tag> |
|
|
|
|
|
<el-tag v-else-if="scope.row.status === 1" type="warning">执行中</el-tag> |
|
|
|
|
|
<el-tag v-else type="danger">失败</el-tag> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="操作" min-width="120" align="center"> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
v-if="scope.row.status === 2 && scope.row.download_url" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
link |
|
|
|
|
|
@click="handleDownload(scope.row.download_url)" |
|
|
|
|
|
> |
|
|
|
|
|
下载 |
|
|
|
|
|
</el-button> |
|
|
|
|
|
<span v-else>-</span> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
|
|
<div class="pagination-container" style="margin-top: 15px;"> |
|
|
|
|
|
<el-pagination |
|
|
|
|
|
background |
|
|
|
|
|
layout="prev, pager, next" |
|
|
|
|
|
:total="exportTotal" |
|
|
|
|
|
:page-size="exportPageSize" |
|
|
|
|
|
v-model:current-page="exportCurrentPage" |
|
|
|
|
|
@current-change="handleExportPageChange" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -102,7 +147,8 @@ |
|
|
import { ref, onMounted, nextTick, watch } from 'vue'; |
|
|
import { ref, onMounted, nextTick, watch } from 'vue'; |
|
|
import { useRoute, useRouter } from 'vue-router'; |
|
|
import { useRoute, useRouter } from 'vue-router'; |
|
|
import * as echarts from 'echarts'; |
|
|
import * as echarts from 'echarts'; |
|
|
import { getUserDeepChartTrend, getDeepChartActiveUserList, getRegionsList } from '../../api/platformData'; |
|
|
|
|
|
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
|
|
import { getUserDeepChartTrend, getDeepChartActiveUserList, getRegionsList, exportDeepChartActiveUserList, getExportStatusList } from '../../api/platformData'; |
|
|
|
|
|
|
|
|
const route = useRoute(); |
|
|
const route = useRoute(); |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
@ -270,6 +316,58 @@ const pageSize = ref(10); |
|
|
const total = ref(0); |
|
|
const total = ref(0); |
|
|
const regionOptions = ref([]); |
|
|
const regionOptions = ref([]); |
|
|
|
|
|
|
|
|
|
|
|
// 导出列表相关 |
|
|
|
|
|
const exportDialogVisible = ref(false); |
|
|
|
|
|
const exportList = ref([]); |
|
|
|
|
|
const exportListLoading = ref(false); |
|
|
|
|
|
const exportCurrentPage = ref(1); |
|
|
|
|
|
const exportPageSize = ref(10); |
|
|
|
|
|
const exportTotal = ref(0); |
|
|
|
|
|
|
|
|
|
|
|
const handleShowExportList = () => { |
|
|
|
|
|
exportDialogVisible.value = true; |
|
|
|
|
|
exportCurrentPage.value = 1; |
|
|
|
|
|
fetchExportList(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleExportPageChange = (page) => { |
|
|
|
|
|
exportCurrentPage.value = page; |
|
|
|
|
|
fetchExportList(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const fetchExportList = async () => { |
|
|
|
|
|
exportListLoading.value = true; |
|
|
|
|
|
try { |
|
|
|
|
|
const params = { |
|
|
|
|
|
page: exportCurrentPage.value, |
|
|
|
|
|
page_size: exportPageSize.value |
|
|
|
|
|
}; |
|
|
|
|
|
const res = await getExportStatusList(params); |
|
|
|
|
|
console.log("获取导出列表响应:", res); |
|
|
|
|
|
const data = res.data || res; |
|
|
|
|
|
|
|
|
|
|
|
if (data && data.list) { |
|
|
|
|
|
exportList.value = data.list.map((item, index) => ({ |
|
|
|
|
|
...item, |
|
|
|
|
|
index: (exportCurrentPage.value - 1) * exportPageSize.value + index + 1 |
|
|
|
|
|
})); |
|
|
|
|
|
exportTotal.value = data.total || 0; |
|
|
|
|
|
} else { |
|
|
|
|
|
exportList.value = []; |
|
|
|
|
|
exportTotal.value = 0; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.error('获取导出列表失败:', e); |
|
|
|
|
|
ElMessage.error('获取导出列表失败'); |
|
|
|
|
|
} finally { |
|
|
|
|
|
exportListLoading.value = false; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleDownload = (url) => { |
|
|
|
|
|
window.open(url.trim(), '_blank'); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
// 获取地区列表 |
|
|
// 获取地区列表 |
|
|
const fetchRegionOptions = async () => { |
|
|
const fetchRegionOptions = async () => { |
|
|
try { |
|
|
try { |
|
|
@ -311,6 +409,38 @@ const handleSizeChange = (size) => { |
|
|
fetchTableData(); |
|
|
fetchTableData(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleExport = async () => { |
|
|
|
|
|
const params = {}; |
|
|
|
|
|
|
|
|
|
|
|
if (tableAccount.value) params.jwcode = tableAccount.value; |
|
|
|
|
|
if (tableRegion.value && tableRegion.value !== 'all') params.region = tableRegion.value; |
|
|
|
|
|
|
|
|
|
|
|
if (tableDateRange.value && tableDateRange.value.length === 2) { |
|
|
|
|
|
params.startTime = formatDate(tableDateRange.value[0]); |
|
|
|
|
|
params.endTime = formatDate(tableDateRange.value[1]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
const res = await exportDeepChartActiveUserList(params); |
|
|
|
|
|
console.log("导出DeepChart活跃用户明细响应:", res); |
|
|
|
|
|
|
|
|
|
|
|
// 兼容处理:后端可能直接返回任务ID (数字),或者标准响应对象 |
|
|
|
|
|
// res 即是返回数据中的data字段,res.code是无效的 |
|
|
|
|
|
const isSuccess = (typeof res === 'number' && res > 0) || |
|
|
|
|
|
(res && res.code === 200) || |
|
|
|
|
|
(res && typeof res.data === 'number' && res.data > 0); |
|
|
|
|
|
|
|
|
|
|
|
if (isSuccess) { |
|
|
|
|
|
ElMessage.success('导出任务已添加到队列,请稍后在“查看导出列表”中查看结果。'); |
|
|
|
|
|
} else { |
|
|
|
|
|
ElMessage.error((res && res.msg) || '导出请求失败'); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.error('导出DeepChart活跃用户明细失败:', e); |
|
|
|
|
|
ElMessage.error('导出请求发生错误'); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const fetchTableData = async () => { |
|
|
const fetchTableData = async () => { |
|
|
const params = { |
|
|
const params = { |
|
|
page: currentPage.value, |
|
|
page: currentPage.value, |
|
|
|