|
|
|
@ -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){ |
|
|
|
|
// 登录了才能下载,否则直接跳转到登录页 |
|
|
|
|