index.vue 36 KB

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