menuList.vue 6.7 KB

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