index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <bgBox :tabChange="tabChange">
  3. <cylindricalHistogram
  4. style="left: 50px; top: 425px"
  5. v-if="isGetData"
  6. title="各区域移栽产量分析"
  7. titleEn="Tongren Tobacco Planting Digital Management Platform"
  8. :area="Transplantarea"
  9. :dataArray="TransplantdataArray"
  10. ></cylindricalHistogram>
  11. <weatherForecast
  12. style="left: 50px; top: 750px"
  13. v-if="isWeather"
  14. title="天气预报"
  15. titleEn="Tongren Tobacco Planting Digital Management Platform"
  16. :area="Weatherarea"
  17. :dataArray="WeatherdataArray"
  18. :alertValue="30"
  19. >
  20. </weatherForecast>
  21. <wavyLineChart
  22. id="`wavyLineChart`"
  23. style="left: 1470px; top: 105px"
  24. v-if="isWavyLine"
  25. title="各区域移栽面积"
  26. :area="wavyLineArea"
  27. :dataArray="wavyLinedataArray"
  28. smooth="true"
  29. >
  30. </wavyLineChart>
  31. <HorizontalHistogram
  32. style="left: 1470px; top: 425px"
  33. v-if="isHorizontal"
  34. title="移栽情况分析"
  35. :area="HorizontalArea"
  36. :dataArray="HorizontalArray"
  37. ></HorizontalHistogram>
  38. <wavyLineChart
  39. id="`移栽趋势分析`"
  40. style="left: 1470px; top: 750px"
  41. v-if="isWavyLine"
  42. title="移栽趋势分析"
  43. :area="wavyLineArea"
  44. :dataArray="wavyLinedataArray"
  45. >
  46. </wavyLineChart>
  47. <threeMap v-if="hasGetJson" :getJson="getJson"></threeMap>
  48. </bgBox>
  49. </template>
  50. <script>
  51. import bgBox from '@/components/bgBox/index.vue'
  52. import { screenSize } from '@/assets/js/utils'
  53. import cylindricalHistogram from '@/components/Customize/cylindricalHistogram'
  54. import weatherForecast from '@/components/Customize/weatherForecast'
  55. import wavyLineChart from '@/components/Customize/wavyLineChart'
  56. import HorizontalHistogram from '@/components/Customize/HorizontalHistogram'
  57. import threeMap from '@/components/Customize/map/index'
  58. export default {
  59. name: `Home`,
  60. components: {
  61. cylindricalHistogram,
  62. weatherForecast,
  63. wavyLineChart,
  64. HorizontalHistogram,
  65. bgBox,
  66. threeMap,
  67. },
  68. data() {
  69. return {
  70. TransplantdataArray: [],
  71. Transplantarea: [],
  72. Weatherarea: [],
  73. WeatherdataArray: [],
  74. wavyLineArea: [],
  75. wavyLinedataArray: {
  76. LastYear: [],
  77. thisYear: [],
  78. },
  79. HorizontalArea: [],
  80. HorizontalArray: {
  81. Done: [],
  82. Percentage: [],
  83. },
  84. getJson: ``,
  85. isGetData: false,
  86. isWeather: false,
  87. isWavyLine: false,
  88. isHorizontal: false,
  89. hasGetJson: false,
  90. }
  91. },
  92. computed: {},
  93. created() {
  94. this.getAnalysisOfTransplantYieldInVariousRegions()
  95. this.getWeatherForecast()
  96. this.getTransplantAreaInEachRegion()
  97. this.getAnalysisOfTransplantingSituation()
  98. this.getJSON()
  99. this.$http.get(`https://httpbin.org/get`)
  100. },
  101. mounted() {
  102. screenSize(this.$refs.editor)
  103. },
  104. methods: {
  105. getAnalysisOfTransplantYieldInVariousRegions() {
  106. this.$http
  107. .get(`/api/analysisOfTransplantYieldInVariousRegions`)
  108. .then((res) => {
  109. res.forEach((element) => {
  110. this.Transplantarea.push(element.名称.slice(0, 2))
  111. this.TransplantdataArray.push(element.值)
  112. })
  113. this.isGetData = true
  114. })
  115. },
  116. getWeatherForecast() {
  117. this.$http.get(`/api/weatherForecast`).then((res) => {
  118. res.forEach((element) => {
  119. this.Weatherarea.push(element.时间)
  120. this.WeatherdataArray.push(element.温度)
  121. })
  122. this.isWeather = true
  123. })
  124. },
  125. getTransplantAreaInEachRegion() {
  126. this.$http.get(`/api/transplantAreaInEachRegion`).then((res) => {
  127. res.forEach((element) => {
  128. this.wavyLineArea.push(element.名称.slice(0, 2))
  129. this.wavyLinedataArray.LastYear.push(element.去年)
  130. this.wavyLinedataArray.thisYear.push(element.今年)
  131. })
  132. this.isWavyLine = true
  133. })
  134. },
  135. getAnalysisOfTransplantingSituation() {
  136. this.$http.get(`/api/analysisOfTransplantingSituation`).then((res) => {
  137. const date = res.sort((a, b) => b.已移载 - a.已移载)
  138. date.forEach((element) => {
  139. this.HorizontalArea.push(element.名称.slice(0, 2))
  140. this.HorizontalArray.Done.push(element.已移载)
  141. this.HorizontalArray.Percentage.push(element.比率.toFixed(0))
  142. })
  143. this.isHorizontal = true
  144. })
  145. },
  146. async getJSON() {
  147. this.getJson = await this.$http.get(
  148. `/datav/areas_v3/bound/geojson?code=520600_full`
  149. )
  150. this.hasGetJson = true
  151. },
  152. },
  153. }
  154. </script>
  155. <style lang="less" scoped>
  156. .home-container {
  157. position: absolute;
  158. left: 0;
  159. top: 0;
  160. width: 100%;
  161. height: 100%;
  162. .wrap {
  163. transform-origin: 0px 0px 0px;
  164. background: url(../../assets/img/bj.jpg) no-repeat;
  165. background-size: contain;
  166. background-position: 50% 0;
  167. background-color: rgb(0, 0, 0);
  168. min-width: auto;
  169. width: 1920px;
  170. min-height: auto;
  171. height: 1080px;
  172. overflow: auto;
  173. .top {
  174. position: absolute;
  175. left: 0;
  176. top: 0;
  177. width: 100%;
  178. height: 80px;
  179. background-color: transparent;
  180. background: url(../../assets/img/top_nav.png) no-repeat;
  181. background-position: 65% 0;
  182. border: none;
  183. overflow: hidden;
  184. }
  185. }
  186. }
  187. </style>