From 6065ddfb591a3b68b9aee69b402c72620cdbb3a1 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 25 Nov 2021 13:42:22 +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/pages/data/list/index.vue | 2 ++ src/pages/index/list/index.vue | 52 ++++++++++++++++++++-------------- src/pages/role/list/index.vue | 1 + 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/pages/data/list/index.vue b/src/pages/data/list/index.vue index 9e3a123..4ef1134 100644 --- a/src/pages/data/list/index.vue +++ b/src/pages/data/list/index.vue @@ -240,6 +240,7 @@ export default { this.$post(`${this.api.getIdQueryTable}?categoryId=${this.defaultType}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => { const list = res.pageList.records list.map(e => { + // 开始结束时间只显示日期 const startTime = e.startTime ? e.startTime.slice(0, 10) : '' const endTime = e.endTime ? e.endTime.slice(0, 10) : '' if (startTime && endTime) { @@ -252,6 +253,7 @@ export default { }) this.listData = list this.total = res.pageList.total + // 从首页跳转过来的预览 if (this.$route.query.preview) { this.preview({ id: this.$route.query.id, diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue index f71e763..5f131eb 100644 --- a/src/pages/index/list/index.vue +++ b/src/pages/index/list/index.vue @@ -256,31 +256,39 @@ export default { this.getData() }, preview(row) { - 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 => { }) + // 登录后才能预览,否则直接跳转到登录页 + if(this.token){ + 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 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])) - } + 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 => { }) + }else{ + let route = this.$router.resolve({ + path: '/login' }) - this.previewData = data - this.previewVisible = true - }).catch(res => { }) + window.open(route.href) + } }, download(row){ // 登录了才能下载,否则直接跳转到登录页 diff --git a/src/pages/role/list/index.vue b/src/pages/role/list/index.vue index 37a2df6..3b9af71 100644 --- a/src/pages/role/list/index.vue +++ b/src/pages/role/list/index.vue @@ -178,6 +178,7 @@ export default { setTimeout(() => { this.$get(`${this.api.getRole}?id=${row.id}`).then(res => { this.form = res.role + // 把已选的权限给默认勾选 this.checkedIds = this.handleRolePer(res.permissionList,this.permissions) this.$refs.per.setCheckedNodes(this.checkedIds) }).catch(res => {})