index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. <!--
  2. * @LastEditors: gcz
  3. -->
  4. <template>
  5. <div class>
  6. <dv-full-screen-container>
  7. <Map></Map>
  8. <Header></Header>
  9. <section class="nav-wrap">
  10. <div
  11. class="nav-item"
  12. :class="{active:(index+1)==page}"
  13. v-for="(item,index) in navList"
  14. @click="navClick(index+1)"
  15. :key="index"
  16. >{{item.text}}</div>
  17. </section>
  18. <Alarm v-if="page==6&&alarmData.length>=1" :data="alarmData" />
  19. <section class="left-wrap" v-if="$store.state.addr.page=='forest'">
  20. <Numerical class="left-item" :data="page1numerical" />
  21. <MyEcharts
  22. class="left-item chart-wrap"
  23. mid="page1Char1"
  24. ref="page1Char1"
  25. :option="page1Char1"
  26. style
  27. />
  28. <MyEcharts
  29. class="left-item chart-wrap"
  30. mid="page1Char2"
  31. ref="page1Char2"
  32. :option="page1Char2"
  33. style
  34. />
  35. </section>
  36. <section class="left-wrap" v-if="$store.state.addr.page=='treeSpecies'">
  37. <Numerical class="left-item" :data="page2numerical" />
  38. <!-- <MyEcharts
  39. class="left-item chart-wrap"
  40. mid="page2Char1"
  41. :option="page2Char1"
  42. ref="page2Char1"
  43. />-->
  44. <MyEcharts
  45. class="left-item chart-wrap"
  46. mid="page2Char2"
  47. :option="page2Char2"
  48. ref="page2Char2"
  49. />
  50. <MyEcharts
  51. class="left-item chart-wrap"
  52. mid="page2Char3"
  53. :option="page2Char3"
  54. ref="page2Char3"
  55. />
  56. </section>
  57. <!-- 林业经济 -->
  58. <section class="left-wrap" v-if="$store.state.addr.page=='economics'">
  59. <!-- <Typeslide :data="typeSlideData" /> -->
  60. <Numerical class="left-item" :data="page5numerical" />
  61. <MyEcharts
  62. class="left-item chart-wrap"
  63. mid="page5Char2"
  64. ref="page5Char2"
  65. :option="page5Char2"
  66. />
  67. <MyEcharts
  68. class="left-item chart-wrap"
  69. mid="page5Char1"
  70. ref="page5Char1"
  71. :option="page5Char1"
  72. />
  73. </section>
  74. <!-- 事件信息 -->
  75. <section class="left-wrap event-page" v-if="$store.state.addr.page=='event'">
  76. <Numerical class="left-item" :data="page6numerical" />
  77. <MyEcharts
  78. class="left-item chart-wrap"
  79. mid="page6Char1"
  80. ref="page6Char1"
  81. :option="page6Char1"
  82. />
  83. <!-- <MyEcharts
  84. class="left-item chart-wrap"
  85. mid="page6Char2"
  86. ref="page6Char2"
  87. :option="page6Char2"
  88. /> -->
  89. <div class="left-item">
  90. <div class="ntitle">{{$store.state.addr.selectAddr}}事件发生记录</div>
  91. <dv-scroll-board
  92. :key="scrollBoardKey"
  93. class="scroll-event"
  94. :config="scrollEventConfig"
  95. ref="scrollBoard"
  96. />
  97. </div>
  98. </section>
  99. <section class="right-wrap">
  100. <PickerAddr />
  101. <div v-if="showbase" class="xiaoban u-flex">
  102. <div class="title">基地查询:</div>
  103. <el-input v-model="baseinput" placeholder="请输入基地名称">
  104. <i class="el-icon-search el-input__icon" slot="suffix" @click="basesearch"></i>
  105. </el-input>
  106. </div>
  107. <div v-if="showxiaoban" class="xiaoban u-flex">
  108. <div class="title">小班查询:</div>
  109. <el-input v-model="xiaobaninput" placeholder="请输入小班号">
  110. <i class="el-icon-search el-input__icon" slot="suffix" @click="xiaobansearch"></i>
  111. </el-input>
  112. </div>
  113. <section v-if="showxiaoban||showbase" class="scroll-board-wrap" :class="{close:showScrollBoard==true}">
  114. <dv-scroll-board
  115. v-if="showbase"
  116. :key="scrollBoardKey"
  117. class="scroll-board-01"
  118. :config="scrollBaseListConfig"
  119. ref="scrollBaseList"
  120. @click="scrollBaseListClick"
  121. />
  122. <dv-scroll-board
  123. v-if="showxiaoban"
  124. :key="scrollBoardKey"
  125. class="scroll-board-01"
  126. :config="scrollBoardConfig"
  127. ref="scrollBoard"
  128. @click="scrollBoardClick"
  129. :style="scrollBoardStyle"
  130. />
  131. <div class="scroll-board-tool" @click="toggleShowScrollBoard">
  132. <div class="inner">
  133. <img src="../assets/img/jiantou.png" alt />
  134. </div>
  135. </div>
  136. </section>
  137. </section>
  138. </dv-full-screen-container>
  139. </div>
  140. </template>
  141. <script>
  142. import Map from '../components/amap.vue';
  143. import Header from '../components/header';
  144. import MyEcharts from '../components/echarts';
  145. import Numerical from '../components/numerical';
  146. import Alarm from '../components/alarm';
  147. import PickerAddr from '../components/pickerAddr';
  148. import Typeslide from '../components/typeslide';
  149. import { Message } from 'element-ui';
  150. import { debounce } from '@/utils/mdebounce';
  151. import { sliceArray } from '@/utils/sliceArray';
  152. import { mapMutations, mapState, mapGetters } from 'vuex';
  153. import {
  154. page1numerical,
  155. page1echarts01,
  156. page1echarts02,
  157. rightScrollData,
  158. baseList,
  159. alarmDataApi,
  160. page2numerical,
  161. page2echarts01,
  162. page2echarts02,
  163. page2echarts03,
  164. page5numerical,
  165. typeSlideApi,
  166. page5echarts01,
  167. page5echarts02,
  168. page6numerical,
  169. page6echarts01,
  170. page6echarts02,
  171. eventList,
  172. smallClassDetail
  173. } from '../service/index';
  174. import scrollBoardSchema from '../dataSchema/scrollBoardSchema';
  175. import scrollBaseListSchema from '../dataSchema/scrollBaseListSchema';
  176. import page1Char1Schema from '../dataSchema/page1Char1Schema';
  177. import page1Char2Schema from '../dataSchema/page1Char2Schema';
  178. import page2Char1Schema from '../dataSchema/page2Char1Schema';
  179. import page2Char2Schema from '../dataSchema/page2Char2Schema';
  180. import page2Char3Schema from '../dataSchema/page2Char3Schema';
  181. import page5Char1Schema from '../dataSchema/page5Char1Schema';
  182. import page5Char2Schema from '../dataSchema/page5Char2Schema';
  183. import page6Char1Schema from '../dataSchema/page6Char1Schema';
  184. import page6Char2Schema from '../dataSchema/page6Char2Schema';
  185. import scrollEventSchema from '../dataSchema/scrollEventSchema';
  186. //柱状图颜色
  187. let colorArr = ['rgb(2, 238, 255)','rgb(94, 229, 116)','rgb(255, 255, 0)'];
  188. // import { provinceAndCityData, regionData, provinceAndCityDataPlus, regionDataPlus, CodeToText, TextToCode } from 'element-china-area-data';
  189. export default {
  190. name: '',
  191. components: {
  192. Map,
  193. Header,
  194. MyEcharts,
  195. Numerical,
  196. Alarm,
  197. PickerAddr,
  198. Typeslide
  199. },
  200. data() {
  201. return {
  202. showxiaoban:true,
  203. showbase:false,
  204. showScrollBoard: false,
  205. page: 1,
  206. // addrOptions: regionDataPlus,
  207. addrSelectedOptions: ['520000', ''],
  208. navList: [
  209. { text: '森林资源', en: 'forest' },
  210. { text: '林木结构', en: 'treeSpecies' },
  211. { text: '碳汇管理', en: 'sink' },
  212. { text: '林下经济', en: 'economics' },
  213. { text: '土地流转', en: 'circulation' },
  214. { text: '事件信息', en: 'event' }
  215. ],
  216. scrollBoardKey: Date.now(),
  217. scrollBoardStyle: {
  218. // width: '100%',
  219. // height: '60vh'
  220. },
  221. scrollBoardConfig: scrollBoardSchema,
  222. scrollBaseListConfig:scrollBaseListSchema,
  223. page1numerical: [
  224. { name: '蓄积量', number: '2309', unit: '立方米' },
  225. { name: '占地面积', number: '55.4', unit: '万亩' }
  226. ],
  227. alarmData: [
  228. // {msg:'三都林场01小班于15:00:00发现火情,请尽快处理!'},
  229. // {msg:'测试1!'},
  230. // {msg:'测试22222222!'},
  231. ],
  232. page1Char1: page1Char1Schema,
  233. page1Char2: page1Char2Schema,
  234. page2numerical: [],
  235. page2Char1: page2Char1Schema,
  236. page2Char2: page2Char2Schema,
  237. page2Char3: page2Char3Schema,
  238. page5numerical: [],
  239. typeSlideData: [],
  240. page5Char1: page5Char1Schema,
  241. page5Char2: page5Char2Schema,
  242. page6numerical: [],
  243. page6Char1: page6Char1Schema,
  244. page6Char2: page6Char2Schema,
  245. scrollEventConfig:scrollEventSchema,
  246. xiaobaninput: '',
  247. baseinput:''
  248. };
  249. },
  250. created() {},
  251. mounted() {
  252. this.getPageData();
  253. this.getRightScrollData();
  254. setInterval(() => {
  255. this.getPageData();
  256. }, 60000);
  257. window.onresize=()=>{
  258. //图表resize
  259. if (this.$store.state.addr.page == 'forest') {
  260. let page1Char1Uuid = this.$refs.page1Char1.mid;
  261. this.$refs.page1Char1.resizeChar(page1Char1Uuid);
  262. let page1Char2Uuid = this.$refs.page1Char2.mid;
  263. this.$refs.page1Char2.resizeChar(page1Char2Uuid);
  264. } else if (this.$store.state.addr.page == 'treeSpecies') {
  265. let page2Char2Uuid = this.$refs.page2Char2.mid;
  266. this.$refs.page2Char2.resizeChar(page2Char2Uuid);
  267. let page2Char3Uuid = this.$refs.page2Char3.mid;
  268. this.$refs.page2Char3.resizeChar(page2Char3Uuid);
  269. } else if (this.$store.state.addr.page == 'economics') {
  270. let page5Char1Uuid = this.$refs.page5Char1.mid;
  271. this.$refs.page5Char1.resizeChar(page5Char1Uuid);
  272. let page5Char2Uuid = this.$refs.page5Char2.mid;
  273. this.$refs.page5Char2.resizeChar(page5Char2Uuid);
  274. } else if (this.$store.state.addr.page == 'event') {
  275. let page6Char1Uuid = this.$refs.page6Char1.mid;
  276. this.$refs.page6Char1.resizeChar(page6Char1Uuid);
  277. let page6Char2Uuid = this.$refs.page6Char2.mid;
  278. this.$refs.page6Char2.resizeChar(page6Char2Uuid);
  279. }
  280. }
  281. },
  282. watch: {
  283. xiaobaninput: {
  284. handler: function () {
  285. debounce(this.xiaobansearch, 500, false);
  286. }
  287. },
  288. baseinput: {
  289. handler: function () {
  290. debounce(this.basesearch, 500, false);
  291. }
  292. },
  293. '$store.state.addr.selectCity'(val) {
  294. // debounce(this.getPageData(), 1000, false)
  295. this.getPageData();
  296. },
  297. '$store.state.addr.selectDistrict'(val) {
  298. this.getPageData();
  299. },
  300. '$store.state.addr.selectStreet'(val) {
  301. this.getPageData();
  302. }
  303. },
  304. methods: {
  305. ...mapMutations([
  306. 'changeSearchSmallClass'
  307. ]),
  308. addrChange(value) {
  309. console.log('addrChange', value);
  310. },
  311. navClick(index) {
  312. let pageName = this.navList[index - 1].en;
  313. if (
  314. pageName == 'sink' ||pageName == 'circulation'
  315. ) {
  316. Message('暂未开放!');
  317. return;
  318. }
  319. this.$store.commit('changePage', this.navList[index - 1].en);
  320. console.log('this.navList[index-1].en', this.navList[index - 1].en);
  321. this.page = index;
  322. console.log('index', index);
  323. if(this.navList[index - 1].en=='economics'){
  324. this.showbase = true;
  325. this.showxiaoban = false;
  326. }else if(this.navList[index - 1].en=='event'){
  327. this.showbase = false;
  328. this.showxiaoban = false;
  329. }else{
  330. this.showbase = false;
  331. this.showxiaoban = true;
  332. }
  333. // 切换专题时,重置区域
  334. // this.$store.dispatch('searchArea', {
  335. // parentId: '520000',
  336. // name: '贵州省',
  337. // mapLevel: 'province'
  338. // });
  339. this.getPageData();
  340. },
  341. getPageData() {
  342. debounce(this.debounceGetData, 300, false);
  343. },
  344. debounceGetData() {
  345. console.log('page', this.$store.state.addr.page);
  346. // {text:'森林资源',en:'forest'},
  347. // {text:'林木结构',en:'treeSpecies'},
  348. // {text:'碳汇管理',en:'sink'},
  349. // {text:'林下经济',en:'economics'},
  350. // {text:'土地流转',en:'circulation'},
  351. // {text:'事件信息',en:'event'},
  352. if (this.$store.state.addr.page == 'forest') {
  353. this.getPage1numerical();
  354. this.getPage1echarts01();
  355. this.getPage1echarts02();
  356. this.getRightScrollData();
  357. } else if (this.$store.state.addr.page == 'treeSpecies') {
  358. this.getPage2numerical();
  359. // this.getPage2echarts01();
  360. this.getPage2echarts02();
  361. this.getPage2echarts03();
  362. this.getRightScrollData();
  363. } else if (this.$store.state.addr.page == 'economics') {
  364. this.getPage5numerical();
  365. // this.getTypeSlideData();
  366. this.getPage5echarts01();
  367. this.getPage5echarts02();
  368. this.getBaseList();
  369. } else if (this.$store.state.addr.page == 'event') {
  370. this.getPage6numerical();
  371. this.getPage6echarts01();
  372. this.getEventList();
  373. // this.getPage6echarts02();
  374. this.getAlarmData();
  375. // this.getRightScrollData();
  376. }
  377. },
  378. getPage1numerical() {
  379. let param = {
  380. cityId: this.$store.state.addr.selectCity.areaId,
  381. countyId: this.$store.state.addr.selectDistrict.areaId,
  382. townId: this.$store.state.addr.selectStreet.areaId
  383. };
  384. page1numerical(param)
  385. .then((res) => {
  386. // console.log('res',res);
  387. this.page1numerical = res.data;
  388. })
  389. .catch((err) => {
  390. console.log('echarts01 err', err);
  391. });
  392. },
  393. getPage1echarts01() {
  394. let param = {
  395. cityId: this.$store.state.addr.selectCity.areaId,
  396. countyId: this.$store.state.addr.selectDistrict.areaId,
  397. townId: this.$store.state.addr.selectStreet.areaId
  398. };
  399. // console.log('cityId',param.cityId);
  400. page1echarts01(param)
  401. .then((res) => {
  402. this.page1Char1.xAxis.data = res.data.map((item) => {
  403. return item.name;
  404. });
  405. this.page1Char1.series[0].data = res.data.map((item) => {
  406. return item.number;
  407. });
  408. //数量过小时隐藏滚动
  409. if (this.page1Char1.xAxis.data.length <= 5) {
  410. this.page1Char1.dataZoom[0].show = false;
  411. }else{
  412. this.page1Char1.dataZoom[0].show = true;
  413. }
  414. let charUuid = this.$refs.page1Char1.mid;
  415. this.$refs.page1Char1.intChar(charUuid);
  416. })
  417. .catch((err) => {
  418. console.log('getPage1echarts01 err', err);
  419. });
  420. },
  421. getPage1echarts02() {
  422. let param = {
  423. cityId: this.$store.state.addr.selectCity.areaId,
  424. countyId: this.$store.state.addr.selectDistrict.areaId,
  425. townId: this.$store.state.addr.selectStreet.areaId
  426. };
  427. // console.log('cityId',param.cityId);
  428. page1echarts02(param)
  429. .then((res) => {
  430. this.page1Char2.xAxis.data = res.data.map((item) => {
  431. return item.name;
  432. });
  433. this.page1Char2.series[0].data = res.data.map((item) => {
  434. return item.number;
  435. });
  436. //数量过小时隐藏滚动
  437. if (this.page1Char2.xAxis.data.length <= 5) {
  438. this.page1Char2.dataZoom[0].show = false;
  439. }else{
  440. this.page1Char2.dataZoom[0].show = true;
  441. }
  442. let charUuid = this.$refs.page1Char2.mid;
  443. this.$refs.page1Char2.intChar(charUuid);
  444. })
  445. .catch((err) => {
  446. console.log('getPage1echarts02 err', err);
  447. });
  448. },
  449. getRightScrollData() {
  450. let param = {
  451. smallNumber: this.xiaobaninput,
  452. cityId: this.$store.state.addr.selectCity.areaId,
  453. countyId: this.$store.state.addr.selectDistrict.areaId,
  454. townId: this.$store.state.addr.selectStreet.areaId
  455. };
  456. rightScrollData(param)
  457. .then((res) => {
  458. // console.log('res',res.rows.length);
  459. // console.log('this.scrollBoardConfig',this.scrollBoardConfig);
  460. //当小班滚动数据少时重设参数
  461. // if(res.rows.length<=15){
  462. // this.scrollBoardConfig.rowNum = 5;
  463. // this.scrollBoardStyle.height = '25vh'
  464. // }
  465. this.scrollBoardConfig.data = [];
  466. res.rows.forEach((element) => {
  467. this.scrollBoardConfig.data.push([
  468. element.smallNumber,
  469. element.treeComp,
  470. element.perAcreStock + 'm³',
  471. element.landArea + '亩'
  472. ]);
  473. });
  474. this.scrollBoardKey = Date.now();
  475. this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
  476. // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
  477. // this.scrollBoardConfig = res.data;
  478. })
  479. .catch((err) => {
  480. console.log('echarts01 err', err);
  481. });
  482. },
  483. getBaseList(){
  484. let param = {
  485. baseName: this.baseinput,
  486. cityId: this.$store.state.addr.selectCity.areaId,
  487. countyId: this.$store.state.addr.selectDistrict.areaId,
  488. townId: this.$store.state.addr.selectStreet.areaId
  489. };
  490. baseList(param)
  491. .then((res) => {
  492. this.scrollBaseListConfig.data = [];
  493. res.rows.forEach((element) => {
  494. let cateInfoList = element.cateInfoList;
  495. let cropName = '';
  496. for (let index = 0; index < cateInfoList.length; index++) {
  497. const item = cateInfoList[index];
  498. cropName+=item.cropName + ',';
  499. }
  500. cropName = cropName.substring(0, cropName.lastIndexOf(","));
  501. this.scrollBaseListConfig.data.push([
  502. element.baseName,
  503. cropName,
  504. element.baseArea+ '亩',
  505. ]);
  506. });
  507. this.scrollBoardKey = Date.now();
  508. })
  509. .catch((err) => {
  510. console.log('echarts01 err', err);
  511. });
  512. },
  513. getEventList(){
  514. let param = {
  515. cityId: this.$store.state.addr.selectCity.areaId,
  516. countyId: this.$store.state.addr.selectDistrict.areaId,
  517. townId: this.$store.state.addr.selectStreet.areaId
  518. };
  519. eventList(param)
  520. .then((res) => {
  521. this.scrollEventConfig.data = [];
  522. res.rows.forEach((element) => {
  523. this.scrollEventConfig.data.push([
  524. element.createTime.slice(5,16),
  525. element.townName+element.villageName,
  526. this.eventTypeFilter(element.eventType),
  527. // element.createBy,
  528. this.eventStateFilter(element.state),
  529. ]);
  530. });
  531. this.scrollBoardKey = Date.now();
  532. })
  533. .catch((err) => {
  534. console.log('getEventList err', err);
  535. });
  536. },
  537. eventTypeFilter(e){
  538. if(e=='1'){
  539. return '火灾'
  540. }else if(e=='2'){
  541. return '砍伐'
  542. }else if(e=='3'){
  543. return '病虫害'
  544. }
  545. },
  546. eventStateFilter(e){
  547. if(e=='0'){
  548. return '未反馈'
  549. }else if(e=='1'){
  550. return '已反馈'
  551. }
  552. },
  553. getAlarmData() {
  554. alarmDataApi()
  555. .then((res) => {
  556. // console.log('this.page',this.page);
  557. // console.log('res',res);
  558. this.alarmData = res.data;
  559. // console.log('alarmData.length',this.alarmData.length);
  560. })
  561. .catch((err) => {
  562. console.log('echarts01 err', err);
  563. });
  564. },
  565. getPage2numerical() {
  566. let param = {
  567. cityId: this.$store.state.addr.selectCity.areaId,
  568. countyId: this.$store.state.addr.selectDistrict.areaId,
  569. townId: this.$store.state.addr.selectStreet.areaId,
  570. smallNumber: this.xiaobaninput
  571. };
  572. page2numerical(param)
  573. .then((res) => {
  574. // console.log('res',res);
  575. this.page2numerical = res.data;
  576. })
  577. .catch((err) => {
  578. console.log('page2numerical err', err);
  579. });
  580. },
  581. getPage2echarts01() {
  582. let param = {
  583. smallNumber: this.xiaobaninput,
  584. cityId: this.$store.state.addr.selectCity.areaId,
  585. countyId: this.$store.state.addr.selectDistrict.areaId,
  586. townId: this.$store.state.addr.selectStreet.areaId
  587. };
  588. page2echarts01(param)
  589. .then((res) => {
  590. // console.log('res',res);
  591. this.page2Char1.series[0].data = [];
  592. this.page2Char1.series[0].data = res.data;
  593. let charUuid = this.$refs.page2Char1.mid;
  594. this.$refs.page2Char1.intChar(charUuid);
  595. })
  596. .catch((err) => {
  597. console.log('getPage2echarts01 err', err);
  598. });
  599. },
  600. getPage2echarts02() {
  601. let param = {
  602. smallNumber: this.xiaobaninput,
  603. cityId: this.$store.state.addr.selectCity.areaId,
  604. countyId: this.$store.state.addr.selectDistrict.areaId,
  605. townId: this.$store.state.addr.selectStreet.areaId
  606. };
  607. page2echarts02(param)
  608. .then((res) => {
  609. // console.log('res',res);
  610. // this.page2Char2 = res.data;
  611. // console.log('this.page2Char2.series', this.page2Char2.series);
  612. this.page2Char2.xAxis.data = [];
  613. this.page2Char2.series = [];
  614. const rows = res.data;
  615. // console.log(rows)
  616. // x坐标
  617. this.page2Char2.xAxis.data = rows.map((item) => {
  618. return item.smallNumber;
  619. });
  620. // console.log('x坐标', this.page2Char2.xAxis.data)
  621. // 获取所有项
  622. let seriesList = rows.map((item) => {
  623. return item.treeList;
  624. });
  625. // 数组扁平化
  626. seriesList = seriesList.flat();
  627. // 去重
  628. let obj = {};
  629. seriesList = seriesList.reduce((newArr, next) => {
  630. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  631. return newArr;
  632. }, []);
  633. seriesList = seriesList.map((item,index ) => {
  634. let itemColor = null;
  635. if(item.name=='杉木'||item.name=='杉'){
  636. itemColor = colorArr[0]
  637. }else if(item.name=='马尾松'||item.name=='马'){
  638. itemColor = colorArr[1]
  639. }else if(item.name=='软阔'||item.name=='软'){
  640. itemColor = colorArr[2]
  641. }else if(item.name=='硬阔'||item.name=='硬'){
  642. itemColor = colorArr[3]
  643. }
  644. return {
  645. name: item.name,
  646. type: 'bar',
  647. stack: 'total',
  648. label: {
  649. show: false
  650. },
  651. emphasis: {
  652. focus: 'series'
  653. },
  654. data: [],
  655. itemStyle: {
  656. normal: { color: itemColor||"auto" },
  657. }
  658. };
  659. });
  660. // console.log(seriesList)
  661. rows.forEach((item) => {
  662. seriesList.forEach((jtem, index) => {
  663. let num = 0;
  664. item.treeList.map((ktem) => {
  665. if (ktem.name.indexOf(jtem.name) > -1) {
  666. num = ktem.value;
  667. }
  668. });
  669. seriesList[index].data.push(num);
  670. });
  671. });
  672. // console.log('page2echarts02 seriesList',seriesList)
  673. this.page2Char2.series = seriesList;
  674. //数量过小时隐藏滚动
  675. if (this.page2Char2.xAxis.data.length <= 5) {
  676. this.page2Char2.dataZoom[0].show = false;
  677. }else{
  678. this.page2Char2.dataZoom[0].show = true;
  679. }
  680. let charUuid = this.$refs.page2Char2.mid;
  681. this.$refs.page2Char2.intChar(charUuid);
  682. })
  683. .catch((err) => {
  684. console.log('getPage2echarts02 err', err);
  685. });
  686. },
  687. getPage2echarts03() {
  688. let param = {
  689. smallNumber: this.xiaobaninput,
  690. cityId: this.$store.state.addr.selectCity.areaId,
  691. countyId: this.$store.state.addr.selectDistrict.areaId,
  692. townId: this.$store.state.addr.selectStreet.areaId
  693. };
  694. page2echarts03(param)
  695. .then((res) => {
  696. // console.log('res',res);
  697. // this.page2Char2 = res.data;
  698. // console.log('this.page2Char2.series', this.page2Char2.series);
  699. this.page2Char3.xAxis.data = [];
  700. this.page2Char3.series = [];
  701. const rows = res.data;
  702. // console.log(rows)
  703. // x坐标
  704. this.page2Char3.xAxis.data = rows.map((item) => {
  705. return item.smallNumber;
  706. });
  707. // console.log('x坐标', this.page2Char2.xAxis.data)
  708. // 获取所有项
  709. let seriesList = rows.map((item) => {
  710. return item.treeList;
  711. });
  712. // 数组扁平化
  713. seriesList = seriesList.flat();
  714. // 去重
  715. let obj = {};
  716. seriesList = seriesList.reduce((newArr, next) => {
  717. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  718. return newArr;
  719. }, []);
  720. seriesList = seriesList.map((item,index) => {
  721. let itemColor = null;
  722. if(item.name=='杉木'||item.name=='杉'){
  723. itemColor = colorArr[0]
  724. }else if(item.name=='马尾松'||item.name=='马'){
  725. itemColor = colorArr[1]
  726. }else if(item.name=='软阔'||item.name=='软'){
  727. itemColor = colorArr[2]
  728. }else if(item.name=='硬阔'||item.name=='硬'){
  729. itemColor = colorArr[3]
  730. }
  731. return {
  732. name: item.name,
  733. type: 'bar',
  734. stack: 'total',
  735. label: {
  736. show: false
  737. },
  738. emphasis: {
  739. focus: 'series'
  740. },
  741. data: [],
  742. itemStyle: {
  743. normal: { color: itemColor||"auto" },
  744. }
  745. };
  746. });
  747. // console.log(seriesList)
  748. rows.forEach((item) => {
  749. seriesList.forEach((jtem, index) => {
  750. let num = 0;
  751. item.treeList.map((ktem) => {
  752. if (ktem.name.indexOf(jtem.name) > -1) {
  753. num = ktem.value;
  754. }
  755. });
  756. seriesList[index].data.push(num);
  757. });
  758. });
  759. // console.log(seriesList)
  760. this.page2Char3.series = seriesList;
  761. //数量过小时隐藏滚动
  762. if (this.page2Char3.xAxis.data.length <= 5) {
  763. this.page2Char3.dataZoom[0].show = false;
  764. }else{
  765. this.page2Char3.dataZoom[0].show = true;
  766. }
  767. let charUuid = this.$refs.page2Char3.mid;
  768. this.$refs.page2Char3.intChar(charUuid);
  769. })
  770. .catch((err) => {
  771. console.log('getPage2echarts03 err', err);
  772. });
  773. },
  774. getPage5numerical() {
  775. let param = {
  776. cityId: this.$store.state.addr.selectCity.areaId,
  777. countyId: this.$store.state.addr.selectDistrict.areaId,
  778. townId: this.$store.state.addr.selectStreet.areaId
  779. };
  780. page5numerical(param)
  781. .then((res) => {
  782. // console.log('res',res);
  783. this.page5numerical = res.data;
  784. })
  785. .catch((err) => {
  786. console.log('echarts01 err', err);
  787. });
  788. },
  789. getTypeSlideData() {
  790. let param = {
  791. cityId: this.$store.state.addr.selectCity.areaId,
  792. countyId: this.$store.state.addr.selectDistrict.areaId,
  793. townId: this.$store.state.addr.selectStreet.areaId
  794. };
  795. typeSlideApi(param)
  796. .then((res) => {
  797. this.typeSlideData = sliceArray(res.data, 3);
  798. // console.log(' this.typeSlideData', this.typeSlideData);
  799. })
  800. .catch((err) => {
  801. console.log('getTypeSlideData err', err);
  802. });
  803. },
  804. getPage5echarts01() {
  805. let param = {
  806. cityId: this.$store.state.addr.selectCity.areaId,
  807. countyId: this.$store.state.addr.selectDistrict.areaId,
  808. townId: this.$store.state.addr.selectStreet.areaId
  809. };
  810. page5echarts01(param)
  811. .then((res) => {
  812. // console.log('res',res);
  813. // this.page5Char1 = res.data;
  814. this.page5Char1.xAxis.data = res.data.map((item) => {
  815. return item.baseName;
  816. });
  817. this.page5Char1.series[0].data = res.data.map((item) => {
  818. return item.baseArea;
  819. });
  820. //数量过小时隐藏滚动
  821. if (this.page5Char1.xAxis.data.length <= 5) {
  822. this.page5Char1.dataZoom[0].show = false;
  823. }else{
  824. this.page5Char1.dataZoom[0].show = true;
  825. }
  826. let charUuid = this.$refs.page5Char1.mid;
  827. this.$refs.page5Char1.intChar(charUuid);
  828. })
  829. .catch((err) => {
  830. console.log('getPage5echarts01 err', err);
  831. });
  832. },
  833. getPage5echarts02() {
  834. let param = {
  835. cityId: this.$store.state.addr.selectCity.areaId,
  836. countyId: this.$store.state.addr.selectDistrict.areaId,
  837. townId: this.$store.state.addr.selectStreet.areaId
  838. };
  839. page5echarts02(param)
  840. .then((res) => {
  841. // console.log('res',res);
  842. // this.page5Char2 = res.data;
  843. this.page5Char2.xAxis.data = res.data.map((item) => {
  844. return item.name;
  845. });
  846. this.page5Char2.series[0].data = res.data.map((item) => {
  847. return item.number;
  848. });
  849. //数量过小时隐藏滚动
  850. if (this.page5Char2.xAxis.data.length <= 5) {
  851. this.page5Char2.dataZoom[0].show = false;
  852. }else{
  853. this.page5Char2.dataZoom[0].show = true;
  854. }
  855. let charUuid = this.$refs.page5Char2.mid;
  856. this.$refs.page5Char2.intChar(charUuid);
  857. })
  858. .catch((err) => {
  859. console.log('getPage5echarts02 err', err);
  860. });
  861. },
  862. getPage6numerical() {
  863. let param = {
  864. cityId: this.$store.state.addr.selectCity.areaId,
  865. countyId: this.$store.state.addr.selectDistrict.areaId,
  866. townId: this.$store.state.addr.selectStreet.areaId
  867. };
  868. //第一屏统计
  869. page6numerical(param)
  870. .then((res) => {
  871. // console.log('res',res);
  872. this.page6numerical = res.data;
  873. })
  874. .catch((err) => {
  875. console.log('getPage6numerical err', err);
  876. });
  877. },
  878. getPage6echarts01() {
  879. let param = {
  880. cityId: this.$store.state.addr.selectCity.areaId,
  881. countyId: this.$store.state.addr.selectDistrict.areaId,
  882. townId: this.$store.state.addr.selectStreet.areaId
  883. };
  884. page6echarts01(param)
  885. .then((res) => {
  886. // console.log('res',res);
  887. // this.page6Char1 = res.data;
  888. // this.page6Char1.xAxis[0].data = [];
  889. // this.page6Char1.series[0].data = [];
  890. // this.page6Char1.series[1].data = [];
  891. // this.page6Char1.series[2].data = [];
  892. // res.data &&
  893. // res.data.forEach((element) => {
  894. // this.page6Char1.xAxis[0].data.push(element.villageName);
  895. // this.page6Char1.series[0].data.push(element.fireCount);
  896. // this.page6Char1.series[1].data.push(element.cutCount);
  897. // this.page6Char1.series[2].data.push(element.pestCount);
  898. // });
  899. this.page6Char1.xAxis.data = [];
  900. this.page6Char1.series[0].data = [];
  901. this.page6Char1.series[1].data = [];
  902. this.page6Char1.series[2].data = [];
  903. const rows = res.data;
  904. // console.log(rows)
  905. // x坐标
  906. this.page6Char1.xAxis.data = rows.map((item) => {
  907. return item.villageName;
  908. });
  909. rows.forEach((element) => {
  910. this.page6Char1.series[0].data.push(element.pestCount);
  911. this.page6Char1.series[1].data.push(element.fireCount);
  912. this.page6Char1.series[2].data.push(element.cutCount);
  913. });
  914. // console.log('x坐标', this.page6Char1.xAxis.data)
  915. //数量过小时隐藏滚动
  916. if (this.page6Char1.xAxis.data.length <= 5) {
  917. this.page6Char1.dataZoom[0].show = false;
  918. }else{
  919. this.page6Char1.dataZoom[0].show = true;
  920. }
  921. let charUuid = this.$refs.page6Char1.mid;
  922. this.$refs.page6Char1.intChar(charUuid);
  923. })
  924. .catch((err) => {
  925. console.log('getPage6echarts01 err', err);
  926. });
  927. },
  928. getPage6echarts02() {
  929. let param = {
  930. cityId: this.$store.state.addr.selectCity.areaId,
  931. countyId: this.$store.state.addr.selectDistrict.areaId,
  932. townId: this.$store.state.addr.selectStreet.areaId
  933. };
  934. page6echarts02(param)
  935. .then((res) => {
  936. console.log('page6echarts02 res', res);
  937. const rows = res.data;
  938. // console.log(rows)
  939. // x坐标
  940. this.page6Char2.xAxis.data = [];
  941. this.page6Char2.series[0].data = [];
  942. this.page6Char2.series[1].data = [];
  943. this.page6Char2.series[2].data = [];
  944. this.page6Char2.xAxis.data = rows.map((item) => {
  945. return item.month;
  946. });
  947. rows.forEach((element) => {
  948. // console.log('element',element.eventList);
  949. this.page6Char2.series[0].data.push(element.eventList[0].value);
  950. this.page6Char2.series[1].data.push(element.eventList[1].value);
  951. this.page6Char2.series[2].data.push(element.eventList[2].value);
  952. });
  953. console.log('this.page6Char2.series', this.page6Char2.series);
  954. let charUuid = this.$refs.page6Char2.mid;
  955. this.$refs.page6Char2.intChar(charUuid);
  956. })
  957. .catch((err) => {
  958. console.log('page6echarts02 err', err);
  959. });
  960. },
  961. xiaobansearch() {
  962. // console.log('xiaobansearch');
  963. this.getRightScrollData();
  964. this.getPageData();
  965. },
  966. basesearch() {
  967. // console.log('xiaobansearch');
  968. this.getBaseList();
  969. this.getPageData();
  970. },
  971. scrollBoardClick(e) {
  972. console.log(e.row[0]);
  973. let param = {
  974. smallNumber: e.row[0],
  975. // cityId: this.$store.state.addr.selectCity.areaId,
  976. // countyId: this.$store.state.addr.selectDistrict.areaId,
  977. // townId: this.$store.state.addr.selectStreet.areaId
  978. };
  979. console.log(param);
  980. rightScrollData(param).then((res) => {
  981. this.changeSearchSmallClass(res.rows[0])
  982. });
  983. },
  984. scrollBaseListClick(e){
  985. console.log('scrollBaseListClick',e);
  986. },
  987. toggleShowScrollBoard() {
  988. this.showScrollBoard = !this.showScrollBoard;
  989. }
  990. }
  991. };
  992. </script>
  993. <style lang='scss' scoped>
  994. @import url(./index.scss);
  995. </style>