App.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <template>
  2. <div
  3. v-if="!showSisView"
  4. id="screen"
  5. :style="{
  6. width: `${style.width}px`,
  7. height: `${style.height}px`,
  8. transform: `${style.transform}`,
  9. }"
  10. >
  11. <div v-if="isLogined" class="main">
  12. <div class="header-body" v-if="hideHeard === '0'">
  13. <div class="header-title" @click="handleClickJump()">
  14. <!-- <img v-if="$store.state.themeName === 'dark'" src="./assets/projectLogo.png" alt="" />
  15. <img v-if="$store.state.themeName === 'light'" src="./assets/light-projectLogo.png" alt="" /> -->
  16. <span
  17. :style="
  18. $store.state.themeName === 'dark'
  19. ? 'color:#fff; font-size:18px;font-family: SimHei'
  20. : 'color:#000'
  21. "
  22. >
  23. >>发电场站生产实时运营管理平台</span
  24. >
  25. </div>
  26. <div class="header-menu-body">
  27. <Header @changeShowSisView="changeShowSisView" />
  28. </div>
  29. </div>
  30. <div
  31. class="menu-body"
  32. :class="{ hover: isFixed ? true : isShowMenu }"
  33. @mouseenter="showMenu"
  34. @mouseleave="hideMenu"
  35. v-show="$store.state?.menuData?.length"
  36. >
  37. <Menu />
  38. </div>
  39. <!-- <div>
  40. <el-menu
  41. class="lightMenu"
  42. :class="$store.state.themeName === 'light' ? 'show' : 'hidden'"
  43. :collapse="true"
  44. text-color="#ffffff"
  45. active-text-color="#6262a2"
  46. background-color="#36348e"
  47. @select="selectMenu"
  48. v-if="hideMenus === '0' && $store.state.menuData.length"
  49. >
  50. <el-sub-menu
  51. :index="index"
  52. :title="item.text"
  53. v-for="(item, index) in menuData"
  54. :key="index"
  55. >
  56. <template #title>
  57. <router-link :to="item.path">
  58. <el-icon>
  59. <SvgIcon :svgid="item.icon" />
  60. </el-icon>
  61. </router-link>
  62. </template>
  63. <el-menu-item-group
  64. v-for="(menu, idx) in item.children"
  65. :index="idx"
  66. :key="idx"
  67. >
  68. <router-link :to="menu.path">
  69. <el-menu-item :index="index + '-' + idx">{{
  70. menu.text
  71. }}</el-menu-item>
  72. </router-link>
  73. </el-menu-item-group>
  74. </el-sub-menu>
  75. </el-menu>
  76. </div> -->
  77. <div
  78. class="main-body"
  79. :style="{ paddingLeft: isFixed && menuLength > 0 ? '52px' : 0 }"
  80. >
  81. <router-view />
  82. </div>
  83. <alarmBadge />
  84. </div>
  85. <div v-else class="login"><login-page @onLogin="login" /></div>
  86. </div>
  87. <div class="daping-app" v-else>
  88. <Home v-if="isLogined" @changeShowSisView="changeShowSisView" />
  89. <div v-else class="daping-login"><login-page @onLogin="login" /></div>
  90. </div>
  91. </template>
  92. <script>
  93. // 导入header.vue文件
  94. import alarmBadge from "@/components/alarm-badge/index.vue";
  95. import Home from "@/views/Home/index1.vue";
  96. import Menu from "@/views/layout/Menu.vue";
  97. import Header from "@/views/layout/Header.vue";
  98. import LoginPage from "./views/layout/login-page.vue";
  99. import { GetBoosterlist } from "@/api/factoryMonitor/index.js";
  100. import { getApiWeatherstation } from "@/api/monthlyPerformanceAnalysis";
  101. import { getAllStation } from "@/api/common.js";
  102. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  103. import { GetDeviceTableData } from "@/api/zhbj/index.js";
  104. import dayjs from "dayjs";
  105. import $ from "jquery";
  106. export default {
  107. components: {
  108. Menu,
  109. Header,
  110. LoginPage,
  111. alarmBadge,
  112. SvgIcon,
  113. Home,
  114. },
  115. data() {
  116. return {
  117. isShowMenu: false,
  118. // 当前子系统
  119. root: "",
  120. // isLogined: localStorage.getItem("loginState") || false,
  121. showSisView: true,
  122. memuCloseTimeout: null,
  123. menuData: [],
  124. hideMenus: "0",
  125. hideHeard: "0",
  126. style: {
  127. width: "1920",
  128. height: "1080",
  129. fontsize: "16px",
  130. transform: "scaleY(1) scaleX(1) translate(-50%, -50%)",
  131. },
  132. };
  133. },
  134. computed: {
  135. isLogined() {
  136. return this.$store.state.user?.loginState;
  137. },
  138. isFixed() {
  139. return this.$store.state?.isFixed;
  140. },
  141. menuLength() {
  142. return this.$store.state?.menuData?.length;
  143. },
  144. },
  145. created() {
  146. },
  147. mounted() {
  148. let that = this;
  149. that.setScale();
  150. /*窗口改变事件*/
  151. $(window).resize(() => {
  152. that.setScale();
  153. });
  154. },
  155. unmounted() {
  156. console.log("离开标记", this.socketLeaveFlag);
  157. },
  158. methods: {
  159. changeShowSisView(val) {
  160. this.showSisView = val;
  161. },
  162. getScale() {
  163. const w = window.innerWidth / this.style.width;
  164. const h = window.innerHeight / this.style.height;
  165. const d = window.devicePixelRatio;
  166. // let f = 16;
  167. // if (d > 1) {
  168. // f = 18;
  169. // }
  170. return { x: w, y: h };
  171. },
  172. setScale() {
  173. let scale = this.getScale();
  174. this.style.transform =
  175. "scaleY(" + scale.y + ") scaleX(" + scale.x + ") translate(-50%, -50%)";
  176. },
  177. // 切换子系统事件
  178. HeaderMenuClick(data) {
  179. this.root = data.id;
  180. },
  181. showMenu() {
  182. if (!this.isFixed) {
  183. this.isShowMenu = true;
  184. clearTimeout(this.memuCloseTimeout);
  185. this.memuCloseTimeout = null;
  186. }
  187. },
  188. hideMenu() {
  189. if (!this.isFixed) {
  190. this.memuCloseTimeout = setTimeout(() => {
  191. this.isShowMenu = false;
  192. }, 500);
  193. }
  194. },
  195. getBooster() {
  196. GetBoosterlist().then((res) => {
  197. if (res.data && res.data.code == 200) {
  198. this.$store.commit("changeBooster", res.data.data);
  199. }
  200. });
  201. },
  202. // 获取测风塔
  203. async getCftlist() {
  204. const { data: datas } = await getApiWeatherstation();
  205. this.$store.commit("changeCft", datas.data);
  206. },
  207. // 获取全部场站(不分风电光伏)
  208. async getAllStation() {
  209. const { data: datas } = await getAllStation();
  210. if (datas) {
  211. this.$store.commit("changeStationAll", datas);
  212. } else {
  213. this.$store.commit("changeStationAll", []);
  214. }
  215. },
  216. login() {
  217. this.$store.commit("user/SET_LOGINSTATE", true);
  218. },
  219. },
  220. watch: {
  221. "$store.state.menuData"(res) {
  222. this.menuData = res || [];
  223. },
  224. isLogined: {
  225. handler(res) {
  226. if (!res && this.socketObj) {
  227. // 离开标记
  228. this.socketLeaveFlag = true;
  229. // 关闭WebSocket
  230. this.socketObj.close();
  231. }
  232. if (res) {
  233. this.getBooster();
  234. this.getCftlist();
  235. this.getAllStation();
  236. }
  237. },
  238. immediate: true,
  239. },
  240. "$store.state.moudleName"(msg) {
  241. if (window.__MODE__.showModuleName && msg) {
  242. this.BASE.showMsg({
  243. type: this.$store.state.themeName === "dark" ? "success" : "warning",
  244. showClose: true,
  245. msg,
  246. });
  247. }
  248. },
  249. },
  250. };
  251. </script>
  252. <style lang="less">
  253. @import "~@/assets/styles/main.less";
  254. #screen {
  255. z-index: 100;
  256. transform-origin: 0 0;
  257. position: fixed;
  258. left: 50%;
  259. top: 50%;
  260. transition: 0.3s;
  261. }
  262. .alarmDeligo {
  263. z-index: 2003;
  264. position: relative;
  265. img {
  266. width: 43px;
  267. max-width: 43px;
  268. height: 43px;
  269. z-index: 3;
  270. }
  271. img:first-child {
  272. width: 53px;
  273. height: 57px;
  274. max-width: 53px;
  275. top: -7px;
  276. left: -5px;
  277. position: absolute;
  278. z-index: 3;
  279. }
  280. }
  281. .daping-app {
  282. width: 100vw;
  283. height: 100vh;
  284. overflow: hidden;
  285. .daping-login {
  286. width: 100%;
  287. height: 100%;
  288. background: url("~@/assets/login-bg.png") no-repeat;
  289. background-size: 100% 100%;
  290. position: relative;
  291. }
  292. }
  293. * {
  294. box-sizing: border-box;
  295. &::-webkit-scrollbar {
  296. width: 6px;
  297. height: 8px;
  298. }
  299. &::-webkit-scrollbar-track-piece {
  300. background-color: rgba(255, 255, 255, 0.05);
  301. border-radius: 4px;
  302. }
  303. &::-webkit-scrollbar-thumb {
  304. background-color: fade(@gray, 75);
  305. border-radius: 4px;
  306. outline: none;
  307. outline-offset: 0px;
  308. border: none;
  309. }
  310. }
  311. body {
  312. margin: 0;
  313. background: #fff;
  314. color: #fff;
  315. // background-image: url("./assets/background.png");
  316. background: rgb(4, 12, 11);
  317. background-size: cover;
  318. font-size: @fontsize;
  319. font-family: @defalut-font-family;
  320. }
  321. @menuWidth: 51.28px;
  322. @headerHeight: 59px;
  323. .main {
  324. width: 100%;
  325. height: 100%;
  326. display: flex;
  327. flex-wrap: wrap;
  328. overflow: hidden;
  329. .header-body {
  330. z-index: 2;
  331. // background: radial-gradient(closest-corner at 22% 40%, #2d5a47, #040d0a, #040d0a);
  332. // flex: 0 0 100%;
  333. width: 100%;
  334. display: flex;
  335. flex-direction: row;
  336. height: @headerHeight;
  337. border-bottom: 1px solid #142b29;
  338. .header-title {
  339. padding-left: 20px;
  340. margin: auto;
  341. color: #fff;
  342. }
  343. .header-menu-body {
  344. flex-grow: 1;
  345. }
  346. }
  347. .menu-body {
  348. position: absolute;
  349. display: flex;
  350. flex-direction: column;
  351. align-items: center;
  352. justify-content: space-between;
  353. flex: 0 0 @menuWidth;
  354. width: @menuWidth;
  355. height: calc(100% - @headerHeight);
  356. // height: calc(100vh - 59px);
  357. top: @headerHeight;
  358. // top: 59px;
  359. background-color: fade(#192a26, 75%);
  360. z-index: 2002;
  361. opacity: 0;
  362. transition: opacity 0.2s;
  363. transition-timing-function: ease-in;
  364. // transform: translate(-@menuWidth);
  365. &:hover,
  366. &.hover {
  367. opacity: 1;
  368. transition: opacity 0.2s;
  369. transition-timing-function: ease-out;
  370. transform: translate(0);
  371. }
  372. }
  373. .main-body {
  374. flex: 0 0 100%;
  375. max-width: 100%;
  376. height: calc(100% - @headerHeight);
  377. // padding: 1.481vh;
  378. // transition: flex 0.1s, margin-left 0.1s;
  379. // transition-timing-function: ease-in-out;
  380. // &.show-menu {
  381. // flex: 0 0 calc(100vw - @menuWidth);
  382. // margin-left: @menuWidth;
  383. // transition: flex 0.1s, margin-left 0.1s;
  384. // transition-timing-function: ease-in-out;
  385. // }
  386. }
  387. .el-table__body tr.current-row > td {
  388. color: #fff;
  389. background: rgba(66, 66, 66, 0.66) !important;
  390. }
  391. .el-transfer-panel {
  392. width: 450px !important;
  393. height: 73vh;
  394. background-color: #111d1c !important;
  395. border: 1px solid #999999 !important;
  396. .el-transfer-panel__body {
  397. height: 100% !important;
  398. .el-transfer-panel__list {
  399. height: 100% !important;
  400. }
  401. }
  402. }
  403. .el-transfer-panel .el-transfer-panel__header {
  404. background-color: #111d1c !important;
  405. color: #05bb4c !important;
  406. .el-checkbox .el-checkbox__label {
  407. color: #05bb4c !important;
  408. }
  409. }
  410. .el-button--primary.is-disabled,
  411. .el-button--primary.is-disabled:active,
  412. .el-button--primary.is-disabled:focus,
  413. .el-button--primary.is-disabled:hover {
  414. background-color: #05bb4c;
  415. border-color: #05bb4c;
  416. }
  417. }
  418. .login {
  419. width: 100%;
  420. height: 100%;
  421. background: url("~@/assets/login-bg.png") no-repeat;
  422. background-size: 100% 100%;
  423. position: relative;
  424. }
  425. .el-badge {
  426. &.active {
  427. .el-badge__content--danger {
  428. opacity: 0 !important;
  429. }
  430. }
  431. }
  432. .el-badge__content--danger {
  433. background: #ff4e00 !important;
  434. border: none !important;
  435. }
  436. .el-badge__content.is-fixed {
  437. top: 7px !important;
  438. right: 14px !important;
  439. z-index: 2003 !important;
  440. }
  441. .trans {
  442. animation: circleProgess 3s linear infinite;
  443. }
  444. @keyframes circleProgess {
  445. 0% {
  446. transform: rotateZ(360deg);
  447. }
  448. 25% {
  449. transform: rotateZ(270deg);
  450. }
  451. 50% {
  452. transform: rotateZ(180deg);
  453. }
  454. 75% {
  455. transform: rotateZ(90deg);
  456. }
  457. 100% {
  458. transform: rotateZ(0deg);
  459. }
  460. }
  461. .el-tree-node__content {
  462. height: 40px !important;
  463. }
  464. .el-tree-node__label {
  465. font-size: 14px !important;
  466. }
  467. .el-pagination.is-background .el-pager li:not(.disabled).active {
  468. background-color: #05bb4c !important;
  469. }
  470. .el-table__body tr.hover-row > td.el-table__cell {
  471. background-color: rgba(2, 2, 2) !important;
  472. }
  473. #appBody.light .el-table th.el-table__cell > .cell {
  474. height: 8.2vh !important;
  475. }
  476. .power-benchmarking-page
  477. .top
  478. .top-left
  479. .table.el-table
  480. thead
  481. tr:last-child
  482. th
  483. .cell {
  484. height: 116px !important;
  485. }
  486. * {
  487. -webkit-touch-callout: none; /*系统默认菜单被禁用*/
  488. -webkit-user-select: none; /*webkit浏览器*/
  489. -khtml-user-select: none; /*早期浏览器*/
  490. -moz-user-select: none; /*火狐*/
  491. -ms-user-select: none; /*IE10*/
  492. user-select: none;
  493. }
  494. input {
  495. -webkit-user-select: auto; /*webkit浏览器*/
  496. }
  497. textarea {
  498. -webkit-user-select: auto; /*webkit浏览器*/
  499. }
  500. .gfSelect .el-input__suffix {
  501. display: none !important;
  502. }
  503. body .gfSelect .el-input__inner {
  504. background: rgba(83, 98, 104, 0);
  505. color: #ffffff;
  506. font-size: 16px;
  507. }
  508. .main-body {
  509. .query {
  510. display: flex;
  511. // justify-content: space-between;
  512. &.left {
  513. justify-content: flex-start;
  514. }
  515. .query-items {
  516. flex: 0 0 auto;
  517. display: flex;
  518. .query-item {
  519. flex: 0 0 auto;
  520. display: flex;
  521. margin: 0 1.4815vh;
  522. .el-input {
  523. &.placeholder-left {
  524. input {
  525. &::placeholder {
  526. text-align: left;
  527. }
  528. }
  529. }
  530. }
  531. .placeholder-left {
  532. .el-input {
  533. input {
  534. height: 33px !important;
  535. &::placeholder {
  536. text-align: left;
  537. }
  538. }
  539. }
  540. }
  541. .lable {
  542. flex: 0 0 auto;
  543. margin-right: 1.4815vh;
  544. line-height: 33px;
  545. color: @gray-l;
  546. }
  547. .search-input {
  548. position: relative;
  549. // input {
  550. // box-sizing: border-box;
  551. // flex: 0 0 200px;
  552. // border: 0px solid @darkgray;
  553. // color: @white;
  554. // outline: unset;
  555. // border-radius: 0%;
  556. // padding-right: 40px;
  557. // background: fade(#536268, 20);
  558. // height: 33px;
  559. // line-height: 33px;
  560. // &::placeholder {
  561. // font-size: 12px;
  562. // text-align: right;
  563. // color: @darkgray;
  564. // }
  565. // }
  566. // .unit {
  567. // position: absolute;
  568. // right: 12px;
  569. // top: 6px;
  570. // line-height: 33px;
  571. // margin: auto;
  572. // }
  573. }
  574. }
  575. }
  576. .query-actions {
  577. flex: 0 0 auto;
  578. margin-left: 50px;
  579. display: flex;
  580. justify-content: flex-start;
  581. align-items: center;
  582. .btn {
  583. cursor: pointer;
  584. }
  585. }
  586. }
  587. input {
  588. box-sizing: border-box;
  589. flex: 0 0 200px;
  590. border: 0px solid @darkgray;
  591. color: @white;
  592. outline: unset;
  593. border-radius: 0%;
  594. padding-right: 40px;
  595. background: fade(#536268, 20);
  596. height: 33px;
  597. line-height: 33px;
  598. &::placeholder {
  599. font-size: 12px;
  600. text-align: right;
  601. color: @darkgray;
  602. }
  603. }
  604. input[type="checkbox"] {
  605. position: relative;
  606. display: inline-block;
  607. appearance: none;
  608. width: 14px;
  609. height: 14px;
  610. outline: none;
  611. border: 1px solid @gray;
  612. background-color: #000;
  613. border-radius: 20%;
  614. margin: 0;
  615. padding: 0;
  616. &:checked {
  617. border-color: @green;
  618. background: @green;
  619. }
  620. &::after {
  621. display: inline-block;
  622. content: " ";
  623. position: absolute;
  624. left: 30%;
  625. top: 5%;
  626. width: 3px;
  627. height: 7px;
  628. border-color: #fff;
  629. border-style: solid;
  630. border-width: 0px 2px 2px 0px;
  631. transform: rotate(45deg);
  632. opacity: 0;
  633. }
  634. &:checked::after {
  635. content: "";
  636. opacity: 1;
  637. transition: opacity 0.3s ease-out;
  638. }
  639. }
  640. }
  641. </style>