diff --git a/src/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration.js b/src/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration.js index a710a1c..d46c21b 100644 --- a/src/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration.js +++ b/src/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration.js @@ -15,4 +15,30 @@ export const getMinigameListStat = query => { method: 'get', params: query }); -}; \ No newline at end of file +}; +// 获取休闲游戏时长明细列表 +export const getMinigamePageDetail = query => { + return request({ + url: '/admin/minigame/sud/stat/pageDetail', + method: 'get', + params: query + }); +}; +// 导出休闲游戏时长统计 +export const exportMiniGameStat = query => { + return request({ + url: `/admin/minigame/sud/stat/exportStat`, + method: 'get', + params: query, + responseType: 'blob' + }); +} +// 导出休闲游戏时长明细 +export const exportMiniGameDetail = query => { + return request({ + url: `/admin/minigame/sud/stat/exportDetail`, + method: 'get', + params: query, + responseType: 'blob' + }); +} \ No newline at end of file diff --git a/src/views/data/statisticsIeisureGameDuration.vue b/src/views/data/statisticsIeisureGameDuration.vue index afa9a1d..0a4a677 100644 --- a/src/views/data/statisticsIeisureGameDuration.vue +++ b/src/views/data/statisticsIeisureGameDuration.vue @@ -20,6 +20,7 @@ type="month" placeholder="选择月" value-format="YYYY-MM" + :clearable="false" > @@ -43,14 +44,18 @@ > - - - - - - - - + + + + + + + + + 导出 - - - + + + + + - + + @@ -93,6 +115,9 @@ import { dateFormat } from "@/utils/system-helper"; import { mgList, getMinigameListStat, + getMinigamePageDetail, + exportMiniGameStat, + exportMiniGameDetail, } from "@/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration"; import zhCn from "element-plus/dist/locale/zh-cn.mjs"; const formData = reactive({ @@ -104,14 +129,25 @@ const tableData = reactive({ total: 0, loading: false, }); +const detailData = reactive({ + month: "", + gameId: "", + page: 1, + size: 10, +}); +const detailtableData = reactive({ + data: [], + total: 0, + loading: false, +}); const gameList = ref([]); const dailydetailDialog = ref(false); // 查询 const getData = () => { - if(formData.month==''){ - ElMessage.warning('请选择月份') - return; - } + if (formData.month == "" && !formData.month) { + ElMessage.warning("请选择月份"); + return; + } tableData.loading = true; getMinigameListStat(formData).then((res) => { if (res.code == 200) { @@ -125,67 +161,90 @@ const getData = () => { } }); }; +// 明细 +const detailFun = (row) => { + if(row){ + detailData.gameId = row.gameId; + detailData.month = row.statMonth; + } + getMinigamePageDetail(detailData).then((res) => { + if (res.code == 200) { + detailtableData.data = res.data.records; + detailtableData.loading = false; + detailtableData.total = res.data.total; + dailydetailDialog.value = true; + } else { + ElMessage.error(res.message); + } + }); +}; //重置 const resetFormData = () => { Object.assign(formData.value, { - erbanNoStr: "", - channel: "", - partitionId: undefined, gameId: "", - pageNo: 1, - pageSize: 10, - total: 0, - startTime: "", - endTime: "", }); - tableData.value.dataOuter = []; - JSON.parse; }; // 导出 const confirmExport2Excel = async () => { - Object.assign(formData.value, { pageSize: 10000, pageNo: 1 }); - const { - erbanNoStr, - channel, - endTime, - gameId, - pageNo, - pageSize, - partitionId, - startTime, - } = formData.value; try { - const res = await { - erbanNoStr, - channel, - endTime, - gameId, - pageNo, - pageSize, - partitionId, - startTime, - }; - if (res) { - ElMessage({ - message: "导出成功", - type: "success", - }); - let time = formatDate(new Date()); - let alink = document.createElement("a"); - alink.download = `game用户汇总${time}.xls`; - alink.style.display = "none"; - const blob = new Blob([res]); - alink.href = URL.createObjectURL(blob); - document.body.appendChild(alink); - alink.click(); - URL.revokeObjectURL(alink.href); - } - } catch (error) { - ElMessage({ - message: error.message, - type: "error", - }); - } + const res = await exportMiniGameStat(formData) + if (res) { + ElMessage({ + message: '导出成功', + type: 'success', + }); + let time = formatDate(new Date()); + let alink = document.createElement("a"); + alink.download = `休闲游戏时长统计${time}.xls`; + alink.style.display = "none"; + const blob = new Blob([res]); + alink.href = URL.createObjectURL(blob); + document.body.appendChild(alink); + alink.click(); + URL.revokeObjectURL(alink.href); + } + + } catch (error) { + ElMessage({ + message: error.message, + type: 'error', + }); + } +}; +// 导出 +const confirmExport2ExcelDetail = async () => { + try { + const res = await exportMiniGameDetail(detailData) + if (res) { + ElMessage({ + message: '导出成功', + type: 'success', + }); + let time = formatDate(new Date()); + let alink = document.createElement("a"); + alink.download = `休闲游戏时长明细统计${time}.xls`; + alink.style.display = "none"; + const blob = new Blob([res]); + alink.href = URL.createObjectURL(blob); + document.body.appendChild(alink); + alink.click(); + URL.revokeObjectURL(alink.href); + } + + } catch (error) { + ElMessage({ + message: error.message, + type: 'error', + }); + } +}; +const handleSizeChangeDetail = (val) => { + detailData.size = val; + detailFun(); +}; +const handleCurrentChangeDetail = (val) => { + detailData.page = val; + detailFun(); }; onMounted(() => { mgList().then((res) => {