From de59d3beeff5a1be0b96bdb47f7b655110b0530e Mon Sep 17 00:00:00 2001 From: Jo <479214531@qq.com> Date: Fri, 19 Nov 2021 20:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/footer/index.vue | 2 +- src/pages/index/list/index.vue | 57 ++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/layouts/footer/index.vue b/src/layouts/footer/index.vue index 38c9e8e..b08f16e 100644 --- a/src/layouts/footer/index.vue +++ b/src/layouts/footer/index.vue @@ -9,7 +9,7 @@ + +
+
+ + 数据预览 +
+ +
+
+ + + + +
+
@@ -176,7 +195,10 @@ export default { pageSize: 10, total: 0, hotData: [], - active: '' + active: '', + previewVisible: false, + previewHead: [], + previewData: [] } }, computed: { @@ -226,7 +248,31 @@ export default { this.getData() }, preview(row) { - this.$router.push(`/data?preview=true&id=${row.id}&name=${row.name}`) + this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { + // 查询次数+1 + this.$post(this.api.saveRecord, { + tableId: row.id, + type: 2, + }).then(res => { }).catch(res => { }) + + let comment = res.comment + let previewHead = [] + comment.map(n => { + // id和操作时间不用显示 + n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) + }) + this.previewHead = previewHead + + let data = res.data + data.map(n => { + for (let i in n) { + // 如果是以+0000结尾的,就表明这个是时间,则转化为正常的时间格式 + if (typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = util.formatDate('yyyy-MM-dd hh:mm:ss', new Date(n[i])) + } + }) + this.previewData = data + this.previewVisible = true + }).catch(res => { }) }, download(row){ // 登录了才能下载,否则直接跳转到登录页 @@ -508,4 +554,11 @@ export default { } } } + /deep/.preview-dia{ + padding: 20px; + .preview-wrap{ + height: calc(100vh - 80px); + overflow: auto; + } + } \ No newline at end of file