App.vue 14 KB

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