华西海圻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.

544 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. html{
  112. color:#606266;
  113. font-size: 14px;
  114. }
  115. .el-dialog__header {
  116. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  117. }
  118. .el-dialog__footer {
  119. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  120. }
  121. .el-dialog__body {
  122. padding: 10px 10px;
  123. }
  124. /*隐藏自动填充密码 */
  125. .sbzdtcma {
  126. width: 0px;
  127. height: 0px;
  128. overflow: hidden;
  129. }
  130. /*搜索区域样式 */
  131. .search-area {
  132. input {
  133. width: 150px;
  134. }
  135. }
  136. .el-tabs--border-card>.el-tabs__content {
  137. padding: 0px 0px;
  138. }
  139. /*详情 */
  140. .detail-container {
  141. background: #ffffff !important;
  142. .detail-top {
  143. background: #fff;
  144. padding: 10px 20px;
  145. margin-bottom: 10px;
  146. display: flex;
  147. flex-direction: row;
  148. align-items: center;
  149. justify-content: space-between;
  150. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  151. .left-top {
  152. flex-shrink: 0;
  153. display: flex;
  154. flex-direction: row;
  155. align-items: center;
  156. img {
  157. height: 16px;
  158. margin-right: 10px;
  159. cursor: pointer;
  160. }
  161. .right-top {}
  162. }
  163. }
  164. .detail-title {
  165. line-height: 60px;
  166. font-size: 16px;
  167. font-weight: bold;
  168. width: 100%;
  169. margin-top: 10px;
  170. display: flex;
  171. justify-content: center;
  172. }
  173. .detail-content {
  174. padding: 10px 10px;
  175. display: flex;
  176. justify-content: space-between;
  177. .content-right {
  178. width: 20%;
  179. margin-left: 2%;
  180. padding: 0px 10px;
  181. border-left: 1px solid #d0d0d0;
  182. }
  183. .content-left {
  184. width: 78%;
  185. }
  186. .content {
  187. width: 100%;
  188. }
  189. .content-title {
  190. width: 100%;
  191. background: #f9f9ff;
  192. font-size: 0.96rem;
  193. font-weight: bold;
  194. padding-left: 10px;
  195. height: 40px;
  196. line-height: 40px;
  197. display: flex;
  198. justify-content: flex-start;
  199. text-align: left;
  200. page-break-inside: avoid;
  201. .line {
  202. width: 2px;
  203. float: left;
  204. height: 16px;
  205. margin-top: 12px;
  206. margin-right: 8px;
  207. border-left: #3178ff 3px solid;
  208. }
  209. .subtitle {
  210. height: 40px;
  211. line-height: 40px;
  212. color: #464647 !important;
  213. }
  214. }
  215. .pal {
  216. display: flex;
  217. justify-content: space-between;
  218. margin: 10px 0px;
  219. .left {
  220. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  221. margin: 5px 5px 5px 0px;
  222. width: 50%;
  223. padding: 10px 10px;
  224. border-radius: 5px 5px;
  225. .left-title {
  226. height: 40px;
  227. line-height: 40px;
  228. }
  229. }
  230. .right {
  231. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  232. margin: 5px 0px 5px 5px;
  233. width: 50%;
  234. padding: 10px 10px;
  235. border-radius: 5px 5px;
  236. .right-title {
  237. height: 40px;
  238. line-height: 40px;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. /*稽查轨迹list */
  245. .jcgjList {
  246. padding: 20px 0px;
  247. .jcgjList-keywords {
  248. width: 100%;
  249. }
  250. .jcgjList-jcgjlx {
  251. height: 50px;
  252. margin: 10px 0px;
  253. }
  254. .jcgjList-content {
  255. width: 100%;
  256. }
  257. .jcgjList-title {
  258. display: flex;
  259. justify-content: space-between;
  260. margin-top: -15px;
  261. .jcgjList-jcmc {
  262. font-size: 16px;
  263. font-weight: bold;
  264. }
  265. }
  266. .jcglList-jcnr {
  267. line-height: 25x;
  268. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  269. padding: 10px 10px;
  270. margin-top: 10px;
  271. }
  272. }
  273. .no-break {
  274. page-break-inside: avoid;
  275. }
  276. /* 表格行不被分割 */
  277. tr,
  278. td,
  279. th {
  280. page-break-inside: avoid;
  281. }
  282. .page-break {
  283. page-break-before: always;
  284. }
  285. .datatable {
  286. border-collapse: collapse;
  287. width: 100%;
  288. font-size: 13px;
  289. }
  290. .datatable thead {
  291. border-left: 1px solid #f5f5f5;
  292. page-break-inside: avoid;
  293. }
  294. .datatable th {
  295. padding: 5px 5px 4px 5px;
  296. max-width: 200px;
  297. line-height: 35px;
  298. text-align: center;
  299. color: #606266;
  300. background: #f8f8f9;
  301. border: 1px solid #f5f5f5;
  302. }
  303. .datatable th.operate {
  304. padding: 5px 5px 4px 5px;
  305. width: 100px;
  306. line-height: 35px;
  307. background: #f8f8f9;
  308. border: 1px solid #f5f5f5;
  309. text-align: center;
  310. }
  311. .datatable td {
  312. border: solid 1px #f5f5f5;
  313. padding: 3px 5px 4px 5px;
  314. max-width: 100px;
  315. color: #606266;
  316. line-height: 35px;
  317. text-align: center;
  318. }
  319. .el-dialog__body {
  320. padding: 10px 20px !important;
  321. }
  322. /** 基础信息设置tab **/
  323. .edit-container {
  324. padding: 10px 10px;
  325. .edit-top {
  326. background: #fff;
  327. padding: 10px 20px;
  328. margin-bottom: 10px;
  329. display: flex;
  330. flex-direction: row;
  331. align-items: center;
  332. justify-content: space-between;
  333. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  334. .left-top {
  335. flex-shrink: 0;
  336. display: flex;
  337. flex-direction: row;
  338. align-items: center;
  339. img {
  340. height: 16px;
  341. margin-right: 10px;
  342. cursor: pointer;
  343. }
  344. }
  345. .center-top {
  346. display: flex;
  347. justify-content: space-between;
  348. height: 24px;
  349. .is-finish {
  350. background: #409eff;
  351. border: 1px solid #409eff;
  352. color: #fff;
  353. }
  354. .is-info {
  355. border: 1px solid #d0d0d0;
  356. }
  357. .line {
  358. height: 0px;
  359. width: 100px;
  360. margin-top: 12px;
  361. margin-left: 5px;
  362. margin-right: 5px;
  363. border-top: 1px solid #d0d0d0;
  364. }
  365. }
  366. .right-top {}
  367. }
  368. .edit-content {
  369. background: #ffffff;
  370. padding: 10px 10px;
  371. margin-top: 10px;
  372. width: 100%;
  373. display: flex;
  374. justify-content: center;
  375. .content-right {
  376. width: 20%;
  377. margin-left: 2%;
  378. padding: 0px 10px;
  379. border-left: 1px solid #d0d0d0;
  380. }
  381. .content-left {
  382. width: 78%;
  383. }
  384. .content {
  385. width: 100%;
  386. }
  387. .content-title {
  388. width: 100%;
  389. background: #f9f9ff;
  390. font-size: 0.96rem;
  391. font-weight: bold;
  392. padding-left: 10px;
  393. height: 40px;
  394. line-height: 40px;
  395. display: flex;
  396. justify-content: flex-start;
  397. text-align: left;
  398. page-break-inside: avoid;
  399. .line {
  400. width: 2px;
  401. float: left;
  402. height: 16px;
  403. margin-top: 12px;
  404. margin-right: 8px;
  405. border-left: #3178ff 3px solid;
  406. }
  407. .subtitle {
  408. height: 40px;
  409. line-height: 40px;
  410. color: #464647 !important;
  411. }
  412. }
  413. .pal {
  414. display: flex;
  415. justify-content: space-between;
  416. margin: 10px 0px;
  417. .left {
  418. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  419. margin: 5px 5px 5px 0px;
  420. width: 50%;
  421. padding: 10px 10px;
  422. border-radius: 5px 5px;
  423. .left-title {
  424. height: 40px;
  425. line-height: 40px;
  426. }
  427. }
  428. .right {
  429. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  430. margin: 5px 0px 5px 5px;
  431. width: 50%;
  432. padding: 10px 10px;
  433. border-radius: 5px 5px;
  434. .right-title {
  435. height: 40px;
  436. line-height: 40px;
  437. }
  438. }
  439. }
  440. }
  441. }
  442. /* 单选,隐藏label */
  443. .hide-label>.el-radio__label {
  444. font-size: 0 !important;
  445. line-height: 0 !important;
  446. }
  447. .template-form-item {
  448. background: #fff;
  449. padding: 20px;
  450. border-radius: 8px;
  451. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  452. margin-top: 24px;
  453. padding: 24px;
  454. }
  455. </style>