master
parent
625494b3d5
commit
fb67f3b60f
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-drawer
|
||||
title="详情"
|
||||
:visible.sync="drawer"
|
||||
direction="rtl"
|
||||
size="600px">
|
||||
<div>
|
||||
<div class="content">
|
||||
<div class="content-item" v-for="(value,key) in rowLabel">
|
||||
<div class="content-item__title">{{ value }}</div>
|
||||
<div class="content-item__value">
|
||||
<template v-if="key === 'regulation_article_file'">
|
||||
<el-link target="_blank" type="primary" v-for="item in row[key]" :href="item.files ? item.files.url : ''">{{ item.files ? item.files.original_name : '' }}</el-link>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ contentValue(key) }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { show } from "@/api/sysManage/article";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
row: {},
|
||||
drawer: false,
|
||||
id: "",
|
||||
rowLabel: {
|
||||
title: "标题",
|
||||
"menu.name": "目录",
|
||||
"type": "类型",
|
||||
"content": "内容",
|
||||
"admin.name": "经办人",
|
||||
created_at: "创建日期",
|
||||
"regulation_article_file": "文件"
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show () {
|
||||
this.drawer = true
|
||||
},
|
||||
hide () {
|
||||
this.drawer = false
|
||||
},
|
||||
setId (id) {
|
||||
this.id = id
|
||||
},
|
||||
|
||||
async getRow () {
|
||||
this.row = await show({ regulation_article_id: this.id })
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
contentValue () {
|
||||
return function (key) {
|
||||
const splitKey = key.split('.')
|
||||
let res = ''
|
||||
try {
|
||||
for(let i = 0;i < splitKey.length;i++) {
|
||||
if (i === 0) {
|
||||
res = this.row[splitKey[i]]
|
||||
} else {
|
||||
res = res[splitKey[i]]
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
drawer(newVal) {
|
||||
if (newVal) {
|
||||
this.getRow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2,1fr);
|
||||
grid-row-gap: 20px;
|
||||
|
||||
padding: 20px;
|
||||
&-item {
|
||||
|
||||
&__title {
|
||||
font-weight: 600;
|
||||
line-height: 2;
|
||||
}
|
||||
&__value {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue