index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <script setup>
  2. import { ref, onMounted, onUnmounted } from "vue";
  3. import autofit from 'autofit.js';
  4. import dayjs from 'dayjs';
  5. import WaterYield from "./components/WaterYield";
  6. import WaterQuality from "./components/WaterQuality";
  7. import ContinueData from "./components/ContinueData";
  8. import DataBox from "./components/dataBox";
  9. import GongYi from "./components/gongyi";
  10. import { editPassword } from '@/components';
  11. import TheUserAvatar from '@/components/Layout/TheUserAvatar.vue';
  12. import { screenApi } from "@/api/screen"
  13. let timer = "";
  14. let dataTimer = "";
  15. const updateTime = ref();
  16. const gongyiData = ref([])
  17. const screenData = ref({});
  18. const reportData = ref({})
  19. const currentTime = ref({
  20. time: '',
  21. weekday: '',
  22. date: '',
  23. })
  24. // 日期 - header使用
  25. const getCurrentWeekDay = () => {
  26. const weekEnum = { 0: '星期日', 1: '星期一', 2: '星期二', 3: '星期三', 4: '星期四', 5: '星期五', 6: '星期六' };
  27. const time = dayjs(new Date()).format('HH:mm:ss');
  28. const weekday = weekEnum[dayjs().day()];
  29. const date = dayjs().format('YYYY-MM-DD');
  30. currentTime.value = { time, weekday, date };
  31. }
  32. // 获取大屏分析数据
  33. const getRealTimeData = () => {
  34. screenApi.realTimeData().then(res => {
  35. screenData.value = res.data;
  36. updateTime.value = `更新时间:${res.data.testHour}`
  37. })
  38. }
  39. // 获取工艺管控 助手
  40. const getWarningList = () => {
  41. screenApi.warningList().then(res => {
  42. gongyiData.value = res.data || []
  43. })
  44. }
  45. // 获取文字数据
  46. const getLeastShortReport = () => {
  47. screenApi.getLeastShortReport().then(res => {
  48. reportData.value = res.data
  49. })
  50. }
  51. onMounted(() => {
  52. // 时钟开始计时
  53. getCurrentWeekDay();
  54. // 图表数据
  55. getRealTimeData();
  56. // 文字数据
  57. getLeastShortReport();
  58. // 工艺
  59. getWarningList();
  60. autofit.init({
  61. dw: 1920,
  62. dh: 1080,
  63. el: "#screen-view-black",
  64. resize: true,
  65. })
  66. timer = setInterval(getCurrentWeekDay, 1 * 1000);
  67. dataTimer = setInterval(() => {
  68. getRealTimeData();
  69. getLeastShortReport();
  70. getWarningList();
  71. }, 60 * 60 * 1000);
  72. })
  73. onUnmounted(() => {
  74. clearInterval(timer);
  75. clearInterval(dataTimer);
  76. })
  77. </script>
  78. <template>
  79. <div class="screen-view-black" id="screen-view-black">
  80. <header class="header">
  81. <div class="header-left">
  82. <div class="time">{{ currentTime.time }}</div>
  83. <div class="line"></div>
  84. <ul class="date">
  85. <li>{{ currentTime.weekday }}</li>
  86. <li>{{ currentTime.date }}</li>
  87. </ul>
  88. </div>
  89. <div class="header-right flex items-center justify-end pr-[18px]">
  90. <div class="select-factory">
  91. <span>LibraAi污水厂</span>
  92. <span></span>
  93. </div>
  94. <TheUserAvatar></TheUserAvatar>
  95. <editPassword></editPassword>
  96. </div>
  97. </header>
  98. <main class="main">
  99. <!-- 导航菜单 -->
  100. <div class="menu-container">
  101. <ul class="menu-list justify-end">
  102. <li class="item mr-[20px] active">
  103. <RouterLink to="/"><span>智慧总控</span></RouterLink>
  104. </li>
  105. <li class="item">
  106. <RouterLink to="/answer"><span>专家问答</span></RouterLink>
  107. </li>
  108. </ul>
  109. <ul class="menu-list justify-start">
  110. <li class="item mr-[20px]">
  111. <RouterLink to="/water-warn"><span>应急决策</span></RouterLink>
  112. </li>
  113. <li class="item">
  114. <RouterLink to="/medicinal"><span>成本管控</span></RouterLink>
  115. </li>
  116. </ul>
  117. </div>
  118. <div class="screen-container">
  119. <div class="factory">
  120. <img class="w-full h-full" src="@/assets/images/screenViewBlack/img-factory.png" alt="">
  121. <img class="coord img-a" src="@/assets/images/screenViewBlack/img-coord-a.png" alt="">
  122. <img class="coord img-b" src="@/assets/images/screenViewBlack/img-coord-b.png" alt="">
  123. <img class="coord img-c" src="@/assets/images/screenViewBlack/img-coord-c.png" alt="">
  124. </div>
  125. <div class="content">
  126. <div class="left">
  127. <WaterYield :screenData="screenData"></WaterYield>
  128. <WaterQuality :screenData="screenData" class="pt-[20px]"></WaterQuality>
  129. </div>
  130. <div class="middle">
  131. <div class="middle-wrap">
  132. <span class="text-[#9E9E9E] pb-[8px] text-[12px]">{{ updateTime }}</span>
  133. <RouterLink to="/answer" class="inp-box">
  134. <span>输入您的问题或需求</span>
  135. <img src="@/assets/images/screenViewBlack/img-start.png" alt="">
  136. </RouterLink>
  137. </div>
  138. </div>
  139. <div class="right">
  140. <ContinueData :screenData="screenData"></ContinueData>
  141. <DataBox :reportData="reportData" class="pt-[20px]"></DataBox>
  142. <GongYi :gongyiData="gongyiData"></GongYi>
  143. </div>
  144. </div>
  145. </div>
  146. </main>
  147. </div>
  148. </template>
  149. <style lang="scss" scoped>
  150. // 主体背景颜色
  151. $primary-bg-color: #040d1c;
  152. .screen-view-black {
  153. position: relative;
  154. display: flex;
  155. flex-flow: column;
  156. width: 100vw;
  157. height: 100vh;
  158. min-width: 1200px;
  159. min-height: 700px;
  160. background: $primary-bg-color;
  161. background-size: 100% 100%;
  162. overflow: hidden;
  163. }
  164. .header {
  165. display: flex;
  166. align-items: start;
  167. justify-content: space-between;
  168. flex-shrink: 0;
  169. height: 98px;
  170. padding: 20px 50px 0 50px;
  171. background: url(@/assets/images/screenViewBlack/bg-header.png) center center no-repeat;
  172. background-size: 100% 100%;
  173. .header-left {
  174. display: flex;
  175. align-items: center;
  176. .time {
  177. width: 160px;
  178. color: #FFF;
  179. text-shadow: 0px 1px 3px rgba(5, 12, 25, 0.54);
  180. font-family: D-DIN-PRO-700-Bold;
  181. font-size: 36px;
  182. font-style: normal;
  183. font-weight: 700;
  184. line-height: normal;
  185. letter-spacing: 4.32px;
  186. }
  187. .line {
  188. width: 1px;
  189. height: 28px;
  190. margin: 0 20px 0 15px;
  191. background: rgba(157, 197, 232, 0.36);
  192. }
  193. .date {
  194. color: #CDD6E3;
  195. text-align: center;
  196. font-size: 16px;
  197. font-weight: bold;
  198. letter-spacing: 1.92px;
  199. line-height: normal;
  200. font-style: normal;
  201. li:nth-child(1) {
  202. color: #CDD6E3;
  203. }
  204. li:nth-child(2) {
  205. color: #CDD6E3;
  206. font-family: D-DIN-PRO-700-Bold;
  207. font-size: 12px;
  208. letter-spacing: 1.44px;
  209. }
  210. }
  211. }
  212. .header-right {
  213. .select-factory {
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. width: 114px;
  218. height: 34px;
  219. padding: 10px;
  220. margin-right: 16px;
  221. background:
  222. url("@/assets/images/screenViewBlack/bg-arrow-left.svg") left bottom no-repeat,
  223. url("@/assets/images/screenViewBlack/bg-select.svg") center center no-repeat,
  224. url("@/assets/images/screenViewBlack/bg-arrow-right.svg") right bottom no-repeat;
  225. background-size: 7px 7px, contain, 7px 7px;
  226. color: #fff;
  227. font-size: 12px;
  228. cursor: pointer;
  229. & span:nth-child(2) {
  230. display: block;
  231. width: 13px;
  232. height: 12px;
  233. background: url("@/assets/images/screenViewBlack/bg-arrow-down.svg") center center no-repeat;
  234. }
  235. }
  236. }
  237. }
  238. .main {
  239. flex: 1;
  240. display: flex;
  241. flex-flow: column;
  242. padding: 0 30px 14px 30px;
  243. .menu-container {
  244. display: flex;
  245. align-items: center;
  246. justify-content: space-between;
  247. .menu-list {
  248. display: flex;
  249. align-items: center;
  250. width: 540px;
  251. height: 86px;
  252. .item {
  253. width: 172px;
  254. height: 46px;
  255. text-align: center;
  256. font-family: YouSheBiaoTiHei;
  257. font-size: 24px;
  258. font-style: normal;
  259. font-weight: 400;
  260. line-height: 40px;
  261. letter-spacing: 1px;
  262. cursor: pointer;
  263. transition: all 0.8s;
  264. span {
  265. transition: all 0.3s;
  266. background: linear-gradient(182deg, #02A3F8 11.72%, #83D2FB 38.89%, #FFF 98.7%);
  267. background-clip: text;
  268. -webkit-background-clip: text;
  269. -webkit-text-fill-color: transparent;
  270. }
  271. }
  272. }
  273. .menu-list:nth-child(1) {
  274. .item {
  275. background: url(@/assets/images/screenViewBlack/bg-left.png) center center no-repeat;
  276. background-size: 100% 100%;
  277. &:hover {
  278. background: url(@/assets/images/screenViewBlack/bg-left-active.png) center center no-repeat;
  279. background-size: 100% 100%;
  280. span {
  281. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  282. background-clip: text;
  283. }
  284. }
  285. }
  286. .active {
  287. background: url(@/assets/images/screenViewBlack/bg-left-active.png) center center no-repeat;
  288. background-size: 100% 100%;
  289. span {
  290. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  291. background-clip: text;
  292. }
  293. }
  294. }
  295. .menu-list:nth-child(2) {
  296. .item {
  297. background: url(@/assets/images/screenViewBlack/bg-right.png) center center no-repeat;
  298. background-size: 100% 100%;
  299. &:hover {
  300. background: url(@/assets/images/screenViewBlack/bg-right-active.png) center center no-repeat;
  301. background-size: 100% 100%;
  302. span {
  303. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  304. background-clip: text;
  305. }
  306. }
  307. }
  308. .active {
  309. background: url(@/assets/images/screenViewBlack/bg-right-active.png) center center no-repeat;
  310. background-size: 100% 100%;
  311. span {
  312. background: linear-gradient(182deg, #00FFE4, #FFF 78.7%);
  313. background-clip: text;
  314. }
  315. }
  316. }
  317. }
  318. @keyframes jump {
  319. 0%, 100% {
  320. transform: translateY(0);
  321. }
  322. 50% {
  323. transform: translateY(-10px); /* 调整这个值来控制跳跃的高度 */
  324. }
  325. }
  326. .screen-container {
  327. position: relative;
  328. background: $primary-bg-color;
  329. .factory {
  330. position: absolute;
  331. top: 50%;
  332. left: 50%;
  333. transform: translate(-50%, -50%);
  334. width: 1408px;
  335. height: 792px;
  336. .coord {
  337. position: absolute;
  338. width: 108px;
  339. height: 82px;
  340. }
  341. .img-a {
  342. top: 370px;
  343. left: 320px;
  344. animation: jump 1.5s ease-in-out infinite;
  345. animation-delay: 0.2s;
  346. }
  347. .img-b {
  348. top: 280px;
  349. left: 650px;
  350. animation: jump 1.5s ease-in-out infinite;
  351. animation-delay: 0.6s;
  352. }
  353. .img-c {
  354. top: 226px;
  355. right: 330px;
  356. animation: jump 1.5s ease-in-out infinite;
  357. animation-delay: 0.4s;
  358. }
  359. }
  360. .content {
  361. position: relative;
  362. display: flex;
  363. ;
  364. justify-content: space-between;
  365. .left,
  366. .right {
  367. width: 540px;
  368. }
  369. .middle {
  370. flex-shrink: 0;
  371. flex: 1;
  372. display: flex;
  373. flex-flow: column;
  374. justify-content: flex-end;
  375. padding: 0 50px 30px 50px;
  376. .middle-wrap {
  377. display: flex;
  378. flex-flow: column;
  379. align-items: flex-end;
  380. .inp-box {
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. width: 100%;
  385. height: 60px;
  386. padding: 0 14px;
  387. background: url(@/assets/images/screenViewBlack/bg-input.png) center center no-repeat;
  388. background-size: 100% 100%;
  389. span {
  390. color: rgba(255, 255, 255, 0.80);
  391. text-shadow: 0px 0px 8px rgba(201, 253, 243, 0.50);
  392. font-size: 15px;
  393. font-weight: 400;
  394. line-height: 22px;
  395. }
  396. img {
  397. width: 56px;
  398. height: 36px;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. }
  405. }
  406. </style>
  407. <style lang="scss">
  408. #screen-view-black {
  409. .header .header-right {
  410. .name {
  411. color: #fff;
  412. }
  413. }
  414. }
  415. </style>