index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <bgBox :tabChange="tabChange" class="bgBox" :tabIndex="2">
  3. <evaluationStatistics
  4. style="position: absolute; left: 20px; top: 98px"
  5. class="animated fadeInLeft"
  6. :barHeight="'312px'"
  7. total="2700"
  8. :area="Transplantarea"
  9. :dataArray="TransplantdataArray"
  10. />
  11. <wordClouds
  12. :barHeight="'312px'"
  13. id="平台订单总交易额趋势(月)"
  14. style="position: absolute; left: 20px; top: 426px"
  15. class="animated fadeInLeft"
  16. title="平台订单总交易额趋势(月)"
  17. >
  18. </wordClouds>
  19. <weatherForecast
  20. id="平台订单总量趋势(月)"
  21. :barHeight="'312px'"
  22. style="position: absolute; left: 20px; top: 750px"
  23. class="animated fadeInLeft"
  24. title="平台订单总量趋势(月)"
  25. :area="trendarea"
  26. :dataArray="trendDataArray"
  27. ></weatherForecast>
  28. <threeMap
  29. @toView="toView"
  30. class="animated zoomIn"
  31. style="
  32. position: absolute;
  33. left: 50%;
  34. transform: translate(-50%,15%);
  35. "
  36. v-if="hasGetJson"
  37. :getJson="getJson"
  38. ></threeMap>
  39. <liquidFill
  40. :barHeight="'312px'"
  41. id="水球"
  42. total="3.5"
  43. style="position: absolute; right: 20px; top: 98px"
  44. class="animated fadeInRight"
  45. title="水球"
  46. :area="trendarea"
  47. :dataArray="trendDataArray"
  48. ></liquidFill>
  49. <slotCake
  50. :showSlot="false"
  51. id="`评价类型分布`"
  52. style="position: absolute; right: 20px; top: 434px"
  53. title="评价类型分布"
  54. :data="statisticsData"
  55. class="animated fadeInRight"
  56. :barHeight="'312px'"
  57. />
  58. <weatherForecast
  59. id="区域收获评价总量趋势"
  60. :barHeight="'312px'"
  61. style="position: absolute; right: 20px; top: 758px"
  62. class="animated fadeInRight"
  63. title="区域收获评价总量趋势(月)"
  64. :area="Weatherarea"
  65. :dataArray="WeatherdataArray"
  66. ></weatherForecast>
  67. </bgBox>
  68. </template>
  69. <script>
  70. import mapOfTongren from '@/http/mapOfTongren.json'
  71. import bgBox from '@/components/bgBox/index.vue'
  72. import cake from '@/components/Customize/cake'
  73. import HybridCharts from '@/components/Customize/HybridCharts'
  74. import liquidFill from '@/components/Customize/liquidfill'
  75. import wordClouds from '@/components/Customize/wordClouds'
  76. import slotCake from '@/components/Customize/slotCake'
  77. import evaluationStatistics from '@/components/Customize/evaluationStatistics/index.vue'
  78. import ComplexHistograms from '@/components/Customize/Complex histograms'
  79. import weatherForecast from '@/components/Customize/weatherForecast'
  80. import HorizontalHistogram from '@/components/Customize/HorizontalHistogram'
  81. import statisticsPanel from '@/components/statisticsPanel/index.vue'
  82. import threeMap from '@/components/Customize/map/index'
  83. export default {
  84. name: `Home`,
  85. components: {
  86. evaluationStatistics,
  87. liquidFill,
  88. wordClouds,
  89. HybridCharts,
  90. slotCake,
  91. weatherForecast,
  92. HorizontalHistogram,
  93. ComplexHistograms,
  94. statisticsPanel,
  95. bgBox,
  96. threeMap,
  97. cake,
  98. },
  99. data() {
  100. return {
  101. tabs: {
  102. index: 0,
  103. list: [`订单总量`, `订单交易额`],
  104. },
  105. max: 100,
  106. autoVueFnInit: false,
  107. statisticsData: {
  108. title: `目标完成率`,
  109. value: 0,
  110. acrossList: [
  111. {name: `年移栽数量`, value: undefined},
  112. {name: `年移栽面积`, value: undefined},
  113. ],
  114. verticalList: [
  115. {name: `移栽区域数`, value: undefined},
  116. {name: `烟农数量`, value: undefined},
  117. ],
  118. },
  119. yearName: {
  120. lastName: `去年`,
  121. thisName: `今年`,
  122. },
  123. TransplantdataArray: [],
  124. Transplantarea: [],
  125. Weatherarea: [],
  126. WeatherdataArray: {
  127. temperature: [],
  128. Weather: [],
  129. },
  130. wavyLineArea: [],
  131. wavyLinedataArray: {
  132. LastYear: [],
  133. thisYear: [],
  134. },
  135. trendarea: [],
  136. trendDataArray: {
  137. LastYear: [],
  138. thisYear: [],
  139. },
  140. HorizontalArea: [],
  141. HorizontalArray: {
  142. Done: [],
  143. Percentage: [],
  144. },
  145. getJson: {},
  146. isGetData: false,
  147. isWeather: false,
  148. isWavyLine: false,
  149. isHorizontal: false,
  150. isTrend: false,
  151. hasGetJson: false,
  152. isCake: false,
  153. }
  154. },
  155. computed: {},
  156. created() {
  157. this.getJSON()
  158. // this.$util.autoVueFn(
  159. // [
  160. // {
  161. // time: 1000 * 60,
  162. // fn: this.getWeatherForecast,
  163. // },
  164. // {
  165. // time: 1000 * 60,
  166. // fn: this.getAnalysisOfTransplantYieldInVariousRegions,
  167. // },
  168. // {
  169. // time: 1000 * 60,
  170. // fn: this.getTransplantAreaInEachRegion,
  171. // },
  172. // {
  173. // time: 1000 * 60,
  174. // fn: this.getAnalysisOfTransplantingSituation,
  175. // },
  176. // {
  177. // time: 1000 * 60,
  178. // fn: this.getStatistics,
  179. // },
  180. // {
  181. // time: 1000 * 60,
  182. // fn: this.getTrendAnalysis,
  183. // },
  184. // ],
  185. // {
  186. // vm: this,
  187. // batEnd() {
  188. // this.autoVueFnInit = true
  189. // },
  190. // }
  191. // )
  192. },
  193. mounted() {
  194. },
  195. methods: {
  196. async toView(code) {
  197. console.log(code)
  198. const {id, 区域编码} = (await this.$util.code2base(this, code)) || {}
  199. this.$router.push({
  200. path: `/page3`,
  201. query: {
  202. id,
  203. code: 区域编码,
  204. },
  205. })
  206. },
  207. tabChange(val) {
  208. if (val === 0) {
  209. this.$router.push(`/page1`)
  210. } else if (val === 1) {
  211. this.$router.push(`/page2`)
  212. } else if (val === 2) {
  213. this.$router.push(`/page3`)
  214. }
  215. console.log(`val`, val)
  216. },
  217. getAnalysisOfTransplantYieldInVariousRegions() {
  218. return this.$http
  219. .get(`/api/analysisOfTransplantYieldInVariousRegions`)
  220. .then((res) => {
  221. const area = []
  222. const dataArray = []
  223. res.forEach((element) => {
  224. area.push(element.名称.slice(0, 2))
  225. dataArray.push(element.值)
  226. })
  227. this.Transplantarea = area
  228. this.TransplantdataArray = dataArray
  229. this.isGetData = true
  230. })
  231. },
  232. getWeatherForecast() {
  233. return this.$http
  234. .get(`/api/weatherForecast`, {
  235. params: {
  236. districtId: 0,
  237. },
  238. })
  239. .then((res) => {
  240. const area = []
  241. const dataArray = {
  242. temperature: [],
  243. Weather: [],
  244. }
  245. res.forEach((element) => {
  246. area.push(element.时间)
  247. dataArray.temperature.push(element.温度)
  248. dataArray.Weather.push(element.天气)
  249. })
  250. this.Weatherarea = area
  251. this.WeatherdataArray = dataArray
  252. this.isWeather = true
  253. })
  254. },
  255. getTransplantAreaInEachRegion() {
  256. return this.$http.get(`/api/transplantAreaInEachRegion`).then((res) => {
  257. const area = []
  258. const dataArray = {
  259. LastYear: [],
  260. thisYear: [],
  261. }
  262. res.forEach((element) => {
  263. area.push(element.名称.slice(0, 2))
  264. dataArray.LastYear.push(element.去年)
  265. dataArray.thisYear.push(element.今年)
  266. })
  267. this.wavyLineArea = area
  268. this.wavyLinedataArray = dataArray
  269. this.isWavyLine = true
  270. })
  271. },
  272. getAnalysisOfTransplantingSituation() {
  273. this.$http.get(`/api/analysisOfTransplantingSituation`).then((res) => {
  274. const area = []
  275. const dataArray = {
  276. Done: [],
  277. Percentage: [],
  278. }
  279. const date = res
  280. date.forEach((element) => {
  281. area.push(element.名称.slice(0, 2))
  282. dataArray.Done.push(element.已移载)
  283. dataArray.Percentage.push(element.比率.toFixed(0))
  284. })
  285. this.HorizontalArea = area
  286. this.HorizontalArray = dataArray
  287. this.isHorizontal = true
  288. })
  289. },
  290. getStatistics() {
  291. return this.$http.get(`/api/realTimeStatistics`).then((res) => {
  292. const obj = this.statisticsData
  293. // eslint-disable-next-line no-prototype-builtins
  294. if (res.hasOwnProperty(obj.title)) {
  295. obj.value = res[obj.title]
  296. }
  297. const list1 = this.statisticsData.acrossList
  298. this.statisticsData.acrossList = list1.map((item) => {
  299. // eslint-disable-next-line no-prototype-builtins
  300. if (res.hasOwnProperty(item.name)) {
  301. return {...item, value: res[item.name]}
  302. }
  303. return item
  304. })
  305. const list2 = this.statisticsData.verticalList
  306. this.statisticsData.verticalList = list2.map((item) => {
  307. // eslint-disable-next-line no-prototype-builtins
  308. if (res.hasOwnProperty(item.name)) {
  309. return {...item, value: res[item.name]}
  310. }
  311. return item
  312. })
  313. this.isCake = true
  314. })
  315. },
  316. getTrendAnalysis() {
  317. return this.$http.get(`/api/transplantTrendAnalysis`).then((res) => {
  318. const area = []
  319. const dataArray = {
  320. LastYear: [],
  321. thisYear: [],
  322. }
  323. res.forEach((element) => {
  324. area.push(element.时间)
  325. dataArray.LastYear.push(element.去年)
  326. dataArray.thisYear.push(element.今年)
  327. })
  328. this.trendarea = area
  329. this.trendDataArray = dataArray
  330. this.isTrend = true
  331. })
  332. },
  333. async getJSON() {
  334. this.getJson = mapOfTongren
  335. this.hasGetJson = true
  336. },
  337. },
  338. }
  339. </script>
  340. <style lang="less">
  341. .tabbotton {
  342. text-align: center;
  343. display: flex;
  344. justify-content: space-between;
  345. background-image: url('~@/assets/img2/综合总览/编组 9.png');
  346. background-repeat: no-repeat;
  347. background-position: center bottom;
  348. width: 460px;
  349. .tab-item {
  350. width: 220px;
  351. height: 40px;
  352. line-height: 40px;
  353. font-family: YouSheBiaoTiHei;
  354. font-size: 22px;
  355. color: #bababa;
  356. text-align: center;
  357. position: relative;
  358. cursor: pointer;
  359. background-image: url("~@/assets/img/rectangle.png");
  360. background-size: contain;
  361. background-repeat: no-repeat;
  362. background-position: center;
  363. &.cur {
  364. color: rgba(77, 255, 251, .9);
  365. background-image: url("~@/assets/img/rectangleing.png");
  366. background-size: contain;
  367. background-repeat: no-repeat;
  368. background-position: center;
  369. }
  370. }
  371. }
  372. </style>