index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <div class="base-container no-events">
  3. <fnHeader showDate></fnHeader>
  4. <div class="content">
  5. <navigation></navigation>
  6. <div class="left yes-events">
  7. <tool-list
  8. direction="left"
  9. :list="leftToolList"
  10. @handleActive="handleActiveLeft"
  11. ></tool-list>
  12. <component :is="components[currentComponent]" />
  13. </div>
  14. <div class="home-bottom">
  15. <div class="log-box yes-events">
  16. <chart-box class="overflow">
  17. <template #title-name>
  18. <div class="box-name" @click="handleSelectArea">果园日志</div>
  19. </template>
  20. <div class="log-content">
  21. 2月13日,共抽样193棵树,拍摄了193张照片
  22. </div>
  23. <div class="chart-wrap">
  24. <indicator-chart></indicator-chart>
  25. <!-- <img class="line" src="@/assets/images/home/time1.png" alt=""> -->
  26. <!-- <img src="@/assets/images/home/text.png" alt=""> -->
  27. </div>
  28. </chart-box>
  29. </div>
  30. <div class="file-box yes-events">
  31. <chart-box name="果园档案">
  32. <template #title-right>
  33. <el-icon class="arrow-icon cursor-pointer" color="#141414"
  34. ><DArrowLeft
  35. /></el-icon>
  36. <div class="edit-btn cursor-pointer" @click="toFilePage">编辑</div>
  37. </template>
  38. <!-- <file-bar></file-bar> -->
  39. <img src="@/assets/images/home/line-data.png" alt="">
  40. </chart-box>
  41. </div>
  42. </div>
  43. <div class="right yes-events">
  44. <div class="list">
  45. <chart-box name="农事列表" arrow="arrow-left">
  46. <template v-if="rightIndex===0">
  47. <img class="tabs" src="@/assets/images/home/ns-tabs.png" alt="">
  48. <div class="img-box">
  49. <img @click="handleAct(item)" v-for="item in 4" :key="item" :src="require(`@/assets/images/home/0${act<=2&&act==item?item+'-act':item}.png`)" alt="">
  50. </div>
  51. </template>
  52. <template v-if="rightIndex===1">
  53. <div class="img-box1">
  54. <img src="@/assets/images/home/fh01.png" alt="">
  55. <img src="@/assets/images/home/fh02.png" alt="">
  56. </div>
  57. </template>
  58. <template v-if="rightIndex===2">
  59. <div class="btn-wrap">
  60. <div :class="{active:btnIndex===0}" @click="handleBtn(0)">{{btnIndex===0&&btnName!=''?'采样分区:'+ btnName:'选择采样分区'}}</div>
  61. <div :class="{active:btnIndex===1}" @click="handleBtn(1)">{{btnIndex===1&&btnName!=''?'单树编号:'+ btnName:'选择树'}}</div>
  62. </div>
  63. <div class="img-box2" v-show="showPoint">
  64. <img v-if="showType==='point'" src="@/assets/images/home/line-chart.png" alt="">
  65. <img v-else src="@/assets/images/home/line-chart2.png" alt="">
  66. <img src="@/assets/images/home/fh01.png" alt="">
  67. </div>
  68. <div class="img-box2" v-show="!showPoint">
  69. <img v-if="showType==='point'" src="@/assets/images/home/line-chart1.png" alt="">
  70. <img v-else src="@/assets/images/home/line-chart3.png" alt="">
  71. <img src="@/assets/images/home/fh02.png" alt="">
  72. </div>
  73. </template>
  74. </chart-box>
  75. </div>
  76. <tool-list direction="right" :list="rightToolList" @handleActive="handleActiveRight"></tool-list>
  77. </div>
  78. <!-- 图例 -->
  79. <img class="legend yes-events" src="@/assets/images/home/legend.png" alt="">
  80. </div>
  81. </div>
  82. <div ref="mapRef" class="bottom-map"></div>
  83. <!-- 图片弹窗 -->
  84. <PicturePreview
  85. :imageUrl="urls"
  86. :curIndex="urlsIndex"
  87. ></PicturePreview>
  88. <album-carousel></album-carousel>
  89. <PdfDialog title="果园报告" ></PdfDialog>
  90. </template>
  91. <script setup>
  92. import { onMounted, ref } from "vue";
  93. import config from "@/api/config.js"
  94. import PicturePreview from "@/components/PicturePreview.vue";
  95. import fnHeader from "@/components/fnHeader.vue";
  96. import navigation from "@/components/navigation.vue";
  97. import chartBox from "@/components/chartBox.vue";
  98. import toolList from "@/components/toolList.vue";
  99. import fileBar from "@/components/fileBar.vue";
  100. import HomeMap from "./map/homeMap";
  101. import homePage from "./components/homePage.vue";
  102. import weatherPage from "./components/weatherPage.vue";
  103. import phenologyPage from "./components/phenologyPage.vue";
  104. import indicatorChart from "./components/indicatorChart.vue";
  105. import { useRouter } from "vue-router";
  106. import SamplePointLayer from "./map/samplePointLayer";
  107. import {useStore} from "vuex";
  108. import RegionLayer from "./map/regionLayer";
  109. import eventBus from "@/api/eventBus";
  110. import AlbumCarousel from "./album_compoents/albumCarousel.vue";
  111. import PdfDialog from "../../components/PdfDialog"
  112. let store = useStore()
  113. const components = {
  114. homePage,
  115. weatherPage,
  116. phenologyPage,
  117. };
  118. //当前农场
  119. const currentFarm = {
  120. id: store.getters.userinfo.curFarmId,
  121. name: store.getters.userinfo.curFarmName,
  122. }
  123. //当前区域
  124. const currentRegion = {
  125. id: null,
  126. name: null
  127. }
  128. let homeMap = new HomeMap();
  129. let samplePointLayer = null
  130. let regionLayer = null
  131. const router = useRouter();
  132. const mapRef = ref();
  133. onMounted(() => {
  134. homeMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
  135. // homeMap.initMap(store.getters.userinfo.location, mapRef.value);
  136. samplePointLayer = new SamplePointLayer(homeMap.kmap.map, currentFarm, currentRegion)
  137. regionLayer = new RegionLayer(homeMap.kmap.map, currentFarm, currentRegion)
  138. getYellow()
  139. });
  140. const urls = ref([])
  141. const urlsIndex = ref(0)
  142. const getYellow = () =>{
  143. VE_API.home.getYellowList().then(res =>{
  144. // urls.value = res.data.map(item =>{
  145. // return {
  146. // ...item,
  147. // imgPath:config.base_img_url2+item.cloudFilename
  148. // }
  149. // })
  150. // urls.value = [
  151. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-07.jpg",
  152. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-08.jpg",
  153. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-09.jpg",
  154. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-10.jpg",
  155. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-11.jpg",
  156. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-12.jpg",
  157. // "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-13.jpg",
  158. // ]
  159. })
  160. }
  161. const btnIndex = ref(null)
  162. const btnName = ref("")
  163. const handleBtn = (e) =>{
  164. btnName.value = ""
  165. btnIndex.value = e
  166. eventBus.emit("clear:area")
  167. samplePointLayer.updateAreaStatus(e===0?true:false)
  168. regionLayer.resetData()
  169. samplePointLayer.resetPoint()
  170. }
  171. //点击果园日志
  172. const handleSelectArea = () =>{
  173. btnName.value = ""
  174. btnIndex.value = null
  175. eventBus.emit("clear:area")
  176. regionLayer.resetData()
  177. samplePointLayer.resetPoint()
  178. samplePointLayer.updateAreaStatus(true)
  179. }
  180. //农事点击高亮
  181. const act = ref(null)
  182. const handleAct = (v) =>{
  183. act.value = v
  184. samplePointLayer.resetPoint()
  185. if(v===1){
  186. regionLayer.selectAreaMultiple([
  187. {value:2,color:"blue"},
  188. {value:4,color:"blue1"},
  189. {value:5,color:"blue2"},
  190. {value:7,color:"blue"},
  191. {value:13,color:"blue2"},
  192. ])
  193. }
  194. if(v===2){
  195. regionLayer.selectAreaMultiple([
  196. {value:1,color:"blue"},
  197. {value:2,color:"blue1"},
  198. {value:9,color:"blue2"},
  199. {value:12,color:"blue2"},
  200. ])
  201. }
  202. }
  203. //柱状图点击事件监听
  204. eventBus.on('echart:barClick',(e)=>{
  205. btnName.value = ""
  206. btnIndex.value = null
  207. eventBus.emit("clear:area")
  208. samplePointLayer.updateAreaStatus(false)
  209. const arr = ["花穗伸长", "啃食虫害","毛毡病"]
  210. const isDraw = arr.includes(e)
  211. const index = arr.indexOf(e)
  212. if(isDraw){
  213. if(index===0){
  214. regionLayer.selectAreaMultiple([
  215. {value:0,color:"green"},
  216. {value:1,color:"green"},
  217. {value:2,color:"green"},
  218. {value:3,color:"green1"},
  219. {value:4,color:"green1"},
  220. {value:5,color:"green2"},
  221. {value:6,color:"green1"},
  222. {value:7,color:"green2"},
  223. {value:8,color:"green2"},
  224. {value:9,color:"green"},
  225. {value:10,color:"green"},
  226. {value:11,color:"green1"},
  227. {value:12,color:"green2"},
  228. {value:13,color:"green"},
  229. {value:14,color:"green2"},
  230. ])
  231. }else if(index===1){
  232. regionLayer.selectAreaMultiple([{value:6,color:"red"}])
  233. }else{
  234. regionLayer.selectAreaMultiple([
  235. {value:12,color:"red2"},
  236. {value:10,color:"red"},
  237. {value:1,color:"red"}
  238. ])
  239. }
  240. }
  241. })
  242. //黄板点击事件监听
  243. eventBus.on('click:yellowBlock',(e)=>{
  244. const arr = ["113.61396985128522","113.61390710255375","113.61491218688275"]
  245. if(arr[0]==e){
  246. urls.value = ["HB-ws0y1menggxv"]
  247. urlsIndex.value = 0
  248. }
  249. if(arr[1]==e){
  250. urls.value = ["HB-ws0y1mg0pvd" ]
  251. urlsIndex.value = 3
  252. }
  253. if(arr[2]==e){
  254. urls.value = ["HB-ws0y1mg9wpcp"]
  255. urlsIndex.value = 6
  256. }
  257. eventBus.emit('dialog:show',true)
  258. })
  259. const showPoint = ref(true)
  260. const showType = ref("point")
  261. //地图点击事件
  262. eventBus.on('click:point',(e)=>{
  263. showType.value = "point"
  264. if(btnIndex.value===1){
  265. btnName.value=e.name
  266. if(e.value===1){
  267. showPoint.value = true
  268. samplePointLayer.updatePointStatus(true)
  269. }else{
  270. showPoint.value = false
  271. }
  272. }
  273. })
  274. //地图点击区域事件
  275. eventBus.on('click:area',(e)=>{
  276. showType.value = "area"
  277. if(btnIndex.value===0){
  278. btnName.value=e.name
  279. if(e.value===1){
  280. showPoint.value = true
  281. }else{
  282. showPoint.value = false
  283. }
  284. regionLayer.selectArea((e.name*1)===0?0: (e.name*1) - 1,"blue")
  285. }
  286. })
  287. eventBus.on('click:updateArea',(e)=>{
  288. btnName.value=e.name
  289. regionLayer.selectArea((e.name*1)===0?0: (e.name*1) - 1,"blue")
  290. })
  291. const currentComponent = ref("homePage");
  292. const handleActiveLeft = (e) => {
  293. currentComponent.value = e.componentName;
  294. };
  295. const leftToolList = [
  296. {
  297. title: "首页",
  298. name: "home",
  299. componentName: "homePage",
  300. },
  301. {
  302. title: "气象预警",
  303. componentName: "weatherPage",
  304. },
  305. {
  306. title: "物候调节",
  307. componentName: "phenologyPage",
  308. },
  309. {
  310. title: "病虫测报",
  311. },
  312. {
  313. title: "营养评估",
  314. },
  315. ];
  316. const rightIndex = ref(0)
  317. const handleActiveRight = ({index}) => {
  318. rightIndex.value = index
  319. btnIndex.value = null
  320. btnName.value = ""
  321. samplePointLayer.updateAreaStatus(false)
  322. regionLayer.resetData()
  323. samplePointLayer.resetPoint()
  324. if(index!==0){
  325. act.value = null
  326. }
  327. };
  328. const hanleRightIndex = (num) =>{
  329. rightIndex.value = num
  330. eventBus.emit('tool:updateAct',num)
  331. }
  332. const rightToolList = [
  333. {
  334. title: "农事列表",
  335. index:0,
  336. },
  337. {
  338. title: "处方分析",
  339. index:2,
  340. },
  341. {
  342. title: "复核对比",
  343. index:1,
  344. },
  345. ];
  346. // 跳转果园档案
  347. const toFilePage = () => {
  348. router.push('/garden-file')
  349. }
  350. </script>
  351. <style lang="scss" scoped>
  352. .base-container {
  353. width: 100%;
  354. height: 100vh;
  355. color: #fff;
  356. position: absolute;
  357. box-sizing: border-box;
  358. z-index: 1;
  359. .content {
  360. width: 100%;
  361. height: calc(100% - 74px - 48px);
  362. display: flex;
  363. justify-content: space-between;
  364. box-sizing: border-box;
  365. .left,
  366. .right {
  367. width: calc(376px + 54px);
  368. height: 100%;
  369. padding-top: 10px;
  370. box-sizing: border-box;
  371. display: flex;
  372. }
  373. .right {
  374. .list {
  375. width: 100%;
  376. height: 100%;
  377. .btn-wrap{
  378. width: 100%;
  379. height: 25px;
  380. line-height: 25px;
  381. margin: 10px 0;
  382. display: flex;
  383. align-items: center;
  384. justify-content: space-between;
  385. div{
  386. width: 48%;
  387. height: 100%;
  388. color: #FFD489;
  389. border: 1px solid rgba(255,213,137,0.6);
  390. border-radius: 2px;
  391. text-align: center;
  392. font-size: 12px;
  393. cursor: pointer;
  394. &.active{
  395. background: #FFD489;
  396. color: #000;
  397. }
  398. }
  399. }
  400. .img-box{
  401. width: 100%;
  402. height: calc(100% - 35px);
  403. overflow: auto;
  404. }
  405. .img-box1{
  406. width: 100%;
  407. height: calc(100% - 10px);
  408. overflow: auto;
  409. margin-top: 10px;
  410. }
  411. .img-box2{
  412. width: 100%;
  413. height: calc(100% - 45px);
  414. overflow: auto;
  415. margin-top: 10px;
  416. }
  417. img{
  418. width: 100%;
  419. height: auto;
  420. object-fit: cover;
  421. margin-bottom: 12px;
  422. cursor: pointer;
  423. }
  424. .mt{
  425. margin-top: -12px;
  426. }
  427. }
  428. }
  429. .overflow{
  430. overflow: auto;
  431. }
  432. .home-bottom {
  433. display: flex;
  434. align-items: flex-end;
  435. width: calc(100% - 430px - 430px - 72px);
  436. height: 100%;
  437. align-self: flex-end;
  438. .log-box {
  439. height: 34%;
  440. width: calc(100% - 340px - 28px);
  441. margin-right: 28px;
  442. .box-name{
  443. width: 89px;
  444. height: 22px;
  445. text-align: center;
  446. line-height: 22px;
  447. border-radius: 20px;
  448. margin: 10px 0 5px 6px;
  449. cursor: pointer;
  450. background: linear-gradient(0deg,#BBA269 0%, #3D3523 100%);
  451. }
  452. .log-content {
  453. font-size: 12px;
  454. line-height: 1.5;
  455. padding: 0 18px;
  456. }
  457. .chart-wrap{
  458. width: 100%;
  459. height: calc(100% - 50px);
  460. .line{
  461. margin-top: 10px;
  462. margin-bottom: 12px;
  463. }
  464. img{
  465. width: 100%;
  466. margin-bottom: 10px;
  467. }
  468. }
  469. }
  470. .file-box {
  471. height: 25%;
  472. min-height: 210px;
  473. width: 340px;
  474. position: relative;
  475. img{
  476. width: 100%;
  477. margin-top: 12px;
  478. }
  479. .arrow-icon {
  480. top: -32px;
  481. left: 50%;
  482. position: absolute;
  483. background: #fff;
  484. width: 16px;
  485. height: 80px;
  486. line-height: 80px;
  487. border-radius: 5px 0 0 5px;
  488. text-align: center;
  489. transform: translateX(-50%) rotate(270deg);
  490. }
  491. .edit-btn {
  492. padding: 2px 24px;
  493. background: #FFD489;
  494. border-radius: 4px;
  495. color: #000;
  496. }
  497. }
  498. }
  499. .legend{
  500. position: fixed;
  501. bottom: 8px;
  502. right: 64px;
  503. width: 525px;
  504. height: 16px;
  505. }
  506. }
  507. }
  508. .bottom-map {
  509. width: 100%;
  510. height: 100vh;
  511. position: absolute;
  512. z-index: 0;
  513. }
  514. </style>