Menu.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <div class="menu">
  3. <ul class="menu-list">
  4. <li class="menu-item" v-for="(menu, index) of currentMenu" :key="menu" @click="click(index)" :class="{ active: activeIndex == index }" @mouseenter="subMenuShow(menu.children, index)">
  5. <router-link v-if="!menu.children" :to="menu.path">
  6. <el-tooltip class="item" effect="dark" :content="menu.text" placement="right" :show-after="500">
  7. <div class="menu-icon svg-icon" :class="activeIndex == index ? 'svg-icon-green' : 'svg-icon-gray'">
  8. <SvgIcon :svgid="menu.icon"></SvgIcon>
  9. </div>
  10. </el-tooltip>
  11. </router-link>
  12. <div v-if="menu.children" class="sub-menu-item">
  13. <div class="menu-icon svg-icon" :class="activeIndex == index ? 'svg-icon-green' : 'svg-icon-gray'">
  14. <SvgIcon :svgid="menu.icon"></SvgIcon>
  15. </div>
  16. </div>
  17. </li>
  18. </ul>
  19. </div>
  20. <div class="sub-menu" v-show="isShowSubMenu">
  21. <ul class="menu-list">
  22. <li class="menu-item" v-for="(menu, index) of subMenu" @click="subclick(index)" :key="menu" :class="{ active: subIndex == index }">
  23. <router-link :to="menu.path">
  24. <div class="menu-icon svg-icon">
  25. <SvgIcon :svgid="menu.icon"></SvgIcon>
  26. </div>
  27. <div class="sub-menu-text" :class="subIndex == index ? 'green' : 'gray'">{{ menu.text }}</div>
  28. </router-link>
  29. </li>
  30. </ul>
  31. </div>
  32. </template>
  33. <script>
  34. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  35. export default {
  36. components: {
  37. SvgIcon,
  38. },
  39. props: {},
  40. data() {
  41. return {
  42. currRoot: "monitor",
  43. menuData: [
  44. {
  45. id: "monitor",
  46. text: "状态监视",
  47. data: [
  48. {
  49. text: "驾驶舱",
  50. icon: "svg-lead-cockpit",
  51. path: "/monitor/home",
  52. },
  53. {
  54. text: "基础矩阵",
  55. icon: "svg-matrix",
  56. path: "/monitor/lightmatrix1",
  57. },
  58. {
  59. text: "明细矩阵",
  60. icon: "svg-mx-matrix",
  61. path: "/monitor/lightmatrix3",
  62. },
  63. {
  64. text: "欠发矩阵",
  65. icon: "svg-qf-matrix",
  66. path: "/monitor/lightmatrix2",
  67. },
  68. {
  69. text: "光伏矩阵",
  70. icon: "svg-gf-matrix",
  71. path: "/monitor/lightmatrix",
  72. },
  73. {
  74. text: "状态监视",
  75. icon: "svg-state-watch",
  76. path: "/monitor/status",
  77. },
  78. {
  79. text: "Agc",
  80. icon: "svg-agc",
  81. path: "/monitor/agc",
  82. },
  83. // {
  84. // text: "风场",
  85. // icon: "svg-wind-site",
  86. // path: "/monitor/windsite/home",
  87. // },
  88. ],
  89. },
  90. {
  91. id: "datacenter",
  92. text: "数据管理",
  93. data: [],
  94. },
  95. {
  96. id: "statistic",
  97. text: "统计分析",
  98. data: [
  99. {
  100. text: "能效分析",
  101. icon: "svg-wind-site",
  102. path: "/nxfx",
  103. children: [
  104. {
  105. text: "功率曲线拟合",
  106. icon: "svg-wind-site",
  107. path: "/nxfx1",
  108. },
  109. {
  110. text: "偏航对风分析",
  111. icon: "svg-wind-site",
  112. path: "/nxfx2",
  113. },
  114. {
  115. text: "切入切出分析",
  116. icon: "svg-wind-site",
  117. path: "/cutAnalyse",
  118. },
  119. {
  120. text: "曲线偏差率分析",
  121. icon: "svg-wind-site",
  122. path: "/nxfx4",
  123. },
  124. {
  125. text: "单机性能分析",
  126. icon: "svg-wind-site",
  127. path: "/nxfx5",
  128. },
  129. {
  130. text: "单机月度分析",
  131. icon: "svg-wind-site",
  132. path: "/nxfx6",
  133. },
  134. {
  135. text: "单机饱和度",
  136. icon: "svg-wind-site",
  137. path: "/wtSaturability",
  138. }
  139. ]
  140. },
  141. {
  142. text: "风光资源分析",
  143. icon: "svg-wind-site",
  144. path: "/fgzyfx",
  145. children: [
  146. {
  147. text: "风资源分析",
  148. icon: "svg-wind-site",
  149. path: "/windAnalysis",
  150. }
  151. ]
  152. }
  153. ],
  154. },
  155. {
  156. id: "health",
  157. text: "健康管理",
  158. data: [
  159. {
  160. text: "健康管理",
  161. icon: "svg-wind-site",
  162. path: "/health",
  163. children: [
  164. {
  165. text: "健康推荐",
  166. icon: "svg-wind-site",
  167. path: "/health",
  168. },
  169. {
  170. text: "健康首页",
  171. icon: "svg-wind-site",
  172. path: "/health/health2",
  173. },
  174. {
  175. text: "健康总览",
  176. icon: "svg-wind-site",
  177. path: "/health/health6",
  178. },
  179. {
  180. text: "健康矩阵",
  181. icon: "svg-wind-site",
  182. path: "/health/health5",
  183. },
  184. // {
  185. // text: "健康列表",
  186. // icon: "svg-wind-site",
  187. // path: "/health/health6",
  188. // }
  189. ],
  190. },
  191. {
  192. text: "健康管理8",
  193. icon: "svg-wind-site",
  194. path: "/health/health8",
  195. },
  196. ],
  197. },
  198. {
  199. id: "decision",
  200. text: "决策支持",
  201. data: [
  202. {
  203. text: "风机绩效榜",
  204. icon: "svg-matrix",
  205. path: "/decision/decision1",
  206. },
  207. {
  208. text: "五项损失率",
  209. icon: "svg-matrix",
  210. path: "/decision/decision2",
  211. },
  212. {
  213. text: "场内对标",
  214. icon: "svg-matrix",
  215. path: "/decision/decision2Cndb",
  216. },
  217. {
  218. text: "场际对标",
  219. icon: "svg-matrix",
  220. path: "/decision/decision2Cjdb",
  221. },
  222. {
  223. text: "项目对标",
  224. icon: "svg-matrix",
  225. path: "/decision/decision2Xmdb",
  226. },
  227. {
  228. text: "线路对标",
  229. icon: "svg-matrix",
  230. path: "/decision/decision2Xldb",
  231. },
  232. // {
  233. // text: "决策支持3",
  234. // icon: "svg-matrix",
  235. // path: "/decision/decision3",
  236. // },
  237. // {
  238. // text: "决策支持4",
  239. // icon: "svg-matrix",
  240. // path: "/decision/decision4",
  241. // },
  242. {
  243. text: "排行榜",
  244. icon: "svg-matrix",
  245. path: "/phb",
  246. children: [
  247. {
  248. text: "发电效率排行",
  249. icon: "svg-wind-site",
  250. path: "/powerRank",
  251. }
  252. ]
  253. }
  254. ],
  255. },
  256. {
  257. id: "knowledge",
  258. text: "知识管理",
  259. data: [
  260. {
  261. text: "故障知识列表",
  262. icon: "svg-matrix",
  263. path: "/knowledge",
  264. },
  265. {
  266. text: "安全措施知识",
  267. icon: "svg-matrix",
  268. path: "/knowledge2",
  269. },
  270. {
  271. text: "风险辨识知识",
  272. icon: "svg-matrix",
  273. path: "/knowledge3",
  274. },
  275. {
  276. text: "作业指导知识",
  277. icon: "svg-matrix",
  278. path: "/knowledge4",
  279. },
  280. {
  281. text: "特征参数",
  282. icon: "svg-matrix",
  283. path: "/knowledge5",
  284. },
  285. ],
  286. },
  287. {
  288. id: "report",
  289. text: "智能报表",
  290. data: [],
  291. },
  292. ],
  293. activeIndex: 0,
  294. isShowSubMenu: false,
  295. parentIndex: null,
  296. subMenu: [],
  297. subIndex: null,
  298. };
  299. },
  300. methods: {
  301. click(index) {
  302. this.activeIndex = index;
  303. this.subIndex = null;
  304. },
  305. subMenuShow(children, index) {
  306. if (children) {
  307. this.isShowSubMenu = true;
  308. this.parentIndex = index;
  309. } else {
  310. this.isShowSubMenu = false;
  311. this.parentIndex = null;
  312. }
  313. this.subMenu = children;
  314. },
  315. subclick(index) {
  316. this.activeIndex = this.parentIndex;
  317. this.subIndex = index;
  318. },
  319. },
  320. computed: {
  321. currentMenu() {
  322. let data = this.menuData.filter((t) => {
  323. return t.id == this.currRoot;
  324. })[0].data;
  325. return data;
  326. },
  327. },
  328. watch: {
  329. // 监听路由
  330. $route: {
  331. handler: function(val, oldVal) {
  332. this.menuData.some((element, index) => {
  333. if (val.path.includes(element.id)) {
  334. this.currRoot = element.id;
  335. this.$nextTick(() => {
  336. this.currentMenu.some((element, index) => {
  337. if (val.path == element.path) {
  338. this.activeIndex = index;
  339. }
  340. });
  341. });
  342. return true;
  343. }
  344. });
  345. },
  346. //深度观察监听
  347. deep: true,
  348. },
  349. },
  350. };
  351. </script>
  352. <style lang="less">
  353. .menu {
  354. padding-top: 1.481vh;
  355. .menu-list {
  356. margin: 0;
  357. padding: 0;
  358. list-style: none;
  359. .menu-item {
  360. padding: 1.481vh 0;
  361. text-align: center;
  362. .menu-icon {
  363. display: flex;
  364. justify-content: center;
  365. }
  366. &.active i {
  367. color: #05bb4c;
  368. transition: color 1s;
  369. }
  370. }
  371. }
  372. i {
  373. font-size: 2.222vh;
  374. color: rgba(255, 255, 255, 50%);
  375. }
  376. }
  377. .sub-menu {
  378. position: absolute;
  379. top: 0;
  380. left: 5.3704vh;
  381. width: 138px;
  382. height: 100%;
  383. padding-top: 1.481vh;
  384. background: fade(#192a26, 75);
  385. border-right: 1px solid fade(@green, 50);
  386. box-shadow: inset 11px 0px 20px 0px fade(#021412, 60);
  387. .menu-list {
  388. margin: 0;
  389. padding: 0;
  390. list-style: none;
  391. .menu-item {
  392. display: flex;
  393. text-align: center;
  394. line-height: 1.5;
  395. padding: 8px 0;
  396. background: #121d1c;
  397. a {
  398. display: flex;
  399. width: 100%;
  400. height: 100%;
  401. padding: 0 1.4815vh;
  402. font-size: @fontsize-s;
  403. text-decoration: unset;
  404. .menu-icon {
  405. display: flex;
  406. align-items: center;
  407. svg {
  408. width: 14px;
  409. height: 14px;
  410. use {
  411. fill: fade(@green, 75);
  412. }
  413. }
  414. }
  415. }
  416. &.active {
  417. background: #323e70;
  418. .menu-icon {
  419. display: flex;
  420. svg use {
  421. fill: fade(@white, 75);
  422. }
  423. }
  424. }
  425. .sub-menu-text {
  426. margin-left: 1.1111vh;
  427. color: @gray-l;
  428. }
  429. & + .menu-item {
  430. border-top: 1px solid fade(@darkgray, 40);
  431. }
  432. }
  433. }
  434. i {
  435. font-size: 2.222vh;
  436. color: rgba(255, 255, 255, 50%);
  437. }
  438. }
  439. </style>