App.vue 15 KB

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