index.vue 20 KB

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