Bang Hu
2 天以前 b3fedd4221b807a07058be9d5d5d8ba8998adbcb
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<template>
  <div class="app-wrapper" :class="classObj">
    <!-- 头部菜单 - 根据环境配置显示 -->
    <div class="header" style="width: auto; overflow: inherit" v-if="!containerOperate?.specialcontainer && menuConfig.showHeader">
      <AppHeader @menuCollapse="changeMenuCollapse"></AppHeader>
    </div>
    <div class="header" style="width: auto; overflow: inherit" v-if="containerOperate?.specialcontainer && menuConfig.showHeader">
      <template v-if="currentMenuCode!='activityInitiate'&&currentMenuCode!='activityInitiate6'">
          <AppActHeader ref='appActHeaderRef' ></AppActHeader>
      </template>
    </div>
    <div   :class="containerOperate?.specialcontainer?'content-wrapperall':'content-wrapper'">
      <!-- 左侧菜单 - 根据环境配置显示 -->
      <LeftSidebar
        v-if="!containerOperate?.specialcontainer && menuConfig.showLeftMenu"
        class="sidebar-container"
        :menuState="menuState"
      ></LeftSidebar>
      <div class="main-container">
        <!-- 顶部菜单 - 根据环境配置显示 -->
        <topMenu class="nav-head"  v-if="!containerOperate?.specialcontainer && menuConfig.showTopMenu"></topMenu>
        <!-- <el-main class="main">
          <Breadcrumb id="breadcrumb" class="breadcrumb" />
        </el-main> -->
        <el-scrollbar
          class="scrollbar-main"
          :style="{ 'max-height': layoutConfig.mainContainerHeight, 'min-width':'900px' }"
          ref="scrollViewContainer"
        >
          <router-view v-slot="{ Component, route }">
            <transition name="slide-left" mode="out-in">
              <keep-alive :include="cachedViews" :exclude="excludeViews">
                <component
                  :is="Component"
                  :key="route.path"
                  v-if="isRouterAlive"
                />
              </keep-alive>
            </transition>
          </router-view>
        </el-scrollbar>
        <!-- 版权信息 - 根据环境配置显示 -->
        <div class="fontDiv" v-if="menuConfig.showFooter">中国交通建设集团有限公司 版权所有</div>
      </div>
    </div>
  </div>
</template>
 
<script setup lang="ts">
// 左侧菜单列表
import LeftSidebar from './components/sideBar/index.vue'
// 顶部menu
import topMenu from './components/topMenu.vue'
import AppHeader from './components/appHeader.vue'
import AppActHeader  from './components/appActHeader.vue'
import Breadcrumb from './components/Breadcrumb.vue'
import { storeToRefs } from 'pinia'
import { useNavTabs } from '@/stores/modules/navTabs'
import { useRoute } from 'vue-router'
// 导入环境配置工具
import { getMenuConfig, getLayoutConfig } from '@/utils/env'
 
const navTabsStore = useNavTabs()
const appActHeaderRef=ref()
// 获取需要缓存的页面,加入到Tabs里的都缓存
const { cachedViews, excludeViews } = storeToRefs(navTabsStore)
const scrollViewContainer = ref()
const isRouterAlive = ref<boolean>(true)
 
// 环境配置
const menuConfig = computed(() => getMenuConfig())
const layoutConfig = computed(() => getLayoutConfig())
 
const reload = () => {
  isRouterAlive.value = false
  nextTick(() => {
    isRouterAlive.value = true
  })
}
const classObj = ref<boolean>(true)
const menuState = ref<boolean>(false) // 控制左侧菜单的展开收起
 
// 切换左侧菜单的展示隐藏
const changeMenuCollapse = (state: boolean) => {
  menuState.value = state
}
const route = useRoute()
const key = computed(() => {
  return route.path + Math.random()
})
provide('reload', reload)
const containerOperate=ref()
const currentMenuCode=ref()
onMounted(() => {
 console.log('route.query',route.query)
 currentMenuCode.value=route.query.actcode
//  如果值是specialcontainer=只显示页面 没有菜单和头部
 containerOperate.value=route.query
})
</script>
<style scoped lang="scss">
.app-wrapper {
  position: relative;
}
.main {
  background-color: #ebeef7;
  box-shadow: inset 2px 3px 10px #eaeaea;
  padding: 10px 20px 0;
  .main-content {
    padding: 24px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 12px #0000000d;
    border: 1px solid #e4e7ed;
  }
 
  .nobg {
    padding: 0px;
    background: transparent !important;
    box-shadow: 0 0 0px #0000000d;
    border-width: 0;
  }
}
 
.breadcrumb {
  margin-bottom: 10px;
  font-size: 12px;
}
 
.content-wrapper {
  width: 100%;
  height: calc(100vh);
  display: flex;
}
.content-wrapperall{
  width: 100%;
  height: 100vh;
  display: flex;
}
.sidebar-container {
  background-color: #374768;
}
 
.main-container {
  flex: 1;
  height: 100%;
  text-align: left;
  //height: 92px;
  padding: 0;
  overflow: hidden;
  position: relative;
 
  .nav-head {
    //width: 100%;
    //height: 30%;
    //padding: 0 20px;
    margin-bottom: 0px;
    //display: flex;
    //flex-direction: row;
    //align-items: center;
  }
}
 
.scrollbar-main {
  width: 100%;
  margin: auto;
  padding: 0px 10px 0 10px;
  // background-color: #fcfcfc;
  // border-radius: 5px;
}
 
// 动画设置
.slide-left-enter-from {
  transform: translateX(-20px);
  opacity: 0;
}
 
.slide-left-enter-to {
  transform: translateX(0px);
}
 
.slide-left-leave-from {
  transform: translateX(0);
}
 
.slide-left-leave-to {
  transform: translateX(20px);
  opacity: 0;
}
 
.slide-left-enter-active,
.slide-left-leave-active {
  transition: all 0.3s;
}
 
.fontDiv {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0;
  color: #646c9a;
  width: 100%;
  font-size: 12px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  // padding-left: 42%;
  background-color: #dce6f4;
}
</style>