feat: 站点管理支持按站点查看变更(审核)记录
This commit is contained in:
@@ -289,6 +289,13 @@ public class AdminController {
|
|||||||
return ApiResponse.success();
|
return ApiResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/sites/{siteId}/submissions")
|
||||||
|
public ApiResponse<List<com.par.core.dto.SiteSubmissionDTO>> listSiteSubmissions(
|
||||||
|
@PathVariable("siteId") String siteId, HttpServletRequest request) {
|
||||||
|
checkAdmin(request);
|
||||||
|
return ApiResponse.success(siteService.listSubmissionsBySite(siteId));
|
||||||
|
}
|
||||||
|
|
||||||
private void checkAdmin(HttpServletRequest request) {
|
private void checkAdmin(HttpServletRequest request) {
|
||||||
TrustLevel level = (TrustLevel) request.getAttribute("trustLevel");
|
TrustLevel level = (TrustLevel) request.getAttribute("trustLevel");
|
||||||
if (level == null || level != TrustLevel.ADMIN) {
|
if (level == null || level != TrustLevel.ADMIN) {
|
||||||
|
|||||||
@@ -55,4 +55,7 @@ public interface SiteService {
|
|||||||
|
|
||||||
/** 拒绝提交 */
|
/** 拒绝提交 */
|
||||||
void rejectSubmission(Long submissionId, Long reviewerId);
|
void rejectSubmission(Long submissionId, Long reviewerId);
|
||||||
|
|
||||||
|
/** 查看站点的变更(审核)记录 */
|
||||||
|
List<SiteSubmissionDTO> listSubmissionsBySite(String siteId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,12 @@ public class SiteServiceImpl implements SiteService {
|
|||||||
log.info("站点审核拒绝: siteId={} submissionId={}", sub.getSiteId(), submissionId);
|
log.info("站点审核拒绝: siteId={} submissionId={}", sub.getSiteId(), submissionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SiteSubmissionDTO> listSubmissionsBySite(String siteId) {
|
||||||
|
return submissionMapper.selectBySiteId(siteId).stream()
|
||||||
|
.map(this::toSubmissionDTO).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
private SiteSubmissionDTO toSubmissionDTO(SiteSubmission sub) {
|
private SiteSubmissionDTO toSubmissionDTO(SiteSubmission sub) {
|
||||||
SiteSubmissionDTO dto = new SiteSubmissionDTO();
|
SiteSubmissionDTO dto = new SiteSubmissionDTO();
|
||||||
dto.setId(sub.getId());
|
dto.setId(sub.getId());
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export default {
|
|||||||
pendingSubmissions: () => api.get('/admin/sites/pending'),
|
pendingSubmissions: () => api.get('/admin/sites/pending'),
|
||||||
approveSubmission: (id) => api.post(`/admin/submissions/${id}/approve`),
|
approveSubmission: (id) => api.post(`/admin/submissions/${id}/approve`),
|
||||||
rejectSubmission: (id) => api.post(`/admin/submissions/${id}/reject`),
|
rejectSubmission: (id) => api.post(`/admin/submissions/${id}/reject`),
|
||||||
|
submissionsBySite: (siteId) => api.get(`/admin/sites/${siteId}/submissions`),
|
||||||
},
|
},
|
||||||
configs: {
|
configs: {
|
||||||
list: () => api.get('/configs'),
|
list: () => api.get('/configs'),
|
||||||
|
|||||||
@@ -62,10 +62,11 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" width="220">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
<el-button size="small" @click="handleViewConfig(scope.row)">配置</el-button>
|
<el-button size="small" @click="handleViewConfig(scope.row)">配置</el-button>
|
||||||
|
<el-button size="small" @click="handleViewHistory(scope.row)">变更</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -108,6 +109,43 @@
|
|||||||
<el-button @click="configVisible = false">关闭</el-button>
|
<el-button @click="configVisible = false">关闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 变更记录对话框 -->
|
||||||
|
<el-dialog v-model="historyVisible" :title="'变更记录:' + historySiteId" width="800px" :close-on-click-modal="false">
|
||||||
|
<el-table :data="historyList" stripe size="small" v-loading="historyLoading" empty-text="暂无记录">
|
||||||
|
<el-table-column label="名称" width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<div v-for="(n, i) in scope.row.names" :key="i" class="text-xs">{{ n }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="地址" min-width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<div v-for="(u, i) in scope.row.urls" :key="i" class="text-xs">{{ u }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="站点状态" width="90">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag size="small" :type="tagForStatus(scope.row.siteStatus)">{{ scope.row.siteStatus }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="审核" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag size="small" :type="scope.row.status === 'approved' ? 'success' : scope.row.status === 'pending' ? 'warning' : 'danger'">
|
||||||
|
{{ scope.row.status === 'approved' ? '已通过' : scope.row.status === 'pending' ? '待审核' : '已拒绝' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" min-width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<span class="text-xs">{{ scope.row.notes || '-' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createdAt" label="时间" width="160" />
|
||||||
|
</el-table>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="historyVisible = false">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -132,6 +170,32 @@ const siteTypes = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// 配置查看
|
// 配置查看
|
||||||
|
const historyVisible = ref(false)
|
||||||
|
const historyLoading = ref(false)
|
||||||
|
const historyList = ref([])
|
||||||
|
const historySiteId = ref('')
|
||||||
|
|
||||||
|
const tagForStatus = (s) => {
|
||||||
|
if (s === '正常') return 'success'
|
||||||
|
if (s === '关停') return 'danger'
|
||||||
|
return 'warning'
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleViewHistory = async (row) => {
|
||||||
|
historySiteId.value = row.siteId
|
||||||
|
historyList.value = []
|
||||||
|
historyVisible.value = true
|
||||||
|
historyLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.sites.submissionsBySite(row.siteId)
|
||||||
|
historyList.value = res.data || []
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error('获取变更记录失败')
|
||||||
|
} finally {
|
||||||
|
historyLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const configVisible = ref(false)
|
const configVisible = ref(false)
|
||||||
const configLoading = ref(false)
|
const configLoading = ref(false)
|
||||||
const configError = ref('')
|
const configError = ref('')
|
||||||
|
|||||||
Reference in New Issue
Block a user