index.vue 11 KB

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