homePage.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="chart-list">
  3. <div class="chart-item">
  4. <chart-box name="气象预警">
  5. <template #title-right>
  6. <div class="button" @click="gybg">果园报告</div>
  7. </template>
  8. <div class="base-wrap">
  9. <!-- <div class="base-item">111</div> -->
  10. <img src="@/assets/images/home/base1.png" alt="">
  11. </div>
  12. <one-line-chart class="line-chart"></one-line-chart>
  13. </chart-box>
  14. </div>
  15. <div class="chart-item phenology">
  16. <chart-box name="基本指标">
  17. <template #title-right>
  18. <tabs :list="btnGroup"></tabs>
  19. </template>
  20. <!-- <bar-chart class="bar-chart" styleName="styleName3" :xData="phenologyXData" :yData="phenologyYData"></bar-chart>
  21. <div class="tips box-bg">
  22. <div class="text" v-for="item in 3" :key="item">
  23. 桂味:<span>占比30%,分布在2区、5区</span>
  24. </div>
  25. </div> -->
  26. <div class="box-flex">
  27. <div class="box-card">
  28. <div class="box-desc">当前分区无品种信息,请确权</div>
  29. <div class="box-button" @click="handlePage">立即确权</div>
  30. </div>
  31. </div>
  32. </chart-box>
  33. </div>
  34. <div class="chart-item phenology">
  35. <chart-box name="物候指标">
  36. <template #title-right>
  37. <tabs :list="phenologyBtnGroup"></tabs>
  38. </template>
  39. <bar-chart class="bar-chart" styleName="styleName3" :xData="phenologyXData" :yData="phenologyYData"></bar-chart>
  40. <div class="tips box-bg">
  41. <div class="text" v-for="item in 3" :key="item">
  42. 白点:<span>刚刚露出,占比xx%,分布在2区</span>
  43. </div>
  44. </div>
  45. </chart-box>
  46. </div>
  47. <div class="chart-item phenology">
  48. <chart-box name="病虫测报">
  49. <template #title-right>
  50. <tabs :list="diseasesBtnGroup"></tabs>
  51. </template>
  52. <bar-chart class="bar-chart" styleName="styleName2" :xData="phenologyXData1" :yData="phenologyYData1"></bar-chart>
  53. <div class="tips box-bg">
  54. <div class="text" v-for="item in 3" :key="item">
  55. 虫害{{item}}:<span>刚刚露出,占比xx%,分布在2区</span>
  56. </div>
  57. </div>
  58. </chart-box>
  59. </div>
  60. <div class="chart-item evaluate">
  61. <chart-box name="生长指标">
  62. <template #title-right>
  63. <tabs :list="growList"></tabs>
  64. </template>
  65. <div class="content">
  66. <bar-chart styleName="styleName1" :xData="evaluateXData" :yData="evaluateYData"></bar-chart>
  67. <div class="box-bg text">
  68. 目前果园跨度异常比例达到<span>2%</span>,需要提供 <span>叶面肥</span>补充营养
  69. </div>
  70. </div>
  71. <div class="text-list box-bg">
  72. <div class="text-item" v-for="item in 3" :key="item">
  73. <div class="circle"></div>
  74. <div class="txt">肥效比 低 <span>**棵树</span></div>
  75. </div>
  76. </div>
  77. </chart-box>
  78. </div>
  79. <div class="chart-item phenology">
  80. <chart-box name="生态指标">
  81. <template #title-right>
  82. <tabs :list="ecologyList"></tabs>
  83. </template>
  84. <bar-chart class="bar-chart" styleName="styleName2" :xData="phenologyXData1" :yData="phenologyYData1"></bar-chart>
  85. <div class="tips box-bg">
  86. <div class="text" v-for="item in 3" :key="item">
  87. 通风正常:<span>通风率80-100%,占比xx%</span>
  88. </div>
  89. </div>
  90. </chart-box>
  91. </div>
  92. </div>
  93. </template>
  94. <script setup>
  95. import {ref,onMounted} from 'vue'
  96. import chartBox from "@/components/chartBox.vue";
  97. import tabs from "./tabs.vue";
  98. import barChart from "@/components/charts/barChart.vue";
  99. import oneLineChart from "@/components/charts/oneLineChart.vue";
  100. import eventBus from "@/api/eventBus";
  101. import {useStore} from "vuex";
  102. import { useRouter } from "vue-router";
  103. const store = useStore()
  104. const router = useRouter()
  105. onMounted(()=>{
  106. getReoprt()
  107. })
  108. const reportData = ref([])
  109. // function filterArr(){}
  110. const getReoprt = () =>{
  111. VE_API.home.farmIndexReport({farmId:766,regionId:2}).then(res =>{
  112. reportData.value = res.data || []
  113. })
  114. }
  115. const handlePage = () =>{
  116. router.push('/variety_map')
  117. }
  118. const btnWrap = [
  119. ["树高","冠幅"]
  120. ]
  121. //选项子项监听事件
  122. eventBus.on('handleTabItem',handleTabItem)
  123. function handleTabItem(e){
  124. console.log('e');
  125. }
  126. //基本指标
  127. const btnGroup = ["树高","冠幅"]
  128. // 物候指标
  129. const phenologyBtnGroup = ["花穗长度","单数花穗率"]
  130. const phenologyXData = ["花芽","花蕾","短花穗","中花穗","长花穗","开花"]
  131. const phenologyYData = [{
  132. startNum:0,
  133. endNum:16,
  134. startColor:"#c6ab6b",
  135. endColor:"#4e442e"
  136. },{
  137. startNum:0,
  138. endNum:16,
  139. startColor:"#c6ab6b",
  140. endColor:"#4e442e"
  141. },{
  142. startNum:0,
  143. endNum:16,
  144. startColor:"#c6ab6b",
  145. endColor:"#4e442e"
  146. },{
  147. startNum:0,
  148. endNum:16,
  149. startColor:"#c6ab6b",
  150. endColor:"#4e442e"
  151. }]
  152. // 病虫测报
  153. const diseasesBtnGroup = ["虫害比例","病害比例"]
  154. const phenologyXData1 = ["炭疽病", "啃食虫害","叶瘿蚊","毛毡病"]
  155. const phenologyYData1 = [{
  156. startNum:0,
  157. endNum:0,
  158. startColor:"#c6ab6b",
  159. endColor:"#4e442e"
  160. },{
  161. startNum:0,
  162. endNum:0,
  163. startColor:"#c6ab6b",
  164. endColor:"#4e442e"
  165. },{
  166. startNum:0,
  167. endNum:0,
  168. startColor:"#c6ab6b",
  169. endColor:"#4e442e"
  170. },{
  171. startNum:0,
  172. endNum:1,
  173. startColor:"#c6ab6b",
  174. endColor:"#4e442e"
  175. }]
  176. // 生长指标
  177. const growList = ["树势","营养","缺水"]
  178. const evaluateXData = ["低", "中", "高"]
  179. const evaluateYData = [1, 8, 7]
  180. //生态指标
  181. const ecologyList = ["通风率","清园程度","益草覆盖率"]
  182. const gybg= ()=>{
  183. VE_API.farm_files.last({farmId: 766,key:"pdf_report"}).then(({data})=>{
  184. eventBus.emit("homePage:gybg",{filename:data.path,title:"果园报告"})
  185. })
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .chart-list {
  190. width: calc(100% - 54px - 10px);
  191. height: 100%;
  192. padding: 8px 8px 8px 0;
  193. box-sizing: border-box;
  194. position: relative;
  195. overflow-y: auto;
  196. .chart-item {
  197. width: 100%;
  198. height: calc(100% / 4.15);
  199. box-sizing: border-box;
  200. margin-bottom: 10px;
  201. .box-flex{
  202. width: 100%;
  203. height: 100%;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. .box-card{
  208. background: rgba(255, 255, 255, 0.1);
  209. border-radius: 5px;
  210. width: 292px;
  211. height: 92px;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. flex-direction: column;
  216. .box-desc{
  217. font-size: 16px;
  218. font-family: "PangMenZhengDao";
  219. margin-bottom: 8px;
  220. }
  221. .box-button{
  222. font-size: 13px;
  223. border-radius: 20px;
  224. padding: 3px 27px;
  225. cursor: pointer;
  226. border: 1px solid rgba(255, 255, 255, 0.45);
  227. background: linear-gradient(180deg,#FFD887,#ED9E1E);
  228. }
  229. }
  230. }
  231. .button{
  232. border: 1px solid rgba(255, 255, 255, 0.4);
  233. border-radius: 4px;
  234. padding: 2px 10px;
  235. cursor: pointer;
  236. }
  237. &.chart-item:last-child {
  238. margin: 0;
  239. }
  240. .base-wrap{
  241. width: 100%;
  242. height: 65px;
  243. margin-top: 4px;
  244. img{
  245. width: 100%;
  246. height: 100%;
  247. }
  248. }
  249. .line-chart{
  250. height: calc(100% - 55px);
  251. }
  252. .box-bg{
  253. border-radius: 2px 2px 0 0;
  254. font-size: 12px;
  255. padding: 3px 6px;
  256. box-sizing: border-box;
  257. font-family: Arial, Helvetica, sans-serif;
  258. background: linear-gradient(180deg, rgb(85, 85, 85,0.4) 0%, rgb(35, 35, 35,1) 100%);
  259. .text{
  260. position: relative;
  261. padding-left: 10px;
  262. &::before{
  263. content: '';
  264. position: absolute;
  265. left: 0;
  266. top: 8px;
  267. width: 3px;
  268. height: 3px;
  269. border-radius: 50%;
  270. background: #fff;
  271. }
  272. span{
  273. color: rgba(255, 255, 255,0.4);
  274. line-height: 1.7;
  275. }
  276. }
  277. }
  278. &.phenology{
  279. .bar-chart{
  280. width: 100%;
  281. height: calc(100% - 75px);
  282. }
  283. .tips{
  284. margin-top: 10px;
  285. width: 100%;
  286. height: 65px;
  287. }
  288. }
  289. &.evaluate {
  290. .content {
  291. width: 100%;
  292. height: calc(100% - 10px - 33px);
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. margin-bottom: 10px;
  297. .text{
  298. font-weight: 400;
  299. padding: 8px 0 4px 5px;
  300. text-indent: 2em;
  301. margin-left: 8px;
  302. span{
  303. color: #FFD489;
  304. }
  305. }
  306. }
  307. .text-list {
  308. width: 100%;
  309. height: 33px;
  310. display: flex;
  311. align-items: flex-start;
  312. justify-content: space-between;
  313. .text-item{
  314. display: flex;
  315. align-items: center;
  316. .circle{
  317. width: 4px;
  318. height: 4px;
  319. background: rgba(255,255,255,0.44);
  320. border-radius: 50%;
  321. margin-right: 6px;
  322. }
  323. .txt{
  324. font-size: 12px;
  325. span{
  326. color: #FFD489;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. }
  333. }
  334. </style>