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.

347 lines
8.1 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <script setup lang="ts">
  2. import logoutIcon from 'assets/images/logout.svg'
  3. import Check from 'components/check/index.vue'
  4. import Stop from 'components/home/Stop/index.vue'
  5. import { useActivateDebug } from 'hooks/useActivateDebug'
  6. import { isClose } from 'libs/socket'
  7. import { formatDateTime } from 'libs/utils'
  8. import { authRoutes } from 'router/routes'
  9. import { useSystemStore } from 'stores/systemStore'
  10. import { onMounted, onUnmounted, ref } from 'vue'
  11. import { useRouter } from 'vue-router'
  12. const { handleLogoClick } = useActivateDebug()
  13. const systemStore = useSystemStore()
  14. const router = useRouter()
  15. const currentTime = ref(formatDateTime())
  16. const timeInterval = setInterval(() => {
  17. currentTime.value = formatDateTime()
  18. }, 1000)
  19. onMounted(() => {
  20. if (!systemStore.systemStatus.selfTest && systemStore.systemUser.username !== 'test') {
  21. isCheck.value = true
  22. }
  23. })
  24. onUnmounted(() => {
  25. clearInterval(timeInterval)
  26. })
  27. const isCheck = ref(false)
  28. </script>
  29. <template>
  30. <el-container class="main">
  31. <el-header class="header">
  32. <div class="logo">
  33. <img src="../assets/images/logo.svg" alt="" @click="handleLogoClick">
  34. <span class="title" @click="handleLogoClick">长春黄金研究院有限公司</span>
  35. <img :class="systemStore.menuExpand ? 'expand-icon' : 'fold-icon'" src="../assets/images/expand.svg" alt="" @click="systemStore.updateMenuExpand()">
  36. </div>
  37. <div class="header-right">
  38. <el-dropdown class="wifi-dropdown" trigger="click">
  39. <div class="wifi-icon">
  40. <img v-if="isClose" src="../assets/images/wifi.svg" alt="">
  41. <img v-else src="../assets/images/wifi-active.svg" alt="">
  42. </div>
  43. <template #dropdown>
  44. <el-dropdown-menu>
  45. <el-dropdown-item @click="systemStore.logout()">
  46. <div class="logout">
  47. <span v-if="!isClose">已连接</span>
  48. <span v-else>已断开</span>
  49. </div>
  50. </el-dropdown-item>
  51. </el-dropdown-menu>
  52. </template>
  53. </el-dropdown>
  54. <div class="time">
  55. {{ currentTime }}
  56. </div>
  57. <div class="user">
  58. <el-dropdown class="user-dropdown" trigger="click">
  59. <div class="user-dropdown-item">
  60. <img src="../assets/images/user.svg" alt="">
  61. <span>{{ systemStore.systemUser.username }}</span>
  62. </div>
  63. <template #dropdown>
  64. <el-dropdown-menu>
  65. <el-dropdown-item @click="systemStore.logout()">
  66. <div class="logout">
  67. <img :src="logoutIcon" alt="">
  68. <span>退出登录</span>
  69. </div>
  70. </el-dropdown-item>
  71. </el-dropdown-menu>
  72. </template>
  73. </el-dropdown>
  74. </div>
  75. </div>
  76. </el-header>
  77. <el-container class="container">
  78. <el-aside class="aside" :class="{ 'aside-off': !systemStore.menuExpand }">
  79. <div
  80. v-for="item in authRoutes.filter(item => item.meta!.isDefault)"
  81. :key="item.path"
  82. class="aside-item"
  83. :class="{ 'aside-item-active': router.currentRoute.value.path.includes(item.path) }"
  84. @click="router.push(item.path)"
  85. >
  86. <img class="swing-icon" :src="((router.currentRoute.value.path.includes(item.path) ? item.meta!.activeIcon : item.meta!.icon) as string)" alt="">
  87. <span class="text">{{ item.meta!.title }}</span>
  88. </div>
  89. </el-aside>
  90. <el-main>
  91. <router-view v-slot="{ Component }" class="content">
  92. <transition name="el-fade-in-linear">
  93. <component :is="Component" />
  94. </transition>
  95. </router-view>
  96. </el-main>
  97. </el-container>
  98. <el-footer class="footer" :class="{ 'footer-expand': !systemStore.menuExpand }">
  99. <el-row>
  100. <el-col :span="16">
  101. <div class="footer-left">
  102. <img src="../assets/images/run.svg" alt="">
  103. <span class="text">机器运行状态</span>
  104. </div>
  105. </el-col>
  106. <el-col :span="8">
  107. <div class="footer-right">
  108. <div class="status" />
  109. <span class="text">溶液容器余量正常</span>
  110. </div>
  111. </el-col>
  112. </el-row>
  113. </el-footer>
  114. <FtStream :visible="systemStore.streamVisible" />
  115. <Check v-if="isCheck" @close="isCheck = false" />
  116. <Stop v-if="systemStore.systemStatus.emergencyStop" />
  117. </el-container>
  118. </template>
  119. <style scoped lang="scss">
  120. .main {
  121. box-sizing: border-box;
  122. height: 100%;
  123. background: #F6F6F6;
  124. .header, .footer {
  125. height: 50px;
  126. width: 100%;
  127. display: flex;
  128. align-items: center;
  129. justify-content: space-between;
  130. padding: 10px 15px;
  131. }
  132. .header {
  133. color: #393F46;
  134. .logo {
  135. height: 100%;
  136. display: flex;
  137. align-items: center;
  138. .title {
  139. margin:0 10px;
  140. color: #8799AB;
  141. font-weight: 600;
  142. }
  143. img {
  144. height: 100%;
  145. }
  146. .expand-icon {
  147. height: 15px;
  148. transition: all 0.3s;
  149. }
  150. .fold-icon {
  151. height: 15px;
  152. transform: rotate(90deg);
  153. transition: all 0.3s;
  154. }
  155. }
  156. .header-right {
  157. display: flex;
  158. align-items: center;
  159. height: 100%;
  160. .wifi-dropdown {
  161. height: 100%;
  162. .wifi-icon {
  163. width: 40px;
  164. height: 100%;
  165. background: #fff;
  166. border-radius: 5px;
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. img {
  171. height: 50%;
  172. }
  173. }
  174. }
  175. .time {
  176. margin:0 10px;
  177. height: 100%;
  178. padding: 0 10px;
  179. display: flex;
  180. align-items: center;
  181. background: #fff;
  182. border-radius: 5px;
  183. }
  184. }
  185. }
  186. .container {
  187. height: calc(100% - 100px);
  188. }
  189. }
  190. .aside {
  191. width: 170px;
  192. overflow: auto;
  193. padding-left: 10px;
  194. //transition: all 0.1s ease;
  195. .aside-item {
  196. width: 100%;
  197. height: 50px;
  198. border-radius: 10px;
  199. color: #1989FA;
  200. margin: 10px 0;
  201. padding: 0 10px;
  202. display: flex;
  203. align-items: center;
  204. overflow: hidden;
  205. img {
  206. height: 80%;
  207. margin-right: 20px;
  208. }
  209. .text {
  210. transition: opacity 0.3s ease;
  211. white-space: nowrap;
  212. }
  213. }
  214. .aside-item-active {
  215. background: #1989FA;
  216. color: #fff;
  217. }
  218. }
  219. .aside-off {
  220. width: 70px;
  221. //transition: all 0.1s ease;
  222. .aside-item {
  223. .text {
  224. opacity: 0
  225. }
  226. }
  227. .aside-item-active {
  228. background: rgba(0,0,0,0);
  229. color: #fff;
  230. }
  231. }
  232. .user-dropdown-item {
  233. display: flex;
  234. align-items: center;
  235. height: 100%;
  236. color: #393F46;
  237. font-weight: bold;
  238. img {
  239. height: 30px;
  240. margin-right: 10px;
  241. }
  242. }
  243. .el-main {
  244. padding: 0 15px;
  245. height: 100%;
  246. position: relative;
  247. }
  248. .content {
  249. width: 100%;
  250. height: 100%;
  251. background: #fff;
  252. border-radius: 10px;
  253. box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
  254. padding: 10px;
  255. }
  256. .footer-expand {
  257. padding: 10px 15px 10px 85px !important;
  258. }
  259. .main .footer {
  260. padding: 10px 15px 10px 185px;
  261. .el-row {
  262. width: 100%;
  263. height: 100%;
  264. .el-col {
  265. height: 100%;
  266. }
  267. }
  268. .footer-left, .footer-right {
  269. width: 100%;
  270. height: 100%;
  271. background: #fff;
  272. border-radius: 5px;
  273. display: flex ;
  274. align-items: center;
  275. padding: 0 20px;
  276. }
  277. .footer-left {
  278. border-right: 5px solid #F6F6F6;
  279. img {
  280. height: 60%;
  281. }
  282. .text {
  283. color: #1C1C1C ;
  284. margin-left: 10px;
  285. font-size: 14px;
  286. }
  287. }
  288. .footer-right {
  289. border-left: 10px solid #F6F6F6;
  290. .status {
  291. width: 15px;
  292. height: 15px;
  293. border-radius: 50%;
  294. background: #4EE993;
  295. }
  296. .text {
  297. color: #1C1C1C ;
  298. margin-left: 10px;
  299. font-size: 14px;
  300. }
  301. }
  302. }
  303. .aside-item:hover {
  304. .swing-icon {
  305. animation: swing 1s ease-in-out;
  306. }
  307. }
  308. .logout {
  309. display: flex;
  310. img {
  311. width: 15px;
  312. margin-right: 10px;
  313. }
  314. }
  315. @keyframes swing {
  316. 0% {
  317. transform: rotate(0deg);
  318. }
  319. 25% {
  320. transform: rotate(-30deg);
  321. }
  322. 50% {
  323. transform: rotate(30deg);
  324. }
  325. 75% {
  326. transform: rotate(-15deg);
  327. }
  328. 100% {
  329. transform: rotate(0deg);
  330. }
  331. }
  332. </style>