63 lines
2.3 KiB
JavaScript
63 lines
2.3 KiB
JavaScript
const ReviewsPage = {
|
|
async render() {
|
|
return '<div class="loading"><i class="fas fa-spinner"></i><p>加载中...</p></div>';
|
|
},
|
|
|
|
async mount() {
|
|
const container = document.getElementById('page-content');
|
|
document.getElementById('page-title').textContent = '审查管理';
|
|
document.getElementById('page-actions').innerHTML = '';
|
|
|
|
try {
|
|
const reviews = await API.get('/reviews');
|
|
this.renderList(container, reviews);
|
|
} catch (err) {
|
|
container.innerHTML = `<div class="alert alert-danger">加载失败: ${err.message}</div>`;
|
|
}
|
|
},
|
|
|
|
renderList(container, reviews) {
|
|
container.innerHTML = `
|
|
${reviews.length === 0 ? `
|
|
<div class="empty-state">
|
|
<i class="fas fa-search"></i>
|
|
<p>暂无审查记录</p>
|
|
</div>
|
|
` : `
|
|
<div class="card">
|
|
<div class="table-container">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>关联投诉</th>
|
|
<th>状态</th>
|
|
<th>审查者</th>
|
|
<th>审查意见</th>
|
|
<th>创建时间</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
${reviews.map(r => `
|
|
<tr>
|
|
<td>${r.id}</td>
|
|
<td><a href="#" onclick="App.navigate('complaint',${r.complaint_id});return false" style="color:var(--primary)">#${r.complaint_id} ${Utils.escapeHtml(r.complaint_title)}</a></td>
|
|
<td>${Utils.statusBadge(r.status)}</td>
|
|
<td>${r.reviewer_name || '-'}</td>
|
|
<td class="text-sm text-muted" style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${r.review_notes ? Utils.escapeHtml(r.review_notes.slice(0, 50)) : '-'}</td>
|
|
<td class="date">${Utils.formatDate(r.created_at)}</td>
|
|
<td>
|
|
<button class="btn btn-sm btn-outline" onclick="App.navigate('complaint',${r.complaint_id})"><i class="fas fa-eye"></i></button>
|
|
</td>
|
|
</tr>
|
|
`).join('')}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
`}
|
|
`;
|
|
}
|
|
};
|