index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <div class="screen-container">
  3. <common-headerB title="装调一体式智能生产线仿真大屏" />
  4. <div class="body">
  5. <div class="left bg">
  6. <TitleHeaderB title="工位状态" />
  7. <div class="totalInfo">
  8. <div class="left">
  9. <div class="text">{{ countData.dayRate }}</div>
  10. </div>
  11. <div class="right">
  12. <div class="big">
  13. <div class="leftBox">
  14. <div class="num">{{ countData.dayPlan }}</div>
  15. <div class="title">今日计划</div>
  16. </div>
  17. <div class="rightBox">
  18. <div class="num">{{ countData.dayFinish }}</div>
  19. <div class="title">今日完成</div>
  20. </div>
  21. </div>
  22. <div class="small">
  23. <div class="title">本周进度</div>
  24. <div class="title">
  25. {{ countData.weekFinish }} &nbsp;/
  26. <span class="num">{{ countData.weekPlan }}</span>
  27. </div>
  28. </div>
  29. <div class="small">
  30. <div class="title">本月进度</div>
  31. <div class="title">
  32. {{ countData.monthFinish }} &nbsp;/
  33. <span class="num">{{ countData.monthPlan }}</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="titleInfo">
  39. <div class="infoItem">
  40. <div class="leftItem">工位名称</div>
  41. <div class="rightItem">完成率</div>
  42. </div>
  43. </div>
  44. <ShowScroll
  45. ref="ShowScrollRef1"
  46. :scrollRef="scrollbarRef1"
  47. :innerRef="innerRef1"
  48. >
  49. <el-scrollbar ref="scrollbarRef1" class="scrollbar">
  50. <div ref="innerRef1">
  51. <div
  52. class="infoItem"
  53. v-for="(item, index) in taskRateArray"
  54. :key="index"
  55. >
  56. <div class="leftItem textComent itembg">
  57. {{ item.stationName }}
  58. </div>
  59. <div class="rightItem itembg">{{ item.dayRate }}</div>
  60. </div>
  61. </div>
  62. </el-scrollbar>
  63. </ShowScroll>
  64. </div>
  65. <div class="middle">
  66. <div class="item">
  67. <el-image src="/images/111.gif" style="width: 100%; height: 100%" />
  68. </div>
  69. <div class="item">
  70. <TitleHeaderB title="自动化设备状态" />
  71. <ShowScroll
  72. ref="ShowScrollRef2"
  73. :scrollRef="scrollbarRef2"
  74. :innerRef="innerRef2"
  75. >
  76. <el-scrollbar ref="scrollbarRef2" class="scrollbar">
  77. <div ref="innerRef2" class="infoContent">
  78. <div
  79. class="deviceInfo"
  80. v-for="(item, index) in deviceArray"
  81. :key="index"
  82. >
  83. <div class="img">
  84. <el-image
  85. :src="`/images/${getRandomLetter()}.png`"
  86. class="img"
  87. />
  88. <div
  89. class="imgbg"
  90. :class="{
  91. outlinebg: item.state == '离线',
  92. errorbg: item.state == '故障',
  93. }"
  94. ></div>
  95. </div>
  96. <div class="info">
  97. <div class="info1">{{ item.deviceName }}</div>
  98. <div class="info2">
  99. <div class="text2">
  100. 今日稼动
  101. <span class="nums">{{ item.utilizationRate }}</span>
  102. </div>
  103. |
  104. <div class="text2">
  105. 总稼动
  106. <span class="nums" style="color: white">{{
  107. item.totalRate
  108. }}</span>
  109. </div>
  110. </div>
  111. <div class="info3">
  112. <div class="ip">IP:{{ item.ip }}</div>
  113. <div
  114. class="infoState"
  115. :class="{
  116. red: item.state == '故障',
  117. white: item.state == '离线',
  118. }"
  119. >
  120. {{ item.state }}
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </el-scrollbar>
  127. </ShowScroll>
  128. </div>
  129. <div class="item">
  130. <TitleHeaderB title="不合格情况" />
  131. <div class="scrollbar" style="position: relative">
  132. <div id="charts2"></div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="right bg">
  137. <div class="top">
  138. <TitleHeaderB title="今日排产" />
  139. <div class="titleInfo">
  140. <div class="infoItem">
  141. <div class="leftItem1">产品名称</div>
  142. <div class="midItem1">今日排产</div>
  143. <div class="rightItem1">完成率</div>
  144. </div>
  145. </div>
  146. <ShowScroll
  147. ref="ShowScrollRef3"
  148. :scrollRef="scrollbarRef3"
  149. :innerRef="innerRef3"
  150. >
  151. <el-scrollbar
  152. class="scrollbar"
  153. ref="scrollbarRef3"
  154. style="height: 53vh"
  155. >
  156. <div ref="innerRef3">
  157. <div
  158. class="infoItem"
  159. v-for="(item, index) in materialArray"
  160. :key="index"
  161. >
  162. <div class="leftItem1 textComent itembg">
  163. {{ item.materialName }}
  164. </div>
  165. <div class="midItem1 itembg">{{ item.planNum }}</div>
  166. <div class="rightItem1 itembg">{{ item.dayRate }}</div>
  167. </div>
  168. </div>
  169. </el-scrollbar>
  170. </ShowScroll>
  171. </div>
  172. <div class="bottom">
  173. <TitleHeaderB title="今日报故" />
  174. <div class="titleInfo">
  175. <div class="infoItem">
  176. <div class="leftItem">工位名称</div>
  177. <div class="rightItem">报故数量</div>
  178. </div>
  179. </div>
  180. <ShowScroll
  181. ref="ShowScrollRef4"
  182. :scrollRef="scrollbarRef4"
  183. :innerRef="innerRef4"
  184. >
  185. <el-scrollbar
  186. ref="scrollbarRef4"
  187. class="scrollbar"
  188. style="height: 20vh"
  189. >
  190. <div ref="innerRef4">
  191. <div
  192. class="infoItem"
  193. v-for="(item, index) in todayErrorArray"
  194. :key="index"
  195. >
  196. <div class="leftItem textComent itembg">
  197. {{ item.materialName }}
  198. </div>
  199. <div class="rightItem itembg" style="color: #db4848">
  200. {{ item.unqualifiedNum }}
  201. </div>
  202. </div>
  203. </div>
  204. </el-scrollbar>
  205. </ShowScroll>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </template>
  211. <script setup>
  212. import CommonHeaderB from "@/views/report/statistics/screens/common-headerB.vue";
  213. import TitleHeaderB from "../titleHeaderB.vue";
  214. import ShowScroll from "@/components/ShowScroll/index.vue";
  215. import * as echarts from "echarts";
  216. import {
  217. getFaultCount,
  218. getTaskCount,
  219. getTaskRate,
  220. getDeviceList,
  221. getMaterialRate,
  222. getTodayError,
  223. } from "@/api/bigScreen";
  224. import Middle3D from "./middle3D.vue";
  225. import moment from "moment";
  226. const fontSize = ref(0);
  227. const scrollbarRef1 = ref(null);
  228. const ShowScrollRef1 = ref(null);
  229. const innerRef1 = ref(null);
  230. const scrollbarRef2 = ref(null);
  231. const ShowScrollRef2 = ref(null);
  232. const innerRef2 = ref(null);
  233. const scrollbarRef3 = ref(null);
  234. const ShowScrollRef3 = ref(null);
  235. const innerRef3 = ref(null);
  236. const scrollbarRef4 = ref(null);
  237. const ShowScrollRef4 = ref(null);
  238. const innerRef4 = ref(null);
  239. const setFontSize = () => {
  240. fontSize.value = (window.innerHeight / 100) * 1.55;
  241. };
  242. const charts2 = shallowRef(null);
  243. const chartsData2 = ref([]);
  244. const getRandomLetter = () => {
  245. const letters = ["a", "b", "c", "d"];
  246. const randomIndex = Math.floor(Math.random() * letters.length);
  247. return letters[randomIndex];
  248. };
  249. const getData4 = async () => {
  250. //不合格品统计
  251. const { data } = await getFaultCount();
  252. chartsData2.value = data;
  253. };
  254. const countData = ref({});
  255. //获取今日任务完成相关统计
  256. const getTodayData = async () => {
  257. const { data } = await getTaskCount();
  258. countData.value = data;
  259. };
  260. const taskRateArray = ref([]);
  261. //获取工位任务完成率
  262. const getRateArray = async () => {
  263. const { data } = await getTaskRate();
  264. taskRateArray.value = data;
  265. nextTick(() => {
  266. ShowScrollRef1.value.setActive();
  267. });
  268. };
  269. const deviceArray = ref([]);
  270. //获取设备列表
  271. const getDevice = async () => {
  272. const { data } = await getDeviceList();
  273. deviceArray.value = data;
  274. nextTick(() => {
  275. ShowScrollRef2.value.setActive();
  276. });
  277. };
  278. const materialArray = ref([]);
  279. const getMaterialArray = async () => {
  280. const { data } = await getMaterialRate();
  281. materialArray.value = data;
  282. nextTick(() => {
  283. ShowScrollRef3.value.setActive();
  284. });
  285. };
  286. //今日报故
  287. const todayErrorArray = ref([]);
  288. const getTodayErrorArray = async () => {
  289. const { data } = await getTodayError();
  290. todayErrorArray.value = data;
  291. nextTick(() => {
  292. ShowScrollRef4.value.setActive();
  293. });
  294. };
  295. const option1 = {
  296. xAxis: {
  297. type: "category",
  298. data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  299. axisLabel: {
  300. fontSize: 12,
  301. },
  302. },
  303. tooltip: {
  304. trigger: "axis",
  305. backgroundColor: "#00000030",
  306. textStyle: {
  307. color: "#fff",
  308. },
  309. formatter: function (param) {
  310. const array = [
  311. moment().year() +
  312. "年" +
  313. param[0].name +
  314. "&nbsp;&nbsp;" +
  315. param[0].value +
  316. "<br/>",
  317. ];
  318. for (
  319. let i = 0;
  320. i < chartsData2.value.faultList[param[0].dataIndex].length;
  321. i++
  322. ) {
  323. array.push(
  324. ` <span style='width: 10vw'>${chartsData2.value.faultList[param[0].dataIndex][i].materialName}</span><span style='color:#D75656;'>&nbsp;&nbsp;${chartsData2.value.faultList[param[0].dataIndex][i].unqualifiedNum}</span>` +
  325. "<br/>"
  326. );
  327. }
  328. return array.join("");
  329. },
  330. },
  331. grid: {
  332. left: "3%",
  333. right: "3%",
  334. top: "12%",
  335. bottom: "15%",
  336. },
  337. yAxis: {
  338. type: "value",
  339. axisLabel: {
  340. fontSize: 12,
  341. },
  342. minInterval: 1,
  343. },
  344. series: [
  345. {
  346. data: [820, 932, 901, 934, 1290, 1330, 1320],
  347. type: "line",
  348. stack: "Total",
  349. label: {
  350. show: true,
  351. position: "top",
  352. fontSize: 20,
  353. color: "white",
  354. },
  355. itemStyle: {
  356. color: "#D7565680",
  357. },
  358. areaStyle: {
  359. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  360. {
  361. offset: 0,
  362. color: "#D7565680",
  363. },
  364. {
  365. offset: 1,
  366. color: "#D7565680",
  367. },
  368. ]),
  369. },
  370. },
  371. ],
  372. textStyle: {
  373. fontSize: fontSize.value,
  374. },
  375. };
  376. const setChart1Option = () => {
  377. const op1 = { ...option1 };
  378. if (chartsData2.value && charts2.value) {
  379. op1.series[0].data = chartsData2.value.countList;
  380. op1.series[0].label.fontSize = fontSize.value;
  381. op1.xAxis.data = chartsData2.value.monthList;
  382. op1.yAxis.axisLabel.fontSize = fontSize.value;
  383. op1.xAxis.axisLabel.fontSize = fontSize.value;
  384. op1.tooltip.textStyle.fontSize = fontSize.value;
  385. charts2.value.setOption(op1, true);
  386. }
  387. };
  388. onMounted(async () => {
  389. setFontSize();
  390. await getData4();
  391. getTodayData();
  392. getRateArray();
  393. getDevice();
  394. getMaterialArray();
  395. getTodayErrorArray();
  396. charts2.value = echarts.init(document.getElementById("charts2"));
  397. setChart1Option();
  398. window.addEventListener("resize", function () {
  399. charts2.value.resize();
  400. });
  401. });
  402. </script>
  403. <style lang="scss" scoped>
  404. .red {
  405. color: red !important;
  406. }
  407. .white {
  408. color: white !important;
  409. }
  410. .titleInfo {
  411. height: 3vh;
  412. }
  413. .scrollbar {
  414. padding-top: 0.5vh;
  415. height: 58vh;
  416. }
  417. #charts2 {
  418. width: 100%;
  419. height: 100%;
  420. position: absolute;
  421. }
  422. .screen-container {
  423. width: 100vw;
  424. height: 100vh;
  425. background-image: url("@/assets/images/screen_bg_task.png");
  426. background-size: cover;
  427. background-position: center;
  428. overflow: hidden;
  429. }
  430. .bg {
  431. background-color: rgba(0, 0, 0, 0.4);
  432. }
  433. .body {
  434. padding-top: 1vh;
  435. width: 100vw;
  436. height: 90vh;
  437. display: flex;
  438. justify-content: space-evenly;
  439. .left {
  440. padding: 1vh;
  441. width: 18vw;
  442. height: 90vh;
  443. .totalInfo {
  444. height: 20vh;
  445. display: flex;
  446. padding: 1vh;
  447. .left {
  448. width: 7vw;
  449. height: 7vw;
  450. background-image: url("@/assets/images/cel.png");
  451. background-size: 100% 100%;
  452. background-position: center;
  453. position: relative;
  454. .text {
  455. width: 7vw;
  456. height: 7vw;
  457. top: 0;
  458. left: 0;
  459. color: white;
  460. text-align: center;
  461. line-height: 6vw;
  462. font-size: 2.3vh;
  463. padding-right: 1vw;
  464. }
  465. }
  466. .right {
  467. width: 9vw;
  468. height: 20vh;
  469. display: flex;
  470. flex-direction: column;
  471. justify-content: space-evenly;
  472. .title {
  473. font-size: 1.5vh;
  474. color: white;
  475. text-align: center;
  476. }
  477. .big {
  478. height: 8vh;
  479. width: 9vw;
  480. display: flex;
  481. .num {
  482. font-size: 3vh;
  483. font-weight: bolder;
  484. color: white;
  485. text-align: center;
  486. }
  487. .leftBox {
  488. width: 4.5vw;
  489. height: 8vh;
  490. border-right: 0.1vw solid white;
  491. }
  492. .rightBox {
  493. width: 4.5vw;
  494. height: 8vh;
  495. }
  496. }
  497. .small {
  498. height: 4vh;
  499. display: flex;
  500. justify-content: space-between;
  501. .num {
  502. color: rgb(8, 174, 199);
  503. }
  504. }
  505. }
  506. }
  507. }
  508. .middle {
  509. width: 60vw;
  510. height: 90vh;
  511. display: flex;
  512. flex-direction: column;
  513. justify-content: space-between;
  514. .item {
  515. height: 29vh;
  516. padding: 1vh;
  517. width: 100%;
  518. background-color: rgba(0, 0, 0, 0.4);
  519. .scrollbar {
  520. height: 23.9vh;
  521. width: 100%;
  522. .infoContent {
  523. width: 100%;
  524. padding: 1vh;
  525. display: grid;
  526. gap: 0.6vw;
  527. grid-template-columns: repeat(3, 1fr);
  528. .deviceInfo {
  529. width: 19vw;
  530. height: 10vh;
  531. display: flex;
  532. background-color: rgba(255, 255, 255, 0.1);
  533. clip-path: polygon(0% 0%, 85% 0%, 100% 25%, 100% 100%, 0% 100%);
  534. .img {
  535. height: 10vh;
  536. width: 7vw;
  537. position: relative;
  538. .imgbg {
  539. position: absolute;
  540. height: 10vh;
  541. width: 7vw;
  542. top: 0;
  543. left: 0;
  544. z-index: 2;
  545. background-color: #06ffa520;
  546. border: 0.4vh solid #06ffa5;
  547. }
  548. .outlinebg {
  549. background-color: #ffffff20 !important;
  550. border: 0.4vh solid #fff !important;
  551. }
  552. .errorbg {
  553. background-color: #db484820 !important;
  554. border: 0.4vh solid #db4848 !important;
  555. }
  556. }
  557. .info {
  558. height: 10vh;
  559. width: 12vw;
  560. display: flex;
  561. flex-direction: column;
  562. justify-content: space-between;
  563. padding-top: 1vh;
  564. .info1 {
  565. padding-left: 0.5vw;
  566. height: 2vh;
  567. font-size: 2vh;
  568. line-height: 2vh;
  569. font-weight: 600;
  570. color: white;
  571. }
  572. .info2 {
  573. height: 2vh;
  574. padding-left: 0.5vw;
  575. display: flex;
  576. justify-content: space-between;
  577. align-items: center;
  578. color: white;
  579. padding-right: 1vw;
  580. .text2 {
  581. font-size: 1.5vh;
  582. .nums {
  583. color: #0ae0ff;
  584. font-weight: 600;
  585. }
  586. }
  587. }
  588. .info3 {
  589. height: 2vh;
  590. font-size: 2vh;
  591. background-color: rgba(255, 255, 255, 0.1);
  592. display: flex;
  593. padding-left: 0.5vw;
  594. padding-right: 1vw;
  595. justify-content: space-between;
  596. .ip {
  597. font-size: 1.6vh;
  598. line-height: 2vh;
  599. color: white;
  600. }
  601. .infoState {
  602. font-size: 1.6vh;
  603. line-height: 2vh;
  604. color: #06ffa5;
  605. }
  606. }
  607. }
  608. }
  609. }
  610. }
  611. }
  612. }
  613. .right {
  614. width: 18vw;
  615. height: 90vh;
  616. display: flex;
  617. flex-direction: column;
  618. .top {
  619. height: 61vh;
  620. padding: 1vh;
  621. }
  622. .bottom {
  623. height: 29vh;
  624. padding: 1vh;
  625. }
  626. }
  627. }
  628. .textComent {
  629. white-space: nowrap; /* 不允许换行 */
  630. overflow: hidden; /* 超出长度时隐藏 */
  631. text-overflow: ellipsis; /* 超出部分显示省略号 */
  632. }
  633. .infoItem {
  634. height: 4vh;
  635. margin-bottom: 0.4vh;
  636. display: flex;
  637. .leftItem {
  638. flex: 1;
  639. height: 4vh;
  640. font-size: 1.8vh;
  641. line-height: 4vh;
  642. color: white;
  643. text-align: center;
  644. }
  645. .rightItem {
  646. width: 25%;
  647. height: 4vh;
  648. line-height: 4vh;
  649. margin-left: 0.3vw;
  650. font-size: 1.8vh;
  651. color: white;
  652. text-align: center;
  653. }
  654. .leftItem1 {
  655. flex: 1;
  656. height: 4vh;
  657. font-size: 1.8vh;
  658. line-height: 4vh;
  659. color: white;
  660. text-align: center;
  661. }
  662. .midItem1 {
  663. width: 25%;
  664. height: 4vh;
  665. line-height: 4vh;
  666. margin-left: 0.3vw;
  667. font-size: 1.8vh;
  668. color: white;
  669. text-align: center;
  670. }
  671. .rightItem1 {
  672. width: 20%;
  673. height: 4vh;
  674. line-height: 4vh;
  675. margin-left: 0.3vw;
  676. font-size: 1.8vh;
  677. color: white;
  678. text-align: center;
  679. }
  680. }
  681. .itembg {
  682. background-color: #46464635;
  683. }
  684. </style>