menuList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <!-- 顶部路由 -->
  3. <div class='menu'>
  4. <div class='home' @click='$emit("update:modelNum", 0)'>
  5. <div class='downright'></div>
  6. <div class='home-box'>
  7. <img src='@/assets/imgs/logo.png' alt />
  8. <span>{{plazas.length>0?formatter(plazaId,plazas):'--'}}</span>
  9. </div>
  10. </div>
  11. <div>
  12. <div
  13. v-for='(item, index) in list'
  14. :key='index'
  15. :class='{ "is-active": item.state }'
  16. @click='clickEventAcitve(item, index)'
  17. >{{ item.name }}</div>
  18. </div>
  19. <div class='home-right'>
  20. <span @click='dumpLegend'>
  21. <img class='img1' src='../assets/imgs/scj.png' alt />
  22. <span class='span1'>图例库</span>
  23. </span>
  24. <span @click='toDrafts' class='span-out'>
  25. <img class='img2' src='../assets/imgs/cgx.png' alt />
  26. <span class='span2'>草稿箱</span>
  27. <span class='span2-num' v-if='value<=99'>{{value}}</span>
  28. <span class='span2-num' style='line-height:10px' v-else>...</span>
  29. </span>
  30. <span>
  31. <img class='img3' src='../assets/imgs/clock.png' alt />
  32. <span class='span3'>{{times}}</span>
  33. </span>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { formatTime } from '@/utils/format.js'
  39. import { mapGetters } from 'vuex'
  40. import moment from 'moment'
  41. export default {
  42. data() {
  43. return {
  44. state: '',
  45. list: [
  46. { name: '首页', state: false, route: 'first' },
  47. { name: '项目概况', state: false, route: 'overview' },
  48. { name: '楼层功能', state: false, route: 'floorFunc' }, //楼层功能
  49. { name: '设备设施', state: false, route: 'equipment' }, //设备设施
  50. { name: '其他事项', state: false, route: 'other' }, //其他
  51. { name: '分析 | 报表', state: false, route: 'analysis' }
  52. ],
  53. times: `${new Date().getFullYear()}.${formatTime(new Date().getMonth() + 1)}.${formatTime(new Date().getDate())} ${formatTime(
  54. new Date().getHours()
  55. )}:${formatTime(new Date().getMinutes())}`,
  56. value: 190,
  57. // 路由词典
  58. dict: {
  59. first: 1,
  60. overview: 2,
  61. floorFunc: 3,
  62. equipment: 4,
  63. other: 5,
  64. analysis: 6
  65. }
  66. }
  67. },
  68. computed: {
  69. ...mapGetters(['plazas', 'plazaId', 'fmapID'])
  70. },
  71. watch: {
  72. $route: 'handleRoute'
  73. },
  74. created() {
  75. this.currentTime()
  76. },
  77. mounted() {
  78. window.vm = this
  79. this.handleRoute(this.$route)
  80. console.log(this.fmapID)
  81. },
  82. methods: {
  83. //入草稿箱
  84. toDrafts() {
  85. const { conf } = window.__systemConf,
  86. { editerUrl } = conf
  87. let data = `projectId=${this.plazaId}&fmapID=${this.fmapID}`
  88. let url = editerUrl + 'drafts?' + encodeURIComponent(data)
  89. window.open(url, true)
  90. },
  91. currentTime() {
  92. this.times = moment().format('YYYY.MM.DD HH:mm')
  93. setTimeout(this.currentTime, 1000)
  94. },
  95. handleRoute(newRouter) {
  96. if (!newRouter) {
  97. return false
  98. }
  99. const { path } = newRouter
  100. let router = path.split('home/')[1]
  101. this.modelNum(this.dict[router])
  102. },
  103. formatter(str, arrv) {
  104. if (str && arrv) {
  105. const Objs = arrv.find(e => e && e.plazaid == str)
  106. return Objs ? Objs.plazaname : '--'
  107. } else {
  108. return ''
  109. }
  110. },
  111. modelNum(val) {
  112. this.list = this.list.map((item, index) => {
  113. if (val == index + 1) {
  114. item.state = true
  115. } else {
  116. item.state = false
  117. }
  118. return item
  119. })
  120. },
  121. clickEventAcitve(item) {
  122. if (item.name == '楼层功能') {
  123. this.$cookie.set('categoryId', 'LCGN', 3)
  124. } else {
  125. this.$cookie.set('categoryId', 'GDXT', 3)
  126. }
  127. this.list.forEach(ele => {
  128. ele.state = false
  129. })
  130. item.state = true
  131. this.state = item.state
  132. this.$router.push({ path: `/home/${item.route}` })
  133. },
  134. dumpLegend() {
  135. const { conf } = window.__systemConf,
  136. { wandaBmGuideUrl } = conf
  137. window.open(`${wandaBmGuideUrl}home/legendLibrary`, true)
  138. }
  139. }
  140. }
  141. </script>
  142. <style scoped lang="less">
  143. .menu {
  144. height: 48px;
  145. min-width: 1366px;
  146. color: #1f2429;
  147. font-size: 16px;
  148. background: rgba(255, 255, 255, 1);
  149. box-shadow: 0px 2px 10px 0px rgba(31, 35, 41, 0.1);
  150. overflow: hidden;
  151. .home {
  152. width: 265px;
  153. height: 48px;
  154. // line-height: 48px;
  155. text-align: center;
  156. cursor: pointer;
  157. color: #ffffff;
  158. float: left;
  159. margin-right: 83px;
  160. // background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
  161. background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
  162. position: relative;
  163. .downright {
  164. position: absolute;
  165. width: 0;
  166. height: 0;
  167. border-left: 20px solid transparent;
  168. border-bottom: 48px solid #fff;
  169. right: 0px;
  170. top: 0;
  171. }
  172. .home-box {
  173. height: 100%;
  174. display: flex;
  175. align-items: center;
  176. img {
  177. width: 28px;
  178. height: 28px;
  179. margin-left: 20px;
  180. margin-right: 24px;
  181. margin-top: -3px;
  182. }
  183. span {
  184. font-size: 20px;
  185. font-family: MicrosoftYaHei;
  186. height: 27px;
  187. line-height: 27px;
  188. margin-top: -4px;
  189. &:after {
  190. content: '|';
  191. position: absolute;
  192. left: 60px;
  193. }
  194. }
  195. }
  196. }
  197. & > div:nth-of-type(2) {
  198. & > div {
  199. line-height: 48px;
  200. text-align: center;
  201. //background: url('../assets/images/topbar1.png') no-repeat;
  202. float: left;
  203. width: 80px;
  204. height: 48px;
  205. cursor: pointer;
  206. transition: all 0.2s;
  207. }
  208. .is-active {
  209. color: #025baa;
  210. font-weight: bolder;
  211. border-bottom: 2px solid #025baa;
  212. background: linear-gradient(180deg, rgba(2, 91, 170, 0) 0%, rgba(2, 91, 170, 0.2) 100%);
  213. }
  214. }
  215. .home-right {
  216. float: right;
  217. margin-right: 20px;
  218. line-height: 48px;
  219. color: #646c73;
  220. font-size: 14px;
  221. cursor: pointer;
  222. display: flex;
  223. align-content: center;
  224. img {
  225. margin-top: -2px;
  226. }
  227. .span-out {
  228. position: relative;
  229. margin: 0 16px;
  230. .span2-num {
  231. position: absolute;
  232. right: -5px;
  233. top: 5px;
  234. display: inline-block;
  235. width: 18px;
  236. height: 18px;
  237. background: red;
  238. border-radius: 90px;
  239. font-size: 12px;
  240. text-align: center;
  241. line-height: 18px;
  242. color: #ffffff;
  243. }
  244. }
  245. }
  246. .span1,
  247. .span2 {
  248. padding: 0 6px 0 3px;
  249. }
  250. .span3 {
  251. padding-left: 3px;
  252. }
  253. }
  254. </style>
  255. <style lang="less">
  256. .menu {
  257. .el-badge__content.is-fixed {
  258. top: 10px;
  259. }
  260. }
  261. </style>