Menu.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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. text: "原始数据查询",
  96. icon: "svg-wind-site",
  97. path: "/yssjcx",
  98. children: [
  99. {
  100. text: "测点数据查询",
  101. icon: "svg-wind-site",
  102. path: "/realSearch"
  103. },
  104. {
  105. text: "测点历史数据查询",
  106. icon: "svg-wind-site",
  107. path: "/historySearch"
  108. }
  109. ]
  110. }
  111. ],
  112. },
  113. {
  114. id: "statistic",
  115. text: "统计分析",
  116. data: [
  117. {
  118. text: "能效分析",
  119. icon: "svg-wind-site",
  120. path: "/nxfx",
  121. children: [
  122. {
  123. text: "功率曲线拟合",
  124. icon: "svg-wind-site",
  125. path: "/nxfx1",
  126. },
  127. {
  128. text: "偏航对风分析",
  129. icon: "svg-wind-site",
  130. path: "/nxfx2",
  131. },
  132. {
  133. text: "切入切出分析",
  134. icon: "svg-wind-site",
  135. path: "/cutAnalyse",
  136. },
  137. {
  138. text: "曲线偏差率分析",
  139. icon: "svg-wind-site",
  140. path: "/nxfx4",
  141. },
  142. {
  143. text: "单机性能分析",
  144. icon: "svg-wind-site",
  145. path: "/nxfx5",
  146. },
  147. {
  148. text: "单机月度分析",
  149. icon: "svg-wind-site",
  150. path: "/nxfx6",
  151. },
  152. {
  153. text: "单机饱和度",
  154. icon: "svg-wind-site",
  155. path: "/wtSaturability",
  156. }
  157. ]
  158. },
  159. {
  160. text: "风光资源分析",
  161. icon: "svg-wind-site",
  162. path: "/fgzyfx",
  163. children: [
  164. {
  165. text: "风资源分析",
  166. icon: "svg-wind-site",
  167. path: "/windAnalysis",
  168. }
  169. ]
  170. }
  171. ],
  172. },
  173. {
  174. id: "health",
  175. text: "健康管理",
  176. data: [
  177. {
  178. text: "健康管理",
  179. icon: "svg-wind-site",
  180. path: "/health",
  181. children: [
  182. {
  183. text: "健康推荐",
  184. icon: "svg-wind-site",
  185. path: "/health",
  186. },
  187. {
  188. text: "健康首页",
  189. icon: "svg-wind-site",
  190. path: "/health/health2",
  191. },
  192. {
  193. text: "健康总览",
  194. icon: "svg-wind-site",
  195. path: "/health/health6",
  196. },
  197. {
  198. text: "健康矩阵",
  199. icon: "svg-wind-site",
  200. path: "/health/health5",
  201. },
  202. // {
  203. // text: "健康列表",
  204. // icon: "svg-wind-site",
  205. // path: "/health/health6",
  206. // }
  207. ],
  208. },
  209. {
  210. text: "健康管理8",
  211. icon: "svg-wind-site",
  212. path: "/health/health8",
  213. },
  214. ],
  215. },
  216. {
  217. id: "decision",
  218. text: "决策支持",
  219. data: [
  220. {
  221. text: "风机绩效榜",
  222. icon: "svg-matrix",
  223. path: "/decision/decision1",
  224. },
  225. {
  226. text: "五项损失率",
  227. icon: "svg-matrix",
  228. path: "/decision/decision2",
  229. },
  230. {
  231. text: "场内对标",
  232. icon: "svg-matrix",
  233. path: "/decision/decision2Cndb",
  234. },
  235. {
  236. text: "场际对标",
  237. icon: "svg-matrix",
  238. path: "/decision/decision2Cjdb",
  239. },
  240. {
  241. text: "项目对标",
  242. icon: "svg-matrix",
  243. path: "/decision/decision2Xmdb",
  244. },
  245. {
  246. text: "线路对标",
  247. icon: "svg-matrix",
  248. path: "/decision/decision2Xldb",
  249. },
  250. // {
  251. // text: "决策支持3",
  252. // icon: "svg-matrix",
  253. // path: "/decision/decision3",
  254. // },
  255. // {
  256. // text: "决策支持4",
  257. // icon: "svg-matrix",
  258. // path: "/decision/decision4",
  259. // },
  260. {
  261. text: "排行榜",
  262. icon: "svg-matrix",
  263. path: "/phb",
  264. children: [
  265. {
  266. text: "发电效率排行",
  267. icon: "svg-wind-site",
  268. path: "/powerRank",
  269. },
  270. {
  271. text: "总发电效率排行",
  272. icon: "svg-wind-site",
  273. path: "/totalPowerRank",
  274. },
  275. {
  276. text: "报警排行",
  277. icon: "svg-wind-site",
  278. path: "/warningRank",
  279. }
  280. ]
  281. }
  282. ],
  283. },
  284. {
  285. id: "knowledge",
  286. text: "知识管理",
  287. data: [
  288. {
  289. text: "故障知识列表",
  290. icon: "svg-matrix",
  291. path: "/knowledge",
  292. },
  293. {
  294. text: "安全措施知识",
  295. icon: "svg-matrix",
  296. path: "/knowledge2",
  297. },
  298. {
  299. text: "排查检修方案",
  300. icon: "svg-matrix",
  301. path: "/knowledge6",
  302. },
  303. {
  304. text: "预警知识",
  305. icon: "svg-matrix",
  306. path: "/knowledge7",
  307. },
  308. {
  309. text: "特征参数",
  310. icon: "svg-matrix",
  311. path: "/knowledge5",
  312. },
  313. {
  314. text: "风险辨识知识",
  315. icon: "svg-matrix",
  316. path: "/knowledge3",
  317. },
  318. {
  319. text: "作业指导知识",
  320. icon: "svg-matrix",
  321. path: "/knowledge4",
  322. }
  323. ],
  324. },
  325. {
  326. id: "report",
  327. text: "智能报表",
  328. data: [],
  329. },
  330. ],
  331. activeIndex: 0,
  332. isShowSubMenu: false,
  333. parentIndex: null,
  334. subMenu: [],
  335. subIndex: null,
  336. };
  337. },
  338. methods: {
  339. click(index) {
  340. this.activeIndex = index;
  341. this.subIndex = null;
  342. },
  343. subMenuShow(children, index) {
  344. if (children) {
  345. this.isShowSubMenu = true;
  346. this.parentIndex = index;
  347. } else {
  348. this.isShowSubMenu = false;
  349. this.parentIndex = null;
  350. }
  351. this.subMenu = children;
  352. },
  353. subclick(index) {
  354. this.activeIndex = this.parentIndex;
  355. this.subIndex = index;
  356. },
  357. },
  358. computed: {
  359. currentMenu() {
  360. let data = this.menuData.filter((t) => {
  361. return t.id == this.currRoot;
  362. })[0].data;
  363. return data;
  364. },
  365. },
  366. watch: {
  367. // 监听路由
  368. $route: {
  369. handler: function(val, oldVal) {
  370. this.menuData.some((element, index) => {
  371. if (val.path.includes(element.id)) {
  372. this.currRoot = element.id;
  373. this.$nextTick(() => {
  374. this.currentMenu.some((element, index) => {
  375. if (val.path == element.path) {
  376. this.activeIndex = index;
  377. }
  378. });
  379. });
  380. return true;
  381. }
  382. });
  383. },
  384. //深度观察监听
  385. deep: true,
  386. },
  387. },
  388. };
  389. </script>
  390. <style lang="less">
  391. .menu {
  392. padding-top: 1.481vh;
  393. .menu-list {
  394. margin: 0;
  395. padding: 0;
  396. list-style: none;
  397. .menu-item {
  398. padding: 1.481vh 0;
  399. text-align: center;
  400. .menu-icon {
  401. display: flex;
  402. justify-content: center;
  403. }
  404. &.active i {
  405. color: #05bb4c;
  406. transition: color 1s;
  407. }
  408. }
  409. }
  410. i {
  411. font-size: 2.222vh;
  412. color: rgba(255, 255, 255, 50%);
  413. }
  414. }
  415. .sub-menu {
  416. position: absolute;
  417. top: 0;
  418. left: 5.3704vh;
  419. width: 138px;
  420. height: 100%;
  421. padding-top: 1.481vh;
  422. background: fade(#192a26, 75);
  423. border-right: 1px solid fade(@green, 50);
  424. box-shadow: inset 11px 0px 20px 0px fade(#021412, 60);
  425. .menu-list {
  426. margin: 0;
  427. padding: 0;
  428. list-style: none;
  429. .menu-item {
  430. display: flex;
  431. text-align: center;
  432. line-height: 1.5;
  433. padding: 8px 0;
  434. background: #121d1c;
  435. a {
  436. display: flex;
  437. width: 100%;
  438. height: 100%;
  439. padding: 0 1.4815vh;
  440. font-size: @fontsize-s;
  441. text-decoration: unset;
  442. .menu-icon {
  443. display: flex;
  444. align-items: center;
  445. svg {
  446. width: 14px;
  447. height: 14px;
  448. use {
  449. fill: fade(@green, 75);
  450. }
  451. }
  452. }
  453. }
  454. &.active {
  455. background: #323e70;
  456. .menu-icon {
  457. display: flex;
  458. svg use {
  459. fill: fade(@white, 75);
  460. }
  461. }
  462. }
  463. .sub-menu-text {
  464. margin-left: 1.1111vh;
  465. color: @gray-l;
  466. }
  467. & + .menu-item {
  468. border-top: 1px solid fade(@darkgray, 40);
  469. }
  470. }
  471. }
  472. i {
  473. font-size: 2.222vh;
  474. color: rgba(255, 255, 255, 50%);
  475. }
  476. }
  477. </style>