index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div>
  3. <bgBox class="bgBox" bgType="g-bg2" :tabChange="tabChange" :tabIndex="1">
  4. <leftBox class="lefBox animated fadeInLeft" />
  5. <cmap />
  6. <HorizontalHistogram
  7. style="position: absolute; right: 50px; top: 115px; z-index: 10"
  8. v-if="isHorizontal"
  9. id="`各区域移栽面积1`"
  10. title="各区域移栽面积"
  11. :area="HorizontalArea"
  12. :dataArray="HorizontalArray"
  13. class="animated fadeInRight"
  14. />
  15. <wavyLineChart
  16. id="`本月移栽数量趋势`"
  17. style="position: absolute; right: 50px; top: 460px; z-index: 10"
  18. v-if="isMonthTrend"
  19. title="本月移栽数量趋势"
  20. :max="max"
  21. :area.sync="monthTrendarea"
  22. :dataArray.sync="monthTrendDataArray"
  23. :lineName="monthName"
  24. class="animated fadeInRight"
  25. />
  26. <wavyLineChart
  27. id="`本年移栽数量趋势`"
  28. :lineName="yearName"
  29. style="position: absolute; right: 50px; top: 760px; z-index: 10"
  30. title="本年移栽数据趋势"
  31. :area.sync="yearTrendarea"
  32. class="animated fadeInRight"
  33. :dataArray.sync="yearTrendDataArray"
  34. v-if="isYearTrend"
  35. />
  36. </bgBox>
  37. </div>
  38. </template>
  39. <script>
  40. import bgBox from '@/components/bgBox/index.vue'
  41. import cmap from './cmap.vue'
  42. import leftBox from './leftBox.vue'
  43. import HorizontalHistogram from '@/components/Customize/HorizontalHistogram'
  44. import wavyLineChart from '@/components/Customize/wavyLineChart'
  45. window.map = {}
  46. export default {
  47. components: {
  48. bgBox,
  49. leftBox,
  50. cmap,
  51. wavyLineChart,
  52. HorizontalHistogram,
  53. },
  54. data() {
  55. return {
  56. max: 100,
  57. HorizontalArea: [],
  58. HorizontalArray: {
  59. Done: [],
  60. },
  61. yearName: {
  62. lastName: `去年`,
  63. thisName: `今年`,
  64. },
  65. isHorizontal: true,
  66. monthTrendarea: [],
  67. monthTrendDataArray: {
  68. LastYear: [],
  69. thisYear: [],
  70. },
  71. monthName: {
  72. lastName: `上月`,
  73. thisName: `本月`,
  74. },
  75. yearTrendarea: [],
  76. yearTrendDataArray: {
  77. LastYear: [],
  78. thisYear: [],
  79. },
  80. isMonthTrend: false,
  81. isYearTrend: false,
  82. }
  83. },
  84. computed: {},
  85. async created() {
  86. this.$util.autoVueFn(
  87. [
  88. {
  89. time: 1000 * 60,
  90. fn: this.getAnalysisOfTransplantingSituation,
  91. },
  92. {
  93. time: 1000 * 60,
  94. fn: this.getTrendOfTransplantQuantityThisMonth,
  95. },
  96. {
  97. time: 1000 * 60,
  98. fn: this.getThisYearsTransplantingDataTrend,
  99. },
  100. ],
  101. this
  102. )
  103. },
  104. mounted() {},
  105. unmounted() {
  106. window.map.destroy()
  107. },
  108. methods: {
  109. tabChange(val) {
  110. if (val === 0) {
  111. this.$router.push(`/page1`)
  112. }
  113. console.log(`val`, val)
  114. },
  115. getTrendOfTransplantQuantityThisMonth() {
  116. this.$http.get(`/api/transplantTrendAnalysis`).then((res) => {
  117. const area = []
  118. const dataArray = {
  119. LastYear: [],
  120. thisYear: [],
  121. comparisonLastDay: [],
  122. comparisonLastYear: [],
  123. }
  124. res.forEach((element) => {
  125. area.push(element.时间)
  126. dataArray.LastYear.push(element.去年)
  127. dataArray.thisYear.push(element.今年)
  128. dataArray.comparisonLastDay.push(element.较上日)
  129. dataArray.comparisonLastYear.push(element.较去年)
  130. })
  131. this.monthTrendarea = area
  132. this.monthTrendDataArray = dataArray
  133. this.isMonthTrend = true
  134. })
  135. },
  136. getThisYearsTransplantingDataTrend() {
  137. this.$http.get(`/api/thisYearsTransplantingDataTrend`).then((res) => {
  138. const area = []
  139. const dataArray = {
  140. LastYear: [],
  141. thisYear: [],
  142. comparisonLastDay: [],
  143. comparisonLastYear: [],
  144. }
  145. res.forEach((element) => {
  146. area.push(element.时间)
  147. dataArray.LastYear.push(element.去年)
  148. dataArray.thisYear.push(element.今年)
  149. dataArray.comparisonLastDay.push(element.较上日)
  150. dataArray.comparisonLastYear.push(element.较去年)
  151. })
  152. this.yearTrendarea = area
  153. this.yearTrendDataArray = dataArray
  154. this.isYearTrend = true
  155. })
  156. },
  157. getAnalysisOfTransplantingSituation() {
  158. this.$http.get(`/api/transplantAreaInEachRegion2`).then((res) => {
  159. const area = []
  160. const dataArray = {
  161. Done: [],
  162. Percentage: [],
  163. }
  164. const date = res
  165. date.forEach((element) => {
  166. area.push(element.名称.slice(0, 2))
  167. dataArray.Done.push(element.已移栽)
  168. dataArray.Percentage.push(element.比率.toFixed(0))
  169. })
  170. this.HorizontalArea = area
  171. this.HorizontalArray = dataArray
  172. this.isHorizontal = true
  173. })
  174. },
  175. },
  176. }
  177. </script>
  178. <style lang="less" scoped>
  179. .bgBox {
  180. .lefBox {
  181. position: absolute;
  182. z-index: 10;
  183. left: 47px;
  184. top: 120px;
  185. }
  186. ::v-deep {
  187. .bg {
  188. position: absolute;
  189. z-index: 9;
  190. }
  191. }
  192. }
  193. </style>