index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <template>
  2. <transition name="slide-up">
  3. <div v-if="true" class="foster-table">
  4. <div class="table-container yes-events">
  5. <div class="table-box">
  6. <div class="table-title">
  7. <div class="file-title">
  8. <img src="@/assets/images/common/chart-yellow.png" alt="" />
  9. 时空容器
  10. </div>
  11. <div class="right-btn">
  12. <el-select
  13. class="select-item common-dark-select"
  14. v-model="yearVal"
  15. @change="changeSelect"
  16. placeholder="请选择"
  17. popper-class="focus-farm-select"
  18. style="width: 126px"
  19. >
  20. <el-option
  21. v-for="item in areaOptions"
  22. :key="item.value"
  23. :label="item.label"
  24. :value="item.value"
  25. />
  26. </el-select>
  27. <div class="put-btn" @click="toggleTable">收起</div>
  28. </div>
  29. </div>
  30. <div class="table-content">
  31. <div class="table-item" v-for="(item, index) in baseList" :key="index">
  32. <div class="item-name">{{ item[0].name }}</div>
  33. <div class="data-list">
  34. <img
  35. v-for="(ele, idx) in item"
  36. :key="idx"
  37. :style="{ left: ele.progress + '%' }"
  38. :src="getImageSrc(ele.id, index)"
  39. alt=""
  40. @click="handleItem(ele.id, index)"
  41. />
  42. </div>
  43. </div>
  44. <!-- <div class="table-item">
  45. <div class="item-name">污染态势</div>
  46. <div class="data-list">
  47. <div
  48. class="risk"
  49. v-for="(item, index) in list4"
  50. :key="index"
  51. :style="{ left: item.progress + '%',width:item.width + '%' }"
  52. >
  53. {{item.name}}
  54. </div>
  55. </div>
  56. </div> -->
  57. <div class="table-item">
  58. <div class="item-name">风险事件</div>
  59. <div class="data-list">
  60. <div
  61. class="risk"
  62. v-for="(item, index) in list5"
  63. :key="index"
  64. :style="{ left: item.progress + '%', width: item.width + '%' }"
  65. >
  66. {{ item.name.slice(0, 2) }}
  67. </div>
  68. </div>
  69. </div>
  70. <div class="table-item">
  71. <time-line></time-line>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </transition>
  78. </template>
  79. <script setup>
  80. import { ref, onMounted } from "vue";
  81. import eventBus from "@/api/eventBus";
  82. import timeLine from "./timeLine.vue";
  83. import { useRouter } from "vue-router";
  84. // 预导入所有图片资源
  85. import icon1 from "@/assets/images/spaceTime/icon-1.png";
  86. import icon2 from "@/assets/images/spaceTime/icon-2.png";
  87. import icon3 from "@/assets/images/spaceTime/icon-3.png";
  88. import iconAct1 from "@/assets/images/spaceTime/icon-act-1.png";
  89. import iconAct2 from "@/assets/images/spaceTime/icon-act-2.png";
  90. import iconAct3 from "@/assets/images/spaceTime/icon-act-3.png";
  91. const router = useRouter();
  92. const curId = ref(null);
  93. // 获取图片路径的方法
  94. const getImageSrc = (id, index) => {
  95. const isActive = id === curId.value;
  96. const imageNumber = index + 1;
  97. // 使用预导入的图片资源
  98. const imageMap = {
  99. 'icon-1': icon1,
  100. 'icon-2': icon2,
  101. 'icon-3': icon3,
  102. 'icon-act-1': iconAct1,
  103. 'icon-act-2': iconAct2,
  104. 'icon-act-3': iconAct3,
  105. };
  106. const imageKey = `${isActive ? 'icon-act' : 'icon'}-${imageNumber}`;
  107. return imageMap[imageKey] || '';
  108. };
  109. const handleItem = (id, index) => {
  110. if (curId.value === id) {
  111. curId.value = null;
  112. } else {
  113. curId.value = id;
  114. }
  115. const filterArr = baseList.value[index].filter((item) => item.id === curId.value);
  116. emit("fosterCallback", filterArr[0] || {});
  117. };
  118. const emit = defineEmits(["fosterCallback", "collapse"]);
  119. const yearVal = ref("2021");
  120. const areaOptions = ref([
  121. { label: "2024年", value: "2024" },
  122. { label: "2023年", value: "2023" },
  123. { label: "2022年", value: "2022" },
  124. { label: "2021年", value: "2021" },
  125. { label: "2020年", value: "2020" },
  126. { label: "2019年", value: "2019" },
  127. { label: "2018年", value: "2018" },
  128. ]);
  129. const toggleTable = () => {
  130. emit("collapse");
  131. };
  132. const baseList = ref([]);
  133. const list4 = ref([]);
  134. const list5 = ref([]);
  135. function fetchTableData() {
  136. // VE_API.spaceTime.containerMenu({ year: yearVal.value }).then((res) => {
  137. const res = {
  138. code: 0,
  139. msg: "success",
  140. data: [
  141. {
  142. id: "52",
  143. name: "高温风险",
  144. startDate: "2021-05-10",
  145. type: 4,
  146. endDate: "2021-05-24",
  147. progress: 36.09,
  148. width: 3.8499999999999943,
  149. tif: "",
  150. },
  151. {
  152. id: "53",
  153. name: "高温风险",
  154. startDate: "2021-05-26",
  155. type: 4,
  156. endDate: "2021-06-03",
  157. progress: 40.5,
  158. width: 2.200000000000003,
  159. tif: "",
  160. },
  161. {
  162. id: "54",
  163. name: "高温风险",
  164. startDate: "2021-06-09",
  165. type: 4,
  166. endDate: "2021-06-11",
  167. progress: 44.35,
  168. width: 0.5499999999999972,
  169. tif: "",
  170. },
  171. {
  172. id: "55",
  173. name: "阴雨高湿",
  174. startDate: "2021-06-12",
  175. type: 4,
  176. endDate: "2021-06-14",
  177. progress: 45.18,
  178. width: 0.5499999999999972,
  179. tif: "",
  180. },
  181. {
  182. id: "56",
  183. name: "高温风险",
  184. startDate: "2021-06-15",
  185. type: 4,
  186. endDate: "2021-06-22",
  187. progress: 46.01,
  188. width: 1.9200000000000017,
  189. tif: "",
  190. },
  191. {
  192. id: "57",
  193. name: "高温风险",
  194. startDate: "2021-06-26",
  195. type: 4,
  196. endDate: "2021-07-06",
  197. progress: 49.04,
  198. width: 2.75,
  199. tif: "",
  200. },
  201. {
  202. id: "58",
  203. name: "高温风险",
  204. startDate: "2021-07-10",
  205. type: 4,
  206. endDate: "2021-07-16",
  207. progress: 52.89,
  208. width: 1.6599999999999966,
  209. tif: "",
  210. },
  211. {
  212. id: "59",
  213. name: "高温风险",
  214. startDate: "2021-07-24",
  215. type: 4,
  216. endDate: "2021-07-27",
  217. progress: 56.75,
  218. width: 0.8299999999999983,
  219. tif: "",
  220. },
  221. {
  222. id: "60",
  223. name: "阴雨高湿",
  224. startDate: "2021-08-02",
  225. type: 4,
  226. endDate: "2021-08-07",
  227. progress: 59.23,
  228. width: 1.3800000000000026,
  229. tif: "",
  230. },
  231. {
  232. id: "61",
  233. name: "高温风险",
  234. startDate: "2021-08-17",
  235. type: 4,
  236. endDate: "2021-08-20",
  237. progress: 63.36,
  238. width: 0.8299999999999983,
  239. tif: "",
  240. },
  241. {
  242. id: "62",
  243. name: "高温风险",
  244. startDate: "2021-08-22",
  245. type: 4,
  246. endDate: "2021-08-25",
  247. progress: 64.74,
  248. width: 0.8200000000000074,
  249. tif: "",
  250. },
  251. {
  252. id: "63",
  253. name: "高温风险",
  254. startDate: "2021-09-08",
  255. type: 4,
  256. endDate: "2021-09-13",
  257. progress: 69.42,
  258. width: 1.3799999999999955,
  259. tif: "",
  260. },
  261. {
  262. id: "64",
  263. name: "阴雨高湿",
  264. startDate: "2021-09-24",
  265. type: 4,
  266. endDate: "2021-09-26",
  267. progress: 73.83,
  268. width: 0.5499999999999972,
  269. tif: "",
  270. },
  271. {
  272. id: "65",
  273. name: "阴雨高湿",
  274. startDate: "2021-10-08",
  275. type: 4,
  276. endDate: "2021-10-11",
  277. progress: 77.69,
  278. width: 0.8200000000000074,
  279. tif: "",
  280. },
  281. {
  282. id: "710976873449918464",
  283. name: "遥感指标",
  284. startDate: "2021-01-01",
  285. type: 2,
  286. endDate: null,
  287. progress: 0.55,
  288. width: null,
  289. tif: '["CHLA_202101","MNDWI_202101","NDCI_202101","TSI_202101"]',
  290. },
  291. {
  292. id: "710976873500250112",
  293. name: "遥感指标",
  294. startDate: "2021-02-01",
  295. type: 2,
  296. endDate: null,
  297. progress: 9.09,
  298. width: null,
  299. tif: '["CHLA_202102","MNDWI_202102","NDCI_202102","TSI_202102"]',
  300. },
  301. {
  302. id: "710976873500250113",
  303. name: "遥感指标",
  304. startDate: "2021-05-01",
  305. type: 2,
  306. endDate: null,
  307. progress: 33.61,
  308. width: null,
  309. tif: '["CHLA_202105","MNDWI_202105","NDCI_202105","TSI_202105"]',
  310. },
  311. {
  312. id: "710976873500250114",
  313. name: "遥感指标",
  314. startDate: "2021-06-01",
  315. type: 2,
  316. endDate: null,
  317. progress: 42.15,
  318. width: null,
  319. tif: '["CHLA_202106","MNDWI_202106","NDCI_202106","TSI_202106"]',
  320. },
  321. {
  322. id: "710976873500250115",
  323. name: "自净能力",
  324. startDate: "2021-06-15",
  325. type: 0,
  326. endDate: null,
  327. progress: 46.01,
  328. width: null,
  329. tif: '["zijing_20210615"]',
  330. },
  331. {
  332. id: "710976873500250116",
  333. name: "污染负荷",
  334. startDate: "2021-06-15",
  335. type: 1,
  336. endDate: null,
  337. progress: 46.01,
  338. width: null,
  339. tif: '["fuhe_20210615"]',
  340. },
  341. {
  342. id: "710976873504444416",
  343. name: "自净能力",
  344. startDate: "2021-06-29",
  345. type: 0,
  346. endDate: null,
  347. progress: 49.86,
  348. width: null,
  349. tif: '["zijing_20210629"]',
  350. },
  351. {
  352. id: "710976873504444417",
  353. name: "污染负荷",
  354. startDate: "2021-06-29",
  355. type: 1,
  356. endDate: null,
  357. progress: 49.86,
  358. width: null,
  359. tif: '["fuhe_20210629"]',
  360. },
  361. {
  362. id: "710976873504444418",
  363. name: "遥感指标",
  364. startDate: "2021-07-01",
  365. type: 2,
  366. endDate: null,
  367. progress: 50.41,
  368. width: null,
  369. tif: '["CHLA_202107","MNDWI_202107","NDCI_202107","TSI_202107"]',
  370. },
  371. {
  372. id: "710976873504444419",
  373. name: "污染负荷",
  374. startDate: "2021-07-13",
  375. type: 1,
  376. endDate: null,
  377. progress: 53.72,
  378. width: null,
  379. tif: '["fuhe_20210713"]',
  380. },
  381. {
  382. id: "710976873504444420",
  383. name: "自净能力",
  384. startDate: "2021-07-13",
  385. type: 0,
  386. endDate: null,
  387. progress: 53.72,
  388. width: null,
  389. tif: '["zijing_20210713"]',
  390. },
  391. {
  392. id: "710976873504444421",
  393. name: "自净能力",
  394. startDate: "2021-07-29",
  395. type: 0,
  396. endDate: null,
  397. progress: 58.13,
  398. width: null,
  399. tif: '["zijing_20210729"]',
  400. },
  401. {
  402. id: "710976873504444422",
  403. name: "污染负荷",
  404. startDate: "2021-07-29",
  405. type: 1,
  406. endDate: null,
  407. progress: 58.13,
  408. width: null,
  409. tif: '["fuhe_20210729"]',
  410. },
  411. {
  412. id: "710976873504444423",
  413. name: "遥感指标",
  414. startDate: "2021-08-01",
  415. type: 2,
  416. endDate: null,
  417. progress: 58.95,
  418. width: null,
  419. tif: '["CHLA_202108","MNDWI_202108","NDCI_202108","TSI_202108"]',
  420. },
  421. {
  422. id: "710976873504444424",
  423. name: "污染负荷",
  424. startDate: "2021-08-12",
  425. type: 1,
  426. endDate: null,
  427. progress: 61.98,
  428. width: null,
  429. tif: '["fuhe_20210812"]',
  430. },
  431. {
  432. id: "710976873504444425",
  433. name: "自净能力",
  434. startDate: "2021-08-12",
  435. type: 0,
  436. endDate: null,
  437. progress: 61.98,
  438. width: null,
  439. tif: '["zijing_20210812"]',
  440. },
  441. {
  442. id: "710976873504444426",
  443. name: "遥感指标",
  444. startDate: "2021-09-01",
  445. type: 2,
  446. endDate: null,
  447. progress: 67.49,
  448. width: null,
  449. tif: '["CHLA_202109","MNDWI_202109","NDCI_202109","TSI_202109"]',
  450. },
  451. {
  452. id: "710976873504444427",
  453. name: "遥感指标",
  454. startDate: "2021-10-01",
  455. type: 2,
  456. endDate: null,
  457. progress: 75.76,
  458. width: null,
  459. tif: '["CHLA_202110","MNDWI_202110","NDCI_202110","TSI_202110"]',
  460. },
  461. {
  462. id: "710976873504444428",
  463. name: "遥感指标",
  464. startDate: "2021-11-01",
  465. type: 2,
  466. endDate: null,
  467. progress: 84.3,
  468. width: null,
  469. tif: '["CHLA_202111","MNDWI_202111","NDCI_202111","TSI_202111"]',
  470. },
  471. {
  472. id: "710976873508638720",
  473. name: "遥感指标",
  474. startDate: "2021-12-01",
  475. type: 2,
  476. endDate: null,
  477. progress: 92.56,
  478. width: null,
  479. tif: '["CHLA_202112","MNDWI_202112","NDCI_202112","TSI_202112"]',
  480. },
  481. ],
  482. extData: null,
  483. success: true,
  484. };
  485. baseList.value.push(res.data.filter((item) => item.type === 0));
  486. baseList.value.push(res.data.filter((item) => item.type === 1));
  487. baseList.value.push(res.data.filter((item) => item.type === 2));
  488. list4.value = res.data.filter((item) => item.type === 3);
  489. list5.value = res.data.filter((item) => item.type === 4);
  490. // });
  491. }
  492. function changeSelect() {
  493. fetchTableData();
  494. eventBus.emit("changeSelect", yearVal.value);
  495. }
  496. onMounted(() => {
  497. fetchTableData();
  498. });
  499. </script>
  500. <style lang="scss" scoped>
  501. .foster-table {
  502. width: 100%;
  503. position: relative;
  504. min-height: 70px;
  505. will-change: transform, opacity;
  506. .table-container {
  507. background: rgba(10, 10, 10, 0.8);
  508. border: 1px solid rgba(255, 212, 137, 0.5);
  509. border-radius: 8px;
  510. border-top: 1px solid rgba(255, 212, 137, 0.8);
  511. ::v-deep {
  512. .el-select__wrapper {
  513. background: rgba(0, 0, 0, 0.3);
  514. box-shadow: 0 0 0 1px #FFD489 inset;
  515. height: 32px;
  516. line-height: 32px;
  517. .el-select__caret {
  518. color: #ffd489;
  519. }
  520. }
  521. .el-select__placeholder {
  522. color: #f7be5a;
  523. font-size: 16px;
  524. text-align: center;
  525. }
  526. .el-select__input {
  527. color: #f7be5a;
  528. }
  529. }
  530. }
  531. .table-box {
  532. padding: 9px 16px;
  533. border-radius: 8px;
  534. background: linear-gradient(180deg, rgba(255, 239, 187, 0.25) 0%, #0a0a0a 16%);
  535. }
  536. .table-title {
  537. display: flex;
  538. align-items: center;
  539. justify-content: space-between;
  540. padding-bottom: 12px;
  541. .right-btn {
  542. display: inline-flex;
  543. align-items: center;
  544. .put-btn {
  545. margin-left: 10px;
  546. background: rgba(255, 255, 255, 0.1);
  547. border-radius: 4px;
  548. color: #fff;
  549. font-size: #ffffff;
  550. padding: 4px 23px;
  551. cursor: pointer;
  552. }
  553. }
  554. }
  555. .file-title {
  556. font-size: 20px;
  557. color: #ffd489;
  558. }
  559. }
  560. .table-content {
  561. overflow-x: auto;
  562. .table-item {
  563. width: 100%;
  564. display: flex;
  565. align-items: center;
  566. border-top: 1px dashed rgba(255, 255, 255, 0.5);
  567. padding-top: 8px;
  568. .item-name {
  569. color: #f3c11d;
  570. font-family: "PangMenZhengDao";
  571. margin-right: 12px;
  572. width: 40px;
  573. text-align: center;
  574. }
  575. .data-list {
  576. width: 100%;
  577. position: relative;
  578. display: flex;
  579. align-items: center;
  580. img {
  581. width: 36px;
  582. height: 36px;
  583. position: absolute;
  584. cursor: pointer;
  585. }
  586. img + img {
  587. margin-left: 20px;
  588. }
  589. .risk {
  590. border: 1px solid #f0ac37;
  591. background: rgba(247, 190, 90, 0.2);
  592. border-radius: 5px;
  593. font-size: 12px;
  594. color: #f0ac37;
  595. display: flex;
  596. align-items: center;
  597. justify-content: center;
  598. padding: 4px;
  599. box-sizing: border-box;
  600. text-align: center;
  601. height: 38px;
  602. position: absolute;
  603. }
  604. }
  605. }
  606. .table-item + .table-item {
  607. margin-top: 8px;
  608. }
  609. }
  610. /* 滑入滑出动画 */
  611. .slide-up-enter-active {
  612. transition: all 0.4s ease-out;
  613. }
  614. .slide-up-leave-active {
  615. transition: all 0.4s ease-in;
  616. }
  617. .slide-up-enter-from {
  618. transform: translateY(100%);
  619. opacity: 0;
  620. }
  621. .slide-up-leave-to {
  622. transform: translateY(100%);
  623. opacity: 0;
  624. }
  625. </style>