App.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <!--
  2. * @Date: 2023-06-18 10:09:15
  3. * @LastEditors: zhubj
  4. * @LastEditTime: 2023-06-19 17:04:11
  5. * @Description: 头部注释
  6. * @FilePath: \own-vue3-vuecli-template\src\App.vue
  7. -->
  8. <template>
  9. <div class="windLife" :class="!swichTheme ? 'themeDark' : 'themeLight'">
  10. <common-header v-if="showHeader" @headerName="headerName" @swichFn="swichFn"></common-header>
  11. <div class="menu-body" :class="!fixed ? 'menuBs' : ''" v-if="isShowMenu" @mouseenter="showMenu"
  12. @mouseleave="hideMenu">
  13. <ul class="menu-list">
  14. <li class="menu-item" v-for="(menu, index) in showMenuData" :key="index"
  15. @click="handleNodeClick(menu.index)">
  16. <router-link :to="menu.index">
  17. <el-tooltip class="item" effect="dark" :content="menu.name" placement="right"
  18. :enterable="false">
  19. <component :is="menu.icon">
  20. </component>
  21. </el-tooltip>
  22. </router-link>
  23. </li>
  24. <li class="lockpage" @click="handleClickFixed">
  25. <el-icon v-if="fixed" style="width:25px;height:25px">
  26. <Lock />
  27. </el-icon>
  28. <el-icon v-else style="width:25px;height:25px">
  29. <Unlock />
  30. </el-icon>
  31. </li>
  32. </ul>
  33. </div>
  34. <div :style="{ paddingLeft: fixed ? '65px' : 0 }">
  35. <router-view />
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import commonHeader from '@/components/commonHeaders.vue'
  41. export default {
  42. components: {
  43. commonHeader,
  44. },
  45. data() {
  46. return {
  47. showHeader: false,
  48. showHeader: false,
  49. loading: true,
  50. isShowMenu: false,
  51. isShowMenuDiv: false,
  52. isFixed: false,
  53. showMenuData: [],
  54. powerPreDatas: [{
  55. index: '/powerPrediction/index',
  56. icon: 'Coin',
  57. name: '概要'
  58. },
  59. {
  60. index: '/powerPrediction/panoramicPower',
  61. icon: 'DataBoard',
  62. name: '全景功率'
  63. },
  64. {
  65. index: '/powerPrediction/power',
  66. icon: 'DataAnalysis',
  67. name: '功率预测'
  68. },
  69. {
  70. index: '/powerPrediction/batteryDiviner',
  71. icon: 'DataLine',
  72. name: '电量预测'
  73. },
  74. {
  75. index: '/powerPrediction/weather',
  76. icon: 'Sunrise',
  77. name: '天气预报'
  78. },
  79. {
  80. index: '/powerPrediction/statisticalSummary',
  81. icon: 'Tickets',
  82. name: '统计汇总'
  83. },
  84. ],
  85. intelligentReportDatas: [{
  86. icon: 'ScaleToOriginal',
  87. index: '/intelligentReport/gkjlb',
  88. name: '关口计量表'
  89. },
  90. {
  91. icon: 'Eleme',
  92. index: '/intelligentReport/erp',
  93. name: 'ERP'
  94. },
  95. {
  96. icon: 'Memo',
  97. index: '/intelligentReport/czzyb',
  98. name: '场站自由报表'
  99. },
  100. {
  101. icon: 'Finished',
  102. index: '/intelligentReport/reporting',
  103. name: '报表上报'
  104. },
  105. {
  106. icon: 'Odometer',
  107. index: '/intelligentReport/scriptgeneration',
  108. name: '报表脚本'
  109. },
  110. ],
  111. generatingCapDatas: [{
  112. icon: 'Coin',
  113. index: '/generatingCap/dataFilter/prepare',
  114. name: '风电数据准备'
  115. }, {
  116. icon: 'DataAnalysis',
  117. index: '/generatingCap/dataFilter/process',
  118. name: '风电数据处理'
  119. }, {
  120. icon: 'Operation',
  121. index: '/generatingCap/dataAnalysis/combine',
  122. name: '功率曲线拟合分析'
  123. }, {
  124. icon: 'ScaleToOriginal',
  125. index: '/generatingCap/dataAnalysis/rateAnalysis',
  126. name: '对风偏差分析'
  127. }, {
  128. icon: 'DataLine',
  129. index: '/generatingCap/dataAnalysis/lineAnalysis',
  130. name: '曲线偏差率分析'
  131. }, {
  132. icon: 'Odometer',
  133. index: '/generatingCap/dataAnalysis/hotAnalysis',
  134. name: '温度与功率分析'
  135. }, {
  136. icon: 'Finished',
  137. index: '/generatingCap/dataAnalysis/windAnalysis',
  138. name: '损失电量分析'
  139. }, {
  140. icon: 'Coordinate',
  141. index: '/generatingCap/dataAnalysis/posAnalysis',
  142. name: '微观选址分析'
  143. }, {
  144. icon: 'SetUp',
  145. index: '/generatingCap/dataAnalysis/spaceAnalysis',
  146. name: '毛容量分析'
  147. }, {
  148. icon: 'Suitcase',
  149. index: '/generatingCap/dataAnalysis/angleAnalysis',
  150. name: '浆距角分析'
  151. }, {
  152. icon: 'Monitor',
  153. index: '/generatingCap/dataAnalysis/agcAnalysis',
  154. name: 'AGC曲线偏差分析'
  155. }, {
  156. icon: 'Files',
  157. index: '/generatingCap/dataAnalysis/analysisReport',
  158. name: '分析报告'
  159. }, ],
  160. memuCloseTimeout: null,
  161. fixed: false,
  162. swichTheme: false
  163. }
  164. },
  165. watch: {
  166. $route: {
  167. handler: function (route) {
  168. this.showHeader = route.path === '/login' ? false : true
  169. this.isShowMenu = route.path === '/login' || route.path === '/home' ? false : true
  170. },
  171. immediate: true
  172. }
  173. },
  174. created() {
  175. debugger
  176. },
  177. mounted() {
  178. if (!JSON.parse(window.sessionStorage.getItem('theme'))) {
  179. document.getElementById('app').style.background = '#040c0b'
  180. } else {
  181. this.swichTheme = JSON.parse(window.sessionStorage.getItem('theme'))
  182. if (!this.swichTheme) {
  183. document.getElementById('app').style.background = '#040c0b'
  184. } else {
  185. document.getElementById('app').style.background =
  186. '-webkit-gradient(linear, 0% 0%, 0% 100%, from(#373590), to(#373590), color-stop(0.2, #645fef), color-stop(0.8, #645fef))'
  187. }
  188. this.$emit('swichFn', this.switchTheme)
  189. }
  190. this.fixed = window.sessionStorage.getItem('menufixed')
  191. this.isShowMenu = window.sessionStorage.getItem('isShowMenu')
  192. // if (window.sessionStorage.getItem('headerRoute')) {
  193. // let str = window.sessionStorage.getItem('headerRoute')
  194. let str = window.location.href
  195. if (str.indexOf('powerPrediction') > -1) {
  196. this.showMenuData = this.powerPreDatas
  197. } else if (str.indexOf('intelligentReport') > -1) {
  198. this.showMenuData = this.intelligentReportDatas
  199. } else if (str.indexOf('generatingCap') > -1) {
  200. this.showMenuData = this.generatingCapDatas
  201. }
  202. // }
  203. },
  204. methods: {
  205. headerName(name) {
  206. this.showMenuData = []
  207. if (name === '功率预测') {
  208. this.showMenuData = this.powerPreDatas
  209. } else if (name === '智能报表') {
  210. this.showMenuData = this.intelligentReportDatas
  211. } else if (name === '发电能力分析') {
  212. this.showMenuData = this.generatingCapDatas
  213. }
  214. },
  215. swichFn(val) {
  216. this.swichTheme = val
  217. if (!this.swichTheme) {
  218. document.getElementById('app').style.background = '#040c0b'
  219. } else {
  220. document.getElementById('app').style.background =
  221. '-webkit-gradient(linear, 0% 0%, 0% 100%, from(#373590), to(#373590), color-stop(0.2, #645fef), color-stop(0.8, #645fef))'
  222. }
  223. // this.$router.go(0);
  224. },
  225. showMenu() {
  226. if (!this.fixed) {
  227. this.isShowMenu = true;
  228. window.sessionStorage.setItem('isShowMenu', this.isShowMenu)
  229. clearTimeout(this.memuCloseTimeout);
  230. this.memuCloseTimeout = null;
  231. }
  232. },
  233. hideMenu() {
  234. if (!this.fixed) {
  235. this.memuCloseTimeout = setTimeout(() => {
  236. this.isShowMenu = true;
  237. window.sessionStorage.setItem('isShowMenu', this.isShowMenu)
  238. }, 500);
  239. }
  240. },
  241. handleNodeClick(index, indexPath) {
  242. this.$router.push({
  243. path: index
  244. })
  245. },
  246. handleClickFixed() {
  247. this.fixed = !this.fixed
  248. window.sessionStorage.setItem('menufixed', JSON.stringify(this.fixed))
  249. if (this.fixed) {
  250. this.isShowMenu = true
  251. window.sessionStorage.setItem('isShowMenu', this.isShowMenu)
  252. }
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="less">
  258. .windLife {
  259. height: 100%;
  260. .menu-body {
  261. position: absolute;
  262. display: flex;
  263. flex-direction: column;
  264. align-items: center;
  265. justify-content: space-between;
  266. flex: 0 0 63px;
  267. width: 63px;
  268. height: calc(100% - 60px);
  269. top: 60px;
  270. background-color: fade(#21192a, 75%);
  271. z-index: 2002;
  272. &:hover {
  273. opacity: 1;
  274. transition: opacity 0.2s;
  275. transition-timing-function: ease-out;
  276. transform: translate(0);
  277. }
  278. .menu-list {
  279. margin: 0;
  280. padding: 0;
  281. list-style: none;
  282. .menu-item {
  283. display: flex;
  284. text-align: center;
  285. line-height: 2;
  286. padding: 12px 0;
  287. width: 25px;
  288. height: 25px;
  289. .el-tooltip__trigger {
  290. color: #fff;
  291. }
  292. a {
  293. display: flex;
  294. width: 100%;
  295. height: 100%;
  296. font-size: 14px;
  297. text-decoration: unset;
  298. white-space: nowrap;
  299. }
  300. &.active {
  301. background: #323e70;
  302. }
  303. &+.menu-item {
  304. border-top: 1px solid fade(#606769, 40);
  305. }
  306. }
  307. }
  308. .lockpage {
  309. position: absolute;
  310. bottom: 20px;
  311. .el-icon {
  312. color: #fff;
  313. svg {
  314. width: 25px;
  315. height: 25px;
  316. }
  317. }
  318. }
  319. }
  320. .menuBs {
  321. opacity: 0;
  322. transition: opacity 0.2s;
  323. transition-timing-function: ease-in;
  324. }
  325. }
  326. @import "./assets/css/main.css";
  327. @import "./assets/css/eleCss/index.less";
  328. @import "./assets/css/eleCss/el-popper.less";
  329. .themeDark {
  330. @import "./assets/css/eleCss/el-dialogB.less";
  331. @import "./assets/css/eleCss/el-tableB.less";
  332. @import "./assets/css/eleCss/el-inputB.less";
  333. @import "./assets/css/eleCss/el-treeB.less";
  334. }
  335. .themeLight {
  336. @import "./assets/css/eleCss/el-dialogW.less";
  337. @import "./assets/css/eleCss/el-treeW.less";
  338. }
  339. // #app {
  340. // background: #040c0b;
  341. // }
  342. </style>