Menu.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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" @mouseleave="subMenuHide">
  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/MHS_FDC",
  87. },
  88. ],
  89. },
  90. {
  91. id: "realSearch",
  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: "singleAnalysis",
  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: "/qxpclfx",
  141. },
  142. {
  143. text: "单机性能分析",
  144. icon: "svg-wind-site",
  145. path: "/performanceAnalysis",
  146. },
  147. {
  148. text: "单机月度分析",
  149. icon: "svg-wind-site",
  150. path: "/singleAnalysis",
  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. text: "单机分析",
  173. icon: "svg-wind-site",
  174. path: "/fgzyfx",
  175. children: [
  176. {
  177. text: "单机分析详细",
  178. icon: "svg-wind-site",
  179. path: "/new/dj1",
  180. },
  181. {
  182. text: "电量预测",
  183. icon: "svg-wind-site",
  184. path: "/new/pf1",
  185. },
  186. {
  187. text: "气象预测",
  188. icon: "svg-wind-site",
  189. path: "/new/fs",
  190. }
  191. ]
  192. }
  193. ],
  194. },
  195. {
  196. id: "health",
  197. text: "健康管理",
  198. data: [
  199. {
  200. text: "健康管理",
  201. icon: "svg-wind-site",
  202. path: "/health",
  203. children: [
  204. {
  205. text: "量化评级",
  206. icon: "svg-wind-site",
  207. path: "/djpg",
  208. },
  209. {
  210. text: "健康推荐",
  211. icon: "svg-wind-site",
  212. path: "/health",
  213. },
  214. {
  215. text: "健康首页",
  216. icon: "svg-wind-site",
  217. path: "/health/health2",
  218. },
  219. {
  220. text: "健康总览",
  221. icon: "svg-wind-site",
  222. path: "/health/health6",
  223. },
  224. {
  225. text: "健康矩阵",
  226. icon: "svg-wind-site",
  227. path: "/health/health5",
  228. },
  229. // {
  230. // text: "健康列表",
  231. // icon: "svg-wind-site",
  232. // path: "/health/health6",
  233. // },
  234. {
  235. text: "健康列表",
  236. icon: "svg-wind-site",
  237. path: "/health/health8",
  238. },
  239. ],
  240. },
  241. ],
  242. },
  243. {
  244. id: "decision",
  245. text: "决策支持",
  246. data: [
  247. {
  248. text: "风机绩效榜",
  249. icon: "svg-matrix",
  250. path: "/decision/decision1",
  251. },
  252. {
  253. text: "五项损失率",
  254. icon: "svg-matrix",
  255. path: "/decision/decision2",
  256. },
  257. {
  258. text: "场内对标",
  259. icon: "svg-matrix",
  260. path: "/decision/decision2Cndb",
  261. },
  262. {
  263. text: "场际对标",
  264. icon: "svg-matrix",
  265. path: "/decision/decision2Cjdb",
  266. },
  267. {
  268. text: "项目对标",
  269. icon: "svg-matrix",
  270. path: "/decision/decision2Xmdb",
  271. },
  272. {
  273. text: "线路对标",
  274. icon: "svg-matrix",
  275. path: "/decision/decision2Xldb",
  276. },
  277. // {
  278. // text: "决策支持3",
  279. // icon: "svg-matrix",
  280. // path: "/decision/decision3",
  281. // },
  282. // {
  283. // text: "决策支持4",
  284. // icon: "svg-matrix",
  285. // path: "/decision/decision4",
  286. // },
  287. {
  288. text: "排行榜",
  289. icon: "svg-matrix",
  290. path: "/phb",
  291. children: [
  292. {
  293. text: "发电效率排行",
  294. icon: "svg-wind-site",
  295. path: "/powerRank",
  296. },
  297. {
  298. text: "总发电效率排行",
  299. icon: "svg-wind-site",
  300. path: "/totalPowerRank",
  301. },
  302. {
  303. text: "报警排行",
  304. icon: "svg-wind-site",
  305. path: "/warningRank",
  306. }
  307. ]
  308. },
  309. // 三率管理
  310. {
  311. text:'三率管理',
  312. icon:'svg-matrix',
  313. path:'/slgl',
  314. children:[
  315. {
  316. text:'复位及时率',
  317. icon:'svg-wind-site',
  318. path:'/fwjsl'
  319. },
  320. {
  321. text:'状态转换率',
  322. icon:'svg-wind-site',
  323. path:'/ztzhl'
  324. },
  325. {
  326. text:'消缺及时率',
  327. icon:'svg-wind-site',
  328. path:'/xqjsl'
  329. }
  330. ]
  331. }
  332. ],
  333. },
  334. {
  335. id: "knowledge",
  336. text: "知识管理",
  337. data: [
  338. {
  339. text: "故障知识列表",
  340. icon: "svg-matrix",
  341. path: "/knowledge",
  342. },
  343. {
  344. text: "安全措施知识",
  345. icon: "svg-matrix",
  346. path: "/knowledge2",
  347. },
  348. {
  349. text: "排查检修方案",
  350. icon: "svg-matrix",
  351. path: "/knowledge6",
  352. },
  353. {
  354. text: "预警知识",
  355. icon: "svg-matrix",
  356. path: "/knowledge7",
  357. },
  358. {
  359. text: "特征参数",
  360. icon: "svg-matrix",
  361. path: "/knowledge5",
  362. },
  363. {
  364. text: "风险辨识知识",
  365. icon: "svg-matrix",
  366. path: "/knowledge3",
  367. },
  368. {
  369. text: "作业指导知识",
  370. icon: "svg-matrix",
  371. path: "/knowledge4",
  372. }
  373. ],
  374. },
  375. {
  376. id: "report",
  377. text: "智能报表",
  378. data: [],
  379. },
  380. ],
  381. activeIndex: 0,
  382. isShowSubMenu: false,
  383. parentIndex: null,
  384. subMenu: [],
  385. subIndex: null,
  386. };
  387. },
  388. methods: {
  389. click(index) {
  390. this.activeIndex = index;
  391. this.subIndex = null;
  392. },
  393. subMenuShow(children, index) {
  394. if (children) {
  395. this.isShowSubMenu = true;
  396. this.parentIndex = index;
  397. } else {
  398. this.isShowSubMenu = false;
  399. this.parentIndex = null;
  400. }
  401. this.subMenu = children;
  402. },
  403. subMenuHide() {
  404. this.isShowSubMenu = false;
  405. this.parentIndex = null;
  406. this.subMenu = [];
  407. },
  408. subclick(index) {
  409. this.activeIndex = this.parentIndex;
  410. this.subIndex = index;
  411. },
  412. },
  413. computed: {
  414. currentMenu() {
  415. let data = this.menuData.filter((t) => {
  416. return t.id == this.currRoot;
  417. })[0].data;
  418. return data;
  419. },
  420. },
  421. watch: {
  422. // 监听路由
  423. $route: {
  424. handler: function(val, oldVal) {
  425. this.menuData.some((element, index) => {
  426. if (val.path.includes(element.id)) {
  427. this.currRoot = element.id;
  428. this.$nextTick(() => {
  429. this.currentMenu.some((element, index) => {
  430. if (val.path == element.path) {
  431. this.activeIndex = index;
  432. }
  433. });
  434. });
  435. return true;
  436. }
  437. });
  438. },
  439. //深度观察监听
  440. deep: true,
  441. },
  442. },
  443. };
  444. </script>
  445. <style lang="less">
  446. .menu {
  447. padding-top: 1.481vh;
  448. .menu-list {
  449. margin: 0;
  450. padding: 0;
  451. list-style: none;
  452. .menu-item {
  453. padding: 1.481vh 0;
  454. text-align: center;
  455. .menu-icon {
  456. display: flex;
  457. justify-content: center;
  458. }
  459. &.active i {
  460. color: #05bb4c;
  461. transition: color 1s;
  462. }
  463. }
  464. }
  465. i {
  466. font-size: 2.222vh;
  467. color: rgba(255, 255, 255, 50%);
  468. }
  469. }
  470. .sub-menu {
  471. position: absolute;
  472. top: 0;
  473. left: 5.3704vh;
  474. width: 138px;
  475. height: 100%;
  476. padding-top: 1.481vh;
  477. background: fade(#192a26, 75);
  478. border-right: 1px solid fade(@green, 50);
  479. box-shadow: inset 11px 0px 20px 0px fade(#021412, 60);
  480. .menu-list {
  481. margin: 0;
  482. padding: 0;
  483. list-style: none;
  484. .menu-item {
  485. display: flex;
  486. text-align: center;
  487. line-height: 1.5;
  488. padding: 8px 0;
  489. background: #121d1c;
  490. a {
  491. display: flex;
  492. width: 100%;
  493. height: 100%;
  494. padding: 0 1.4815vh;
  495. font-size: @fontsize-s;
  496. text-decoration: unset;
  497. .menu-icon {
  498. display: flex;
  499. align-items: center;
  500. svg {
  501. width: 14px;
  502. height: 14px;
  503. use {
  504. fill: fade(@green, 75);
  505. }
  506. }
  507. }
  508. }
  509. &.active {
  510. background: #323e70;
  511. .menu-icon {
  512. display: flex;
  513. svg use {
  514. fill: fade(@white, 75);
  515. }
  516. }
  517. }
  518. .sub-menu-text {
  519. margin-left: 1.1111vh;
  520. color: @gray-l;
  521. }
  522. & + .menu-item {
  523. border-top: 1px solid fade(@darkgray, 40);
  524. }
  525. }
  526. }
  527. i {
  528. font-size: 2.222vh;
  529. color: rgba(255, 255, 255, 50%);
  530. }
  531. }
  532. </style>