<template>
|
|
<section class="app-main">
|
|
<transition name="fade-transform" mode="out-in">
|
|
<keep-alive :include="cachedViews">
|
|
<router-view v-if="!$route.meta.link" :key="key" />
|
|
</keep-alive>
|
|
</transition>
|
|
<iframe-toggle />
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import iframeToggle from "./IframeToggle/index"
|
|
|
|
export default {
|
|
name: 'AppMain',
|
|
components: { iframeToggle },
|
|
computed: {
|
|
cachedViews() {
|
|
return this.$store.state.tagsView.cachedViews
|
|
},
|
|
key() {
|
|
// 拼上工作台选中的站名编码:切换站名时仅重建当前页面(重新拉取数据),导航栏不整页刷新
|
|
const stationCode = this.$store.getters.workspaceStationCode || ''
|
|
return this.$route.path + (stationCode ? '||' + stationCode : '')
|
|
}
|
|
},
|
|
watch: {
|
|
$route() {
|
|
this.addIframe()
|
|
}
|
|
},
|
|
mounted() {
|
|
this.addIframe()
|
|
},
|
|
methods: {
|
|
addIframe() {
|
|
const {name} = this.$route
|
|
if (name && this.$route.meta.link) {
|
|
this.$store.dispatch('tagsView/addIframeView', this.$route)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.app-main {
|
|
/* 5.5vh = navbar,和别家标题栏同一高度。标题栏固定后由外边距占位,这里不再重复扣高度 */
|
|
height: calc(100vh - 5.5vh);
|
|
min-height: 0;
|
|
width: 100%;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.app-main.hasTagsView,
|
|
.app-main.patrolWorkspace.hasTagsView {
|
|
/* 5.5vh + 80px = navbar + subbar + tags view */
|
|
height: calc(100vh - 5.5vh - 80px);
|
|
min-height: 0;
|
|
}
|
|
|
|
</style>
|
|
|
|
<style lang="scss">
|
|
// fix css style bug in open el-dialog
|
|
.el-popup-parent--hidden {
|
|
.fixed-header {
|
|
padding-right: 6px;
|
|
}
|
|
}
|
|
|
|
::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
}
|
|
|
|
::-webkit-scrollbar-track {
|
|
background-color: #f1f1f1;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
background-color: #c0c0c0;
|
|
border-radius: 3px;
|
|
}
|
|
</style>
|