QuerySqlPreview.vue
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template>
<ht-query-sql-preview :viewId="viewId"></ht-query-sql-preview>
</template>
<script>
export default {
name: 'QuerySqlPreview',
props: {
sqlViewId: {type: String}
},
data() {
return {
viewId: this.sqlViewId
}
},
created() {
if (!this.viewId && this.$route.params.sqlViewId) {
this.viewId = this.$route.params.sqlViewId
}
},
mounted() {},
beforeRouteUpdate(to, from, next) {
// 在当前路由改变,但是该组件被复用时调用
// 举例来说,对于一个带有动态参数的路径 /foo/:id,在 /foo/1 和 /foo/2 之间跳转的时候,
// 由于会渲染同样的 Foo 组件,因此组件实例会被复用。而这个钩子就会在这个情况下被调用。
// 可以访问组件实例 `this`
if (to.fullPath != from.fullPath) {
this.viewId = to.params.sqlViewId
}
next()
}
}
</script>
<style lang="scss" scoped>
::v-deep {
.search-field__container {
.search-item {
width: 100%;
.el-select__tags {
width: calc(100% - 85px) !important;
max-height: 32px;
overflow-y: auto;
}
}
}
.summary-table {
margin: 10px 24px 24px 24px;
.project-column {
.cell {
font-size: 16px;
color: #333;
font-weight: bold;
}
}
.summary-num {
.summary-table-field {
font-size: 18px;
color: #4ba232;
font-weight: bold;
}
}
}
.custom-summary {
padding: 10px 24px 24px 24px;
}
}
</style>