App.vue 13 KB

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