App.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <div>
  3. <div
  4. :class="{
  5. 'grid-container': isShowTopNavigation,
  6. 'grid-container-hide-column1': !isShowMenu,
  7. }"
  8. :style="{
  9. gridTemplateColumns: width + 'px auto',
  10. }"
  11. >
  12. <div v-if="isShowMenu" class="grid-item-row12-column1">
  13. <div>
  14. <div
  15. id="resizable"
  16. ref="resizable"
  17. class="resizable-container"
  18. :style="{ width: width + 'px' }"
  19. >
  20. <div>
  21. <keep-alive>
  22. <MenuWidget :width="width" />
  23. <div class="resize-handle" @mousedown="handleMouseDown" />
  24. </keep-alive>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div v-if="isShowTopNavigation" class="grid-item-row1-column2">
  30. <div>
  31. <!-- top navigation -->
  32. <keep-alive>
  33. <TopNavigation @menu-visible-changed="clickIsShowMenu" />
  34. </keep-alive>
  35. </div>
  36. </div>
  37. <div :class="{ 'grid-item-row2-column2': isShowTopNavigation }">
  38. <div
  39. id="grid-item-center"
  40. :class="{ 'grid-center-container': isShowTopNavigation }"
  41. />
  42. <div
  43. :class="{
  44. 'center-container-single': !isShowTopNavigation,
  45. 'center-container': isShowTopNavigation,
  46. }"
  47. >
  48. <a-config-provider :locale="locale">
  49. <router-view />
  50. </a-config-provider>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import MenuWidget from './client/MenuWidget.vue';
  58. import TopNavigation from './client/TopNavigation.vue';
  59. import zhCN from 'ant-design-vue/es/locale/zh_CN';
  60. import dayjs from 'dayjs';
  61. import 'dayjs/locale/zh-cn';
  62. dayjs.locale('zh-cn');
  63. export default {
  64. components: {
  65. MenuWidget,
  66. TopNavigation,
  67. },
  68. data: function () {
  69. return {
  70. // 是否显示菜单
  71. isShowMenu: false,
  72. // 是否显示上导航栏
  73. isShowTopNavigation: false,
  74. locale: zhCN,
  75. // 菜单拉伸值
  76. isResizing: false,
  77. startX: 0,
  78. startWidth: 0,
  79. width: 230,
  80. };
  81. },
  82. watch: {
  83. '$route.path': function (value) {
  84. this.computerComponentVisible();
  85. },
  86. },
  87. mounted: function () {
  88. var _self = this;
  89. var languageSelected = localStorage.getItem('#languageSelected');
  90. if (languageSelected == null || languageSelected == '') {
  91. this.$i18n.locale = 'zh-CN';
  92. } else {
  93. this.$i18n.locale = languageSelected;
  94. }
  95. // 恢复菜单栏宽度
  96. const menuWidth = localStorage.getItem('menuWidth');
  97. if (menuWidth !== null && menuWidth !== undefined) {
  98. this.width = Number(menuWidth);
  99. } else {
  100. this.width = 230;
  101. localStorage.setItem('menuWidth', 230);
  102. }
  103. this.computerComponentVisible();
  104. },
  105. methods: {
  106. throttle(func, limit) {
  107. let inThrottle;
  108. return function () {
  109. const args = arguments;
  110. const context = this;
  111. if (!inThrottle) {
  112. func.apply(context, args);
  113. inThrottle = true;
  114. setTimeout(() => (inThrottle = false), limit);
  115. }
  116. };
  117. },
  118. // 鼠标按下时开始监听
  119. handleMouseDown(e) {
  120. this.isResizing = true;
  121. this.startX = e.clientX;
  122. this.startWidth = this.width;
  123. const el = document.querySelector('.grid-container');
  124. el.style.userSelect = 'none';
  125. // 绑定鼠标移动和鼠标抬起事件到document
  126. document.documentElement.addEventListener(
  127. 'mousemove',
  128. this.throttle(this.handleMouseMove, 20),
  129. );
  130. document.documentElement.addEventListener('mouseup', this.handleMouseUp);
  131. },
  132. // 鼠标移动时开始计算
  133. handleMouseMove(e) {
  134. const _self = this;
  135. if (!_self.isResizing) return;
  136. e.preventDefault();
  137. const deltaX = e.clientX - _self.startX;
  138. // 最小宽度230
  139. if (_self.startWidth + deltaX >= 230) {
  140. _self.width = _self.startWidth + deltaX;
  141. }
  142. },
  143. // 鼠标松开时清除
  144. handleMouseUp(e) {
  145. const _self = this;
  146. this.isResizing = false;
  147. const el = document.querySelector('.grid-container');
  148. el.style.userSelect = 'auto';
  149. setTimeout(() => {
  150. localStorage.setItem('menuWidth', _self.width);
  151. }, 1000);
  152. document.documentElement.removeEventListener(
  153. 'mousemove',
  154. this.handleMouseMove,
  155. );
  156. document.documentElement.removeEventListener(
  157. 'mouseup',
  158. this.handleMouseUp,
  159. );
  160. },
  161. /**
  162. * 点击之后存储isShowMenu
  163. */
  164. clickIsShowMenu: function () {
  165. var _self = this;
  166. this.isShowMenu = !this.isShowMenu;
  167. if (this.isShowMenu) {
  168. const menuWidth = localStorage.getItem('menuWidth');
  169. this.width = Number(menuWidth);
  170. } else {
  171. this.width = 0;
  172. }
  173. // localStorage.setItem('menuWidth', this.width);
  174. // localStorage.setItem('#IsShowMenu', this.isShowMenu);
  175. },
  176. /**
  177. * 计算组件的显示隐藏
  178. */
  179. computerComponentVisible: function () {
  180. let path = this.$route.path;
  181. let count = 0;
  182. if (path != null) {
  183. for (let index = 0; index < path.length; index++) {
  184. if (path[index] == '/') {
  185. count++;
  186. }
  187. }
  188. if (path.indexOf('register/') >= 0) {
  189. count = 1;
  190. }
  191. if (path.indexOf('dictionary/') >= 0) {
  192. count = 1;
  193. }
  194. if (path.indexOf('propassapp/') >= 0) {
  195. count = 1;
  196. }
  197. if (path.indexOf('single/') >= 0) {
  198. count = 1;
  199. }
  200. if (path.indexOf('lowcode-page/') >= 0) {
  201. count = 1;
  202. }
  203. if (path.indexOf('/generate-document/') >= 0) {
  204. count = 1;
  205. }
  206. if (path.indexOf('/excel-import/') >= 0) {
  207. count = 1;
  208. }
  209. if (path.indexOf('/CheckVouchImport/') >= 0) {
  210. count = 1;
  211. }
  212. if (path.indexOf('/repertoryCheckWork/') >= 0) {
  213. count = 1;
  214. }
  215. if (path.indexOf('/repertoryCheck/') >= 0) {
  216. count = 1;
  217. }
  218. if (path.indexOf('/CheckVouchsImport/') >= 0) {
  219. count = 1;
  220. }
  221. if (path.indexOf('/CheckVouchProjectUserImport/') >= 0) {
  222. count = 1;
  223. }
  224. if (path.indexOf('/CheckVouchProjectImport/') >= 0) {
  225. count = 1;
  226. }
  227. if (path.indexOf('/CheckVouchWorkImport/') >= 0) {
  228. count = 1;
  229. }
  230. if (path.indexOf('/CheckVouchWorksImport/') >= 0) {
  231. count = 1;
  232. }
  233. if (window.top !== window.self) {
  234. count = 1;
  235. }
  236. }
  237. //if (value == "/client-init" || value == "/login") {
  238. if (count == 1) {
  239. this.isShowMenu = false;
  240. this.isShowTopNavigation = false;
  241. } else {
  242. // var isShowMenu = localStorage.getItem('#IsShowMenu');
  243. // if (isShowMenu == 'true') {
  244. // this.isShowMenu = true;
  245. // } else {
  246. // this.isShowMenu = false;
  247. // }
  248. this.isShowMenu = true;
  249. this.isShowTopNavigation = true;
  250. }
  251. },
  252. },
  253. };
  254. </script>
  255. <style scoped>
  256. .grid-container {
  257. display: grid;
  258. grid-template-columns: 230px auto;
  259. grid-template-rows: 54px 1fr;
  260. gap: 0px;
  261. justify-items: stretch;
  262. align-items: stretch;
  263. height: calc(100vh);
  264. overflow: auto;
  265. }
  266. .grid-container-hide-column1 {
  267. grid-template-columns: 0px auto;
  268. /*grid-template-rows: 0px 1fr;*/
  269. }
  270. .grid-item-row12-column1 {
  271. grid-row-start: 1;
  272. grid-row-end: 3;
  273. grid-column-start: 1;
  274. grid-column-end: 2;
  275. }
  276. .grid-item-row1-column2 {
  277. grid-row-start: 1;
  278. grid-row-end: 2;
  279. grid-column-start: 2;
  280. grid-column-end: 3;
  281. }
  282. .grid-item-row2-column2 {
  283. grid-row-start: 2;
  284. grid-row-end: 3;
  285. grid-column-start: 2;
  286. grid-column-end: 3;
  287. overflow: auto;
  288. }
  289. .grid-center-container {
  290. padding: 10px 20px 0;
  291. }
  292. .center-container-single {
  293. /* padding: 0px 20px 0; */
  294. padding: 0px;
  295. }
  296. .center-container {
  297. padding: 0px 20px 0;
  298. }
  299. </style>
  300. <style>
  301. /** 修复Bootstrap样式的BUG,input-group form-control 控件 会显示在 日期控件的前面 */
  302. .input-group .form-control {
  303. /* z-index: 0; */
  304. /*checked by DengXin,修复input-group form-control 控件 会显示在 日期控件的前面的BUG*/
  305. position: static;
  306. }
  307. </style>
  308. <!-- 已确定的CSS样式 -->
  309. <style>
  310. .site_title {
  311. text-overflow: ellipsis;
  312. overflow: hidden;
  313. font-weight: 400;
  314. font-size: 22px;
  315. width: 100%;
  316. color: #ecf0f1 !important;
  317. margin-left: 0 !important;
  318. line-height: 59px;
  319. display: block;
  320. height: 55px;
  321. margin: 0;
  322. padding-left: 10px;
  323. }
  324. .site_title:hover,
  325. .site_title:focus {
  326. text-decoration: none;
  327. }
  328. .clearfix {
  329. clear: both;
  330. }
  331. </style>
  332. <!-- 已确定的CSS 样式 -->
  333. <style>
  334. .container {
  335. width: 100% !important;
  336. padding: 0 !important;
  337. }
  338. .left_col {
  339. background: #2a3f54;
  340. }
  341. .menu_section {
  342. margin-bottom: 35px;
  343. }
  344. .menu_section h3 {
  345. padding-left: 23px;
  346. color: #fff;
  347. text-transform: uppercase;
  348. letter-spacing: 0.5px;
  349. font-weight: bold;
  350. font-size: 11px;
  351. margin-bottom: 0;
  352. margin-top: 0;
  353. text-shadow: 1px 1px #000;
  354. }
  355. .menu_section > ul {
  356. margin-top: 10px;
  357. }
  358. </style>
  359. <style>
  360. .nav-md .container.body .col-md-3.left_col {
  361. width: 230px;
  362. padding: 0;
  363. position: absolute;
  364. display: -ms-flexbox;
  365. display: flex;
  366. }
  367. .nav-md .container.body .col-md-3.left_col.menu_fixed {
  368. height: 100%;
  369. position: fixed;
  370. }
  371. .nav-md .container.body .right_col {
  372. padding: 10px 20px 0;
  373. }
  374. /*@media (max-width: 991px) {
  375. .nav-md .container.body .right_col {
  376. width: 100%;
  377. margin: 0;
  378. }
  379. .nav-md .container.body .col-md-3.left_col {
  380. display: none;
  381. }
  382. .nav-md .container.body .right_col {
  383. width: 100%;
  384. padding-right: 0;
  385. }
  386. .right_col {
  387. padding: 10px !important;
  388. }
  389. }*/
  390. </style>
  391. <style>
  392. .profile_pic {
  393. width: 35%;
  394. float: left;
  395. }
  396. .img-circle.profile_img {
  397. width: 70%;
  398. background: #fff;
  399. margin-left: 15%;
  400. z-index: 1000;
  401. position: inherit;
  402. border: 1px solid rgba(52, 73, 94, 0.44);
  403. padding: 0px;
  404. }
  405. .profile_info {
  406. margin-top: 5px;
  407. width: 65%;
  408. float: left;
  409. }
  410. .profile_info span {
  411. font-size: 13px;
  412. line-height: 30px;
  413. color: #bab8b8;
  414. }
  415. .profile_info h2 {
  416. font-size: 14px;
  417. color: #ecf0f1;
  418. margin: 0;
  419. font-weight: 300;
  420. }
  421. .profile.img_2 {
  422. text-align: center;
  423. }
  424. .profile.img_2 .profile_pic {
  425. width: 100%;
  426. }
  427. .profile.img_2 .profile_pic .img-circle.profile_img {
  428. width: 50%;
  429. margin: 10px 0 0;
  430. }
  431. .profile.img_2 .profile_info {
  432. padding: 15px 10px 0;
  433. width: 100%;
  434. margin-bottom: 10px;
  435. float: left;
  436. }
  437. .main_menu span.fa {
  438. float: right;
  439. text-align: center;
  440. margin-top: 5px;
  441. font-size: 10px;
  442. min-width: inherit;
  443. color: #c4cfda;
  444. }
  445. .active a span.fa {
  446. text-align: right !important;
  447. margin-right: 4px;
  448. }
  449. /* .navbar-nav > li > a {
  450. color: #fff !important;
  451. } */
  452. body .container.body .right_col {
  453. background: #f7f7f7;
  454. }
  455. .nav_title {
  456. width: 230px;
  457. float: left;
  458. background: #2a3f54;
  459. border-radius: 0;
  460. height: 57px;
  461. }
  462. @media (max-width: 1200px) {
  463. .x_title h2 {
  464. width: 62%;
  465. font-size: 17px;
  466. }
  467. .tile,
  468. .graph {
  469. zoom: 85%;
  470. height: inherit;
  471. }
  472. }
  473. @media (max-width: 1270px) and (min-width: 192px) {
  474. .x_title h2 small {
  475. display: none;
  476. }
  477. }
  478. .left_col .mCSB_scrollTools {
  479. width: 6px;
  480. }
  481. .left_col .mCSB_dragger {
  482. max-height: 400px !important;
  483. }
  484. </style>
  485. <style>
  486. /** 修复分页的样式 By YangZhiJie 2021-07-06 11:23 */
  487. nav ul.pagination {
  488. margin: 0 !important;
  489. }
  490. /** 修复CURD界面输入框右上角和右下角的圆弧倒角覆盖的BUG By YangZhiJie 2021-12-09 20:14 */
  491. .input-group .form-control:first-child {
  492. border-radius: 4px;
  493. }
  494. </style>
  495. <style scoped>
  496. .resizable-container {
  497. position: relative;
  498. min-width: 230px; /* 设置最小宽度 */
  499. padding: 10px;
  500. }
  501. .resize-handle {
  502. position: absolute;
  503. right: 0;
  504. top: 0;
  505. bottom: 0;
  506. width: 6px;
  507. height: calc(100vh);
  508. background-color: #ffffff;
  509. }
  510. .resize-handle:hover {
  511. cursor: ew-resize;
  512. }
  513. </style>