123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- <!--
- * @LastEditors: gcz
- -->
- <template>
- <div class>
- <dv-full-screen-container>
- <Map></Map>
- <Header></Header>
- <section class="nav-wrap">
- <div
- class="nav-item"
- :class="{active:(index+1)==page}"
- v-for="(item,index) in navList"
- @click="navClick(index+1)"
- :key="index"
- >{{item.text}}</div>
- </section>
- <Alarm v-if="page==6&&alarmData.length>=1" :data="alarmData" />
- <section class="left-wrap" v-if="$store.state.addr.page=='forest'">
- <Numerical class="left-item" :data="page1numerical" />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page1Char1"
- ref="page1Char1"
- :option="page1Char1"
- style
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page1Char2"
- ref="page1Char2"
- :option="page1Char2"
- style
- />
- </section>
- <section class="left-wrap" v-if="$store.state.addr.page=='treeSpecies'">
- <Numerical class="left-item" :data="page2numerical" />
- <!-- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char1"
- :option="page2Char1"
- ref="page2Char1"
- />-->
- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char2"
- :option="page2Char2"
- ref="page2Char2"
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char3"
- :option="page2Char3"
- ref="page2Char3"
- />
- </section>
- <!-- 林业经济 -->
- <section class="left-wrap" v-if="$store.state.addr.page=='economics'">
- <!-- <Typeslide :data="typeSlideData" /> -->
- <Numerical class="left-item" :data="page5numerical" />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page5Char2"
- ref="page5Char2"
- :option="page5Char2"
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page5Char1"
- ref="page5Char1"
- :option="page5Char1"
- />
- </section>
- <!-- 事件信息 -->
- <section class="left-wrap" v-if="$store.state.addr.page=='event'">
- <Numerical class="left-item" :data="page6numerical" />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page6Char1"
- ref="page6Char1"
- :option="page6Char1"
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page6Char2"
- ref="page6Char2"
- :option="page6Char2"
- />
- </section>
- <section class="right-wrap">
- <PickerAddr />
- <div class="xiaoban u-flex">
- <div class="title">小班查询:</div>
- <el-input v-model="xiaobaninput" placeholder="请输入小班号">
- <i class="el-icon-search el-input__icon" slot="suffix" @click="xiaobansearch"></i>
- </el-input>
- </div>
- <section class="scroll-board-wrap" :class="{close:showScrollBoard==true}">
- <dv-scroll-board
- :key="scrollBoardKey"
- class="scroll-board-01"
- :config="scrollBoardConfig"
- ref="scrollBoard"
- @click="scrollBoardClick"
- :style="scrollBoardStyle"
- />
- <div class="scroll-board-tool" @click="toggleShowScrollBoard">
- <div class="inner">
- <img src="../assets/img/jiantou.png" alt />
- </div>
- </div>
- </section>
- </section>
- </dv-full-screen-container>
- </div>
- </template>
- <script>
- import Map from '../components/amap.vue';
- import Header from '../components/header';
- import MyEcharts from '../components/echarts';
- import Numerical from '../components/numerical';
- import Alarm from '../components/alarm';
- import PickerAddr from '../components/pickerAddr';
- import Typeslide from '../components/typeslide';
- import { Message } from 'element-ui';
- import { debounce } from '@/utils/mdebounce';
- import { sliceArray } from '@/utils/sliceArray';
- import { mapMutations, mapState, mapGetters } from 'vuex';
- import {
- page1numerical,
- page1echarts01,
- page1echarts02,
- rightScrollData,
- alarmDataApi,
- page2numerical,
- page2echarts01,
- page2echarts02,
- page2echarts03,
- page5numerical,
- typeSlideApi,
- page5echarts01,
- page5echarts02,
- page6numerical,
- page6echarts01,
- page6echarts02,
- smallClassDetail
- } from '../service/index';
- import scrollBoardSchema from '../dataSchema/scrollBoardSchema';
- import page1Char1Schema from '../dataSchema/page1Char1Schema';
- import page1Char2Schema from '../dataSchema/page1Char2Schema';
- import page2Char1Schema from '../dataSchema/page2Char1Schema';
- import page2Char2Schema from '../dataSchema/page2Char2Schema';
- import page2Char3Schema from '../dataSchema/page2Char3Schema';
- import page5Char1Schema from '../dataSchema/page5Char1Schema';
- import page5Char2Schema from '../dataSchema/page5Char2Schema';
- import page6Char1Schema from '../dataSchema/page6Char1Schema';
- import page6Char2Schema from '../dataSchema/page6Char2Schema';
- //柱状图颜色
- let colorArr = ['rgb(2, 238, 255)','rgb(94, 229, 116)','rgb(255, 255, 0)'];
- // import { provinceAndCityData, regionData, provinceAndCityDataPlus, regionDataPlus, CodeToText, TextToCode } from 'element-china-area-data';
- export default {
- name: '',
- components: {
- Map,
- Header,
- MyEcharts,
- Numerical,
- Alarm,
- PickerAddr,
- Typeslide
- },
- data() {
- return {
- showScrollBoard: false,
- page: 1,
- // addrOptions: regionDataPlus,
- addrSelectedOptions: ['520000', ''],
- navList: [
- { text: '森林资源', en: 'forest' },
- { text: '林木结构', en: 'treeSpecies' },
- { text: '碳汇管理', en: 'sink' },
- { text: '林下经济', en: 'economics' },
- { text: '土地流转', en: 'circulation' },
- { text: '事件信息', en: 'event' }
- ],
- scrollBoardKey: Date.now(),
- scrollBoardStyle: {
- // width: '100%',
- // height: '60vh'
- },
- scrollBoardConfig: scrollBoardSchema,
- page1numerical: [
- { name: '蓄积量', number: '2309', unit: '立方米' },
- { name: '占地面积', number: '55.4', unit: '万亩' }
- ],
- alarmData: [
- // {msg:'三都林场01小班于15:00:00发现火情,请尽快处理!'},
- // {msg:'测试1!'},
- // {msg:'测试22222222!'},
- ],
- page1Char1: page1Char1Schema,
- page1Char2: page1Char2Schema,
- page2numerical: [],
- page2Char1: page2Char1Schema,
- page2Char2: page2Char2Schema,
- page2Char3: page2Char3Schema,
- page5numerical: [],
- typeSlideData: [],
- page5Char1: page5Char1Schema,
- page5Char2: page5Char2Schema,
- page6numerical: [],
- page6Char1: page6Char1Schema,
- page6Char2: page6Char2Schema,
- xiaobaninput: ''
- };
- },
- created() {},
- mounted() {
- this.getPageData();
- this.getRightScrollData();
- setInterval(() => {
- this.getPageData();
- }, 60000);
- window.onresize=()=>{
- //图表resize
- if (this.$store.state.addr.page == 'forest') {
- let page1Char1Uuid = this.$refs.page1Char1.mid;
- this.$refs.page1Char1.resizeChar(page1Char1Uuid);
- let page1Char2Uuid = this.$refs.page1Char2.mid;
- this.$refs.page1Char2.resizeChar(page1Char2Uuid);
- } else if (this.$store.state.addr.page == 'treeSpecies') {
- let page2Char2Uuid = this.$refs.page2Char2.mid;
- this.$refs.page2Char2.resizeChar(page2Char2Uuid);
- let page2Char3Uuid = this.$refs.page2Char3.mid;
- this.$refs.page2Char3.resizeChar(page2Char3Uuid);
- } else if (this.$store.state.addr.page == 'economics') {
- let page5Char1Uuid = this.$refs.page5Char1.mid;
- this.$refs.page5Char1.resizeChar(page5Char1Uuid);
- let page5Char2Uuid = this.$refs.page5Char2.mid;
- this.$refs.page5Char2.resizeChar(page5Char2Uuid);
- } else if (this.$store.state.addr.page == 'event') {
- let page6Char1Uuid = this.$refs.page6Char1.mid;
- this.$refs.page6Char1.resizeChar(page6Char1Uuid);
- let page6Char2Uuid = this.$refs.page6Char2.mid;
- this.$refs.page6Char2.resizeChar(page6Char2Uuid);
- }
- }
- },
- watch: {
- xiaobaninput: {
- handler: function () {
- debounce(this.xiaobansearch, 500, false);
- }
- },
- '$store.state.addr.selectCity'(val) {
- // debounce(this.getPageData(), 1000, false)
- this.getPageData();
- },
- '$store.state.addr.selectDistrict'(val) {
- this.getPageData();
- },
- '$store.state.addr.selectStreet'(val) {
- this.getPageData();
- }
- },
- methods: {
- ...mapMutations([
- 'changeSearchSmallClass'
- ]),
- addrChange(value) {
- console.log('addrChange', value);
- },
- navClick(index) {
- this.$store.commit('changePage', this.navList[index - 1].en);
- console.log('this.navList[index-1].en', this.navList[index - 1].en);
- this.page = index;
- console.log('index', index);
- if (
- this.$store.state.addr.page == 'sink' ||
- this.$store.state.addr.page == 'circulation'
- ) {
- Message('暂未开放!');
- return;
- }
- // 切换专题时,重置区域
- // this.$store.dispatch('searchArea', {
- // parentId: '520000',
- // name: '贵州省',
- // mapLevel: 'province'
- // });
- this.getPageData();
- },
- getPageData() {
- debounce(this.debounceGetData, 300, false);
- },
- debounceGetData() {
- console.log('page', this.$store.state.addr.page);
- // {text:'森林资源',en:'forest'},
- // {text:'林木结构',en:'treeSpecies'},
- // {text:'碳汇管理',en:'sink'},
- // {text:'林下经济',en:'economics'},
- // {text:'土地流转',en:'circulation'},
- // {text:'事件信息',en:'event'},
- if (this.$store.state.addr.page == 'forest') {
- this.getPage1numerical();
- this.getPage1echarts01();
- this.getPage1echarts02();
- this.getRightScrollData();
- } else if (this.$store.state.addr.page == 'treeSpecies') {
- this.getPage2numerical();
- // this.getPage2echarts01();
- this.getPage2echarts02();
- this.getPage2echarts03();
- this.getRightScrollData();
- } else if (this.$store.state.addr.page == 'economics') {
- this.getPage5numerical();
- // this.getTypeSlideData();
- this.getPage5echarts01();
- this.getPage5echarts02();
- this.getRightScrollData();
- } else if (this.$store.state.addr.page == 'event') {
- this.getPage6numerical();
- this.getPage6echarts01();
- this.getPage6echarts02();
- this.getAlarmData();
- this.getRightScrollData();
- }
- },
- getPage1numerical() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page1numerical(param)
- .then((res) => {
- // console.log('res',res);
- this.page1numerical = res.data;
- })
- .catch((err) => {
- console.log('echarts01 err', err);
- });
- },
- getPage1echarts01() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- // console.log('cityId',param.cityId);
- page1echarts01(param)
- .then((res) => {
- this.page1Char1.xAxis.data = res.data.map((item) => {
- return item.name;
- });
- this.page1Char1.series[0].data = res.data.map((item) => {
- return item.number;
- });
- //数量过小时隐藏滚动
- if (this.page1Char1.xAxis.data.length <= 8) {
- this.page1Char1.dataZoom[0].show = false;
- }else{
- this.page1Char1.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page1Char1.mid;
- this.$refs.page1Char1.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage1echarts01 err', err);
- });
- },
- getPage1echarts02() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- // console.log('cityId',param.cityId);
- page1echarts02(param)
- .then((res) => {
- this.page1Char2.xAxis.data = res.data.map((item) => {
- return item.name;
- });
- this.page1Char2.series[0].data = res.data.map((item) => {
- return item.number;
- });
- //数量过小时隐藏滚动
- if (this.page1Char2.xAxis.data.length <= 8) {
- this.page1Char2.dataZoom[0].show = false;
- }else{
- this.page1Char2.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page1Char2.mid;
- this.$refs.page1Char2.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage1echarts02 err', err);
- });
- },
- getRightScrollData() {
- let param = {
- smallNumber: this.xiaobaninput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- rightScrollData(param)
- .then((res) => {
- // console.log('res',res.rows.length);
- // console.log('this.scrollBoardConfig',this.scrollBoardConfig);
- //当小班滚动数据少时重设参数
- // if(res.rows.length<=15){
- // this.scrollBoardConfig.rowNum = 5;
- // this.scrollBoardStyle.height = '25vh'
- // }
- this.scrollBoardConfig.data = [];
- res.rows.forEach((element) => {
- this.scrollBoardConfig.data.push([
- element.smallNumber,
- element.treeComp,
- element.perAcreStock + 'm³',
- element.landArea + '亩'
- ]);
- });
- this.scrollBoardKey = Date.now();
- this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
- // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
- // this.scrollBoardConfig = res.data;
- })
- .catch((err) => {
- console.log('echarts01 err', err);
- });
- },
- getAlarmData() {
- alarmDataApi()
- .then((res) => {
- // console.log('this.page',this.page);
- // console.log('res',res);
- this.alarmData = res.data;
- // console.log('alarmData.length',this.alarmData.length);
- })
- .catch((err) => {
- console.log('echarts01 err', err);
- });
- },
- getPage2numerical() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId,
- smallNumber: this.xiaobaninput
- };
- page2numerical(param)
- .then((res) => {
- // console.log('res',res);
- this.page2numerical = res.data;
- })
- .catch((err) => {
- console.log('page2numerical err', err);
- });
- },
- getPage2echarts01() {
- let param = {
- smallNumber: this.xiaobaninput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page2echarts01(param)
- .then((res) => {
- // console.log('res',res);
- this.page2Char1.series[0].data = [];
- this.page2Char1.series[0].data = res.data;
- let charUuid = this.$refs.page2Char1.mid;
- this.$refs.page2Char1.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage2echarts01 err', err);
- });
- },
- getPage2echarts02() {
- let param = {
- smallNumber: this.xiaobaninput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page2echarts02(param)
- .then((res) => {
- // console.log('res',res);
- // this.page2Char2 = res.data;
- // console.log('this.page2Char2.series', this.page2Char2.series);
- this.page2Char2.xAxis.data = [];
- this.page2Char2.series = [];
- const rows = res.data;
- // console.log(rows)
- // x坐标
- this.page2Char2.xAxis.data = rows.map((item) => {
- return item.smallNumber;
- });
- // console.log('x坐标', this.page2Char2.xAxis.data)
- // 获取所有项
- let seriesList = rows.map((item) => {
- return item.treeList;
- });
- // 数组扁平化
- seriesList = seriesList.flat();
- // 去重
- let obj = {};
- seriesList = seriesList.reduce((newArr, next) => {
- obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
- return newArr;
- }, []);
- seriesList = seriesList.map((item,index ) => {
- let itemColor = null;
- if(item.name=='杉木'||item.name=='杉'){
- itemColor = colorArr[0]
- }else if(item.name=='马尾松'||item.name=='马'){
- itemColor = colorArr[1]
- }else if(item.name=='软阔'||item.name=='软'){
- itemColor = colorArr[2]
- }else if(item.name=='硬阔'||item.name=='硬'){
- itemColor = colorArr[3]
- }
- return {
- name: item.name,
- type: 'bar',
- stack: 'total',
- label: {
- show: false
- },
- emphasis: {
- focus: 'series'
- },
- data: [],
- itemStyle: {
- normal: { color: itemColor||"auto" },
- }
- };
- });
- // console.log(seriesList)
- rows.forEach((item) => {
- seriesList.forEach((jtem, index) => {
- let num = 0;
- item.treeList.map((ktem) => {
- if (ktem.name.indexOf(jtem.name) > -1) {
- num = ktem.value;
- }
- });
- seriesList[index].data.push(num);
- });
- });
- // console.log('page2echarts02 seriesList',seriesList)
- this.page2Char2.series = seriesList;
- //数量过小时隐藏滚动
- if (this.page2Char2.xAxis.data.length <= 8) {
- this.page2Char2.dataZoom[0].show = false;
- }else{
- this.page2Char2.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page2Char2.mid;
- this.$refs.page2Char2.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage2echarts02 err', err);
- });
- },
- getPage2echarts03() {
- let param = {
- smallNumber: this.xiaobaninput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page2echarts03(param)
- .then((res) => {
- // console.log('res',res);
- // this.page2Char2 = res.data;
- // console.log('this.page2Char2.series', this.page2Char2.series);
- this.page2Char3.xAxis.data = [];
- this.page2Char3.series = [];
- const rows = res.data;
- // console.log(rows)
- // x坐标
- this.page2Char3.xAxis.data = rows.map((item) => {
- return item.smallNumber;
- });
- // console.log('x坐标', this.page2Char2.xAxis.data)
- // 获取所有项
- let seriesList = rows.map((item) => {
- return item.treeList;
- });
- // 数组扁平化
- seriesList = seriesList.flat();
- // 去重
- let obj = {};
- seriesList = seriesList.reduce((newArr, next) => {
- obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
- return newArr;
- }, []);
- seriesList = seriesList.map((item,index) => {
- let itemColor = null;
- if(item.name=='杉木'||item.name=='杉'){
- itemColor = colorArr[0]
- }else if(item.name=='马尾松'||item.name=='马'){
- itemColor = colorArr[1]
- }else if(item.name=='软阔'||item.name=='软'){
- itemColor = colorArr[2]
- }else if(item.name=='硬阔'||item.name=='硬'){
- itemColor = colorArr[3]
- }
- return {
- name: item.name,
- type: 'bar',
- stack: 'total',
- label: {
- show: false
- },
- emphasis: {
- focus: 'series'
- },
- data: [],
- itemStyle: {
- normal: { color: itemColor||"auto" },
- }
- };
- });
- // console.log(seriesList)
- rows.forEach((item) => {
- seriesList.forEach((jtem, index) => {
- let num = 0;
- item.treeList.map((ktem) => {
- if (ktem.name.indexOf(jtem.name) > -1) {
- num = ktem.value;
- }
- });
- seriesList[index].data.push(num);
- });
- });
- // console.log(seriesList)
- this.page2Char3.series = seriesList;
- //数量过小时隐藏滚动
- if (this.page2Char3.xAxis.data.length <= 8) {
- this.page2Char3.dataZoom[0].show = false;
- }else{
- this.page2Char3.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page2Char3.mid;
- this.$refs.page2Char3.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage2echarts03 err', err);
- });
- },
- getPage5numerical() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page5numerical(param)
- .then((res) => {
- // console.log('res',res);
- this.page5numerical = res.data;
- })
- .catch((err) => {
- console.log('echarts01 err', err);
- });
- },
- getTypeSlideData() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- typeSlideApi(param)
- .then((res) => {
- this.typeSlideData = sliceArray(res.data, 3);
- // console.log(' this.typeSlideData', this.typeSlideData);
- })
- .catch((err) => {
- console.log('getTypeSlideData err', err);
- });
- },
- getPage5echarts01() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page5echarts01(param)
- .then((res) => {
- // console.log('res',res);
- // this.page5Char1 = res.data;
- this.page5Char1.xAxis.data = res.data.map((item) => {
- return item.baseName;
- });
- this.page5Char1.series[0].data = res.data.map((item) => {
- return item.baseArea;
- });
- //数量过小时隐藏滚动
- if (this.page5Char1.xAxis.data.length <= 8) {
- this.page5Char1.dataZoom[0].show = false;
- }else{
- this.page5Char1.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page5Char1.mid;
- this.$refs.page5Char1.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage5echarts01 err', err);
- });
- },
- getPage5echarts02() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page5echarts02(param)
- .then((res) => {
- // console.log('res',res);
- // this.page5Char2 = res.data;
- this.page5Char2.xAxis.data = res.data.map((item) => {
- return item.name;
- });
- this.page5Char2.series[0].data = res.data.map((item) => {
- return item.number;
- });
- //数量过小时隐藏滚动
- if (this.page5Char2.xAxis.data.length <= 8) {
- this.page5Char2.dataZoom[0].show = false;
- }else{
- this.page5Char2.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page5Char2.mid;
- this.$refs.page5Char2.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage5echarts02 err', err);
- });
- },
- getPage6numerical() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- //第一屏统计
- page6numerical(param)
- .then((res) => {
- // console.log('res',res);
- this.page6numerical = res.data;
- })
- .catch((err) => {
- console.log('getPage6numerical err', err);
- });
- },
- getPage6echarts01() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page6echarts01(param)
- .then((res) => {
- // console.log('res',res);
- // this.page6Char1 = res.data;
- // this.page6Char1.xAxis[0].data = [];
- // this.page6Char1.series[0].data = [];
- // this.page6Char1.series[1].data = [];
- // this.page6Char1.series[2].data = [];
- // res.data &&
- // res.data.forEach((element) => {
- // this.page6Char1.xAxis[0].data.push(element.villageName);
- // this.page6Char1.series[0].data.push(element.fireCount);
- // this.page6Char1.series[1].data.push(element.cutCount);
- // this.page6Char1.series[2].data.push(element.pestCount);
- // });
- this.page6Char1.xAxis.data = [];
- this.page6Char1.series[0].data = [];
- this.page6Char1.series[1].data = [];
- this.page6Char1.series[2].data = [];
- const rows = res.data;
- // console.log(rows)
- // x坐标
- this.page6Char1.xAxis.data = rows.map((item) => {
- return item.villageName;
- });
- rows.forEach((element) => {
- this.page6Char1.series[0].data.push(element.pestCount);
- this.page6Char1.series[1].data.push(element.fireCount);
- this.page6Char1.series[2].data.push(element.cutCount);
- });
- // console.log('x坐标', this.page6Char1.xAxis.data)
- //数量过小时隐藏滚动
- if (this.page6Char1.xAxis.data.length <= 8) {
- this.page6Char1.dataZoom[0].show = false;
- }else{
- this.page6Char1.dataZoom[0].show = true;
- }
- let charUuid = this.$refs.page6Char1.mid;
- this.$refs.page6Char1.intChar(charUuid);
- })
- .catch((err) => {
- console.log('getPage6echarts01 err', err);
- });
- },
- getPage6echarts02() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- page6echarts02(param)
- .then((res) => {
- console.log('page6echarts02 res', res);
- const rows = res.data;
- // console.log(rows)
- // x坐标
- this.page6Char2.xAxis.data = [];
- this.page6Char2.series[0].data = [];
- this.page6Char2.series[1].data = [];
- this.page6Char2.series[2].data = [];
- this.page6Char2.xAxis.data = rows.map((item) => {
- return item.month;
- });
- rows.forEach((element) => {
- // console.log('element',element.eventList);
- this.page6Char2.series[0].data.push(element.eventList[0].value);
- this.page6Char2.series[1].data.push(element.eventList[1].value);
- this.page6Char2.series[2].data.push(element.eventList[2].value);
- });
- console.log('this.page6Char2.series', this.page6Char2.series);
- let charUuid = this.$refs.page6Char2.mid;
- this.$refs.page6Char2.intChar(charUuid);
- })
- .catch((err) => {
- console.log('page6echarts02 err', err);
- });
- },
- xiaobansearch() {
- // console.log('xiaobansearch');
- this.getRightScrollData();
- this.getPageData();
- },
- scrollBoardClick(e) {
- console.log(e.row[0]);
- let param = {
- smallNumber: e.row[0],
- // cityId: this.$store.state.addr.selectCity.areaId,
- // countyId: this.$store.state.addr.selectDistrict.areaId,
- // townId: this.$store.state.addr.selectStreet.areaId
- };
- console.log(param);
- rightScrollData(param).then((res) => {
- this.changeSearchSmallClass(res.rows[0])
- });
- },
- toggleShowScrollBoard() {
- this.showScrollBoard = !this.showScrollBoard;
- }
- }
- };
- </script>
- <style lang='scss' scoped>
- @import url(./index.scss);
- </style>
|