index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. <!--
  2. * @LastEditors: wangcc
  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" 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. </section>
  90. <section class="right-wrap">
  91. <PickerAddr />
  92. <div class="xiaoban u-flex">
  93. <div class="title">小班查询:</div>
  94. <el-input v-model="xiaobaninput" placeholder="请输入小班号">
  95. <i class="el-icon-search el-input__icon" slot="suffix" @click="xiaobansearch"></i>
  96. </el-input>
  97. </div>
  98. <section class="scroll-board-wrap" :class="{close:showScrollBoard==true}">
  99. <dv-scroll-board
  100. :key="scrollBoardKey"
  101. class="scroll-board-01"
  102. :config="scrollBoardConfig"
  103. ref="scrollBoard"
  104. @click="scrollBoardClick"
  105. :style="scrollBoardStyle"
  106. />
  107. <div class="scroll-board-tool" @click="toggleShowScrollBoard">
  108. <div class="inner">
  109. <img src="../assets/img/jiantou.png" alt />
  110. </div>
  111. </div>
  112. </section>
  113. </section>
  114. </dv-full-screen-container>
  115. </div>
  116. </template>
  117. <script>
  118. import Map from '../components/amap.vue';
  119. import Header from '../components/header';
  120. import MyEcharts from '../components/echarts';
  121. import Numerical from '../components/numerical';
  122. import Alarm from '../components/alarm';
  123. import PickerAddr from '../components/pickerAddr';
  124. import Typeslide from '../components/typeslide';
  125. import { Message } from 'element-ui';
  126. import { debounce } from '@/utils/mdebounce';
  127. import { sliceArray } from '@/utils/sliceArray';
  128. import { mapMutations, mapState, mapGetters } from 'vuex';
  129. import {
  130. page1numerical,
  131. page1echarts01,
  132. page1echarts02,
  133. rightScrollData,
  134. alarmDataApi,
  135. page2numerical,
  136. page2echarts01,
  137. page2echarts02,
  138. page2echarts03,
  139. page5numerical,
  140. typeSlideApi,
  141. page5echarts01,
  142. page5echarts02,
  143. page6numerical,
  144. page6echarts01,
  145. page6echarts02,
  146. smallClassDetail
  147. } from '../service/index';
  148. import scrollBoardSchema from '../dataSchema/scrollBoardSchema';
  149. import page1Char1Schema from '../dataSchema/page1Char1Schema';
  150. import page1Char2Schema from '../dataSchema/page1Char2Schema';
  151. import page2Char1Schema from '../dataSchema/page2Char1Schema';
  152. import page2Char2Schema from '../dataSchema/page2Char2Schema';
  153. import page2Char3Schema from '../dataSchema/page2Char3Schema';
  154. import page5Char1Schema from '../dataSchema/page5Char1Schema';
  155. import page5Char2Schema from '../dataSchema/page5Char2Schema';
  156. import page6Char1Schema from '../dataSchema/page6Char1Schema';
  157. import page6Char2Schema from '../dataSchema/page6Char2Schema';
  158. //柱状图颜色
  159. let colorArr = ['rgb(2, 238, 255)','rgb(94, 229, 116)','rgb(255, 255, 0)'];
  160. // import { provinceAndCityData, regionData, provinceAndCityDataPlus, regionDataPlus, CodeToText, TextToCode } from 'element-china-area-data';
  161. export default {
  162. name: '',
  163. components: {
  164. Map,
  165. Header,
  166. MyEcharts,
  167. Numerical,
  168. Alarm,
  169. PickerAddr,
  170. Typeslide
  171. },
  172. data() {
  173. return {
  174. showScrollBoard: false,
  175. page: 1,
  176. // addrOptions: regionDataPlus,
  177. addrSelectedOptions: ['520000', ''],
  178. navList: [
  179. { text: '森林资源', en: 'forest' },
  180. { text: '林木结构', en: 'treeSpecies' },
  181. { text: '碳汇管理', en: 'sink' },
  182. { text: '林下经济', en: 'economics' },
  183. { text: '土地流转', en: 'circulation' },
  184. { text: '事件信息', en: 'event' }
  185. ],
  186. scrollBoardKey: Date.now(),
  187. scrollBoardStyle: {
  188. // width: '100%',
  189. // height: '60vh'
  190. },
  191. scrollBoardConfig: scrollBoardSchema,
  192. page1numerical: [
  193. { name: '蓄积量', number: '2309', unit: '立方米' },
  194. { name: '占地面积', number: '55.4', unit: '万亩' }
  195. ],
  196. alarmData: [
  197. // {msg:'三都林场01小班于15:00:00发现火情,请尽快处理!'},
  198. // {msg:'测试1!'},
  199. // {msg:'测试22222222!'},
  200. ],
  201. page1Char1: page1Char1Schema,
  202. page1Char2: page1Char2Schema,
  203. page2numerical: [],
  204. page2Char1: page2Char1Schema,
  205. page2Char2: page2Char2Schema,
  206. page2Char3: page2Char3Schema,
  207. page5numerical: [],
  208. typeSlideData: [],
  209. page5Char1: page5Char1Schema,
  210. page5Char2: page5Char2Schema,
  211. page6numerical: [],
  212. page6Char1: page6Char1Schema,
  213. page6Char2: page6Char2Schema,
  214. xiaobaninput: ''
  215. };
  216. },
  217. created() {},
  218. mounted() {
  219. this.getPageData();
  220. this.getRightScrollData();
  221. setInterval(() => {
  222. this.getPageData();
  223. }, 60000);
  224. },
  225. watch: {
  226. xiaobaninput: {
  227. handler: function () {
  228. debounce(this.xiaobansearch, 500, false);
  229. }
  230. },
  231. '$store.state.addr.selectCity'(val) {
  232. // debounce(this.getPageData(), 1000, false)
  233. this.getPageData();
  234. },
  235. '$store.state.addr.selectDistrict'(val) {
  236. this.getPageData();
  237. },
  238. '$store.state.addr.selectStreet'(val) {
  239. this.getPageData();
  240. }
  241. },
  242. methods: {
  243. ...mapMutations([
  244. 'changeSearchSmallClass'
  245. ]),
  246. addrChange(value) {
  247. console.log('addrChange', value);
  248. },
  249. navClick(index) {
  250. this.$store.commit('changePage', this.navList[index - 1].en);
  251. console.log('this.navList[index-1].en', this.navList[index - 1].en);
  252. this.page = index;
  253. console.log('index', index);
  254. if (
  255. this.$store.state.addr.page == 'sink' ||
  256. this.$store.state.addr.page == 'circulation'
  257. ) {
  258. Message('暂未开放!');
  259. return;
  260. }
  261. // 切换专题时,重置区域
  262. // this.$store.dispatch('searchArea', {
  263. // parentId: '520000',
  264. // name: '贵州省',
  265. // mapLevel: 'province'
  266. // });
  267. this.getPageData();
  268. },
  269. getPageData() {
  270. debounce(this.debounceGetData, 300, false);
  271. },
  272. debounceGetData() {
  273. console.log('page', this.$store.state.addr.page);
  274. // {text:'森林资源',en:'forest'},
  275. // {text:'林木结构',en:'treeSpecies'},
  276. // {text:'碳汇管理',en:'sink'},
  277. // {text:'林下经济',en:'economics'},
  278. // {text:'土地流转',en:'circulation'},
  279. // {text:'事件信息',en:'event'},
  280. if (this.$store.state.addr.page == 'forest') {
  281. this.getPage1numerical();
  282. this.getPage1echarts01();
  283. this.getPage1echarts02();
  284. this.getRightScrollData();
  285. } else if (this.$store.state.addr.page == 'treeSpecies') {
  286. this.getPage2numerical();
  287. // this.getPage2echarts01();
  288. this.getPage2echarts02();
  289. this.getPage2echarts03();
  290. this.getRightScrollData();
  291. } else if (this.$store.state.addr.page == 'economics') {
  292. this.getPage5numerical();
  293. // this.getTypeSlideData();
  294. this.getPage5echarts01();
  295. this.getPage5echarts02();
  296. this.getRightScrollData();
  297. } else if (this.$store.state.addr.page == 'event') {
  298. this.getPage6numerical();
  299. this.getPage6echarts01();
  300. this.getPage6echarts02();
  301. this.getAlarmData();
  302. this.getRightScrollData();
  303. }
  304. },
  305. getPage1numerical() {
  306. let param = {
  307. cityId: this.$store.state.addr.selectCity.areaId,
  308. countyId: this.$store.state.addr.selectDistrict.areaId,
  309. townId: this.$store.state.addr.vuexSelectStreet.areaId
  310. };
  311. page1numerical(param)
  312. .then((res) => {
  313. // console.log('res',res);
  314. this.page1numerical = res.data;
  315. })
  316. .catch((err) => {
  317. console.log('echarts01 err', err);
  318. });
  319. },
  320. getPage1echarts01() {
  321. let param = {
  322. cityId: this.$store.state.addr.selectCity.areaId,
  323. countyId: this.$store.state.addr.selectDistrict.areaId,
  324. townId: this.$store.state.addr.vuexSelectStreet.areaId
  325. };
  326. // console.log('cityId',param.cityId);
  327. page1echarts01(param)
  328. .then((res) => {
  329. this.page1Char1.xAxis.data = res.data.map((item) => {
  330. return item.name;
  331. });
  332. this.page1Char1.series[0].data = res.data.map((item) => {
  333. return item.number;
  334. });
  335. //数量过小时隐藏滚动
  336. if (this.page1Char1.xAxis.data.length <= 8) {
  337. this.page1Char1.dataZoom[0].show = false;
  338. }
  339. let charUuid = this.$refs.page1Char1.mid;
  340. this.$refs.page1Char1.intChar(charUuid);
  341. })
  342. .catch((err) => {
  343. console.log('getPage1echarts01 err', err);
  344. });
  345. },
  346. getPage1echarts02() {
  347. let param = {
  348. cityId: this.$store.state.addr.selectCity.areaId,
  349. countyId: this.$store.state.addr.selectDistrict.areaId,
  350. townId: this.$store.state.addr.selectStreet.areaId
  351. };
  352. // console.log('cityId',param.cityId);
  353. page1echarts02(param)
  354. .then((res) => {
  355. this.page1Char2.xAxis.data = res.data.map((item) => {
  356. return item.name;
  357. });
  358. this.page1Char2.series[0].data = res.data.map((item) => {
  359. return item.number;
  360. });
  361. //数量过小时隐藏滚动
  362. if (this.page1Char2.xAxis.data.length <= 8) {
  363. this.page1Char2.dataZoom[0].show = false;
  364. }
  365. let charUuid = this.$refs.page1Char2.mid;
  366. this.$refs.page1Char2.intChar(charUuid);
  367. })
  368. .catch((err) => {
  369. console.log('getPage1echarts02 err', err);
  370. });
  371. },
  372. getRightScrollData() {
  373. let param = {
  374. smallNumber: this.xiaobaninput,
  375. cityId: this.$store.state.addr.selectCity.areaId,
  376. countyId: this.$store.state.addr.selectDistrict.areaId,
  377. townId: this.$store.state.addr.selectStreet.areaId
  378. };
  379. rightScrollData(param)
  380. .then((res) => {
  381. // console.log('res',res.rows.length);
  382. // console.log('this.scrollBoardConfig',this.scrollBoardConfig);
  383. //当小班滚动数据少时重设参数
  384. // if(res.rows.length<=15){
  385. // this.scrollBoardConfig.rowNum = 5;
  386. // this.scrollBoardStyle.height = '25vh'
  387. // }
  388. this.scrollBoardConfig.data = [];
  389. res.rows.forEach((element) => {
  390. this.scrollBoardConfig.data.push([
  391. element.smallNumber,
  392. element.treeComp,
  393. element.perAcreStock + 'm³',
  394. element.landArea + '亩'
  395. ]);
  396. });
  397. this.scrollBoardKey = Date.now();
  398. this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
  399. // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
  400. // this.scrollBoardConfig = res.data;
  401. })
  402. .catch((err) => {
  403. console.log('echarts01 err', err);
  404. });
  405. },
  406. getAlarmData() {
  407. alarmDataApi()
  408. .then((res) => {
  409. // console.log('this.page',this.page);
  410. // console.log('res',res);
  411. this.alarmData = res.data;
  412. // console.log('alarmData.length',this.alarmData.length);
  413. })
  414. .catch((err) => {
  415. console.log('echarts01 err', err);
  416. });
  417. },
  418. getPage2numerical() {
  419. let param = {
  420. cityId: this.$store.state.addr.selectCity.areaId,
  421. countyId: this.$store.state.addr.selectDistrict.areaId,
  422. townId: this.$store.state.addr.vuexSelectStreet.areaId,
  423. smallNumber: this.xiaobaninput
  424. };
  425. page2numerical(param)
  426. .then((res) => {
  427. // console.log('res',res);
  428. this.page2numerical = res.data;
  429. })
  430. .catch((err) => {
  431. console.log('page2numerical err', err);
  432. });
  433. },
  434. getPage2echarts01() {
  435. let param = {
  436. smallNumber: this.xiaobaninput,
  437. cityId: this.$store.state.addr.selectCity.areaId,
  438. countyId: this.$store.state.addr.selectDistrict.areaId,
  439. townId: this.$store.state.addr.selectStreet.areaId
  440. };
  441. page2echarts01(param)
  442. .then((res) => {
  443. // console.log('res',res);
  444. this.page2Char1.series[0].data = [];
  445. this.page2Char1.series[0].data = res.data;
  446. let charUuid = this.$refs.page2Char1.mid;
  447. this.$refs.page2Char1.intChar(charUuid);
  448. })
  449. .catch((err) => {
  450. console.log('getPage2echarts01 err', err);
  451. });
  452. },
  453. getPage2echarts02() {
  454. let param = {
  455. smallNumber: this.xiaobaninput,
  456. cityId: this.$store.state.addr.selectCity.areaId,
  457. countyId: this.$store.state.addr.selectDistrict.areaId,
  458. townId: this.$store.state.addr.selectStreet.areaId
  459. };
  460. page2echarts02(param)
  461. .then((res) => {
  462. // console.log('res',res);
  463. // this.page2Char2 = res.data;
  464. // console.log('this.page2Char2.series', this.page2Char2.series);
  465. this.page2Char2.xAxis.data = [];
  466. this.page2Char2.series = [];
  467. const rows = res.data;
  468. // console.log(rows)
  469. // x坐标
  470. this.page2Char2.xAxis.data = rows.map((item) => {
  471. return item.smallNumber;
  472. });
  473. // console.log('x坐标', this.page2Char2.xAxis.data)
  474. // 获取所有项
  475. let seriesList = rows.map((item) => {
  476. return item.treeList;
  477. });
  478. // 数组扁平化
  479. seriesList = seriesList.flat();
  480. // 去重
  481. let obj = {};
  482. seriesList = seriesList.reduce((newArr, next) => {
  483. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  484. return newArr;
  485. }, []);
  486. seriesList = seriesList.map((item,index ) => {
  487. return {
  488. name: item.name,
  489. type: 'bar',
  490. stack: 'total',
  491. label: {
  492. show: false
  493. },
  494. emphasis: {
  495. focus: 'series'
  496. },
  497. data: [],
  498. itemStyle: {
  499. normal: { color: colorArr[index]||"auto" },
  500. }
  501. };
  502. });
  503. // console.log(seriesList)
  504. rows.forEach((item) => {
  505. seriesList.forEach((jtem, index) => {
  506. let num = 0;
  507. item.treeList.map((ktem) => {
  508. if (ktem.name.indexOf(jtem.name) > -1) {
  509. num = ktem.value;
  510. }
  511. });
  512. seriesList[index].data.push(num);
  513. });
  514. });
  515. // console.log('page2echarts02 seriesList',seriesList)
  516. this.page2Char2.series = seriesList;
  517. //数量过小时隐藏滚动
  518. if (this.page2Char2.xAxis.data.length <= 8) {
  519. this.page2Char2.dataZoom[0].show = false;
  520. }
  521. let charUuid = this.$refs.page2Char2.mid;
  522. this.$refs.page2Char2.intChar(charUuid);
  523. })
  524. .catch((err) => {
  525. console.log('getPage2echarts02 err', err);
  526. });
  527. },
  528. getPage2echarts03() {
  529. let param = {
  530. smallNumber: this.xiaobaninput,
  531. cityId: this.$store.state.addr.selectCity.areaId,
  532. countyId: this.$store.state.addr.selectDistrict.areaId,
  533. townId: this.$store.state.addr.selectStreet.areaId
  534. };
  535. page2echarts03(param)
  536. .then((res) => {
  537. // console.log('res',res);
  538. // this.page2Char2 = res.data;
  539. // console.log('this.page2Char2.series', this.page2Char2.series);
  540. this.page2Char3.xAxis.data = [];
  541. this.page2Char3.series = [];
  542. const rows = res.data;
  543. // console.log(rows)
  544. // x坐标
  545. this.page2Char3.xAxis.data = rows.map((item) => {
  546. return item.smallNumber;
  547. });
  548. // console.log('x坐标', this.page2Char2.xAxis.data)
  549. // 获取所有项
  550. let seriesList = rows.map((item) => {
  551. return item.treeList;
  552. });
  553. // 数组扁平化
  554. seriesList = seriesList.flat();
  555. // 去重
  556. let obj = {};
  557. seriesList = seriesList.reduce((newArr, next) => {
  558. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  559. return newArr;
  560. }, []);
  561. seriesList = seriesList.map((item,index) => {
  562. return {
  563. name: item.name,
  564. type: 'bar',
  565. stack: 'total',
  566. label: {
  567. show: false
  568. },
  569. emphasis: {
  570. focus: 'series'
  571. },
  572. data: [],
  573. itemStyle: {
  574. normal: { color: colorArr[index]||"auto" },
  575. }
  576. };
  577. });
  578. // console.log(seriesList)
  579. rows.forEach((item) => {
  580. seriesList.forEach((jtem, index) => {
  581. let num = 0;
  582. item.treeList.map((ktem) => {
  583. if (ktem.name.indexOf(jtem.name) > -1) {
  584. num = ktem.value;
  585. }
  586. });
  587. seriesList[index].data.push(num);
  588. });
  589. });
  590. // console.log(seriesList)
  591. this.page2Char3.series = seriesList;
  592. //数量过小时隐藏滚动
  593. if (this.page2Char3.xAxis.data.length <= 8) {
  594. this.page2Char3.dataZoom[0].show = false;
  595. }
  596. let charUuid = this.$refs.page2Char3.mid;
  597. this.$refs.page2Char3.intChar(charUuid);
  598. })
  599. .catch((err) => {
  600. console.log('getPage2echarts03 err', err);
  601. });
  602. },
  603. getPage5numerical() {
  604. let param = {
  605. cityId: this.$store.state.addr.selectCity.areaId,
  606. countyId: this.$store.state.addr.selectDistrict.areaId,
  607. townId: this.$store.state.addr.selectStreet.areaId
  608. };
  609. page5numerical(param)
  610. .then((res) => {
  611. // console.log('res',res);
  612. this.page5numerical = res.data;
  613. })
  614. .catch((err) => {
  615. console.log('echarts01 err', err);
  616. });
  617. },
  618. getTypeSlideData() {
  619. let param = {
  620. cityId: this.$store.state.addr.selectCity.areaId,
  621. countyId: this.$store.state.addr.selectDistrict.areaId,
  622. townId: this.$store.state.addr.selectStreet.areaId
  623. };
  624. typeSlideApi(param)
  625. .then((res) => {
  626. this.typeSlideData = sliceArray(res.data, 3);
  627. // console.log(' this.typeSlideData', this.typeSlideData);
  628. })
  629. .catch((err) => {
  630. console.log('getTypeSlideData err', err);
  631. });
  632. },
  633. getPage5echarts01() {
  634. let param = {
  635. cityId: this.$store.state.addr.selectCity.areaId,
  636. countyId: this.$store.state.addr.selectDistrict.areaId,
  637. townId: this.$store.state.addr.selectStreet.areaId
  638. };
  639. page5echarts01(param)
  640. .then((res) => {
  641. // console.log('res',res);
  642. // this.page5Char1 = res.data;
  643. this.page5Char1.xAxis.data = res.data.map((item) => {
  644. return item.baseName;
  645. });
  646. this.page5Char1.series[0].data = res.data.map((item) => {
  647. return item.baseArea;
  648. });
  649. //数量过小时隐藏滚动
  650. if (this.page5Char1.xAxis.data.length <= 8) {
  651. this.page5Char1.dataZoom[0].show = false;
  652. }
  653. let charUuid = this.$refs.page5Char1.mid;
  654. this.$refs.page5Char1.intChar(charUuid);
  655. })
  656. .catch((err) => {
  657. console.log('getPage5echarts01 err', err);
  658. });
  659. },
  660. getPage5echarts02() {
  661. let param = {
  662. cityId: this.$store.state.addr.selectCity.areaId,
  663. countyId: this.$store.state.addr.selectDistrict.areaId,
  664. townId: this.$store.state.addr.selectStreet.areaId
  665. };
  666. page5echarts02(param)
  667. .then((res) => {
  668. // console.log('res',res);
  669. // this.page5Char2 = res.data;
  670. this.page5Char2.xAxis.data = res.data.map((item) => {
  671. return item.name;
  672. });
  673. this.page5Char2.series[0].data = res.data.map((item) => {
  674. return item.number;
  675. });
  676. //数量过小时隐藏滚动
  677. if (this.page5Char2.xAxis.data.length <= 8) {
  678. this.page5Char2.dataZoom[0].show = false;
  679. }
  680. let charUuid = this.$refs.page5Char2.mid;
  681. this.$refs.page5Char2.intChar(charUuid);
  682. })
  683. .catch((err) => {
  684. console.log('getPage5echarts02 err', err);
  685. });
  686. },
  687. getPage6numerical() {
  688. let param = {
  689. cityId: this.$store.state.addr.selectCity.areaId,
  690. countyId: this.$store.state.addr.selectDistrict.areaId,
  691. townId: this.$store.state.addr.selectStreet.areaId
  692. };
  693. //第一屏统计
  694. page6numerical(param)
  695. .then((res) => {
  696. // console.log('res',res);
  697. this.page6numerical = res.data;
  698. })
  699. .catch((err) => {
  700. console.log('getPage6numerical err', err);
  701. });
  702. },
  703. getPage6echarts01() {
  704. let param = {
  705. cityId: this.$store.state.addr.selectCity.areaId,
  706. countyId: this.$store.state.addr.selectDistrict.areaId,
  707. townId: this.$store.state.addr.selectStreet.areaId
  708. };
  709. page6echarts01(param)
  710. .then((res) => {
  711. // console.log('res',res);
  712. // this.page6Char1 = res.data;
  713. // this.page6Char1.xAxis[0].data = [];
  714. // this.page6Char1.series[0].data = [];
  715. // this.page6Char1.series[1].data = [];
  716. // this.page6Char1.series[2].data = [];
  717. // res.data &&
  718. // res.data.forEach((element) => {
  719. // this.page6Char1.xAxis[0].data.push(element.villageName);
  720. // this.page6Char1.series[0].data.push(element.fireCount);
  721. // this.page6Char1.series[1].data.push(element.cutCount);
  722. // this.page6Char1.series[2].data.push(element.pestCount);
  723. // });
  724. this.page6Char1.xAxis.data = [];
  725. this.page6Char1.series[0].data = [];
  726. this.page6Char1.series[1].data = [];
  727. this.page6Char1.series[2].data = [];
  728. const rows = res.data;
  729. // console.log(rows)
  730. // x坐标
  731. this.page6Char1.xAxis.data = rows.map((item) => {
  732. return item.villageName;
  733. });
  734. rows.forEach((element) => {
  735. this.page6Char1.series[0].data.push(element.pestCount);
  736. this.page6Char1.series[1].data.push(element.fireCount);
  737. this.page6Char1.series[2].data.push(element.cutCount);
  738. });
  739. // console.log('x坐标', this.page6Char1.xAxis.data)
  740. //数量过小时隐藏滚动
  741. if (this.page6Char1.xAxis.data.length <= 8) {
  742. this.page6Char1.dataZoom[0].show = false;
  743. }
  744. let charUuid = this.$refs.page6Char1.mid;
  745. this.$refs.page6Char1.intChar(charUuid);
  746. })
  747. .catch((err) => {
  748. console.log('getPage6echarts01 err', err);
  749. });
  750. },
  751. getPage6echarts02() {
  752. let param = {
  753. cityId: this.$store.state.addr.selectCity.areaId,
  754. countyId: this.$store.state.addr.selectDistrict.areaId,
  755. townId: this.$store.state.addr.selectStreet.areaId
  756. };
  757. page6echarts02(param)
  758. .then((res) => {
  759. console.log('page6echarts02 res', res);
  760. const rows = res.data;
  761. // console.log(rows)
  762. // x坐标
  763. this.page6Char2.xAxis.data = [];
  764. this.page6Char2.series[0].data = [];
  765. this.page6Char2.series[1].data = [];
  766. this.page6Char2.series[2].data = [];
  767. this.page6Char2.xAxis.data = rows.map((item) => {
  768. return item.month;
  769. });
  770. rows.forEach((element) => {
  771. // console.log('element',element.eventList);
  772. this.page6Char2.series[0].data.push(element.eventList[0].value);
  773. this.page6Char2.series[1].data.push(element.eventList[1].value);
  774. this.page6Char2.series[2].data.push(element.eventList[2].value);
  775. });
  776. console.log('this.page6Char2.series', this.page6Char2.series);
  777. let charUuid = this.$refs.page6Char2.mid;
  778. this.$refs.page6Char2.intChar(charUuid);
  779. })
  780. .catch((err) => {
  781. console.log('page6echarts02 err', err);
  782. });
  783. },
  784. xiaobansearch() {
  785. // console.log('xiaobansearch');
  786. this.getRightScrollData();
  787. this.getPageData();
  788. },
  789. scrollBoardClick(e) {
  790. console.log(e.row[0]);
  791. let param = {
  792. smallNumber: e.row[0],
  793. cityId: this.$store.state.addr.selectCity.areaId,
  794. countyId: this.$store.state.addr.selectDistrict.areaId,
  795. townId: this.$store.state.addr.selectStreet.areaId
  796. };
  797. console.log(param);
  798. rightScrollData(param).then((res) => {
  799. this.changeSearchSmallClass(res.rows[0])
  800. });
  801. },
  802. toggleShowScrollBoard() {
  803. this.showScrollBoard = !this.showScrollBoard;
  804. }
  805. }
  806. };
  807. </script>
  808. <style lang='scss' scoped>
  809. @import url(./index.scss);
  810. </style>