Header.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <div id="header">
  3. <div class="main">
  4. <div class="title">黄浦江数字孪生系统</div>
  5. <div class="content">
  6. <div class="left">
  7. <div class="right-box">
  8. <span class="now-time" @click="ueCallGetNowTime">{{time}}</span>
  9. <div class="date">
  10. <span>{{day}}</span>
  11. <span>{{date}}</span>
  12. </div>
  13. <i class="weather" :class="weather" @click="toggleScene"></i>
  14. </div>
  15. </div>
  16. <div class="right">
  17. <div class="tab-item"
  18. v-for="item,index in isCheck.data"
  19. :key="item.name"
  20. @click="changeImage(index,item.imageName)">
  21. <img class="tab-icon" :src="item.click? item.iconOn: item.icon" alt="">
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. <!-- <div class="sub">-->
  27. <!-- <ul>-->
  28. <!-- <li v-for="item,index in subList" :class="{'highlight': item.status}">-->
  29. <!-- <span @click="handleToggleLayer(index)">{{ item.name }}</span>-->
  30. <!-- </li>-->
  31. <!-- </ul>-->
  32. <!-- </div>-->
  33. <MiForChange v-if="miForChangeShow"/>
  34. <water-level v-if="waterDeepShow"/>
  35. <Tools v-if="checkTool" />
  36. <LunDuMessage v-if="checkLinDu" :datas="ldData.value"/>
  37. <SelectForUnit v-if="showSelect" />
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. name: 'HomeHeader',
  43. }
  44. </script>
  45. <script setup>
  46. import { onMounted, reactive, ref } from 'vue';
  47. import { useNow, useDateFormat } from '@vueuse/core'
  48. import bus from '@/utils/bus'
  49. import { GetWeather } from '@/apis/other'
  50. import {
  51. ueCallBoatRealtime, ueCallClearBoatTime, ueCallfullExtent,ueCallCloseMi,ueCallShowWarningReturn,
  52. ueCallOpenVideoFusion, ueCallCloseVideoFusion, ueCallShowHangdaoLine, ueCallCloseHangdaoLine,ueCallCloseWarningReturn,
  53. ueCallOpenRlt, ueCallCloseRlt, ueCallFlyToHD, ueCallFlyToSP, ueCallFlyToZrcb, ueCallShowAllMi,ueCallGetNowTime
  54. } from '@/utils/UIInteractions'
  55. import WaterLevel from './cpns/WaterLevel.vue'
  56. import MiForChange from './cpns/MiForChange.vue'
  57. import Tools from './cpns/tools/Tools.vue'
  58. import LunDuMessage from './cpns/boatPanel/LunDuMessage.vue'
  59. import SelectForUnit from './SelectForUnit.vue'
  60. import { asideShow } from '@/store/index'
  61. import {ElMessage} from "element-plus";
  62. // 地图方法
  63. import {fullExtent,calculation,clearMap} from "@/utils/map/ArcgisUtil"
  64. let ldData=reactive({value: ''})
  65. const checkLinDu=ref(false)
  66. const checkSelect = ref(false)
  67. const checkTool = ref(false)
  68. const checkSouXiao = ref(false)
  69. const checkQuanjing = ref(false)
  70. const checkRuale = ref(false)
  71. const checkCeMian = ref(false)
  72. const checkClear = ref(false)
  73. const showSelect = ref(false)
  74. bus.on('click_Lundu', (data) => {
  75. console.log(data)
  76. if(data!=null && data!='') {
  77. checkLinDu.value=true
  78. ldData.value=data
  79. }
  80. })
  81. const isCheck=ref({
  82. data: [
  83. { name: '搜索', icon: require('@/assets/imgs/header/ssou-wei.png'), iconOn: require('@/assets/imgs/header/ssou-select.png'), imageName: 'ssou' ,click:false,checkIoc:showSelect},
  84. { name: '图层', icon: require('@/assets/imgs/header/tc-wei.png'), iconOn: require('@/assets/imgs/header/tc-select.png'), imageName: 'tc' ,click:false,checkIoc:checkTool},
  85. { name: '收缩', icon: require('@/assets/imgs/header/ss-wei.png'), iconOn: require('@/assets/imgs/header/ss-select.png'), imageName: 'ss' ,click:false,checkIoc:checkSouXiao},
  86. { name: '全景', icon: require('@/assets/imgs/page_ylcbq/qj-wei.png'), iconOn: require('@/assets/imgs/page_ylcbq/qj-xuan.png'), imageName: 'qj' ,click:false,checkIoc:checkQuanjing},
  87. { name: '测量', icon: require('@/assets/imgs/page_ylcbq/cl-wei.png'), iconOn: require('@/assets/imgs/page_ylcbq/cl-xuan.png'), imageName: 'cl' ,click:false,checkIoc:checkRuale},
  88. { name: '测面', icon: require('@/assets/imgs/page_ylcbq/cm-wei.png'), iconOn: require('@/assets/imgs/page_ylcbq/cm-xuan.png'), imageName: 'cm' ,click:false,checkIoc:checkCeMian},
  89. { name: '清除', icon: require('@/assets/imgs/page_ylcbq/qc-wei.png'), iconOn: require('@/assets/imgs/page_ylcbq/qc-xuan.png'), imageName: 'qc' ,click:false,checkIoc:checkClear},
  90. ]})
  91. const global_aside = asideShow()
  92. onMounted(() => [
  93. getWeather()
  94. ])
  95. const weather = ref('qing')
  96. function changeImage(index,name) {
  97. isCheck.value.data.forEach(i=>{
  98. if(i.imageName===name) {
  99. console.log(name)
  100. i.click = !i.click ;
  101. i.checkIoc = !i.checkIoc;
  102. if (i.click) {
  103. // 选择
  104. if (name == 'qj') {
  105. //返回全景
  106. fullExtent();
  107. i.click = !i.click ;
  108. i.checkIoc = !i.checkIoc;
  109. } else if (name == 'ss') {
  110. togglePageAside()
  111. }else if (name == 'cl') {
  112. calculation('distance')
  113. }else if (name == 'cm') {
  114. calculation('area')
  115. }
  116. else if (name == 'qc') {
  117. clearMap()
  118. i.click = !i.click ;
  119. i.checkIoc = !i.checkIoc;
  120. }
  121. }else {
  122. // 取消
  123. if (name == 'ss') {
  124. togglePageAside()
  125. }else if (name == 'cl') {
  126. clearMap()
  127. }else if (name == 'cm') {
  128. clearMap()
  129. }else if (name == 'qc') {
  130. clearMap()
  131. }
  132. }
  133. }
  134. })
  135. }
  136. function getWeather() {
  137. GetWeather().then(res => {
  138. switch(res.data.weather) {
  139. case '晴': weather.value = 'qing'; break
  140. case '多云':weather.value = 'duoyun'; break
  141. case '小雨':weather.value = 'xiaoyu'; break
  142. case '中雨':weather.value = 'zhongyu'; break
  143. case '大雨':weather.value = 'dayu'; break
  144. case '雾':weather.value = 'wu'; break
  145. case '小雪':weather.value = 'xiaoxue'; break
  146. }
  147. })
  148. }
  149. const subList = reactive([
  150. { name: '航道', status: false },
  151. { name: '潮高', status: false },
  152. { name: '船舶', status: true },
  153. { name: '视频', status: false },
  154. { name: '水下地形', status: false },
  155. { name: '断面', status: false },
  156. { name: '中燃船舶', status: false },
  157. ])
  158. function handleToggleLayer(index) {
  159. subList[index].status = !subList[index].status
  160. if(subList[index].status===true) {
  161. switch(index) {
  162. case 0:
  163. ueCallFlyToHD()
  164. setTimeout(() => {
  165. ueCallShowHangdaoLine()
  166. }, 1000);
  167. break
  168. case 1:
  169. ueCallCloseWarningReturn()
  170. waterDeepShow.value = true
  171. break
  172. case 2:
  173. ueCallfullExtent()
  174. setTimeout(() => {
  175. ueCallBoatRealtime()
  176. }, 1000);
  177. break
  178. case 3:
  179. ueCallFlyToSP()
  180. bus.on('fly_Action', (data) => {
  181. if(data.isOk=='true') {
  182. ueCallOpenVideoFusion()
  183. bus.off('fly_Action')
  184. }
  185. })
  186. break
  187. case 4:
  188. bus.emit('toggle_sxdx', true)
  189. clickWeeather.value=true
  190. break
  191. case 5:
  192. if (clickWeeather.value) {
  193. miForChangeShow.value = true
  194. subList[index].status = true
  195. ueCallShowAllMi()
  196. }else {
  197. subList[index].status = false
  198. }
  199. break
  200. case 6:
  201. ueCallFlyToZrcb()
  202. break
  203. }
  204. } else {
  205. switch(index) {
  206. case 0:
  207. ueCallCloseHangdaoLine()
  208. break
  209. case 1:
  210. ueCallShowWarningReturn()
  211. waterDeepShow.value = false
  212. break
  213. case 2:
  214. ueCallClearBoatTime()
  215. break
  216. case 3:
  217. ueCallCloseVideoFusion()
  218. break
  219. case 4:
  220. clickWeeather.value=false
  221. miForChangeShow.value = false
  222. subList[index+1].status = false
  223. ueCallCloseMi()
  224. bus.emit('toggle_sxdx', false)
  225. break
  226. case 5:
  227. miForChangeShow.value = false
  228. ueCallCloseMi()
  229. break
  230. case 6:
  231. ueCallfullExtent()
  232. break
  233. }
  234. }
  235. }
  236. const clickWeeather = ref(false)
  237. const temperature = ref('8')
  238. const time = useDateFormat(useNow(), 'HH:mm')
  239. const date = useDateFormat(useNow(), 'YYYY.MM.DD')
  240. const day = useDateFormat(useNow(), 'ddd', { locales: 'en-US' })
  241. const waterDeepShow = ref(false)
  242. const miForChangeShow = ref(false)
  243. function toggleScene() {
  244. bus.emit('toggleSceneBox')
  245. }
  246. function togglePageAside() {
  247. global_aside.toggleAside()
  248. }
  249. </script>
  250. <style lang="scss" scoped>
  251. #header {
  252. position: absolute;
  253. top: 0;
  254. left: 0;
  255. width: 100%;
  256. height: 160px;
  257. .main {
  258. position: absolute;
  259. top: 0;
  260. left: 0;
  261. width: 100%;
  262. height: 119px;
  263. background: url('@/assets/imgs/header/bg-main.png') no-repeat;
  264. background-size: 100% 100%;
  265. }
  266. .tab-icon {
  267. width: 50px;
  268. height: 50px;
  269. }
  270. .sub {
  271. position: absolute;
  272. top: 50px;
  273. left: 50%;
  274. width: 1114px;
  275. height: 105px;
  276. transform: translateX(-50%);
  277. background: url('@/assets/imgs/header/bg-sub.png') no-repeat;
  278. background-size: 100% 100%;
  279. &>ul {
  280. position: absolute;
  281. bottom: 9px;
  282. left: 0;
  283. width: 100%;
  284. text-align: center;
  285. li {
  286. display: inline-block;
  287. // width: 110px;
  288. padding: 0 25px;
  289. height: 72px;
  290. margin: 0 5px;
  291. text-align: center;
  292. span {
  293. display: inline-block;
  294. margin-top: 40px;
  295. width: fit-content;
  296. font-size: 20px;
  297. font-family: YSBTH;
  298. font-weight: 400;
  299. color: #CCE6FF;
  300. opacity: 0.65;
  301. cursor: pointer;
  302. &:hover {
  303. transform: scale(1.1);
  304. }
  305. }
  306. }
  307. .highlight {
  308. background: url('@/assets/imgs/header/bg-sub-highl.png') no-repeat;
  309. background-size: 100% 100%;
  310. span {
  311. color: #EDF3FF;
  312. opacity: 1;
  313. }
  314. }
  315. }
  316. }
  317. .title {
  318. position: absolute;
  319. width: fit-content;
  320. top: 20px;
  321. left: 50%;
  322. transform: translateX(-50%);
  323. font-family: YSBTH;
  324. font-size: 42px;
  325. }
  326. .content {
  327. position: absolute;
  328. top: 32px;
  329. display: flex;
  330. justify-content: space-between;
  331. width: 100%;
  332. .left, .right {
  333. display: flex;
  334. align-items: center;
  335. justify-content: flex-start;
  336. }
  337. }
  338. .right {
  339. margin-top: 8px;
  340. margin-right: 3px;
  341. .humidity, .temperature {
  342. display: inline-block;
  343. width: 36px;
  344. height: 36px;
  345. margin-right: 6px;
  346. }
  347. li{
  348. list-style: none;
  349. float: left;
  350. i {
  351. display: block;
  352. height: 50px;
  353. width: 50px;
  354. }
  355. }
  356. .humidity {
  357. background: url('@/assets/imgs/header/humidity.png') no-repeat;
  358. }
  359. .temperature {
  360. background: url('@/assets/imgs/header/temperature.png') no-repeat;
  361. }
  362. .humidity, .temperature {
  363. background-size: contain;
  364. }
  365. .wsd-title {
  366. text-align: left;
  367. margin-right: 9px;
  368. font-family: PFlight;
  369. span {
  370. display: block;
  371. color: #F6F6F6;
  372. }
  373. span:first-child {
  374. font-size: 16px;
  375. line-height: 16px;
  376. margin-bottom: 3px;
  377. }
  378. span:last-child {
  379. font-size: 8px;
  380. line-height: 8px;
  381. }
  382. }
  383. .wsd-data {
  384. font-family: PFlight;
  385. font-size: 26px;
  386. line-height: 26px;
  387. }
  388. .wsd-unit {
  389. font-family: PFlight;
  390. font-size: 14px;
  391. line-height: 14px;
  392. transform: translateY(-5px);
  393. margin: 0 18px 0 3px;
  394. }
  395. }
  396. .left {
  397. .right-btns {
  398. display: flex;
  399. align-items: center;
  400. &>i {
  401. display: inline-block;
  402. margin-right: 10px;
  403. cursor: pointer;
  404. }
  405. .rb-search {
  406. width: 30px;
  407. height: 30px;
  408. background: url('@/assets/imgs/header/search.png') no-repeat;
  409. background-size: contain;
  410. }
  411. .rb-fulls {
  412. width: 35px;
  413. height: 35px;
  414. background: url('@/assets/imgs/header/fulls.png') no-repeat;
  415. background-size: contain;
  416. }
  417. .rb-aside {
  418. width: 40px;
  419. height: 40px;
  420. margin-right: 5px;
  421. background: url('@/assets/imgs/header/btn-aside.png') no-repeat;
  422. background-size: contain;
  423. }
  424. }
  425. .right-box {
  426. margin-left: 40px;
  427. display: flex;
  428. justify-content: flex-start;
  429. align-items: center;
  430. // cursor: pointer;
  431. }
  432. .now-time {
  433. font-family: PFlight;
  434. font-size: 30px;
  435. margin-right: 16px;
  436. cursor: pointer;
  437. &:hover {
  438. filter: brightness(1.2);
  439. }
  440. }
  441. .date {
  442. position: relative;
  443. text-align: left;
  444. margin-right: 28px;
  445. span {
  446. color: #ccc;
  447. display: block;
  448. font-size: 12px;
  449. line-height: 14px;
  450. }
  451. &::after {
  452. content: '';
  453. position: absolute;
  454. right: -28px;
  455. top: 7px;
  456. display: inline-block;
  457. width: 1px;
  458. height: 14px;
  459. background-color: #fff;
  460. }
  461. }
  462. .weather {
  463. display: inline-block;
  464. width: 32px;
  465. height: 32px;
  466. background: url('@/assets/imgs/scene/w-qing.png') no-repeat;
  467. background-size: contain;
  468. margin: 0 36px;
  469. cursor: pointer;
  470. &.qing {
  471. background: url('@/assets/imgs/scene/w-qing.png') no-repeat;
  472. background-size: contain;
  473. }
  474. &.duoyun {
  475. background: url('@/assets/imgs/scene/w-duoyun.png') no-repeat;
  476. background-size: contain;
  477. }
  478. &.xiaoyu {
  479. background: url('@/assets/imgs/scene/w-xiaoyu.png') no-repeat;
  480. background-size: contain;
  481. }
  482. &.zhongyu {
  483. background: url('@/assets/imgs/scene/w-zhongyu.png') no-repeat;
  484. background-size: contain;
  485. }
  486. &.dayu {
  487. background: url('@/assets/imgs/scene/w-dayu.png') no-repeat;
  488. background-size: contain;
  489. }
  490. &.wu {
  491. background: url('@/assets/imgs/scene/w-wu.png') no-repeat;
  492. background-size: contain;
  493. }
  494. &.xiaoxue {
  495. background: url('@/assets/imgs/scene/w-xiaoxue.png') no-repeat;
  496. background-size: contain;
  497. }
  498. }
  499. }
  500. }
  501. </style>