feat: 站点管理支持按站点查看变更(审核)记录
This commit is contained in:
@@ -39,6 +39,7 @@ export default {
|
||||
pendingSubmissions: () => api.get('/admin/sites/pending'),
|
||||
approveSubmission: (id) => api.post(`/admin/submissions/${id}/approve`),
|
||||
rejectSubmission: (id) => api.post(`/admin/submissions/${id}/reject`),
|
||||
submissionsBySite: (siteId) => api.get(`/admin/sites/${siteId}/submissions`),
|
||||
},
|
||||
configs: {
|
||||
list: () => api.get('/configs'),
|
||||
|
||||
@@ -62,10 +62,11 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column label="操作" width="220">
|
||||
<template #default="scope">
|
||||
<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="handleViewHistory(scope.row)">变更</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -108,6 +109,43 @@
|
||||
<el-button @click="configVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</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>
|
||||
</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 configLoading = ref(false)
|
||||
const configError = ref('')
|
||||
|
||||
Reference in New Issue
Block a user