App.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <router-view v-slot="{ Component }">
  3. <keep-alive>
  4. <component :is="Component"/>
  5. </keep-alive>
  6. </router-view>
  7. </template>
  8. <script>
  9. import {defineComponent} from 'vue'
  10. import locale from 'element-plus/lib/locale/lang/zh-cn'
  11. import {useStore} from 'vuex'
  12. import store from "@/store";
  13. import {setCallback} from "@/utils/websocket";
  14. import {ElMessageBox, ElNotification} from "element-plus";
  15. import sleep from "@/utils/sleep";
  16. export default defineComponent({
  17. name: 'App',
  18. setup() {
  19. const store = useStore()
  20. let windowSize = getWindowSize()
  21. store.commit('app/setWindowSize', windowSize)
  22. store.commit('app/setJdt', {
  23. title: '数据上传',
  24. isOpen: false,
  25. abnormalClosing: false,
  26. })
  27. window.onresize = () => {
  28. store.commit('app/setWindowSize', getWindowSize())
  29. }
  30. onMounted(() => {
  31. setCallback('refreshToken', (data) => {
  32. store.commit('user/tokenChange', data.token)
  33. })
  34. setCallback('sidSingle', async () => {
  35. await store.dispatch('user/loginOut')
  36. await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
  37. type: 'warning',
  38. })
  39. })
  40. setCallback('systemNotification', async (data) => {
  41. if (data.count) {
  42. let newCount = store.state.app.unreadMessageCount + data.count
  43. store.commit('app/setUnreadMessageCount', newCount)
  44. }
  45. if (data.refreshDelay) {
  46. sleep(data.refreshDelay).then(() => {
  47. location.reload();
  48. })
  49. }
  50. ElNotification({
  51. title: typeof data.title === 'undefined' ? '新消息' : data.title,
  52. message: data.message,
  53. dangerouslyUseHTMLString: true,
  54. type: typeof data.type === 'undefined' ? 'warning' : data.type,
  55. duration: 0,
  56. })
  57. })
  58. })
  59. return {
  60. locale,
  61. }
  62. },
  63. })
  64. function getWindowSize() {
  65. const w = window.innerWidth
  66. const h = window.innerHeight - 96
  67. return {w, h}
  68. }
  69. </script>
  70. <style lang="scss">
  71. ::-webkit-scrollbar {
  72. width: 6px;
  73. &:hover {
  74. cursor: pointer;
  75. }
  76. }
  77. ::-webkit-scrollbar-thumb {
  78. border-radius: 4px;
  79. background: rgba(144, 147, 153, .3);
  80. &:hover {
  81. cursor: pointer;
  82. }
  83. }
  84. ::-webkit-scrollbar-button {
  85. width: 0;
  86. height: 0;
  87. display: none;
  88. }
  89. html,
  90. body,
  91. #app {
  92. height: 100%;
  93. margin: 0;
  94. padding: 0;
  95. background-color: #f5f5f5;
  96. }
  97. ul, li {
  98. list-style: none;
  99. margin: 0;
  100. padding: 0;
  101. }
  102. .小手指 {
  103. cursor: pointer;
  104. }
  105. .xc_box {
  106. box-shadow: 0 4px 8px rgb(0 0 0 / 20%), 0 6px 20px rgb(0 0 0 / 19%);
  107. }
  108. #app {
  109. font-family: Avenir, Helvetica, Arial, sans-serif;
  110. -webkit-font-smoothing: antialiased;
  111. -moz-osx-font-smoothing: grayscale;
  112. color: #2c3e50;
  113. width: 100%;
  114. height: 100vh;
  115. font-size: 13px;
  116. }
  117. .ellipsis-text {
  118. text-overflow: ellipsis;
  119. white-space: nowrap;
  120. overflow: hidden;
  121. }
  122. .sex-icon {
  123. width: 15px;
  124. height: 15px;
  125. }
  126. .el-table .cell {
  127. padding-left: 4px;
  128. padding-right: 4px;
  129. }
  130. .el-header {
  131. padding: 0 14px;
  132. height: 36px;
  133. display: flex;
  134. align-items: center;
  135. justify-content: flex-start;
  136. }
  137. .el-header > * {
  138. flex-wrap: nowrap;
  139. flex-shrink: 0;
  140. flex-grow: 0;
  141. }
  142. .el-main {
  143. padding: 0 14px;
  144. overflow: hidden;
  145. }
  146. .el-table__body tr.current-row > td,
  147. .el-table--striped .el-table__body tr.el-table__row--striped.current-row td {
  148. background-color: #a7d3ff !important;
  149. }
  150. .el-input.is-disabled .el-input__inner {
  151. color: blue;
  152. }
  153. .icon-shangxiatuodong {
  154. cursor: move;
  155. font-size: 12px;
  156. }
  157. .shangxiatuodong {
  158. cursor: move;
  159. }
  160. .el-checkbox__inner {
  161. width: 16px;
  162. height: 16px;
  163. border: 1px solid #000;
  164. border-radius: 4px;
  165. }
  166. .axios-loading2 {
  167. animation: axiosloading 1s;
  168. background-image: url('/src/assets/images/loading.gif');
  169. -webkit-background-image: url('/src/assets/images/loading.gif');
  170. background-repeat: no-repeat;
  171. background-position: center;
  172. }
  173. .el-dialog__header {
  174. border-bottom: 1px solid #ebeef5;
  175. background-color: #f8f8f8;
  176. border-radius: 4px;
  177. }
  178. .el-dialog {
  179. border-radius: 4px;
  180. }
  181. @keyframes axiosloading {
  182. 0% {
  183. opacity: 0;
  184. }
  185. 99% {
  186. opacity: 0;
  187. }
  188. 100% {
  189. opacity: 1;
  190. }
  191. }
  192. .component-box-wrapper__fullscreen {
  193. position: fixed;
  194. top: 0;
  195. left: 0;
  196. bottom: 0;
  197. right: 0;
  198. background: white;
  199. padding: 20px;
  200. z-index: 10000;
  201. height: 100%;
  202. overflow: auto;
  203. }
  204. .component-box-wrapper__half-transparent {
  205. position: fixed;
  206. top: 0;
  207. left: 0;
  208. bottom: 0;
  209. right: 0;
  210. background: rgba(0, 0, 0, 0.7);
  211. padding: 20px;
  212. z-index: 1000;
  213. height: 100%;
  214. overflow: auto;
  215. display: flex;
  216. align-items: flex-start;
  217. justify-content: center;
  218. }
  219. .finger:hover {
  220. cursor: pointer;
  221. }
  222. .component-content-box__dialog-like {
  223. width: 60%;
  224. padding: 20px;
  225. background: white;
  226. margin-top: 15vh;
  227. }
  228. .component-header-box {
  229. position: relative;
  230. width: 100%;
  231. display: flex;
  232. padding: 0 0 12px 0;
  233. }
  234. .component-header__title {
  235. width: 70%;
  236. font-size: 16px;
  237. display: flex;
  238. align-items: center;
  239. }
  240. .component-header__close-button {
  241. width: 30%;
  242. text-align: right;
  243. }
  244. table th.star div::before {
  245. content: '*';
  246. color: #f56c6cff;
  247. margin-right: 4px;
  248. }
  249. .bi_tian .el-form-item__label::before {
  250. content: '*';
  251. color: #f56c6cff;
  252. margin-right: 4px;
  253. }
  254. .el-select-dropdown__item.selected {
  255. background-color: #71abed66;
  256. }
  257. .el-select-dropdown__item.hover,
  258. .el-select-dropdown__item:hover {
  259. background-color: #fac44d;
  260. color: white;
  261. }
  262. .el-message {
  263. border: none;
  264. border-radius: 2px;
  265. background-color: white;
  266. padding: 10px 16px;
  267. box-shadow: 1px 3px 8px 4px rgb(0 0 0 / 10%);
  268. .el-message__content {
  269. color: #333333;
  270. }
  271. }
  272. .el-table .el_table__current {
  273. background-color: #a7d3ff;
  274. }
  275. .remove_hover tbody tr:hover > td {
  276. background-color: transparent !important;
  277. }
  278. </style>