index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. <template>
  2. <div class="base-container no-events">
  3. <fnHeader showDate></fnHeader>
  4. <div class="content">
  5. <navigation @handleTab="handleTab"></navigation>
  6. <div class="left yes-events">
  7. <!-- <tool-list direction="left" :list="leftToolList" @handleActive="handleActiveLeft"></tool-list> -->
  8. <component :is="components[currentComponent]" />
  9. <!-- 箭头 -->
  10. <!-- <div class="arrow" @click="handleShrink('left')">
  11. <el-icon class="icon" color="#141414"><DArrowLeft /></el-icon>
  12. </div> -->
  13. </div>
  14. <!-- <div class="home-bottom">
  15. <div class="garden-file yes-events" :class="{ isShrink: isShrink }">
  16. <home-file></home-file>
  17. <div class="arrow" @click="handleShrink('bottom')">
  18. <el-icon class="icon" color="#141414"><DArrowLeft /></el-icon>
  19. </div>
  20. </div>
  21. </div> -->
  22. <div class="right yes-events">
  23. <div class="list adopt-list-wrap">
  24. <chart-box name="认养管理" arrow="">
  25. <el-tabs v-model="activeName" class="demo-tabs">
  26. <el-tab-pane label="认养列表" name="认养列表">
  27. <adopt-list></adopt-list>
  28. </el-tab-pane>
  29. <el-tab-pane label="客户列表" name="客户列表">
  30. <client-list></client-list>
  31. </el-tab-pane>
  32. <el-tab-pane label="认养申请" name="认养申请">
  33. <apply-list></apply-list>
  34. </el-tab-pane>
  35. <el-tab-pane label="确认地址" name="确认地址">
  36. <address-list></address-list>
  37. </el-tab-pane>
  38. </el-tabs>
  39. </chart-box>
  40. </div>
  41. <!-- <tool-list direction="right" :list="rightToolList" @handleActive="handleActiveRight"></tool-list> -->
  42. </div>
  43. <!-- 图例 -->
  44. <!-- <img class="legend yes-events" src="@/assets/images/home/legend-img.png" alt="" /> -->
  45. <div v-if="legendArr && legendArr.length" class="map-bg map-legend yes-events">
  46. <div class="item" v-for="(legend, legendI) in legendArr" :key="legendI">
  47. <span class="legend-block" :style="{background: legend.color}"></span>
  48. {{ legend.name }}
  49. </div>
  50. </div>
  51. <div v-else class="map-bg map-legend yes-events">
  52. <div class="item">
  53. <img src="@/assets/images/map/status/status-bh.png" alt="" />
  54. 病害异常
  55. </div>
  56. <div class="item">
  57. <img src="@/assets/images/map/status/status-ch.png" alt="" />
  58. 虫害异常
  59. </div>
  60. <div class="item">
  61. <img src="@/assets/images/map/status/status-zc.png" alt="" />
  62. 正常
  63. </div>
  64. <!-- <div class="item">
  65. <img src="@/assets/images/map/status/defalut-icon.png" alt="" />
  66. 无照片
  67. </div> -->
  68. </div>
  69. </div>
  70. </div>
  71. <div ref="mapRef" class="bottom-map"></div>
  72. <!-- 图片弹窗 -->
  73. <PicturePreview :imageUrl="urls" :curIndex="urlsIndex"></PicturePreview>
  74. <album-carousel></album-carousel>
  75. <PdfDialog title="果园报告"></PdfDialog>
  76. </template>
  77. <script setup>
  78. import { onMounted, onUnmounted, ref } from "vue";
  79. import config from "@/api/config.js";
  80. import timeLine from "@/components/timeLine.vue";
  81. import PicturePreview from "@/components/PicturePreview.vue";
  82. import fnHeader from "@/components/fnHeader.vue";
  83. import navigation from "@/components/navigation.vue";
  84. import chartBox from "@/components/chartBox.vue";
  85. import toolList from "@/components/toolList.vue";
  86. import fileBar from "@/components/fileBar.vue";
  87. import HomeMap from "./map/homeMap";
  88. import homePage from "./components/homePage.vue";
  89. import adoptList from "./components/adoptList.vue";
  90. import clientList from "./components/clientList.vue";
  91. import applyList from "./components/applyList.vue";
  92. import addressList from "./components/addressList.vue";
  93. import { useRouter } from "vue-router";
  94. import SamplePointLayer from "./map/samplePointLayer";
  95. import { useStore } from "vuex";
  96. import BlueRegionLayer from "./map/blueRegionLayer";
  97. import eventBus from "@/api/eventBus";
  98. import AlbumCarousel from "./album_compoents/albumCarousel.vue";
  99. // import compareDialog from "./album_compoents/compareDialog.vue";
  100. // import album from "./album/index.vue";
  101. import PdfDialog from "../../components/PdfDialog";
  102. let store = useStore();
  103. const components = {
  104. homePage,
  105. };
  106. //当前农场
  107. const currentFarm = {
  108. id: store.getters.userinfo.curFarmId,
  109. name: store.getters.userinfo.curFarmName,
  110. };
  111. //当前区域
  112. const currentRegion = {
  113. id: null,
  114. name: null,
  115. };
  116. let homeMap = new HomeMap();
  117. let samplePointLayer = null;
  118. let blueRegionLayer = null;
  119. const router = useRouter();
  120. const mapRef = ref();
  121. const activeName = ref('认养列表')
  122. onMounted(() => {
  123. homeMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
  124. // homeMap.initMap(store.getters.userinfo.location, mapRef.value);
  125. samplePointLayer = new SamplePointLayer(homeMap.kmap);
  126. blueRegionLayer = new BlueRegionLayer(homeMap.kmap);
  127. // getFarmLog()
  128. //区域切换监听事件
  129. eventBus.on("area:id", areaId);
  130. });
  131. onUnmounted(() => {
  132. eventBus.off("area:id", areaId);
  133. });
  134. const blueList = ref([]);
  135. const getBlueRegionList = (callback) => {
  136. let selectAll = undefined;
  137. if (regionId.value === 0) {
  138. selectAll = 1;
  139. }
  140. const areaId = selectAll ? undefined : regionId.value;
  141. VE_API.farm.blueRegionList({ farmId: organId.value, regionId: areaId, selectAll }).then(({ data }) => {
  142. blueList.value = data.map((item) => {
  143. let color = "rgba(255, 255, 255, 0.5)"; //失效区域
  144. if (item.status === 2) {
  145. //物候期风险
  146. // color = "rgba(63, 255, 53, 0.5)";
  147. color = "#2BFE00";
  148. }
  149. if (item.status === 3) {
  150. //生长异常
  151. // color = "rgba(255, 252, 61, 0.5)";
  152. color = "#FF7410";
  153. }
  154. if (item.status === 4) {
  155. //病虫害
  156. // color = "rgba(255, 73, 73, 0.5)";
  157. color = "#F82121";
  158. }
  159. return {
  160. ...item,
  161. color,
  162. };
  163. });
  164. blueRegionLayer.initData(blueList.value);
  165. callback && callback();
  166. });
  167. };
  168. // 图例
  169. const legendArr = ref([])
  170. const organId = ref(null);
  171. const regionId = ref(null);
  172. const tabName = ref("");
  173. const tabId = ref(0);
  174. eventBus.off("changePointLegend", toggleLegend)
  175. eventBus.on("changePointLegend", toggleLegend)
  176. function toggleLegend({colorObj}) {
  177. legendArr.value = colorObj?.list
  178. }
  179. //选项卡事件监听
  180. const handleTab = async ({ name, id, isUpdate, params, legend, colorObj }) => {
  181. eventBus.emit("changePointType", {legend, colorObj})
  182. legendArr.value = colorObj?.list
  183. console.log('name, id, isUpdate, params', name, id, isUpdate, params, legend, colorObj);
  184. tabName.value = name;
  185. tabId.value = id;
  186. if (id === 0) {
  187. getBlueRegionList();
  188. }
  189. };
  190. //区域切换监听事件
  191. function areaId({ areaId, farmId }) {
  192. organId.value = farmId;
  193. regionId.value = areaId;
  194. samplePointLayer.initData(farmId, areaId);
  195. if (tabId.value === 0) {
  196. getBlueRegionList();
  197. }
  198. }
  199. const urls = ref([]);
  200. const urlsIndex = ref(0);
  201. const currentComponent = ref("homePage");
  202. </script>
  203. <style lang="scss" scoped>
  204. .base-container {
  205. width: 100%;
  206. height: 100vh;
  207. color: #fff;
  208. position: absolute;
  209. box-sizing: border-box;
  210. z-index: 1;
  211. .content {
  212. width: 100%;
  213. height: calc(100% - 74px - 48px);
  214. display: flex;
  215. justify-content: space-between;
  216. box-sizing: border-box;
  217. .left,
  218. .right {
  219. width: 376px;
  220. height: 100%;
  221. margin-top: 10px;
  222. box-sizing: border-box;
  223. display: flex;
  224. position: relative;
  225. }
  226. .left {
  227. background: #101010;
  228. border-radius: 4px;
  229. border: 1px solid #444444;
  230. margin-left: 25px;
  231. .arrow {
  232. position: absolute;
  233. right: -16px;
  234. top: calc(50% - 40px);
  235. background: #fff;
  236. width: 16px;
  237. height: 80px;
  238. line-height: 80px;
  239. border-radius: 0 5px 5px 0;
  240. text-align: center;
  241. cursor: pointer;
  242. }
  243. }
  244. .right {
  245. width: 376px;
  246. margin-right: 25px;
  247. .adopt-list-wrap {
  248. ::v-deep {
  249. .el-tabs__item {
  250. color: #727272;
  251. }
  252. .el-tabs__active-bar {
  253. background-color: #FFFFFF;
  254. height: 1px;
  255. }
  256. .el-tabs__item.is-active {
  257. color: #fff;
  258. }
  259. .el-tabs__nav-wrap:after {
  260. height: 1px;
  261. background-color: rgba(127, 127, 127, 0.3);
  262. }
  263. .el-tabs__nav {
  264. left: 50%;
  265. transform: translateX(-50%) !important;
  266. }
  267. }
  268. }
  269. .list {
  270. width: 100%;
  271. height: 100%;
  272. overflow: auto;
  273. .btn-wrap {
  274. width: 100%;
  275. height: 25px;
  276. line-height: 25px;
  277. margin: 10px 0;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. div {
  282. width: 48%;
  283. height: 100%;
  284. color: #ffd489;
  285. border: 1px solid rgba(255, 213, 137, 0.6);
  286. border-radius: 2px;
  287. text-align: center;
  288. font-size: 12px;
  289. cursor: pointer;
  290. &.active {
  291. background: #ffd489;
  292. color: #000;
  293. }
  294. }
  295. }
  296. .img-box {
  297. width: 100%;
  298. height: calc(100% - 35px);
  299. overflow: auto;
  300. }
  301. .img-box1 {
  302. width: 100%;
  303. height: calc(100% - 10px);
  304. overflow: auto;
  305. margin-top: 10px;
  306. }
  307. .img-box2 {
  308. width: 100%;
  309. height: calc(100% - 45px);
  310. overflow: auto;
  311. margin-top: 10px;
  312. }
  313. img {
  314. width: 100%;
  315. height: auto;
  316. object-fit: cover;
  317. margin-bottom: 12px;
  318. cursor: pointer;
  319. }
  320. .mt {
  321. margin-top: -12px;
  322. }
  323. }
  324. }
  325. .overflow {
  326. overflow: auto;
  327. }
  328. .home-bottom {
  329. display: flex;
  330. align-items: flex-end;
  331. width: calc(100% - 60px - 376px * 2);
  332. height: 152px;
  333. align-self: flex-end;
  334. .time-wrap {
  335. height: 85px;
  336. }
  337. .fly-icon {
  338. width: 148px;
  339. height: 100%;
  340. margin-left: 27px;
  341. }
  342. .log-box {
  343. height: 34%;
  344. width: calc(100% - 340px - 28px);
  345. margin-right: 28px;
  346. .box-name {
  347. width: 89px;
  348. height: 22px;
  349. text-align: center;
  350. line-height: 22px;
  351. border-radius: 20px;
  352. margin: 10px 0 5px 6px;
  353. cursor: pointer;
  354. background: linear-gradient(0deg, #bba269 0%, #3d3523 100%);
  355. }
  356. .log-content {
  357. font-size: 12px;
  358. line-height: 1.5;
  359. padding: 0 18px;
  360. }
  361. .chart-wrap {
  362. width: 100%;
  363. height: calc(100% - 50px);
  364. .line {
  365. margin-top: 10px;
  366. margin-bottom: 12px;
  367. }
  368. img {
  369. width: 100%;
  370. margin-bottom: 10px;
  371. }
  372. }
  373. }
  374. .garden-file {
  375. position: relative;
  376. top: 10px;
  377. // height: 30%;
  378. // min-height: 210px;
  379. // width: 640px;
  380. transition: all 0.3s;
  381. width: 800px;
  382. height: 320px;
  383. overflow: hidden;
  384. &.isShrink {
  385. height: 66px;
  386. width: 450px;
  387. overflow: hidden;
  388. .arrow {
  389. .icon {
  390. transform: rotate(90deg);
  391. }
  392. }
  393. }
  394. .arrow {
  395. position: absolute;
  396. right: 56px;
  397. top: 36px;
  398. background: #fff;
  399. height: 16px;
  400. width: 80px;
  401. line-height: 16px;
  402. border-radius: 0 0 5px 5px;
  403. text-align: center;
  404. cursor: pointer;
  405. .icon {
  406. transform: rotate(270deg);
  407. }
  408. }
  409. }
  410. .file-box {
  411. height: 25%;
  412. min-height: 210px;
  413. width: 340px;
  414. position: relative;
  415. img {
  416. width: 100%;
  417. margin-top: 12px;
  418. }
  419. .arrow-icon {
  420. top: -32px;
  421. left: 50%;
  422. position: absolute;
  423. background: #fff;
  424. width: 16px;
  425. height: 80px;
  426. line-height: 80px;
  427. border-radius: 5px 0 0 5px;
  428. text-align: center;
  429. transform: translateX(-50%) rotate(270deg);
  430. }
  431. .edit-btn {
  432. padding: 2px 24px;
  433. background: #ffd489;
  434. border-radius: 4px;
  435. color: #000;
  436. }
  437. }
  438. }
  439. .legend {
  440. position: fixed;
  441. bottom: 8px;
  442. right: 64px;
  443. // width: 525px;
  444. height: 20px;
  445. }
  446. .map-bg {
  447. position: fixed;
  448. z-index: 2;
  449. background: rgba(35, 35, 35, 0.8);
  450. border-radius: 18px;
  451. padding: 7px 16px;
  452. right: 460px;
  453. }
  454. .map-btn {
  455. top: 19px;
  456. cursor: pointer;
  457. }
  458. .map-legend {
  459. bottom: 34px;
  460. .item {
  461. display: flex;
  462. align-items: center;
  463. font-size: 14px;
  464. img {
  465. width: 16px;
  466. margin-right: 6px;
  467. }
  468. .legend-block {
  469. width: 16px;
  470. height: 16px;
  471. box-sizing: border-box;
  472. border-radius: 50%;
  473. border: 2px solid #fff;
  474. margin-right: 6px;
  475. }
  476. }
  477. .legend-title {
  478. border-bottom: 1px solid rgba(102, 102, 102, 0.35);
  479. }
  480. .item + .item {
  481. padding-top: 10px;
  482. }
  483. }
  484. }
  485. }
  486. .bottom-map {
  487. width: 100%;
  488. height: 100vh;
  489. position: absolute;
  490. z-index: 0;
  491. }
  492. .compare-start-btn {
  493. position: absolute;
  494. z-index: 2;
  495. left: 50%;
  496. transform: translateX(-50%);
  497. cursor: pointer;
  498. bottom: 106px;
  499. // right: 445px;
  500. img {
  501. height: 55px;
  502. }
  503. }
  504. </style>
  505. <style lang="less">
  506. .file-wrap {
  507. &.map-file {
  508. width: 367px;
  509. position: relative;
  510. background: url("@/assets/images/home/file-bg.png") no-repeat top center / 100% 100%;
  511. margin-left: 12px;
  512. padding: 12px;
  513. .file-title {
  514. font-size: 20px;
  515. color: #ffd489;
  516. .tag {
  517. border: 1px solid #FFD489;
  518. border-radius: 4px;
  519. font-size: 12px;
  520. display: inline-block;
  521. width: 44px;
  522. height: 20px;
  523. text-align: center;
  524. line-height: 18px;
  525. margin-left: 8px;
  526. padding: 1px 4px;
  527. }
  528. }
  529. .overview-file {
  530. padding-top: 20px;
  531. .box-title {
  532. font-size: 16px;
  533. padding-left: 13px;
  534. margin-bottom: 16px;
  535. position: relative;
  536. display: flex;
  537. justify-content: space-between;
  538. color: #fff;
  539. &::before {
  540. content: "";
  541. position: absolute;
  542. left: 0;
  543. top: 3px;
  544. width: 3px;
  545. height: 16px;
  546. background: #fff;
  547. border-radius: 11px;
  548. }
  549. }
  550. .title {
  551. color: #f3c11d;
  552. font-size: 16px;
  553. font-family: "PangMenZhengDao";
  554. margin-bottom: 20px;
  555. .big {
  556. width: 13px;
  557. height: 13px;
  558. margin: -10px 0 0 4px;
  559. }
  560. .small {
  561. width: 7px;
  562. height: 7px;
  563. margin-left: -3px;
  564. }
  565. }
  566. .base-data {
  567. background: rgba(207, 207, 207, 0.1);
  568. border-radius: 4px;
  569. padding: 6px 0;
  570. display: flex;
  571. .base-item {
  572. flex: 1;
  573. text-align: center;
  574. .label {
  575. font-size: 12px;
  576. color: #666666;
  577. }
  578. .value {
  579. padding-top: 2px;
  580. font-size: 16px;
  581. color: #ffffff;
  582. }
  583. }
  584. .base-item + .base-item {
  585. border-left: 1px solid rgba(102, 102, 102, 0.42);
  586. }
  587. }
  588. .list {
  589. margin-top: 15px;
  590. width: max-content;
  591. font-size: 14px;
  592. .list-item {
  593. color: #bbbbbb;
  594. display: flex;
  595. margin-bottom: 8px;
  596. .list-name {
  597. color: #f3c11d;
  598. margin-right: 6px;
  599. img {
  600. width: 17px;
  601. height: 13px;
  602. }
  603. }
  604. }
  605. }
  606. }
  607. .overview-file + .overview-file {
  608. margin-top: 8px;
  609. }
  610. .box-wrap {
  611. display: flex;
  612. .box-item {
  613. // flex: 1;
  614. min-width: 109px;
  615. display: flex;
  616. flex-direction: column;
  617. justify-content: center;
  618. align-items: center;
  619. padding: 6px;
  620. box-sizing: border-box;
  621. background: rgba(207, 207, 207, 0.1);
  622. border-radius: 4px;
  623. border: 1px solid rgba(207, 207, 207, 0.1);
  624. cursor: pointer;
  625. .item-name {
  626. font-size: 12px;
  627. color: #666666;
  628. width: max-content;
  629. }
  630. .item-val {
  631. font-size: 18px;
  632. color: #fff;
  633. width: max-content;
  634. padding-top: 3px;
  635. }
  636. &.active {
  637. background: rgba(255, 212, 137, 0.16);
  638. border: 1px solid #ffd489;
  639. .item-name {
  640. color: #bbbbbb;
  641. }
  642. }
  643. }
  644. .box-item + .box-item {
  645. margin-left: 8px;
  646. }
  647. }
  648. }
  649. }
  650. </style>