index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912
  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" 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. window.onresize=()=>{
  225. //图表resize
  226. if (this.$store.state.addr.page == 'forest') {
  227. let page1Char1Uuid = this.$refs.page1Char1.mid;
  228. this.$refs.page1Char1.resizeChar(page1Char1Uuid);
  229. let page1Char2Uuid = this.$refs.page1Char2.mid;
  230. this.$refs.page1Char2.resizeChar(page1Char2Uuid);
  231. } else if (this.$store.state.addr.page == 'treeSpecies') {
  232. let page2Char2Uuid = this.$refs.page2Char2.mid;
  233. this.$refs.page2Char2.resizeChar(page2Char2Uuid);
  234. let page2Char3Uuid = this.$refs.page2Char3.mid;
  235. this.$refs.page2Char3.resizeChar(page2Char3Uuid);
  236. } else if (this.$store.state.addr.page == 'economics') {
  237. let page5Char1Uuid = this.$refs.page5Char1.mid;
  238. this.$refs.page5Char1.resizeChar(page5Char1Uuid);
  239. let page5Char2Uuid = this.$refs.page5Char2.mid;
  240. this.$refs.page5Char2.resizeChar(page5Char2Uuid);
  241. } else if (this.$store.state.addr.page == 'event') {
  242. let page6Char1Uuid = this.$refs.page6Char1.mid;
  243. this.$refs.page6Char1.resizeChar(page6Char1Uuid);
  244. let page6Char2Uuid = this.$refs.page6Char2.mid;
  245. this.$refs.page6Char2.resizeChar(page6Char2Uuid);
  246. }
  247. }
  248. },
  249. watch: {
  250. xiaobaninput: {
  251. handler: function () {
  252. debounce(this.xiaobansearch, 500, false);
  253. }
  254. },
  255. '$store.state.addr.selectCity'(val) {
  256. // debounce(this.getPageData(), 1000, false)
  257. this.getPageData();
  258. },
  259. '$store.state.addr.selectDistrict'(val) {
  260. this.getPageData();
  261. },
  262. '$store.state.addr.selectStreet'(val) {
  263. this.getPageData();
  264. }
  265. },
  266. methods: {
  267. ...mapMutations([
  268. 'changeSearchSmallClass'
  269. ]),
  270. addrChange(value) {
  271. console.log('addrChange', value);
  272. },
  273. navClick(index) {
  274. this.$store.commit('changePage', this.navList[index - 1].en);
  275. console.log('this.navList[index-1].en', this.navList[index - 1].en);
  276. this.page = index;
  277. console.log('index', index);
  278. if (
  279. this.$store.state.addr.page == 'sink' ||
  280. this.$store.state.addr.page == 'circulation'
  281. ) {
  282. Message('暂未开放!');
  283. return;
  284. }
  285. // 切换专题时,重置区域
  286. // this.$store.dispatch('searchArea', {
  287. // parentId: '520000',
  288. // name: '贵州省',
  289. // mapLevel: 'province'
  290. // });
  291. this.getPageData();
  292. },
  293. getPageData() {
  294. debounce(this.debounceGetData, 300, false);
  295. },
  296. debounceGetData() {
  297. console.log('page', this.$store.state.addr.page);
  298. // {text:'森林资源',en:'forest'},
  299. // {text:'林木结构',en:'treeSpecies'},
  300. // {text:'碳汇管理',en:'sink'},
  301. // {text:'林下经济',en:'economics'},
  302. // {text:'土地流转',en:'circulation'},
  303. // {text:'事件信息',en:'event'},
  304. if (this.$store.state.addr.page == 'forest') {
  305. this.getPage1numerical();
  306. this.getPage1echarts01();
  307. this.getPage1echarts02();
  308. this.getRightScrollData();
  309. } else if (this.$store.state.addr.page == 'treeSpecies') {
  310. this.getPage2numerical();
  311. // this.getPage2echarts01();
  312. this.getPage2echarts02();
  313. this.getPage2echarts03();
  314. this.getRightScrollData();
  315. } else if (this.$store.state.addr.page == 'economics') {
  316. this.getPage5numerical();
  317. // this.getTypeSlideData();
  318. this.getPage5echarts01();
  319. this.getPage5echarts02();
  320. this.getRightScrollData();
  321. } else if (this.$store.state.addr.page == 'event') {
  322. this.getPage6numerical();
  323. this.getPage6echarts01();
  324. this.getPage6echarts02();
  325. this.getAlarmData();
  326. this.getRightScrollData();
  327. }
  328. },
  329. getPage1numerical() {
  330. let param = {
  331. cityId: this.$store.state.addr.selectCity.areaId,
  332. countyId: this.$store.state.addr.selectDistrict.areaId,
  333. townId: this.$store.state.addr.selectStreet.areaId
  334. };
  335. page1numerical(param)
  336. .then((res) => {
  337. // console.log('res',res);
  338. this.page1numerical = res.data;
  339. })
  340. .catch((err) => {
  341. console.log('echarts01 err', err);
  342. });
  343. },
  344. getPage1echarts01() {
  345. let param = {
  346. cityId: this.$store.state.addr.selectCity.areaId,
  347. countyId: this.$store.state.addr.selectDistrict.areaId,
  348. townId: this.$store.state.addr.selectStreet.areaId
  349. };
  350. // console.log('cityId',param.cityId);
  351. page1echarts01(param)
  352. .then((res) => {
  353. this.page1Char1.xAxis.data = res.data.map((item) => {
  354. return item.name;
  355. });
  356. this.page1Char1.series[0].data = res.data.map((item) => {
  357. return item.number;
  358. });
  359. //数量过小时隐藏滚动
  360. if (this.page1Char1.xAxis.data.length <= 8) {
  361. this.page1Char1.dataZoom[0].show = false;
  362. }else{
  363. this.page1Char1.dataZoom[0].show = true;
  364. }
  365. let charUuid = this.$refs.page1Char1.mid;
  366. this.$refs.page1Char1.intChar(charUuid);
  367. })
  368. .catch((err) => {
  369. console.log('getPage1echarts01 err', err);
  370. });
  371. },
  372. getPage1echarts02() {
  373. let param = {
  374. cityId: this.$store.state.addr.selectCity.areaId,
  375. countyId: this.$store.state.addr.selectDistrict.areaId,
  376. townId: this.$store.state.addr.selectStreet.areaId
  377. };
  378. // console.log('cityId',param.cityId);
  379. page1echarts02(param)
  380. .then((res) => {
  381. this.page1Char2.xAxis.data = res.data.map((item) => {
  382. return item.name;
  383. });
  384. this.page1Char2.series[0].data = res.data.map((item) => {
  385. return item.number;
  386. });
  387. //数量过小时隐藏滚动
  388. if (this.page1Char2.xAxis.data.length <= 8) {
  389. this.page1Char2.dataZoom[0].show = false;
  390. }else{
  391. this.page1Char2.dataZoom[0].show = true;
  392. }
  393. let charUuid = this.$refs.page1Char2.mid;
  394. this.$refs.page1Char2.intChar(charUuid);
  395. })
  396. .catch((err) => {
  397. console.log('getPage1echarts02 err', err);
  398. });
  399. },
  400. getRightScrollData() {
  401. let param = {
  402. smallNumber: this.xiaobaninput,
  403. cityId: this.$store.state.addr.selectCity.areaId,
  404. countyId: this.$store.state.addr.selectDistrict.areaId,
  405. townId: this.$store.state.addr.selectStreet.areaId
  406. };
  407. rightScrollData(param)
  408. .then((res) => {
  409. // console.log('res',res.rows.length);
  410. // console.log('this.scrollBoardConfig',this.scrollBoardConfig);
  411. //当小班滚动数据少时重设参数
  412. // if(res.rows.length<=15){
  413. // this.scrollBoardConfig.rowNum = 5;
  414. // this.scrollBoardStyle.height = '25vh'
  415. // }
  416. this.scrollBoardConfig.data = [];
  417. res.rows.forEach((element) => {
  418. this.scrollBoardConfig.data.push([
  419. element.smallNumber,
  420. element.treeComp,
  421. element.perAcreStock + 'm³',
  422. element.landArea + '亩'
  423. ]);
  424. });
  425. this.scrollBoardKey = Date.now();
  426. this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
  427. // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
  428. // this.scrollBoardConfig = res.data;
  429. })
  430. .catch((err) => {
  431. console.log('echarts01 err', err);
  432. });
  433. },
  434. getAlarmData() {
  435. alarmDataApi()
  436. .then((res) => {
  437. // console.log('this.page',this.page);
  438. // console.log('res',res);
  439. this.alarmData = res.data;
  440. // console.log('alarmData.length',this.alarmData.length);
  441. })
  442. .catch((err) => {
  443. console.log('echarts01 err', err);
  444. });
  445. },
  446. getPage2numerical() {
  447. let param = {
  448. cityId: this.$store.state.addr.selectCity.areaId,
  449. countyId: this.$store.state.addr.selectDistrict.areaId,
  450. townId: this.$store.state.addr.selectStreet.areaId,
  451. smallNumber: this.xiaobaninput
  452. };
  453. page2numerical(param)
  454. .then((res) => {
  455. // console.log('res',res);
  456. this.page2numerical = res.data;
  457. })
  458. .catch((err) => {
  459. console.log('page2numerical err', err);
  460. });
  461. },
  462. getPage2echarts01() {
  463. let param = {
  464. smallNumber: this.xiaobaninput,
  465. cityId: this.$store.state.addr.selectCity.areaId,
  466. countyId: this.$store.state.addr.selectDistrict.areaId,
  467. townId: this.$store.state.addr.selectStreet.areaId
  468. };
  469. page2echarts01(param)
  470. .then((res) => {
  471. // console.log('res',res);
  472. this.page2Char1.series[0].data = [];
  473. this.page2Char1.series[0].data = res.data;
  474. let charUuid = this.$refs.page2Char1.mid;
  475. this.$refs.page2Char1.intChar(charUuid);
  476. })
  477. .catch((err) => {
  478. console.log('getPage2echarts01 err', err);
  479. });
  480. },
  481. getPage2echarts02() {
  482. let param = {
  483. smallNumber: this.xiaobaninput,
  484. cityId: this.$store.state.addr.selectCity.areaId,
  485. countyId: this.$store.state.addr.selectDistrict.areaId,
  486. townId: this.$store.state.addr.selectStreet.areaId
  487. };
  488. page2echarts02(param)
  489. .then((res) => {
  490. // console.log('res',res);
  491. // this.page2Char2 = res.data;
  492. // console.log('this.page2Char2.series', this.page2Char2.series);
  493. this.page2Char2.xAxis.data = [];
  494. this.page2Char2.series = [];
  495. const rows = res.data;
  496. // console.log(rows)
  497. // x坐标
  498. this.page2Char2.xAxis.data = rows.map((item) => {
  499. return item.smallNumber;
  500. });
  501. // console.log('x坐标', this.page2Char2.xAxis.data)
  502. // 获取所有项
  503. let seriesList = rows.map((item) => {
  504. return item.treeList;
  505. });
  506. // 数组扁平化
  507. seriesList = seriesList.flat();
  508. // 去重
  509. let obj = {};
  510. seriesList = seriesList.reduce((newArr, next) => {
  511. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  512. return newArr;
  513. }, []);
  514. seriesList = seriesList.map((item,index ) => {
  515. let itemColor = null;
  516. if(item.name=='杉木'||item.name=='杉'){
  517. itemColor = colorArr[0]
  518. }else if(item.name=='马尾松'||item.name=='马'){
  519. itemColor = colorArr[1]
  520. }else if(item.name=='软阔'||item.name=='软'){
  521. itemColor = colorArr[2]
  522. }else if(item.name=='硬阔'||item.name=='硬'){
  523. itemColor = colorArr[3]
  524. }
  525. return {
  526. name: item.name,
  527. type: 'bar',
  528. stack: 'total',
  529. label: {
  530. show: false
  531. },
  532. emphasis: {
  533. focus: 'series'
  534. },
  535. data: [],
  536. itemStyle: {
  537. normal: { color: itemColor||"auto" },
  538. }
  539. };
  540. });
  541. // console.log(seriesList)
  542. rows.forEach((item) => {
  543. seriesList.forEach((jtem, index) => {
  544. let num = 0;
  545. item.treeList.map((ktem) => {
  546. if (ktem.name.indexOf(jtem.name) > -1) {
  547. num = ktem.value;
  548. }
  549. });
  550. seriesList[index].data.push(num);
  551. });
  552. });
  553. // console.log('page2echarts02 seriesList',seriesList)
  554. this.page2Char2.series = seriesList;
  555. //数量过小时隐藏滚动
  556. if (this.page2Char2.xAxis.data.length <= 8) {
  557. this.page2Char2.dataZoom[0].show = false;
  558. }else{
  559. this.page2Char2.dataZoom[0].show = true;
  560. }
  561. let charUuid = this.$refs.page2Char2.mid;
  562. this.$refs.page2Char2.intChar(charUuid);
  563. })
  564. .catch((err) => {
  565. console.log('getPage2echarts02 err', err);
  566. });
  567. },
  568. getPage2echarts03() {
  569. let param = {
  570. smallNumber: this.xiaobaninput,
  571. cityId: this.$store.state.addr.selectCity.areaId,
  572. countyId: this.$store.state.addr.selectDistrict.areaId,
  573. townId: this.$store.state.addr.selectStreet.areaId
  574. };
  575. page2echarts03(param)
  576. .then((res) => {
  577. // console.log('res',res);
  578. // this.page2Char2 = res.data;
  579. // console.log('this.page2Char2.series', this.page2Char2.series);
  580. this.page2Char3.xAxis.data = [];
  581. this.page2Char3.series = [];
  582. const rows = res.data;
  583. // console.log(rows)
  584. // x坐标
  585. this.page2Char3.xAxis.data = rows.map((item) => {
  586. return item.smallNumber;
  587. });
  588. // console.log('x坐标', this.page2Char2.xAxis.data)
  589. // 获取所有项
  590. let seriesList = rows.map((item) => {
  591. return item.treeList;
  592. });
  593. // 数组扁平化
  594. seriesList = seriesList.flat();
  595. // 去重
  596. let obj = {};
  597. seriesList = seriesList.reduce((newArr, next) => {
  598. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  599. return newArr;
  600. }, []);
  601. seriesList = seriesList.map((item,index) => {
  602. let itemColor = null;
  603. if(item.name=='杉木'||item.name=='杉'){
  604. itemColor = colorArr[0]
  605. }else if(item.name=='马尾松'||item.name=='马'){
  606. itemColor = colorArr[1]
  607. }else if(item.name=='软阔'||item.name=='软'){
  608. itemColor = colorArr[2]
  609. }else if(item.name=='硬阔'||item.name=='硬'){
  610. itemColor = colorArr[3]
  611. }
  612. return {
  613. name: item.name,
  614. type: 'bar',
  615. stack: 'total',
  616. label: {
  617. show: false
  618. },
  619. emphasis: {
  620. focus: 'series'
  621. },
  622. data: [],
  623. itemStyle: {
  624. normal: { color: itemColor||"auto" },
  625. }
  626. };
  627. });
  628. // console.log(seriesList)
  629. rows.forEach((item) => {
  630. seriesList.forEach((jtem, index) => {
  631. let num = 0;
  632. item.treeList.map((ktem) => {
  633. if (ktem.name.indexOf(jtem.name) > -1) {
  634. num = ktem.value;
  635. }
  636. });
  637. seriesList[index].data.push(num);
  638. });
  639. });
  640. // console.log(seriesList)
  641. this.page2Char3.series = seriesList;
  642. //数量过小时隐藏滚动
  643. if (this.page2Char3.xAxis.data.length <= 8) {
  644. this.page2Char3.dataZoom[0].show = false;
  645. }else{
  646. this.page2Char3.dataZoom[0].show = true;
  647. }
  648. let charUuid = this.$refs.page2Char3.mid;
  649. this.$refs.page2Char3.intChar(charUuid);
  650. })
  651. .catch((err) => {
  652. console.log('getPage2echarts03 err', err);
  653. });
  654. },
  655. getPage5numerical() {
  656. let param = {
  657. cityId: this.$store.state.addr.selectCity.areaId,
  658. countyId: this.$store.state.addr.selectDistrict.areaId,
  659. townId: this.$store.state.addr.selectStreet.areaId
  660. };
  661. page5numerical(param)
  662. .then((res) => {
  663. // console.log('res',res);
  664. this.page5numerical = res.data;
  665. })
  666. .catch((err) => {
  667. console.log('echarts01 err', err);
  668. });
  669. },
  670. getTypeSlideData() {
  671. let param = {
  672. cityId: this.$store.state.addr.selectCity.areaId,
  673. countyId: this.$store.state.addr.selectDistrict.areaId,
  674. townId: this.$store.state.addr.selectStreet.areaId
  675. };
  676. typeSlideApi(param)
  677. .then((res) => {
  678. this.typeSlideData = sliceArray(res.data, 3);
  679. // console.log(' this.typeSlideData', this.typeSlideData);
  680. })
  681. .catch((err) => {
  682. console.log('getTypeSlideData err', err);
  683. });
  684. },
  685. getPage5echarts01() {
  686. let param = {
  687. cityId: this.$store.state.addr.selectCity.areaId,
  688. countyId: this.$store.state.addr.selectDistrict.areaId,
  689. townId: this.$store.state.addr.selectStreet.areaId
  690. };
  691. page5echarts01(param)
  692. .then((res) => {
  693. // console.log('res',res);
  694. // this.page5Char1 = res.data;
  695. this.page5Char1.xAxis.data = res.data.map((item) => {
  696. return item.baseName;
  697. });
  698. this.page5Char1.series[0].data = res.data.map((item) => {
  699. return item.baseArea;
  700. });
  701. //数量过小时隐藏滚动
  702. if (this.page5Char1.xAxis.data.length <= 8) {
  703. this.page5Char1.dataZoom[0].show = false;
  704. }else{
  705. this.page5Char1.dataZoom[0].show = true;
  706. }
  707. let charUuid = this.$refs.page5Char1.mid;
  708. this.$refs.page5Char1.intChar(charUuid);
  709. })
  710. .catch((err) => {
  711. console.log('getPage5echarts01 err', err);
  712. });
  713. },
  714. getPage5echarts02() {
  715. let param = {
  716. cityId: this.$store.state.addr.selectCity.areaId,
  717. countyId: this.$store.state.addr.selectDistrict.areaId,
  718. townId: this.$store.state.addr.selectStreet.areaId
  719. };
  720. page5echarts02(param)
  721. .then((res) => {
  722. // console.log('res',res);
  723. // this.page5Char2 = res.data;
  724. this.page5Char2.xAxis.data = res.data.map((item) => {
  725. return item.name;
  726. });
  727. this.page5Char2.series[0].data = res.data.map((item) => {
  728. return item.number;
  729. });
  730. //数量过小时隐藏滚动
  731. if (this.page5Char2.xAxis.data.length <= 8) {
  732. this.page5Char2.dataZoom[0].show = false;
  733. }else{
  734. this.page5Char2.dataZoom[0].show = true;
  735. }
  736. let charUuid = this.$refs.page5Char2.mid;
  737. this.$refs.page5Char2.intChar(charUuid);
  738. })
  739. .catch((err) => {
  740. console.log('getPage5echarts02 err', err);
  741. });
  742. },
  743. getPage6numerical() {
  744. let param = {
  745. cityId: this.$store.state.addr.selectCity.areaId,
  746. countyId: this.$store.state.addr.selectDistrict.areaId,
  747. townId: this.$store.state.addr.selectStreet.areaId
  748. };
  749. //第一屏统计
  750. page6numerical(param)
  751. .then((res) => {
  752. // console.log('res',res);
  753. this.page6numerical = res.data;
  754. })
  755. .catch((err) => {
  756. console.log('getPage6numerical err', err);
  757. });
  758. },
  759. getPage6echarts01() {
  760. let param = {
  761. cityId: this.$store.state.addr.selectCity.areaId,
  762. countyId: this.$store.state.addr.selectDistrict.areaId,
  763. townId: this.$store.state.addr.selectStreet.areaId
  764. };
  765. page6echarts01(param)
  766. .then((res) => {
  767. // console.log('res',res);
  768. // this.page6Char1 = res.data;
  769. // this.page6Char1.xAxis[0].data = [];
  770. // this.page6Char1.series[0].data = [];
  771. // this.page6Char1.series[1].data = [];
  772. // this.page6Char1.series[2].data = [];
  773. // res.data &&
  774. // res.data.forEach((element) => {
  775. // this.page6Char1.xAxis[0].data.push(element.villageName);
  776. // this.page6Char1.series[0].data.push(element.fireCount);
  777. // this.page6Char1.series[1].data.push(element.cutCount);
  778. // this.page6Char1.series[2].data.push(element.pestCount);
  779. // });
  780. this.page6Char1.xAxis.data = [];
  781. this.page6Char1.series[0].data = [];
  782. this.page6Char1.series[1].data = [];
  783. this.page6Char1.series[2].data = [];
  784. const rows = res.data;
  785. // console.log(rows)
  786. // x坐标
  787. this.page6Char1.xAxis.data = rows.map((item) => {
  788. return item.villageName;
  789. });
  790. rows.forEach((element) => {
  791. this.page6Char1.series[0].data.push(element.pestCount);
  792. this.page6Char1.series[1].data.push(element.fireCount);
  793. this.page6Char1.series[2].data.push(element.cutCount);
  794. });
  795. // console.log('x坐标', this.page6Char1.xAxis.data)
  796. //数量过小时隐藏滚动
  797. if (this.page6Char1.xAxis.data.length <= 8) {
  798. this.page6Char1.dataZoom[0].show = false;
  799. }else{
  800. this.page6Char1.dataZoom[0].show = true;
  801. }
  802. let charUuid = this.$refs.page6Char1.mid;
  803. this.$refs.page6Char1.intChar(charUuid);
  804. })
  805. .catch((err) => {
  806. console.log('getPage6echarts01 err', err);
  807. });
  808. },
  809. getPage6echarts02() {
  810. let param = {
  811. cityId: this.$store.state.addr.selectCity.areaId,
  812. countyId: this.$store.state.addr.selectDistrict.areaId,
  813. townId: this.$store.state.addr.selectStreet.areaId
  814. };
  815. page6echarts02(param)
  816. .then((res) => {
  817. console.log('page6echarts02 res', res);
  818. const rows = res.data;
  819. // console.log(rows)
  820. // x坐标
  821. this.page6Char2.xAxis.data = [];
  822. this.page6Char2.series[0].data = [];
  823. this.page6Char2.series[1].data = [];
  824. this.page6Char2.series[2].data = [];
  825. this.page6Char2.xAxis.data = rows.map((item) => {
  826. return item.month;
  827. });
  828. rows.forEach((element) => {
  829. // console.log('element',element.eventList);
  830. this.page6Char2.series[0].data.push(element.eventList[0].value);
  831. this.page6Char2.series[1].data.push(element.eventList[1].value);
  832. this.page6Char2.series[2].data.push(element.eventList[2].value);
  833. });
  834. console.log('this.page6Char2.series', this.page6Char2.series);
  835. let charUuid = this.$refs.page6Char2.mid;
  836. this.$refs.page6Char2.intChar(charUuid);
  837. })
  838. .catch((err) => {
  839. console.log('page6echarts02 err', err);
  840. });
  841. },
  842. xiaobansearch() {
  843. // console.log('xiaobansearch');
  844. this.getRightScrollData();
  845. this.getPageData();
  846. },
  847. scrollBoardClick(e) {
  848. console.log(e.row[0]);
  849. let param = {
  850. smallNumber: e.row[0],
  851. // cityId: this.$store.state.addr.selectCity.areaId,
  852. // countyId: this.$store.state.addr.selectDistrict.areaId,
  853. // townId: this.$store.state.addr.selectStreet.areaId
  854. };
  855. console.log(param);
  856. rightScrollData(param).then((res) => {
  857. this.changeSearchSmallClass(res.rows[0])
  858. });
  859. },
  860. toggleShowScrollBoard() {
  861. this.showScrollBoard = !this.showScrollBoard;
  862. }
  863. }
  864. };
  865. </script>
  866. <style lang='scss' scoped>
  867. @import url(./index.scss);
  868. </style>