index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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 name="果园日志">
  17. <div class="log-content">
  18. 10月8日,共抽样 **棵树 ,拍摄了 多少 张照片。10月8日,共抽样 **棵树 ,拍摄了 多少 张照片。10月8日,共抽样 **棵树 ,拍摄了 多少 张照片。10月8日,共抽样 **棵树 ,拍摄了 多少 张照片。10月8日,共抽样 **棵树 ,拍摄了 多少 张照片。
  19. </div>
  20. <div class="chart-wrap">
  21. <indicator-chart></indicator-chart>
  22. </div>
  23. </chart-box>
  24. </div>
  25. <div class="file-box yes-events">
  26. <chart-box name="果园档案">
  27. <template #title-right>
  28. <el-icon class="arrow-icon cursor-pointer" color="#141414"
  29. ><DArrowLeft
  30. /></el-icon>
  31. <div class="edit-btn cursor-pointer" @click="toFilePage">编辑</div>
  32. </template>
  33. <file-bar></file-bar>
  34. </chart-box>
  35. </div>
  36. </div>
  37. <div class="right yes-events">
  38. <div class="list">
  39. <chart-box name="农事列表" arrow="arrow-left">
  40. <div class="img-box">
  41. <img src="@/assets/images/home/ns.png" alt="">
  42. </div>
  43. </chart-box>
  44. </div>
  45. <tool-list direction="right" :list="rightToolList"></tool-list>
  46. </div>
  47. </div>
  48. </div>
  49. <div ref="mapRef" class="bottom-map"></div>
  50. </template>
  51. <script setup>
  52. import { onMounted, ref } from "vue";
  53. import fnHeader from "@/components/fnHeader.vue";
  54. import navigation from "@/components/navigation.vue";
  55. import chartBox from "@/components/chartBox.vue";
  56. import toolList from "@/components/toolList.vue";
  57. import fileBar from "@/components/fileBar.vue";
  58. import HomeMap from "./map/homeMap";
  59. import homePage from "./components/homePage.vue";
  60. import weatherPage from "./components/weatherPage.vue";
  61. import phenologyPage from "./components/phenologyPage.vue";
  62. import indicatorChart from "./components/indicatorChart.vue";
  63. import { useRouter } from "vue-router";
  64. import SamplePointLayer from "./map/samplePointLayer";
  65. import {useStore} from "vuex";
  66. import RegionLayer from "./map/regionLayer";
  67. import "./map/mockFarmLayer"
  68. let store = useStore()
  69. const components = {
  70. homePage,
  71. weatherPage,
  72. phenologyPage,
  73. };
  74. //当前农场
  75. const currentFarm = {
  76. id: store.getters.userinfo.curFarmId,
  77. name: store.getters.userinfo.curFarmName,
  78. }
  79. //当前区域
  80. const currentRegion = {
  81. id: null,
  82. name: null
  83. }
  84. let homeMap = new HomeMap();
  85. let samplePointLayer = null
  86. let regionLayer = null
  87. const router = useRouter();
  88. const mapRef = ref();
  89. onMounted(() => {
  90. homeMap.initMap(store.getters.userinfo.location, mapRef.value);
  91. samplePointLayer = new SamplePointLayer(homeMap.kmap.map, currentFarm, currentRegion)
  92. regionLayer = new RegionLayer(homeMap.kmap.map, currentFarm, currentRegion)
  93. });
  94. const currentComponent = ref("homePage");
  95. const handleActiveLeft = (e) => {
  96. currentComponent.value = e.componentName;
  97. };
  98. const leftToolList = [
  99. {
  100. title: "首页",
  101. name: "home",
  102. componentName: "homePage",
  103. },
  104. {
  105. title: "气象预警",
  106. componentName: "weatherPage",
  107. },
  108. {
  109. title: "物候调节",
  110. componentName: "phenologyPage",
  111. },
  112. {
  113. title: "病虫测报",
  114. },
  115. {
  116. title: "营养评估",
  117. },
  118. ];
  119. const rightToolList = [
  120. {
  121. title: "农事列表",
  122. },
  123. {
  124. title: "复核对比",
  125. },
  126. {
  127. title: "处方分析",
  128. },
  129. ];
  130. // 跳转果园档案
  131. const toFilePage = () => {
  132. router.push('/garden-file')
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .base-container {
  137. width: 100%;
  138. height: 100vh;
  139. color: #fff;
  140. position: absolute;
  141. box-sizing: border-box;
  142. z-index: 1;
  143. .content {
  144. width: 100%;
  145. height: calc(100% - 74px - 48px);
  146. display: flex;
  147. justify-content: space-between;
  148. box-sizing: border-box;
  149. .left,
  150. .right {
  151. width: calc(376px + 54px);
  152. height: 100%;
  153. padding-top: 10px;
  154. box-sizing: border-box;
  155. display: flex;
  156. }
  157. .right {
  158. .list {
  159. width: 100%;
  160. height: 100%;
  161. .img-box{
  162. width: 100%;
  163. height: 100%;
  164. overflow: hidden;
  165. }
  166. img{
  167. width: 100%;
  168. height: auto;
  169. object-fit: cover;
  170. }
  171. }
  172. }
  173. .home-bottom {
  174. display: flex;
  175. align-items: flex-end;
  176. width: calc(100% - 430px - 430px - 72px);
  177. height: 100%;
  178. align-self: flex-end;
  179. .log-box {
  180. height: 34%;
  181. width: calc(100% - 340px - 28px);
  182. margin-right: 28px;
  183. .log-content {
  184. font-size: 12px;
  185. line-height: 1.5;
  186. padding: 0 18px;
  187. }
  188. }
  189. .file-box {
  190. height: 25%;
  191. min-height: 210px;
  192. width: 340px;
  193. position: relative;
  194. .arrow-icon {
  195. top: -32px;
  196. left: 50%;
  197. position: absolute;
  198. background: #fff;
  199. width: 16px;
  200. height: 80px;
  201. line-height: 80px;
  202. border-radius: 5px 0 0 5px;
  203. text-align: center;
  204. transform: translateX(-50%) rotate(270deg);
  205. }
  206. .edit-btn {
  207. padding: 2px 24px;
  208. background: #FFD489;
  209. border-radius: 4px;
  210. color: #000;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .bottom-map {
  217. width: 100%;
  218. height: 100vh;
  219. position: absolute;
  220. z-index: 0;
  221. }
  222. </style>