diff --git a/web/src/views/config/ConfigList.vue b/web/src/views/config/ConfigList.vue index 7d4a0ca..f170675 100644 --- a/web/src/views/config/ConfigList.vue +++ b/web/src/views/config/ConfigList.vue @@ -39,18 +39,38 @@ layout="total, prev, pager, next" > - + - + + + + + +
+ 配置名称:{{ currentHistory.name }} | + 版本:{{ currentHistory.version }} | + 类型:{{ getTypeName(currentHistory.type) }} +
+ +
@@ -68,7 +88,10 @@ export default { profiles: [], historyVisible: false, historyList: [], - currentConfig: null + currentConfig: null, + contentVisible: false, + currentHistory: {}, + formattedContent: '' } }, created() { @@ -112,6 +135,32 @@ export default { this.historyVisible = true } catch (e) {} }, + viewHistoryContent(row) { + this.currentHistory = row + const content = row.contents || '' + if (row.type === 3) { + try { + this.formattedContent = JSON.stringify(JSON.parse(content), null, 2) + } catch (e) { + this.formattedContent = content + } + } else { + this.formattedContent = content + } + this.contentVisible = true + }, + getTypeName(type) { + if (type === 1) return '文件' + if (type === 2) return '配置项' + if (type === 3) return 'JSON' + return '未知' + }, + formatTime(time) { + if (!time) return '' + const d = new Date(time) + const pad = n => String(n).padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` + }, async handleRollback(row) { try { await this.$confirm('确定回滚到此版本?')