App.vue 15 KB

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