HomeView.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="dashboard">
  3. <div class="background-image"></div>
  4. <div class="bottom-bg" v-if="!showMap"></div>
  5. <div class="top-title"></div>
  6. <TopNav :activeButton="navButtonMap[activeTab]" @navigate="handleNav" />
  7. <!-- 全局地图 -->
  8. <div class="map-container" v-if="showMap">
  9. <CesiumMap
  10. @toggleMap="toggleMap"
  11. :simulationTime="simulationTime"
  12. :simulationData="simulationData"
  13. :loadEmbankmentWarning="loadEmbankmentWarning"
  14. />
  15. </div>
  16. <!-- 渐变装饰层(四周暗角) -->
  17. <GradientOverlay />
  18. <!-- 流域总览视图 -->
  19. <OverviewView v-if="activeTab === '流域总览'" @selectTab="selectTab" />
  20. <!-- 水文四预视图 -->
  21. <HydrologyForecastView
  22. v-if="activeTab === '水文四预'"
  23. :activeSecondaryTab="activeSecondaryTab"
  24. :simulationTime="simulationTime"
  25. :simulationData="simulationData"
  26. :loadEmbankmentWarning="loadEmbankmentWarning"
  27. @selectSecondaryTab="selectSecondaryTab"
  28. @updateSimulationTime="updateSimulationTime"
  29. @updateSimulationData="updateSimulationData"
  30. @loadEmbankmentWarning="handleLoadEmbankmentWarning"
  31. @updateForecastData="handleUpdateForecastData"
  32. />
  33. <!-- 工程安全视图 -->
  34. <EngineeringSafetyView
  35. v-if="activeTab === '工程安全'"
  36. />
  37. <!-- 水资源调配视图 -->
  38. <WaterResourceAllocationView
  39. v-if="activeTab === '水资源调配'"
  40. />
  41. </div>
  42. </template>
  43. <script>
  44. import OverviewView from './OverviewView.vue'
  45. import HydrologyForecastView from './HydrologyForecastView.vue'
  46. import WaterResourceAllocationView from './WaterResourceAllocationView.vue'
  47. import CesiumMap from '../components/CesiumMap.vue'
  48. import GradientOverlay from '../components/gradient-overlay.vue'
  49. import EngineeringSafetyView from './EngineeringSafetyView.vue'
  50. import TopNav from '../components/TopNav.vue'
  51. export default {
  52. name: 'HomeView',
  53. components: {
  54. OverviewView,
  55. HydrologyForecastView,
  56. WaterResourceAllocationView,
  57. EngineeringSafetyView,
  58. CesiumMap,
  59. GradientOverlay,
  60. TopNav
  61. },
  62. data() {
  63. return {
  64. activeTab: '流域总览',
  65. activeSecondaryTab: '水文监控',
  66. showMap: true,
  67. loadEmbankmentWarning: false,
  68. navButtonMap: {
  69. '流域总览': '综合首页',
  70. '水文四预': '水情测报',
  71. '工程安全': '工程安全'
  72. },
  73. simulationTime: 0,
  74. simulationData: {
  75. heilinStation: {
  76. waterLevel: '3.25',
  77. flow: '12.5',
  78. rainfall: '0.5'
  79. },
  80. reservoir: {
  81. waterLevel: '18.5',
  82. storage: '2350.8'
  83. }
  84. }
  85. }
  86. },
  87. methods: {
  88. selectTab(tab) {
  89. this.activeTab = tab
  90. if (tab === '水文四预' || tab === '水资源调配') {
  91. this.activeSecondaryTab = '水文监控'
  92. }
  93. if (tab !== '水文四预') {
  94. this.loadEmbankmentWarning = false
  95. }
  96. },
  97. handleNav(button) {
  98. if (button === '综合首页') this.selectTab('流域总览')
  99. else if (button === '水情测报') this.selectTab('水文四预')
  100. else if (button === '工程安全') this.selectTab('工程安全')
  101. },
  102. selectSecondaryTab(tab) {
  103. this.activeSecondaryTab = tab
  104. // 在水文预警和水文预演页面时显示堤防图层
  105. if (this.activeTab === '水文四预' && (tab === '水文预警' || tab === '水文预演')) {
  106. // 先设为false,再设为true,触发重新加载
  107. this.loadEmbankmentWarning = false
  108. this.$nextTick(() => {
  109. this.loadEmbankmentWarning = true
  110. })
  111. } else if (this.activeTab === '水文四预' && tab !== '水文预警') {
  112. this.loadEmbankmentWarning = false
  113. }
  114. },
  115. toggleMap(show) {
  116. this.showMap = show
  117. },
  118. updateSimulationTime(time) {
  119. this.simulationTime = time
  120. },
  121. updateSimulationData(data) {
  122. this.simulationData = { ...this.simulationData, ...data }
  123. },
  124. handleLoadEmbankmentWarning() {
  125. // 在水文预警和水文预演页面时显示堤防图层
  126. if (this.activeTab === '水文四预' && (this.activeSecondaryTab === '水文预警' || this.activeSecondaryTab === '水文预演')) {
  127. this.loadEmbankmentWarning = true
  128. }
  129. },
  130. handleUpdateForecastData(data) {
  131. this.simulationData = { ...this.simulationData, ...data }
  132. }
  133. }
  134. }
  135. </script>
  136. <style scoped>
  137. .dashboard {
  138. width: 100%;
  139. height: 100%;
  140. overflow: hidden;
  141. position: relative;
  142. }
  143. .background-image {
  144. position: absolute;
  145. top: 0;
  146. left: 0;
  147. width: 100%;
  148. height: 100%;
  149. background-image: url('/src/assets/images/背景.png');
  150. background-size: 100% 100%;
  151. background-position: center;
  152. background-repeat: no-repeat;
  153. pointer-events: none;
  154. z-index: 3;
  155. }
  156. .bottom-bg {
  157. position: absolute;
  158. bottom: 0;
  159. left: 0;
  160. width: 100%;
  161. height: 100%;
  162. background-image: url('/src/assets/images/Heilin/WPS图片(1).jpeg');
  163. background-size: 100% 100%;
  164. background-position: center;
  165. background-repeat: no-repeat;
  166. pointer-events: none;
  167. z-index: 3;
  168. }
  169. .top-title {
  170. position: absolute;
  171. top: 0;
  172. left: 0;
  173. width: 100%;
  174. height: 100%;
  175. background-image: url('/src/assets/images/顶部大标题.png');
  176. background-size: 100% 100%;
  177. background-position: center;
  178. background-repeat: no-repeat;
  179. pointer-events: none;
  180. z-index: 4;
  181. }
  182. /* 地图容器样式 */
  183. .map-container {
  184. position: absolute;
  185. width: 100%;
  186. height: 100%;
  187. bottom: 0;
  188. z-index: 1;
  189. overflow: hidden;
  190. pointer-events: auto;
  191. }
  192. .bottom-sub-title {
  193. position: absolute;
  194. bottom: 46px;
  195. width: 159px;
  196. height: 31px;
  197. background-image: url('/src/assets/images/未选中底部标题.png');
  198. background-size: 100% 100%;
  199. background-position: center;
  200. background-repeat: no-repeat;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. z-index: 2;
  205. cursor: pointer;
  206. transition: all 0.3s ease;
  207. }
  208. .bottom-sub-title:hover,
  209. .bottom-sub-title.active {
  210. background-image: url('/src/assets/images/选中底部标题.png');
  211. }
  212. .bottom-sub-title.bottom-left {
  213. left: 50%;
  214. transform: translateX(-169px);
  215. }
  216. .bottom-sub-title.bottom-right {
  217. right: 50%;
  218. transform: translateX(169px);
  219. }
  220. .bottom-text {
  221. font-size: 14px;
  222. font-weight: bold;
  223. background: linear-gradient(to bottom, #e2e8ff, #7bbef6);
  224. -webkit-background-clip: text;
  225. background-clip: text;
  226. color: transparent;
  227. text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
  228. }
  229. .bottom-sub-title.active .bottom-text {
  230. background: linear-gradient(to bottom, #e2e8ff, #62f6fb);
  231. -webkit-background-clip: text;
  232. background-clip: text;
  233. color: transparent;
  234. }
  235. /* 二级标题样式 */
  236. .secondary-title-container {
  237. position: absolute;
  238. bottom: 46px;
  239. left: 50%;
  240. transform: translateX(-50%);
  241. display: flex;
  242. gap: 20px;
  243. z-index: 4;
  244. }
  245. .secondary-title {
  246. width: 159px;
  247. height: 31px;
  248. background-image: url('/src/assets/images/未选中底部标题.png');
  249. background-size: 100% 100%;
  250. background-position: center;
  251. background-repeat: no-repeat;
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. font-size: 14px;
  256. font-weight: bold;
  257. cursor: pointer;
  258. transition: all 0.3s ease;
  259. }
  260. .secondary-title span {
  261. background: linear-gradient(to bottom, #e2e8ff, #7bbef6);
  262. -webkit-background-clip: text;
  263. background-clip: text;
  264. color: transparent;
  265. text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
  266. }
  267. .secondary-title:hover,
  268. .secondary-title.active {
  269. background-image: url('/src/assets/images/选中底部标题.png');
  270. }
  271. .secondary-title:hover span,
  272. .secondary-title.active span {
  273. background: linear-gradient(to bottom, #e2e8ff, #62f6fb);
  274. -webkit-background-clip: text;
  275. background-clip: text;
  276. color: transparent;
  277. }
  278. </style>