Yiqi.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <video autoplay loop muted>
  3. <source src="/@/assets/particle2.mp4">
  4. </video>
  5. <div class="yiqi_box">
  6. <div class="yiqi_box1">
  7. <div class="visual_box">
  8. <div class="swiper-container visual_swiper1 visual_chart">
  9. <div class="visual_con">
  10. <div class="visual_conTop">
  11. <div class="visual_conTop_box visual_conTop1">
  12. <div>
  13. <h3>仪器总数(台)</h3>
  14. <div class="visual_shuju">
  15. <p class="danshu">{{ ltydata.count }}</p>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="visual_conTop_box visual_conTop1">
  20. <div class="visual_shuju">
  21. <h3>仪器总价值(万元)</h3>
  22. <p class="danshu">{{ ltydata.value }}</p>
  23. </div>
  24. </div>
  25. <div class="visual_conTop_box visual_conTop2">
  26. <div>
  27. <h3>仪器借出(台)</h3>
  28. <div class="visual_shuju">
  29. <!-- <p class="shuanshu">{{ ltydata.lent_number }}</p> -->
  30. <p class="shuanshu">165</p>
  31. <div class="conTop_smil">
  32. <!-- fa-long-arrow-up -->
  33. <a class="sz">周环比:<span>-5%</span><i class="fa fa-long-arrow-down"></i></a>
  34. <a class="xd">月环比:<span>-2%</span><i class="fa fa-long-arrow-down"></i></a>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="visual_conTop_box visual_conTop2">
  40. <div>
  41. <h3>仪器损坏(台)</h3>
  42. <div class="visual_shuju">
  43. <p class="shuanshu">{{ ltydata.repair_number }}</p>
  44. <div class="conTop_smil">
  45. <a class="null">null</a>
  46. <a class="xd">月环比:<span>-10%</span><i class="fa fa-long-arrow-down"></i></a>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- 蓝晓玉 -->
  57. <div class="yiqi_box3">
  58. <dv-border-box13 style="width:96vw;height:18vw;padding-left: 0.5vw;padding-top: 0.5vw;margin: 0 auto;"
  59. :color="['#4fd2dd', '#235fa7']">
  60. <div>
  61. <!-- title -->
  62. </div>
  63. <div class="lunbo_con">
  64. <!-- 内容 -->
  65. <Swiper :speed="2" :direction="'left'" :swiper_a='ltydata.labdisplay'></Swiper>
  66. </div>
  67. </dv-border-box13>
  68. </div>
  69. <div class="yiqi_box2">
  70. <div class="box2_left">
  71. <dv-border-box13 style="width:27vw;height:15.5vw;padding-left: 0.5vw;padding-top: 0.5vw;"
  72. :color="['#4fd2dd', '#235fa7']">
  73. <div class="box2_left_title">
  74. 借单列表{{ data }}
  75. </div>
  76. <div class="box2_left_con">
  77. <!-- <dv-scroll-board :config="config" style="width:26vw;height:12vw"-->
  78. <!-- />-->
  79. <dv-scroll-board :config="config" style="width:26vw;height:12vw" @mouseover="mouseoverHandler"
  80. @click="clickHandler" />
  81. </div>
  82. </dv-border-box13>
  83. </div>
  84. <div class="box2_center">
  85. <dv-border-box13 style="width:41vw;height:15.5vw;margin: 0 1.5vw; padding-left: 0.5vw;padding-top: 0.5vw;"
  86. :color="['#4fd2dd', '#235fa7']">
  87. <div class="box2_center_title">
  88. 仪器借用统计(近6月)
  89. </div>
  90. <div class="box2_center_con">
  91. <div :style="{ width: '100%', height: '100%' }">
  92. <Echarts :option="option" />
  93. </div>
  94. </div>
  95. </dv-border-box13>
  96. </div>
  97. <div class="box2_right dslca">
  98. <dv-border-box13 style="width:25vw;height:15.5vw;padding-left: 0.5vw;padding-top: 0.5vw;"
  99. :color="['#4fd2dd', '#235fa7']">
  100. <div class="box2_right_title">
  101. 仪器借用排行
  102. </div>
  103. <div class="box2_right_con">
  104. <dv-scroll-ranking-board :config="config2" style="width:24vw;height:11.5vw" />
  105. </div>
  106. </dv-border-box13>
  107. </div>
  108. </div>
  109. <div class="beijin"></div>
  110. </div>
  111. </template>
  112. <script setup lang="ts" name="Home">
  113. import {onMounted, ref, reactive, computed, onUnmounted} from 'vue';
  114. // import { BorderBox13 as DvBorderBox13 } from '@kjgl77/datav-vue3'
  115. import dayjs from 'dayjs';
  116. import Echarts from '/@/components/ReEcharts/index.vue';
  117. import * as echarts from 'echarts';
  118. import Swiper from '/@/layouts/frontend/BaseSwiper.vue'
  119. import {useRouter} from "vue-router";
  120. import createAxios from '/@/utils/axios'
  121. const router = useRouter()
  122. const ltydata = reactive({
  123. labinfo: [{
  124. laboratory_introduction: '',
  125. laboratorydisplay_diagram: ''
  126. }],
  127. count: 0,
  128. value: 0,
  129. lent_number: 0,
  130. repair_number: 0,
  131. "a": {
  132. "水准仪": 109,
  133. "RTK": 43,
  134. "全站仪": 89,
  135. "无人机": 19,
  136. "其他": 68
  137. },
  138. labborrow: [],
  139. });
  140. const datas = ref()
  141. // 月份数据
  142. const mouthsData = ref()
  143. function pps_svg(i: number) {
  144. // 0k 1j
  145. return (i as boolean) ? '<span style="font-size:0.8vw"><svg width="1vw" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" data-v-ea893728=""><path fill="currentColor" d="M359.168 768H160a32 32 0 0 1-32-32V192H64a32 32 0 0 1 0-64h896a32 32 0 1 1 0 64h-64v544a32 32 0 0 1-32 32H665.216l110.848 192h-73.856L591.36 768H433.024L322.176 960H248.32zM832 192H192v512h640zM342.656 534.656a32 32 0 1 1-45.312-45.312L444.992 341.76l125.44 94.08L679.04 300.032a32 32 0 1 1 49.92 39.936L581.632 524.224 451.008 426.24 342.656 534.592z"></path></svg>教学借单</span>'
  146. : '<span style="font-size:0.8vw"><svg width="1vw" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" data-v-ea893728=""><path fill="currentColor" d="M839.7 734.7c0 33.3-17.9 41-17.9 41S519.7 949.8 499.2 960c-10.2 5.1-20.5 5.1-30.7 0 0 0-314.9-184.3-325.1-192-5.1-5.1-10.2-12.8-12.8-20.5V368.6c0-17.9 20.5-28.2 20.5-28.2L466 158.6c12.8-5.1 25.6-5.1 38.4 0 0 0 279 161.3 309.8 179.2 17.9 7.7 28.2 25.6 25.6 46.1-.1-5-.1 317.5-.1 350.8M714.2 371.2c-64-35.8-217.6-125.4-217.6-125.4-7.7-5.1-20.5-5.1-30.7 0L217.6 389.1s-17.9 10.2-17.9 23v297c0 5.1 5.1 12.8 7.7 17.9 7.7 5.1 256 148.5 256 148.5 7.7 5.1 17.9 5.1 25.6 0 15.4-7.7 250.9-145.9 250.9-145.9s12.8-5.1 12.8-30.7v-74.2l-276.5 169v-64c0-17.9 7.7-30.7 20.5-46.1L745 535c5.1-7.7 10.2-20.5 10.2-30.7v-66.6l-279 169v-69.1c0-15.4 5.1-30.7 17.9-38.4l220.1-128zM919 135.7c0-5.1-5.1-7.7-7.7-7.7h-58.9V66.6c0-5.1-5.1-5.1-10.2-5.1l-30.7 5.1c-5.1 0-5.1 2.6-5.1 5.1V128h-56.3c-5.1 0-5.1 5.1-7.7 5.1v38.4h69.1v64c0 5.1 5.1 5.1 10.2 5.1l30.7-5.1c5.1 0 5.1-2.6 5.1-5.1v-56.3h64l-2.5-38.4z"></path></svg>科研借单</span>'
  147. }
  148. function sta_style(i: number) {
  149. // 0k 1j
  150. var lty_color_tab = ['#fe3e12', '#c5c8ce', '#00ff00', '#00ff00', '#c5c8ce', '#fe3e12', '#fe3e12', '#c5c8ce'];
  151. var sta_str = ['待审批', '已驳回', '待使用', '使用中', '已归还', '已逾期', '待审批', '已驳回']
  152. return '<span style="color:' + lty_color_tab[i] + ';font-size:0.8vw">' + sta_str[i] + '</span>';
  153. }
  154. //大屏操作
  155. const timer: any = ref(null);
  156. const checkBackendStatus: any = async () => {
  157. const response = await createAxios({
  158. url: '/api/ScreenData/getCurrent',
  159. method: 'get',
  160. }
  161. ).then(async (val: any) => {
  162. console.log(val.data)
  163. if (val.code == 1) {
  164. if (val.data.data.types == 'opt1') {
  165. setTimeout(() => {
  166. console.log(val.data.data.time* 60 * 1000)
  167. router.push('/home');
  168. }, val.data.data.time * 60 * 1000)
  169. }
  170. }
  171. })
  172. };
  173. onMounted(() => {
  174. // 每5秒轮询一次
  175. timer.value = setInterval(checkBackendStatus, 5000);
  176. });
  177. onUnmounted(() => {
  178. // 清除定时器
  179. clearInterval(timer.value);
  180. });
  181. // 列表
  182. let config: any = reactive({
  183. header: ['<span style="color:#20dbfd;font-weight: bold;font-size:0.9vw">仪器类型</span>', '<span style="color:#20dbfd;font-weight: bold;font-size:0.9vw">借单时间</span>', '<span style="color:#20dbfd;font-weight: bold;font-size:0.9vw">领用人</span>', '<span style="color:#20dbfd;font-weight: bold;font-size:0.9vw">借单状态</span>'],
  184. headerBGC: '',
  185. indexHeader: '',
  186. oddRowBGC: '#31416042',
  187. evenRowBGC: '',
  188. columnWidth: [110],
  189. align: ['center'],
  190. rowNum: 4,
  191. columnWidth: [130, 200, 100, 100],
  192. })
  193. await createAxios({
  194. url: '/api/ScreenData/getdata',
  195. method: 'get',
  196. },
  197. {
  198. loading: true,
  199. }
  200. ).then(async (val: any) => {
  201. // console.log(val)
  202. // yiqiData.value = val.data
  203. // console.log(yiqiData.value)
  204. Object.assign(ltydata, val.data);
  205. var reb_labborrow = [];
  206. ltydata.labborrow.forEach(elm => {
  207. reb_labborrow.push([
  208. pps_svg(elm.purpose),
  209. '<span style="font-size:0.8vw">' + elm.create_time + '</span>',
  210. '<span style="font-size:0.8vw">' + elm.username + '</span>',
  211. sta_style(elm.status)
  212. ])
  213. });
  214. config.data = reb_labborrow;
  215. console.log(ltydata)
  216. })
  217. // 排名
  218. datas.value = Object.entries(ltydata.q).map(entry => ({
  219. name: entry[0],
  220. value: entry[1]
  221. }));
  222. console.log('s', datas);
  223. const config2 = reactive({
  224. data: datas,
  225. unit: '台',
  226. color: '#409EFF',
  227. })
  228. // 月份柱状图
  229. mouthsData.value = Object.entries(ltydata.mq).map(entry => ({
  230. key: entry[0],
  231. value: entry[1]
  232. }));
  233. console.log("mouthsData", mouthsData.value);
  234. // 获取当前月份
  235. const currentMonth = computed(() => {
  236. return dayjs().format('MM');
  237. });
  238. // 筛选出当前月和前5个月的数据
  239. const currentAndPreviousFiveMonthsData = computed(() => {
  240. const now = dayjs();
  241. const filteredData = [];
  242. for (let i = 0; i < 6; i++) {
  243. const month = now.subtract(i, 'month').format('MM');
  244. const dataItem = mouthsData.value.find(item => item.key === month);
  245. if (dataItem) {
  246. filteredData.push(dataItem);
  247. }
  248. }
  249. return filteredData;
  250. });
  251. console.log("currentAndPreviousFiveMonthsData", currentAndPreviousFiveMonthsData.value)
  252. currentAndPreviousFiveMonthsData.value.reverse();
  253. const keys = ref();
  254. const values = ref();
  255. // 提取键和值
  256. keys.value = currentAndPreviousFiveMonthsData.value.map(item => item.key);
  257. values.value = currentAndPreviousFiveMonthsData.value.map(item => item.value);
  258. console.log('Keys:', keys.value);
  259. console.log('Values:', values.value);
  260. const monthNumberToChineseMap = {
  261. '01': '一月',
  262. '02': '二月',
  263. '03': '三月',
  264. '04': '四月',
  265. '05': '五月',
  266. '06': '六月',
  267. '07': '七月',
  268. '08': '八月',
  269. '09': '九月',
  270. '10': '十月',
  271. '11': '十一月',
  272. '12': '十二月'
  273. };
  274. // // 假设你有一个包含数字月份的数组
  275. // const numberMonths = ['03', '02', '01', '12', '11', '10'];
  276. // 转换为中文月份名称
  277. const chineseMonthNames = keys.value.map(month => monthNumberToChineseMap[month]);
  278. console.log(chineseMonthNames);
  279. const option = reactive({
  280. xAxis: [{
  281. type: 'category',
  282. data: chineseMonthNames,
  283. axisLabel: {
  284. textStyle: {
  285. color: '#fff', //坐标值得具体的颜色
  286. }
  287. },
  288. },
  289. ],
  290. yAxis: [{
  291. type: 'value',
  292. axisLabel: {
  293. textStyle: {
  294. color: '#fff', //坐标值得具体的颜色
  295. }
  296. },
  297. }],
  298. grid: {
  299. left: '3%',
  300. right: '4%',
  301. bottom: '3%',
  302. top: '12%',
  303. containLabel: true
  304. },
  305. series: [
  306. {
  307. data: values.value,
  308. type: 'bar',
  309. showBackground: true,
  310. barWidth: '60%',
  311. itemStyle: {
  312. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  313. { offset: 0, color: '#83bff6' },
  314. { offset: 0.5, color: '#188df0' },
  315. { offset: 1, color: '#188df0' }
  316. ])
  317. },
  318. label: {
  319. show: true, //开启显示
  320. position: 'top', //在上方显示
  321. formatter: '{c}',//显示百分号
  322. textStyle: { //数值样式
  323. color: '#fff',//字体颜色
  324. fontSize: 16//字体大小
  325. }
  326. },
  327. }
  328. ]
  329. })
  330. </script>
  331. <style scoped>
  332. video {
  333. width: 100%;
  334. position: absolute;
  335. /* top: 0; */
  336. left: 0;
  337. bottom: -110px;
  338. }
  339. .beijin {
  340. width: 100%;
  341. height: 100%;
  342. position: absolute;
  343. z-index: -1;
  344. top: 0;
  345. background-color: rgb(23, 23, 23) !important;
  346. }
  347. .lunbo_con {
  348. height: 14vw;
  349. }
  350. .yiqi_box3 {
  351. width: 100%;
  352. margin-bottom: 1vw;
  353. }
  354. /* .box2_right_con{
  355. height: 12vw;
  356. } */
  357. .yiqi_box2 {
  358. height: 14vw;
  359. }
  360. .box2_center_con {
  361. height: 12vw;
  362. }
  363. .box2_left,
  364. .box2_center,
  365. .box2_right {
  366. float: left;
  367. }
  368. .box2_left_title,
  369. .box2_center_title,
  370. .box2_right_title {
  371. color: #ffffff;
  372. font-weight: bold;
  373. font-size: 1vw;
  374. margin: 0.5vw;
  375. }
  376. .box2_left {
  377. margin-left: 2vw;
  378. width: 27vw;
  379. height: 14vw;
  380. /* background-color: #747474; */
  381. }
  382. .shuanshu {
  383. margin-left: 33%;
  384. }
  385. .visual_conTop1 .danshu {
  386. width: 99%;
  387. }
  388. .visual_shuju {
  389. width: 100%;
  390. }
  391. .yiqi_box {
  392. width: 100%;
  393. }
  394. .visual_box {
  395. height: 6vw;
  396. }
  397. .visual_box .visual_title {
  398. position: relative;
  399. height: 2vw;
  400. }
  401. .visual_box .visual_title span[data-v-8733ac73] {
  402. color: #fff;
  403. font-size: 1.2vw;
  404. line-height: 1.5vw;
  405. margin-left: 1vw;
  406. }
  407. .visual_con {
  408. height: 100%;
  409. }
  410. .visual_con .visual_conTop {
  411. height: 6.5vw;
  412. margin-top: 6vw;
  413. }
  414. .visual_con .visual_conTop .visual_conTop_box {
  415. height: 100%;
  416. padding: 0 3px;
  417. }
  418. .visual_con .visual_conTop .visual_conTop1 {
  419. width: 25%;
  420. height: 100%;
  421. float: left;
  422. }
  423. .visual_con .visual_conTop .visual_conTop1>div {
  424. background: url(../images/ksh40.png) no-repeat;
  425. background-size: 100% 100%;
  426. }
  427. .visual_con .visual_conTop .visual_conTop2 {
  428. width: 25%;
  429. height: 100%;
  430. float: left;
  431. }
  432. .visual_con .visual_conTop .visual_conTop2>div {
  433. background: url(../images/ksh39.png) no-repeat;
  434. background-size: 100% 100%;
  435. }
  436. .visual_right {
  437. width: 25%;
  438. height: 900px;
  439. float: right;
  440. }
  441. .visual_con .visual_conTop .visual_conTop_box>div {
  442. height: 100%;
  443. text-align: center;
  444. }
  445. .visual_con .visual_conTop .visual_conTop_box>div h3 {
  446. color: #fff;
  447. font-size: 1vw;
  448. }
  449. .visual_con .visual_conTop .visual_conTop_box>div p {
  450. float: left;
  451. line-height: 4vw;
  452. color: #20dbfd;
  453. text-shadow: 0 0 0.8vw #00d8ff;
  454. font-size: 2.5vw;
  455. font-family: 'yjsz';
  456. }
  457. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil {
  458. width: 31%;
  459. height: 4vw;
  460. float: left;
  461. padding-top: 1.2vw;
  462. font-size: 0.7vw;
  463. margin-left: 0.5vw;
  464. }
  465. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil a {
  466. display: block;
  467. text-align: left;
  468. color: #fff;
  469. }
  470. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil span {
  471. display: inline-block;
  472. margin-left: 0.2vw;
  473. }
  474. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil a.sz {
  475. color: #ff9900;
  476. }
  477. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil a.xd {
  478. color: #12fe81;
  479. }
  480. .visual_con .visual_conTop .visual_conTop_box>div .conTop_smil a.null {
  481. visibility: hidden;
  482. }
  483. .home {
  484. width: 800px;
  485. height: 300px;
  486. }
  487. .bg {
  488. width: 100vw;
  489. height: 100vh;
  490. background: url(/@/assets/bg.jpg) repeat;
  491. background-size: 100%;
  492. color: var(--el-color-white);
  493. z-index: -1;
  494. position: absolute;
  495. background-attachment: fixed
  496. }
  497. </style>
  498. <style>
  499. .ranking-value {
  500. font-size: 0.9vw;
  501. }
  502. .rank {
  503. font-size: 0.8vw;
  504. }
  505. .info-name {
  506. font-size: 0.8vw;
  507. }
  508. .dslca .rank{
  509. width: auto !important;
  510. margin-right: 5px;
  511. }
  512. .dslca .ranking-info{
  513. line-height: 20px;
  514. }
  515. .dslca .row-item{
  516. margin-bottom: 0px;
  517. }
  518. .dslca .ranking-value{
  519. margin-right: 5px;
  520. }
  521. .dslca .dv-scroll-ranking-board .ranking-column{
  522. margin-top: 1px !important;
  523. }
  524. </style>