/* * MC Report System * Copyright (C) 2026 Sea Network Technology Studio * Author: CangLan * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ const ExportPage = { async render() { return '
'; }, mount() { const ct = document.getElementById('page-content'); document.getElementById('page-title').textContent = '数据导出'; document.getElementById('page-actions').innerHTML = ''; ct.innerHTML = `
导出工单
被举报人统计导出

导出所有被举报玩家列表,含被举报次数、处理结果、常见原因等

导出操作日志
统计报表

查看系统整体统计和趋势数据

`; document.getElementById('exp-tickets').onsubmit = async e => { e.preventDefault(); const p = new URLSearchParams({ format: document.getElementById('et-fmt').value, type: document.getElementById('et-type').value, status: document.getElementById('et-status').value, start_date: document.getElementById('et-start').value, end_date: document.getElementById('et-end').value, }); try { await API.download(`/export/tickets?${p}`); } catch (ex) { alert(ex.message); } }; document.getElementById('exp-reported').onsubmit = async e => { e.preventDefault(); const p = new URLSearchParams({ format: document.getElementById('er-fmt').value }); try { await API.download(`/export/reported-players?${p}`); } catch (ex) { alert(ex.message); } }; document.getElementById('exp-logs').onsubmit = async e => { e.preventDefault(); const p = new URLSearchParams({ format: document.getElementById('el-fmt').value, start_date: document.getElementById('el-start').value, end_date: document.getElementById('el-end').value, }); try { await API.download(`/export/audit-logs?${p}`); } catch (ex) { alert(ex.message); } }; }, async viewStats() { try { const d = await API.get('/export/dashboard'); U.modal('系统统计', `

概览

工单总数${d.total}
今日新增${d.today}
用户数${d.usersTotal}

状态分布

${(d.byStatus||[]).map(r=>`
${U.STATUS[r.status]||r.status}${r.c}
`).join('')}

类型分布

${(d.byType||[]).map(r=>`
${U.TYPE[r.type]||r.type}${r.c}
`).join('')}
${d.monthly?.length?`

月度趋势

${d.monthly.map(m=>`
${m.m}${m.c} 条
`).join('')}
`:''} `, '600px'); } catch (e) { alert(e.message); } } };