华西海圻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.8 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
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: 20%;
  175. margin-left: 2%;
  176. padding: 0px 10px;
  177. border-left: 1px solid #d0d0d0;
  178. }
  179. .content-left {
  180. width: 78%;
  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. page-break-inside: avoid;
  197. .line {
  198. width: 2px;
  199. float: left;
  200. height: 16px;
  201. margin-top: 12px;
  202. margin-right: 8px;
  203. border-left: #3178ff 3px solid;
  204. }
  205. .subtitle {
  206. height: 40px;
  207. line-height: 40px;
  208. color: #464647 !important;
  209. }
  210. }
  211. .pal {
  212. display: flex;
  213. justify-content: space-between;
  214. margin: 10px 0px;
  215. .left {
  216. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  217. margin: 5px 5px 5px 0px;
  218. width: 50%;
  219. padding: 10px 10px;
  220. border-radius: 5px 5px;
  221. .left-title {
  222. height: 40px;
  223. line-height: 40px;
  224. }
  225. }
  226. .right {
  227. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  228. margin: 5px 0px 5px 5px;
  229. width: 50%;
  230. padding: 10px 10px;
  231. border-radius: 5px 5px;
  232. .right-title {
  233. height: 40px;
  234. line-height: 40px;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. /*稽查轨迹list */
  241. .jcgjList {
  242. padding: 20px 0px;
  243. .jcgjList-keywords {
  244. width: 100%;
  245. }
  246. .jcgjList-jcgjlx {
  247. height: 50px;
  248. margin: 10px 0px;
  249. }
  250. .jcgjList-content {
  251. width: 100%;
  252. }
  253. .jcgjList-title {
  254. display: flex;
  255. justify-content: space-between;
  256. margin-top: -15px;
  257. .jcgjList-jcmc {
  258. font-size: 16px;
  259. font-weight: bold;
  260. }
  261. }
  262. .jcglList-jcnr {
  263. line-height: 25x;
  264. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  265. padding: 10px 10px;
  266. margin-top: 10px;
  267. }
  268. }
  269. .no-break {
  270. page-break-inside: avoid;
  271. }
  272. /* 表格行不被分割 */
  273. tr,
  274. td,
  275. th {
  276. page-break-inside: avoid;
  277. }
  278. .page-break {
  279. page-break-before: always;
  280. }
  281. .datatable {
  282. border-collapse: collapse;
  283. width: 100%;
  284. font-size: 13px;
  285. }
  286. .datatable thead {
  287. border-left: 1px solid #f5f5f5;
  288. page-break-inside: avoid;
  289. }
  290. .datatable th {
  291. padding: 5px 5px 4px 5px;
  292. max-width: 200px;
  293. line-height: 35px;
  294. text-align: center;
  295. color: #606266;
  296. background: #f8f8f9;
  297. border: 1px solid #f5f5f5;
  298. }
  299. .datatable th.operate {
  300. padding: 5px 5px 4px 5px;
  301. width: 100px;
  302. line-height: 35px;
  303. background: #f8f8f9;
  304. border: 1px solid #f5f5f5;
  305. text-align: center;
  306. }
  307. .datatable td {
  308. border: solid 1px #f5f5f5;
  309. padding: 3px 5px 4px 5px;
  310. max-width: 100px;
  311. color: #606266;
  312. line-height: 35px;
  313. text-align: center;
  314. }
  315. .el-dialog__body {
  316. padding: 10px 20px !important;
  317. }
  318. /** 基础信息设置tab **/
  319. .edit-container {
  320. .edit-top {
  321. background: #fff;
  322. padding: 10px 20px;
  323. margin-bottom: 10px;
  324. display: flex;
  325. flex-direction: row;
  326. align-items: center;
  327. justify-content: space-between;
  328. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  329. .left-top {
  330. flex-shrink: 0;
  331. display: flex;
  332. flex-direction: row;
  333. align-items: center;
  334. img {
  335. height: 16px;
  336. margin-right: 10px;
  337. cursor: pointer;
  338. }
  339. }
  340. .center-top {
  341. display: flex;
  342. justify-content: space-between;
  343. height: 24px;
  344. .is-finish {
  345. background: #409eff;
  346. border: 1px solid #409eff;
  347. color: #fff;
  348. }
  349. .is-info {
  350. border: 1px solid #d0d0d0;
  351. }
  352. .line {
  353. height: 0px;
  354. width: 100px;
  355. margin-top: 12px;
  356. margin-left: 5px;
  357. margin-right: 5px;
  358. border-top: 1px solid #d0d0d0;
  359. }
  360. }
  361. .right-top {}
  362. }
  363. .edit-content {
  364. background: #ffffff;
  365. padding: 10px 10px;
  366. margin-top: 10px;
  367. width: 100%;
  368. display: flex;
  369. justify-content: center;
  370. .content-right {
  371. width: 20%;
  372. margin-left: 2%;
  373. padding: 0px 10px;
  374. border-left: 1px solid #d0d0d0;
  375. }
  376. .content-left {
  377. width: 78%;
  378. }
  379. .content {
  380. width: 100%;
  381. }
  382. .content-title {
  383. width: 100%;
  384. background: #f9f9ff;
  385. font-size: 0.96rem;
  386. font-weight: bold;
  387. padding-left: 10px;
  388. height: 40px;
  389. line-height: 40px;
  390. display: flex;
  391. justify-content: flex-start;
  392. text-align: left;
  393. page-break-inside: avoid;
  394. .line {
  395. width: 2px;
  396. float: left;
  397. height: 16px;
  398. margin-top: 12px;
  399. margin-right: 8px;
  400. border-left: #3178ff 3px solid;
  401. }
  402. .subtitle {
  403. height: 40px;
  404. line-height: 40px;
  405. color: #464647 !important;
  406. }
  407. }
  408. .pal {
  409. display: flex;
  410. justify-content: space-between;
  411. margin: 10px 0px;
  412. .left {
  413. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  414. margin: 5px 5px 5px 0px;
  415. width: 50%;
  416. padding: 10px 10px;
  417. border-radius: 5px 5px;
  418. .left-title {
  419. height: 40px;
  420. line-height: 40px;
  421. }
  422. }
  423. .right {
  424. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  425. margin: 5px 0px 5px 5px;
  426. width: 50%;
  427. padding: 10px 10px;
  428. border-radius: 5px 5px;
  429. .right-title {
  430. height: 40px;
  431. line-height: 40px;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. /* 单选,隐藏label */
  438. .hide-label>.el-radio__label {
  439. font-size: 0 !important;
  440. line-height: 0 !important;
  441. }
  442. .template-form-item {
  443. background: #fff;
  444. padding: 20px;
  445. border-radius: 8px;
  446. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  447. margin-top: 24px;
  448. padding: 24px;
  449. }
  450. </style>