index.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. <!--
  2. * @Description:
  3. * @Author: wangcc
  4. * @Date: 2022-07-06 15:56:45
  5. * @LastEditors: gcz
  6. * @LastEditTime: 2022-10-21 14:45:40
  7. * @FilePath: \ntbigscreen\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 = ['#00FAFD', '#FF4E46', '#FFAA00','#19D800'];
  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. alarData: {},
  240. page: 1,
  241. // addrOptions: regionDataPlus,
  242. addrSelectedOptions: ['520000', ''],
  243. navList: [
  244. { text: '森林资源', en: 'forest' },
  245. { text: '林木结构', en: 'treeSpecies' },
  246. { text: '碳汇管理', en: 'sink' },
  247. { text: '林下经济', en: 'economics' },
  248. { text: '土地流转', en: 'circulation' },
  249. { text: '事件信息', en: 'event' }
  250. ],
  251. scrollBoardKey: Date.now(),
  252. scrollBoardStyle: {
  253. // width: '100%',
  254. // height: '60vh'
  255. },
  256. scrollBoardConfig: scrollBoardSchema,
  257. scrollBaseListConfig: scrollBaseListSchema,
  258. page1numerical: [
  259. { name: '蓄积量', number: '2309', unit: '立方米' },
  260. { name: '占地面积', number: '55.4', unit: '万亩' }
  261. ],
  262. alarmData: [
  263. // {msg:'三都林场01小班于15:00:00发现火情,请尽快处理!'},
  264. // {msg:'测试1!'},
  265. // {msg:'测试22222222!'},
  266. ],
  267. page1Char1: page1Char1Schema,
  268. page1Char2: page1Char2Schema,
  269. page2numerical: [],
  270. page2Char1: page2Char1Schema,
  271. page2Char2: page2Char2Schema,
  272. page2Char3: page2Char3Schema,
  273. page5numerical: [],
  274. typeSlideData: [],
  275. page5Char1: page5Char1Schema,
  276. page5Char2: page5Char2Schema,
  277. page6numerical: [],
  278. page6Char1: page6Char1Schema,
  279. page6Char2: page6Char2Schema,
  280. scrollEventConfig: scrollEventSchema,
  281. xiaobaninput: '',
  282. baseinput: ''
  283. };
  284. },
  285. created() {},
  286. computed: {
  287. ...mapGetters(['vuexCityList', 'vuexDistrictList', 'vuexStreetList'])
  288. },
  289. mounted() {
  290. this.getPageData();
  291. this.getRightScrollData();
  292. setInterval(() => {
  293. this.getPageData();
  294. }, 60000);
  295. window.onresize = () => {
  296. //图表resize
  297. if (this.$store.state.addr.page == 'forest') {
  298. let page1Char1Uuid = this.$refs.page1Char1.mid;
  299. this.$refs.page1Char1.resizeChar(page1Char1Uuid);
  300. let page1Char2Uuid = this.$refs.page1Char2.mid;
  301. this.$refs.page1Char2.resizeChar(page1Char2Uuid);
  302. } else if (this.$store.state.addr.page == 'treeSpecies') {
  303. let page2Char2Uuid = this.$refs.page2Char2.mid;
  304. this.$refs.page2Char2.resizeChar(page2Char2Uuid);
  305. let page2Char3Uuid = this.$refs.page2Char3.mid;
  306. this.$refs.page2Char3.resizeChar(page2Char3Uuid);
  307. } else if (this.$store.state.addr.page == 'economics') {
  308. let page5Char1Uuid = this.$refs.page5Char1.mid;
  309. this.$refs.page5Char1.resizeChar(page5Char1Uuid);
  310. let page5Char2Uuid = this.$refs.page5Char2.mid;
  311. this.$refs.page5Char2.resizeChar(page5Char2Uuid);
  312. } else if (this.$store.state.addr.page == 'event') {
  313. let page6Char1Uuid = this.$refs.page6Char1.mid;
  314. this.$refs.page6Char1.resizeChar(page6Char1Uuid);
  315. let page6Char2Uuid = this.$refs.page6Char2.mid;
  316. this.$refs.page6Char2.resizeChar(page6Char2Uuid);
  317. }
  318. };
  319. },
  320. watch: {
  321. xiaobaninput: {
  322. handler: function () {
  323. debounce(this.xiaobansearch, 500, false);
  324. }
  325. },
  326. baseinput: {
  327. handler: function () {
  328. debounce(this.basesearch, 500, false);
  329. }
  330. },
  331. '$store.state.addr.selectCity'(val) {
  332. // debounce(this.getPageData(), 1000, false)
  333. this.getPageData();
  334. },
  335. '$store.state.addr.selectDistrict'(val) {
  336. this.getPageData();
  337. },
  338. '$store.state.addr.selectStreet'(val) {
  339. this.getPageData();
  340. },
  341. '$store.state.addr.mapLevel': {
  342. handler(val) {
  343. console.log(val);
  344. if (val === 'city') {
  345. this.jumpDistrict();
  346. }
  347. }
  348. }
  349. },
  350. methods: {
  351. ...mapMutations([
  352. 'changeSearchSmallClass',
  353. 'changeEvenData',
  354. 'changeBaseDetail',
  355. 'changeSelectCity',
  356. 'changeSelectDistrict',
  357. 'changeSelectStreet'
  358. ]),
  359. addrChange(value) {
  360. console.log('addrChange', value);
  361. },
  362. navClick(index) {
  363. let pageName = this.navList[index - 1].en;
  364. if (pageName == 'sink' || pageName == 'circulation') {
  365. Message('暂未开放!');
  366. return;
  367. }
  368. this.$store.commit('changePage', this.navList[index - 1].en);
  369. console.log('this.navList[index-1].en', this.navList[index - 1].en);
  370. this.page = index;
  371. console.log('index', index);
  372. if (this.navList[index - 1].en == 'economics') {
  373. this.showbase = true;
  374. this.showxiaoban = false;
  375. } else if (this.navList[index - 1].en == 'event') {
  376. this.showbase = false;
  377. this.showxiaoban = false;
  378. } else {
  379. this.showbase = false;
  380. this.showxiaoban = true;
  381. }
  382. // 切换专题时,重置区域
  383. // this.$store.dispatch('searchArea', {
  384. // parentId: '520000',
  385. // name: '贵州省',
  386. // mapLevel: 'province'
  387. // });
  388. this.getPageData();
  389. },
  390. getPageData() {
  391. debounce(this.debounceGetData, 300, false);
  392. },
  393. debounceGetData() {
  394. console.log('page', this.$store.state.addr.page);
  395. // {text:'森林资源',en:'forest'},
  396. // {text:'林木结构',en:'treeSpecies'},
  397. // {text:'碳汇管理',en:'sink'},
  398. // {text:'林下经济',en:'economics'},
  399. // {text:'土地流转',en:'circulation'},
  400. // {text:'事件信息',en:'event'},
  401. if (this.$store.state.addr.page == 'forest') {
  402. this.getPage1numerical();
  403. this.getPage1echarts01();
  404. this.getPage1echarts02();
  405. this.getRightScrollData();
  406. } else if (this.$store.state.addr.page == 'treeSpecies') {
  407. this.getPage2numerical();
  408. // this.getPage2echarts01();
  409. this.getPage2echarts02();
  410. this.getPage2echarts03();
  411. this.getRightScrollData();
  412. } else if (this.$store.state.addr.page == 'economics') {
  413. this.getPage5numerical();
  414. // this.getTypeSlideData();
  415. this.getPage5echarts01();
  416. this.getPage5echarts02();
  417. this.getBaseList();
  418. } else if (this.$store.state.addr.page == 'event') {
  419. this.getPage6numerical();
  420. this.getPage6echarts01();
  421. this.getEventList();
  422. // this.getPage6echarts02();
  423. this.getAlarmData();
  424. // this.getRightScrollData();
  425. }
  426. },
  427. getPage1numerical() {
  428. let param = {
  429. cityId: this.$store.state.addr.selectCity.areaId,
  430. countyId: this.$store.state.addr.selectDistrict.areaId,
  431. townId: this.$store.state.addr.selectStreet.areaId
  432. };
  433. page1numerical(param)
  434. .then((res) => {
  435. // console.log('res',res);
  436. this.page1numerical = res.data;
  437. })
  438. .catch((err) => {
  439. console.log('echarts01 err', err);
  440. });
  441. },
  442. getPage1echarts01() {
  443. let param = {
  444. cityId: this.$store.state.addr.selectCity.areaId,
  445. countyId: this.$store.state.addr.selectDistrict.areaId,
  446. townId: this.$store.state.addr.selectStreet.areaId
  447. };
  448. // console.log('cityId',param.cityId);
  449. page1echarts01(param)
  450. .then((res) => {
  451. this.page1Char1.xAxis.data = res.data.map((item) => {
  452. return item.name;
  453. });
  454. this.page1Char1.series[0].data = res.data.map((item) => {
  455. return item.number;
  456. });
  457. //数量过小时隐藏滚动
  458. if (this.page1Char1.xAxis.data.length <= 5) {
  459. this.page1Char1.dataZoom[0].show = false;
  460. } else {
  461. this.page1Char1.dataZoom[0].show = true;
  462. }
  463. let charUuid = this.$refs.page1Char1.mid;
  464. this.$refs.page1Char1.intChar(charUuid);
  465. })
  466. .catch((err) => {
  467. console.log('getPage1echarts01 err', err);
  468. });
  469. },
  470. getPage1echarts02() {
  471. let param = {
  472. cityId: this.$store.state.addr.selectCity.areaId,
  473. countyId: this.$store.state.addr.selectDistrict.areaId,
  474. townId: this.$store.state.addr.selectStreet.areaId
  475. };
  476. // console.log('cityId',param.cityId);
  477. page1echarts02(param)
  478. .then((res) => {
  479. this.page1Char2.xAxis.data = res.data.map((item) => {
  480. return item.name;
  481. });
  482. this.page1Char2.series[0].data = res.data.map((item) => {
  483. return item.number;
  484. });
  485. //数量过小时隐藏滚动
  486. if (this.page1Char2.xAxis.data.length <= 5) {
  487. this.page1Char2.dataZoom[0].show = false;
  488. } else {
  489. this.page1Char2.dataZoom[0].show = true;
  490. }
  491. let charUuid = this.$refs.page1Char2.mid;
  492. this.$refs.page1Char2.intChar(charUuid);
  493. })
  494. .catch((err) => {
  495. console.log('getPage1echarts02 err', err);
  496. });
  497. },
  498. getRightScrollData() {
  499. let param = {
  500. smallNumber: this.xiaobaninput,
  501. cityId: this.$store.state.addr.selectCity.areaId,
  502. countyId: this.$store.state.addr.selectDistrict.areaId,
  503. townId: this.$store.state.addr.selectStreet.areaId
  504. };
  505. rightScrollData(param)
  506. .then((res) => {
  507. // console.log('res',res.rows.length);
  508. // console.log('this.scrollBoardConfig',this.scrollBoardConfig);
  509. //当小班滚动数据少时重设参数
  510. // if(res.rows.length<=15){
  511. // this.scrollBoardConfig.rowNum = 5;
  512. // this.scrollBoardStyle.height = '25vh'
  513. // }
  514. this.scrollBoardConfig.data = [];
  515. res.rows.forEach((element) => {
  516. this.scrollBoardConfig.data.push([
  517. element.smallNumber,
  518. element.treeComp,
  519. element.perAcreStock + 'm³',
  520. element.landArea + '亩',
  521. element.id
  522. ]);
  523. });
  524. this.scrollBoardKey = Date.now();
  525. this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
  526. // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
  527. // this.scrollBoardConfig = res.data;
  528. })
  529. .catch((err) => {
  530. console.log('echarts01 err', err);
  531. });
  532. },
  533. getBaseList() {
  534. let param = {
  535. baseName: this.baseinput,
  536. cityId: this.$store.state.addr.selectCity.areaId,
  537. countyId: this.$store.state.addr.selectDistrict.areaId,
  538. townId: this.$store.state.addr.selectStreet.areaId
  539. };
  540. baseList(param)
  541. .then((res) => {
  542. this.scrollBaseListConfig.data = [];
  543. res.rows.forEach((element) => {
  544. let cateInfoList = element.cateInfoList;
  545. let cropName = '';
  546. for (let index = 0; index < cateInfoList.length; index++) {
  547. const item = cateInfoList[index];
  548. cropName += item.cropName + ',';
  549. }
  550. cropName = cropName.substring(0, cropName.lastIndexOf(','));
  551. this.scrollBaseListConfig.data.push([
  552. element.baseName,
  553. cropName || '暂无作物',
  554. element.baseArea + '亩',
  555. element.id
  556. ]);
  557. });
  558. this.scrollBoardKey = Date.now();
  559. })
  560. .catch((err) => {
  561. console.log('echarts01 err', err);
  562. });
  563. },
  564. getEventList() {
  565. let param = {
  566. cityId: this.$store.state.addr.selectCity.areaId,
  567. countyId: this.$store.state.addr.selectDistrict.areaId,
  568. townId: this.$store.state.addr.selectStreet.areaId
  569. };
  570. eventList(param)
  571. .then((res) => {
  572. this.scrollEventConfig.data = [];
  573. res.rows.forEach((element) => {
  574. this.scrollEventConfig.data.push([
  575. element.createTime.slice(5, 16),
  576. element.townName + element.villageName,
  577. this.eventTypeFilter(element.eventType),
  578. // element.createBy,
  579. this.eventStateFilter(element.state),
  580. element.id
  581. ]);
  582. });
  583. this.scrollBoardKey = Date.now();
  584. })
  585. .catch((err) => {
  586. console.log('getEventList err', err);
  587. });
  588. },
  589. eventTypeFilter(e) {
  590. if (e == '1') {
  591. return '火灾';
  592. } else if (e == '2') {
  593. return '砍伐';
  594. } else if (e == '3') {
  595. return '病虫害';
  596. } else if (e == '4') {
  597. return '偷盗林木';
  598. }
  599. },
  600. eventStateFilter(e) {
  601. if (e == '0') {
  602. return '未反馈';
  603. } else if (e == '1') {
  604. return '已反馈';
  605. }
  606. },
  607. getAlarmData() {
  608. alarmDataApi()
  609. .then((res) => {
  610. // console.log('this.page',this.page);
  611. // console.log('res',res);
  612. this.alarmData = res.data;
  613. // console.log('alarmData.length',this.alarmData.length);
  614. })
  615. .catch((err) => {
  616. console.log('echarts01 err', err);
  617. });
  618. },
  619. getPage2numerical() {
  620. let param = {
  621. cityId: this.$store.state.addr.selectCity.areaId,
  622. countyId: this.$store.state.addr.selectDistrict.areaId,
  623. townId: this.$store.state.addr.selectStreet.areaId,
  624. smallNumber: this.xiaobaninput
  625. };
  626. page2numerical(param)
  627. .then((res) => {
  628. // console.log('res',res);
  629. this.page2numerical = res.data;
  630. })
  631. .catch((err) => {
  632. console.log('page2numerical err', err);
  633. });
  634. },
  635. getPage2echarts01() {
  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. page2echarts01(param)
  643. .then((res) => {
  644. // console.log('res',res);
  645. this.page2Char1.series[0].data = [];
  646. this.page2Char1.series[0].data = res.data;
  647. let charUuid = this.$refs.page2Char1.mid;
  648. this.$refs.page2Char1.intChar(charUuid);
  649. })
  650. .catch((err) => {
  651. console.log('getPage2echarts01 err', err);
  652. });
  653. },
  654. getPage2echarts02() {
  655. let param = {
  656. smallNumber: this.xiaobaninput,
  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. page2echarts02(param)
  662. .then((res) => {
  663. // console.log('res',res);
  664. // this.page2Char2 = res.data;
  665. // console.log('this.page2Char2.series', this.page2Char2.series);
  666. this.page2Char2.xAxis.data = [];
  667. this.page2Char2.series = [];
  668. const rows = res.data;
  669. // console.log(rows)
  670. // x坐标
  671. this.page2Char2.xAxis.data = rows.map((item) => {
  672. return item.smallNumber;
  673. });
  674. // console.log('x坐标', this.page2Char2.xAxis.data)
  675. // 获取所有项
  676. let seriesList = rows.map((item) => {
  677. return item.treeList || [];
  678. });
  679. // 数组扁平化
  680. seriesList = seriesList.flat();
  681. // 去重
  682. let obj = {};
  683. seriesList = seriesList.reduce((newArr, next) => {
  684. // console.log('page2Char2 seriesList',seriesList);
  685. // console.log('page2Char2 next',next);
  686. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  687. return newArr;
  688. }, []);
  689. seriesList.sort((star, next) => {
  690. // 按name的指定顺序排序,不排序可以删掉
  691. var order = ['杉木', '马尾松', '软阔', '硬阔'];
  692. return order.indexOf(star.name) - order.indexOf(next.name);
  693. });
  694. seriesList = seriesList.map((item, index) => {
  695. let itemColor = null;
  696. if (item.name == '杉木' || item.name == '杉') {
  697. itemColor = colorArr[0];
  698. } else if (item.name == '马尾松' || item.name == '马') {
  699. itemColor = colorArr[1];
  700. } else if (item.name == '软阔' || item.name == '软') {
  701. itemColor = colorArr[2];
  702. } else if (item.name == '硬阔' || item.name == '硬') {
  703. itemColor = colorArr[3];
  704. }
  705. return {
  706. name: item.name,
  707. type: 'bar',
  708. stack: 'total',
  709. label: {
  710. show: false
  711. },
  712. emphasis: {
  713. focus: 'series'
  714. },
  715. data: [],
  716. itemStyle: {
  717. normal: { color: itemColor || 'auto' }
  718. }
  719. };
  720. });
  721. // console.log(seriesList)
  722. rows.forEach((item) => {
  723. seriesList.forEach((jtem, index) => {
  724. let num = 0;
  725. item.treeList &&
  726. item.treeList.map((ktem) => {
  727. if (ktem.name.indexOf(jtem.name) > -1) {
  728. num = ktem.value;
  729. }
  730. });
  731. seriesList[index].data.push(num);
  732. });
  733. });
  734. // console.log('page2echarts02 seriesList',seriesList)
  735. this.page2Char2.series = seriesList;
  736. //数量过小时隐藏滚动
  737. if (this.page2Char2.xAxis.data.length <= 5) {
  738. this.page2Char2.dataZoom[0].show = false;
  739. } else {
  740. this.page2Char2.dataZoom[0].show = true;
  741. }
  742. let charUuid = this.$refs.page2Char2.mid;
  743. this.$refs.page2Char2.intChar(charUuid);
  744. })
  745. .catch((err) => {
  746. console.log('getPage2echarts02 err', err);
  747. });
  748. },
  749. getPage2echarts03() {
  750. let param = {
  751. smallNumber: this.xiaobaninput,
  752. cityId: this.$store.state.addr.selectCity.areaId,
  753. countyId: this.$store.state.addr.selectDistrict.areaId,
  754. townId: this.$store.state.addr.selectStreet.areaId
  755. };
  756. page2echarts03(param)
  757. .then((res) => {
  758. // console.log('res',res);
  759. // this.page2Char2 = res.data;
  760. // console.log('this.page2Char2.series', this.page2Char2.series);
  761. this.page2Char3.xAxis.data = [];
  762. this.page2Char3.series = [];
  763. const rows = res.data;
  764. // console.log(rows)
  765. // x坐标
  766. this.page2Char3.xAxis.data = rows.map((item) => {
  767. return item.smallNumber;
  768. });
  769. // console.log('x坐标', this.page2Char2.xAxis.data)
  770. // 获取所有项
  771. let seriesList = rows.map((item) => {
  772. return item.treeList || [];
  773. });
  774. // 数组扁平化
  775. seriesList = seriesList.flat();
  776. // 去重
  777. let obj = {};
  778. seriesList = seriesList.reduce((newArr, next) => {
  779. obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
  780. return newArr;
  781. }, []);
  782. // console.log('seriesList',seriesList);
  783. seriesList.sort((star, next) => {
  784. // 按name的指定顺序排序,不排序可以删掉
  785. var order = ['杉木', '马尾松', '软阔', '硬阔'];
  786. return order.indexOf(star.name) - order.indexOf(next.name);
  787. });
  788. seriesList = seriesList.map((item, index) => {
  789. let itemColor = null;
  790. if (item.name == '杉木' || item.name == '杉') {
  791. itemColor = colorArr[0];
  792. } else if (item.name == '马尾松' || item.name == '马') {
  793. itemColor = colorArr[1];
  794. } else if (item.name == '软阔' || item.name == '软') {
  795. itemColor = colorArr[2];
  796. } else if (item.name == '硬阔' || item.name == '硬') {
  797. itemColor = colorArr[3];
  798. }
  799. return {
  800. name: item.name,
  801. type: 'bar',
  802. stack: 'total',
  803. label: {
  804. show: false
  805. },
  806. emphasis: {
  807. focus: 'series'
  808. },
  809. data: [],
  810. itemStyle: {
  811. normal: { color: itemColor || 'auto' }
  812. }
  813. };
  814. });
  815. // console.log(seriesList)
  816. rows.forEach((item) => {
  817. seriesList.forEach((jtem, index) => {
  818. let num = 0;
  819. item.treeList &&
  820. item.treeList.map((ktem) => {
  821. if (ktem.name.indexOf(jtem.name) > -1) {
  822. num = ktem.value;
  823. }
  824. });
  825. seriesList[index].data.push(num);
  826. });
  827. });
  828. // console.log(seriesList)
  829. this.page2Char3.series = seriesList;
  830. //数量过小时隐藏滚动
  831. if (this.page2Char3.xAxis.data.length <= 5) {
  832. this.page2Char3.dataZoom[0].show = false;
  833. } else {
  834. this.page2Char3.dataZoom[0].show = true;
  835. }
  836. let charUuid = this.$refs.page2Char3.mid;
  837. this.$refs.page2Char3.intChar(charUuid);
  838. })
  839. .catch((err) => {
  840. console.log('getPage2echarts03 err', err);
  841. });
  842. },
  843. getPage5numerical() {
  844. let param = {
  845. cityId: this.$store.state.addr.selectCity.areaId,
  846. countyId: this.$store.state.addr.selectDistrict.areaId,
  847. townId: this.$store.state.addr.selectStreet.areaId
  848. };
  849. page5numerical(param)
  850. .then((res) => {
  851. // console.log('res',res);
  852. this.page5numerical = res.data;
  853. })
  854. .catch((err) => {
  855. console.log('echarts01 err', err);
  856. });
  857. },
  858. getTypeSlideData() {
  859. let param = {
  860. cityId: this.$store.state.addr.selectCity.areaId,
  861. countyId: this.$store.state.addr.selectDistrict.areaId,
  862. townId: this.$store.state.addr.selectStreet.areaId
  863. };
  864. typeSlideApi(param)
  865. .then((res) => {
  866. this.typeSlideData = sliceArray(res.data, 3);
  867. // console.log(' this.typeSlideData', this.typeSlideData);
  868. })
  869. .catch((err) => {
  870. console.log('getTypeSlideData err', err);
  871. });
  872. },
  873. getPage5echarts01() {
  874. let param = {
  875. cityId: this.$store.state.addr.selectCity.areaId,
  876. countyId: this.$store.state.addr.selectDistrict.areaId,
  877. townId: this.$store.state.addr.selectStreet.areaId
  878. };
  879. page5echarts01(param)
  880. .then((res) => {
  881. // console.log('res',res);
  882. // this.page5Char1 = res.data;
  883. this.page5Char1.xAxis.data = res.data.map((item) => {
  884. return item.baseName;
  885. });
  886. this.page5Char1.series[0].data = res.data.map((item) => {
  887. return item.baseArea;
  888. });
  889. //数量过小时隐藏滚动
  890. if (this.page5Char1.xAxis.data.length <= 5) {
  891. this.page5Char1.dataZoom[0].show = false;
  892. } else {
  893. this.page5Char1.dataZoom[0].show = true;
  894. }
  895. let charUuid = this.$refs.page5Char1.mid;
  896. this.$refs.page5Char1.intChar(charUuid);
  897. })
  898. .catch((err) => {
  899. console.log('getPage5echarts01 err', err);
  900. });
  901. },
  902. getPage5echarts02() {
  903. let param = {
  904. cityId: this.$store.state.addr.selectCity.areaId,
  905. countyId: this.$store.state.addr.selectDistrict.areaId,
  906. townId: this.$store.state.addr.selectStreet.areaId
  907. };
  908. page5echarts02(param)
  909. .then((res) => {
  910. // console.log('res',res);
  911. // this.page5Char2 = res.data;
  912. this.page5Char2.xAxis.data = res.data.map((item) => {
  913. return item.name;
  914. });
  915. this.page5Char2.series[0].data = res.data.map((item) => {
  916. return item.number;
  917. });
  918. //数量过小时隐藏滚动
  919. if (this.page5Char2.xAxis.data.length <= 5) {
  920. this.page5Char2.dataZoom[0].show = false;
  921. } else {
  922. this.page5Char2.dataZoom[0].show = true;
  923. }
  924. let charUuid = this.$refs.page5Char2.mid;
  925. this.$refs.page5Char2.intChar(charUuid);
  926. })
  927. .catch((err) => {
  928. console.log('getPage5echarts02 err', err);
  929. });
  930. },
  931. getPage6numerical() {
  932. let param = {
  933. cityId: this.$store.state.addr.selectCity.areaId,
  934. countyId: this.$store.state.addr.selectDistrict.areaId,
  935. townId: this.$store.state.addr.selectStreet.areaId
  936. };
  937. //第一屏统计
  938. page6numerical(param)
  939. .then((res) => {
  940. // console.log('res',res);
  941. this.page6numerical = res.data;
  942. })
  943. .catch((err) => {
  944. console.log('getPage6numerical err', err);
  945. });
  946. },
  947. getPage6echarts01() {
  948. let param = {
  949. cityId: this.$store.state.addr.selectCity.areaId,
  950. countyId: this.$store.state.addr.selectDistrict.areaId,
  951. townId: this.$store.state.addr.selectStreet.areaId
  952. };
  953. page6echarts01(param)
  954. .then((res) => {
  955. // console.log('res',res);
  956. // this.page6Char1 = res.data;
  957. // this.page6Char1.xAxis[0].data = [];
  958. // this.page6Char1.series[0].data = [];
  959. // this.page6Char1.series[1].data = [];
  960. // this.page6Char1.series[2].data = [];
  961. // res.data &&
  962. // res.data.forEach((element) => {
  963. // this.page6Char1.xAxis[0].data.push(element.villageName);
  964. // this.page6Char1.series[0].data.push(element.fireCount);
  965. // this.page6Char1.series[1].data.push(element.cutCount);
  966. // this.page6Char1.series[2].data.push(element.pestCount);
  967. // });
  968. this.page6Char1.xAxis.data = [];
  969. this.page6Char1.series[0].data = [];
  970. this.page6Char1.series[1].data = [];
  971. this.page6Char1.series[2].data = [];
  972. this.page6Char1.series[3].data = [];
  973. const rows = res.data;
  974. // console.log(rows)
  975. // x坐标
  976. this.page6Char1.xAxis.data = rows.map((item) => {
  977. return item.villageName;
  978. });
  979. rows.forEach((element) => {
  980. this.page6Char1.series[0].data.push(element.pestCount);
  981. this.page6Char1.series[1].data.push(element.fireCount);
  982. this.page6Char1.series[2].data.push(element.cutCount);
  983. this.page6Char1.series[3].data.push(element.stealCount);
  984. });
  985. // console.log('x坐标', this.page6Char1.xAxis.data)
  986. //数量过小时隐藏滚动
  987. if (this.page6Char1.xAxis.data.length <= 5) {
  988. this.page6Char1.dataZoom[0].show = false;
  989. } else {
  990. this.page6Char1.dataZoom[0].show = true;
  991. }
  992. let charUuid = this.$refs.page6Char1.mid;
  993. this.$refs.page6Char1.intChar(charUuid);
  994. })
  995. .catch((err) => {
  996. console.log('getPage6echarts01 err', err);
  997. });
  998. },
  999. getPage6echarts02() {
  1000. let param = {
  1001. cityId: this.$store.state.addr.selectCity.areaId,
  1002. countyId: this.$store.state.addr.selectDistrict.areaId,
  1003. townId: this.$store.state.addr.selectStreet.areaId
  1004. };
  1005. page6echarts02(param)
  1006. .then((res) => {
  1007. console.log('page6echarts02 res', res);
  1008. const rows = res.data;
  1009. // console.log(rows)
  1010. // x坐标
  1011. this.page6Char2.xAxis.data = [];
  1012. this.page6Char2.series[0].data = [];
  1013. this.page6Char2.series[1].data = [];
  1014. this.page6Char2.series[2].data = [];
  1015. this.page6Char2.xAxis.data = rows.map((item) => {
  1016. return item.month;
  1017. });
  1018. rows.forEach((element) => {
  1019. // console.log('element',element.eventList);
  1020. this.page6Char2.series[0].data.push(element.eventList[0].value);
  1021. this.page6Char2.series[1].data.push(element.eventList[1].value);
  1022. this.page6Char2.series[2].data.push(element.eventList[2].value);
  1023. });
  1024. console.log('this.page6Char2.series', this.page6Char2.series);
  1025. let charUuid = this.$refs.page6Char2.mid;
  1026. this.$refs.page6Char2.intChar(charUuid);
  1027. })
  1028. .catch((err) => {
  1029. console.log('page6echarts02 err', err);
  1030. });
  1031. },
  1032. xiaobansearch() {
  1033. // console.log('xiaobansearch');
  1034. this.getRightScrollData();
  1035. this.getPageData();
  1036. },
  1037. basesearch() {
  1038. // console.log('xiaobansearch');
  1039. this.getBaseList();
  1040. this.getPageData();
  1041. },
  1042. scrollBoardClick(e) {
  1043. let param = {
  1044. id: e.row[4]
  1045. };
  1046. smallClassDetail(param).then((res) => {
  1047. this.changeSearchSmallClass(res.data);
  1048. console.log(res.data);
  1049. this.alarData = res.data;
  1050. console.log(this.$store.state.addr.mapLevel);
  1051. if (this.$store.state.addr.mapLevel == 'city') {
  1052. this.jumpDistrict();
  1053. } else {
  1054. this.vuexCityList.forEach((element) => {
  1055. if (res.data.cityId === element.areaId) {
  1056. this.changeSelectCity({
  1057. value: element.areaCode,
  1058. label: res.data.cityName,
  1059. areaId: element.areaId
  1060. });
  1061. this.$store.dispatch('searchArea', {
  1062. parentId: element.areaCode.substring(0, 6),
  1063. name: res.data.cityName,
  1064. mapLevel: 'city'
  1065. });
  1066. }
  1067. });
  1068. }
  1069. });
  1070. },
  1071. jumpDistrict() {
  1072. if (this.vuexDistrictList) {
  1073. this.vuexDistrictList.forEach((element) => {
  1074. if (this.alarData.countyId === element.areaId) {
  1075. this.changeSelectDistrict({
  1076. value: element.areaCode,
  1077. label: this.alarData.cityName,
  1078. areaId: element.areaId
  1079. });
  1080. console.log(element.areaCode.substring(0, 6));
  1081. console.log(element.areaName);
  1082. this.$store.dispatch('searchArea', {
  1083. parentId: element.areaCode.substring(0, 6),
  1084. name: element.areaName,
  1085. mapLevel: 'district'
  1086. });
  1087. }
  1088. });
  1089. }
  1090. },
  1091. scrollOut() {
  1092. this.changeSearchSmallClass({ name: false });
  1093. },
  1094. scrollBaseListClick(e) {
  1095. console.log('scrollBaseListClick', e);
  1096. let param = {
  1097. baseId: e.row[3]
  1098. };
  1099. financeBaseDetail(param).then((res) => {
  1100. this.changeBaseDetail(res.data);
  1101. });
  1102. },
  1103. baseListClick() {
  1104. this.changeBaseDetail({ name: false });
  1105. },
  1106. scrollEventClick(e) {
  1107. let param = {
  1108. id: e.row[4]
  1109. };
  1110. eventDetail(param).then((res) => {
  1111. this.changeEvenData(res.data);
  1112. });
  1113. },
  1114. scrollEventOut() {
  1115. this.changeEvenData({ name: false });
  1116. },
  1117. toggleShowScrollBoard() {
  1118. this.showScrollBoard = !this.showScrollBoard;
  1119. }
  1120. }
  1121. };
  1122. </script>
  1123. <style lang='scss' scoped>
  1124. @import url(./index.scss);
  1125. </style>