华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

539 lines
9.7 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. <theme-picker />
  5. </div>
  6. </template>
  7. <script>
  8. import ThemePicker from "@/components/ThemePicker"
  9. import { checkStatus } from "@/api/system/user"
  10. export default {
  11. name: "App",
  12. components: { ThemePicker },
  13. data() {
  14. return {
  15. statusCheckTimer: null
  16. }
  17. },
  18. computed: {
  19. // // 监听登录状态
  20. // isLoggedIn() {
  21. // return this.$store.getters.token && this.$store.getters.token !== ''
  22. // }
  23. },
  24. watch: {
  25. // // 监听登录状态变化
  26. // isLoggedIn(newVal, oldVal) {
  27. // console.log('登录状态变化:', newVal, oldVal)
  28. // if (newVal) {
  29. // // 用户已登录,启动轮询
  30. // this.startStatusCheck()
  31. // } else {
  32. // // 用户已退出,停止轮询
  33. // this.stopStatusCheck()
  34. // }
  35. // },
  36. // 监听token
  37. '$store.getters.token': {
  38. handler(newToken, oldToken) {
  39. console.log('token变化:', newToken, oldToken)
  40. if (newToken) {
  41. // 有token,启动轮询
  42. this.startStatusCheck()
  43. } else {
  44. // token为空,停止轮询
  45. this.stopStatusCheck()
  46. }
  47. },
  48. immediate: true // 立即执行一次,这样在页面刷新时,如果已经有token,就会启动轮询
  49. }
  50. },
  51. mounted() {
  52. // // 页面加载时检查当前登录状态
  53. // if (this.isLoggedIn) {
  54. // this.startStatusCheck()
  55. // }
  56. },
  57. beforeDestroy() {
  58. this.stopStatusCheck()
  59. },
  60. methods: {
  61. startStatusCheck() {
  62. // 先停止可能存在的定时器
  63. this.stopStatusCheck()
  64. console.log('启动状态检查轮询')
  65. // 立即执行一次检查
  66. this.checkStatusImmediate()
  67. // 设置定时器每秒检查一次
  68. this.statusCheckTimer = setInterval(() => {
  69. this.checkStatus()
  70. }, 10000)
  71. },
  72. stopStatusCheck() {
  73. if (this.statusCheckTimer) {
  74. console.log('停止状态检查轮询')
  75. clearInterval(this.statusCheckTimer)
  76. this.statusCheckTimer = null
  77. }
  78. },
  79. // 立即检查(不等待)
  80. async checkStatusImmediate() {
  81. await this.checkStatus()
  82. },
  83. // 定时检查
  84. async checkStatus() {
  85. // 再次确认登录状态
  86. // if (!this.isLoggedIn) {
  87. // this.stopStatusCheck()
  88. // return
  89. // }
  90. try {
  91. console.log('开始checkStatus')
  92. checkStatus().then(response => {
  93. console.log(JSON.stringify(response))
  94. }).catch(err => {
  95. console.log(JSON.stringify(err))
  96. // if (err === '无效的会话,或者会话已过期,请重新登录。') {
  97. if (err === this.$t('system.timeOutTip')) {
  98. this.stopStatusCheck()
  99. }
  100. })
  101. } catch (error) {
  102. }
  103. },
  104. }
  105. }
  106. </script>
  107. <style rel="stylesheet/scss" lang="scss">
  108. #app .theme-picker {
  109. display: none;
  110. }
  111. .el-dialog__header {
  112. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  113. }
  114. .el-dialog__footer {
  115. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  116. }
  117. .el-dialog__body {
  118. padding: 10px 10px;
  119. }
  120. /*隐藏自动填充密码 */
  121. .sbzdtcma {
  122. width: 0px;
  123. height: 0px;
  124. overflow: hidden;
  125. }
  126. /*搜索区域样式 */
  127. .search-area {
  128. input {
  129. width: 150px;
  130. }
  131. }
  132. .el-tabs--border-card>.el-tabs__content {
  133. padding: 0px 0px;
  134. }
  135. /*详情 */
  136. .detail-container {
  137. background: #ffffff !important;
  138. .detail-top {
  139. background: #fff;
  140. padding: 10px 20px;
  141. margin-bottom: 10px;
  142. display: flex;
  143. flex-direction: row;
  144. align-items: center;
  145. justify-content: space-between;
  146. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  147. .left-top {
  148. flex-shrink: 0;
  149. display: flex;
  150. flex-direction: row;
  151. align-items: center;
  152. img {
  153. height: 16px;
  154. margin-right: 10px;
  155. cursor: pointer;
  156. }
  157. .right-top {}
  158. }
  159. }
  160. .detail-title {
  161. line-height: 60px;
  162. font-size: 16px;
  163. font-weight: bold;
  164. width: 100%;
  165. margin-top: 10px;
  166. display: flex;
  167. justify-content: center;
  168. }
  169. .detail-content {
  170. padding: 10px 10px;
  171. display: flex;
  172. justify-content: space-between;
  173. .content-right {
  174. width: 33%;
  175. margin-left: 2%;
  176. padding: 0px 10px;
  177. border-left: 1px solid #d0d0d0;
  178. }
  179. .content-left {
  180. width: 65%;
  181. }
  182. .content {
  183. width: 100%;
  184. }
  185. .content-title {
  186. width: 100%;
  187. background: #f9f9ff;
  188. font-size: 0.96rem;
  189. font-weight: bold;
  190. padding-left: 10px;
  191. height: 40px;
  192. line-height: 40px;
  193. display: flex;
  194. justify-content: flex-start;
  195. text-align: left;
  196. .line {
  197. width: 2px;
  198. float: left;
  199. height: 16px;
  200. margin-top: 12px;
  201. margin-right: 8px;
  202. border-left: #3178ff 3px solid;
  203. }
  204. .subtitle {
  205. height: 40px;
  206. line-height: 40px;
  207. color: #464647 !important;
  208. }
  209. }
  210. .pal {
  211. display: flex;
  212. justify-content: space-between;
  213. margin: 10px 0px;
  214. .left {
  215. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  216. margin: 5px 5px 5px 0px;
  217. width: 50%;
  218. padding: 10px 10px;
  219. border-radius: 5px 5px;
  220. .left-title {
  221. height: 40px;
  222. line-height: 40px;
  223. }
  224. }
  225. .right {
  226. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  227. margin: 5px 0px 5px 5px;
  228. width: 50%;
  229. padding: 10px 10px;
  230. border-radius: 5px 5px;
  231. .right-title {
  232. height: 40px;
  233. line-height: 40px;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. /*稽查轨迹list */
  240. .jcgjList {
  241. padding: 20px 0px;
  242. .jcgjList-keywords {
  243. width: 100%;
  244. }
  245. .jcgjList-jcgjlx {
  246. height: 50px;
  247. margin: 10px 0px;
  248. }
  249. .jcgjList-content {
  250. width: 100%;
  251. }
  252. .jcgjList-title {
  253. display: flex;
  254. justify-content: space-between;
  255. margin-top: -15px;
  256. .jcgjList-jcmc {
  257. font-size: 16px;
  258. font-weight: bold;
  259. }
  260. }
  261. .jcglList-jcnr {
  262. line-height: 25x;
  263. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  264. padding: 10px 10px;
  265. margin-top: 10px;
  266. }
  267. }
  268. .no-break {
  269. page-break-inside: avoid;
  270. }
  271. /* 表格行不被分割 */
  272. tr,
  273. td,
  274. th {
  275. page-break-inside: avoid;
  276. }
  277. .page-break {
  278. page-break-before: always;
  279. }
  280. .datatable {
  281. border-collapse: collapse;
  282. width: 100%;
  283. font-size: 13px;
  284. }
  285. .datatable thead {
  286. border-left: 1px solid #f5f5f5;
  287. page-break-inside: avoid;
  288. }
  289. .datatable th {
  290. padding: 5px 5px 4px 5px;
  291. max-width: 200px;
  292. line-height: 35px;
  293. text-align: center;
  294. color: #606266;
  295. background: #f8f8f9;
  296. border: 1px solid #f5f5f5;
  297. }
  298. .datatable th.operate {
  299. padding: 5px 5px 4px 5px;
  300. width: 100px;
  301. line-height: 35px;
  302. background: #f8f8f9;
  303. border: 1px solid #f5f5f5;
  304. text-align: center;
  305. }
  306. .datatable td {
  307. border: solid 1px #f5f5f5;
  308. padding: 3px 5px 4px 5px;
  309. max-width: 100px;
  310. color: #606266;
  311. line-height: 35px;
  312. text-align: center;
  313. }
  314. .el-dialog__body {
  315. padding: 10px 20px !important;
  316. }
  317. /** 基础信息设置tab **/
  318. .edit-container {
  319. .edit-top {
  320. background: #fff;
  321. padding: 10px 20px;
  322. margin-bottom: 10px;
  323. display: flex;
  324. flex-direction: row;
  325. align-items: center;
  326. justify-content: space-between;
  327. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  328. .left-top {
  329. flex-shrink: 0;
  330. display: flex;
  331. flex-direction: row;
  332. align-items: center;
  333. img {
  334. height: 16px;
  335. margin-right: 10px;
  336. cursor: pointer;
  337. }
  338. }
  339. .center-top {
  340. display: flex;
  341. justify-content: space-between;
  342. height: 24px;
  343. .is-finish {
  344. background: #409eff;
  345. border: 1px solid #409eff;
  346. color: #fff;
  347. }
  348. .is-info {
  349. border: 1px solid #d0d0d0;
  350. }
  351. .line {
  352. height: 0px;
  353. width: 100px;
  354. margin-top: 12px;
  355. margin-left: 5px;
  356. margin-right: 5px;
  357. border-top: 1px solid #d0d0d0;
  358. }
  359. }
  360. .right-top {}
  361. }
  362. .edit-content {
  363. background: #ffffff;
  364. padding: 10px 10px;
  365. margin-top: 10px;
  366. width: 100%;
  367. display: flex;
  368. justify-content: center;
  369. .content-right {
  370. width: 33%;
  371. margin-left: 2%;
  372. padding: 0px 10px;
  373. border-left: 1px solid #d0d0d0;
  374. }
  375. .content-left {
  376. width: 65%;
  377. }
  378. .content {
  379. width: 100%;
  380. }
  381. .content-title {
  382. width: 100%;
  383. background: #f9f9ff;
  384. font-size: 0.96rem;
  385. font-weight: bold;
  386. padding-left: 10px;
  387. height: 40px;
  388. line-height: 40px;
  389. display: flex;
  390. justify-content: flex-start;
  391. text-align: left;
  392. .line {
  393. width: 2px;
  394. float: left;
  395. height: 16px;
  396. margin-top: 12px;
  397. margin-right: 8px;
  398. border-left: #3178ff 3px solid;
  399. }
  400. .subtitle {
  401. height: 40px;
  402. line-height: 40px;
  403. color: #464647 !important;
  404. }
  405. }
  406. .pal {
  407. display: flex;
  408. justify-content: space-between;
  409. margin: 10px 0px;
  410. .left {
  411. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  412. margin: 5px 5px 5px 0px;
  413. width: 50%;
  414. padding: 10px 10px;
  415. border-radius: 5px 5px;
  416. .left-title {
  417. height: 40px;
  418. line-height: 40px;
  419. }
  420. }
  421. .right {
  422. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  423. margin: 5px 0px 5px 5px;
  424. width: 50%;
  425. padding: 10px 10px;
  426. border-radius: 5px 5px;
  427. .right-title {
  428. height: 40px;
  429. line-height: 40px;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. /* 单选,隐藏label */
  436. .hide-label>.el-radio__label {
  437. font-size: 0 !important;
  438. line-height: 0 !important;
  439. }
  440. .template-form-item {
  441. background: #fff;
  442. padding: 20px;
  443. border-radius: 8px;
  444. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  445. margin-top: 24px;
  446. padding: 24px;
  447. }
  448. </style>