menuList.vue 6.1 KB

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