123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446 |
- <!--
- * @Description:
- * @Author: wangcc
- * @Date: 2022-07-06 15:56:45
- * @LastEditors: gcz
- * @LastEditTime: 2022-11-04 14:48:39
- * @FilePath: \ntbigscreen\src\views\index.vue
- * @Copyright: Copyright (c) 2016~2022 by wangcc, All Rights Reserved.
- -->
- <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" pageName="forest" />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page1Char1"
- streetTitleText="各小班"
- ref="page1Char1"
- :option="page1Char1"
- style
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page1Char2"
- streetTitleText="各小班"
- ref="page1Char2"
- :option="page1Char2"
- style
- />
- </section>
- <section class="left-wrap" v-if="$store.state.addr.page == 'treeSpecies'">
- <Numerical class="left-item" :data="page2numerical" pageName="treeSpecies" />
- <!-- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char1"
- :option="page2Char1"
- ref="page2Char1"
- />-->
- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char2"
- streetTitleText="各小班"
- :option="page2Char2"
- ref="page2Char2"
- />
- <MyEcharts
- class="left-item chart-wrap"
- mid="page2Char3"
- streetTitleText="各小班"
- :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" pageName="economics" />
- <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 event-page" 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"
- />-->
- <div class="left-item">
- <!-- <div class="ntitle">{{$store.state.addr.selectAddr}}事件发生记录</div> -->
- <div class="ntitle">
- <span
- v-if="$store.state.addr.mapLevel == 'province'"
- >{{ $store.state.addr.selectAddr }}各地州(市)事件发生记录</span>
- <span
- v-if="$store.state.addr.mapLevel == 'city'"
- >{{ $store.state.addr.selectAddr }}各县事件发生记录</span>
- <span
- v-if="$store.state.addr.mapLevel == 'district'"
- >{{ $store.state.addr.selectAddr }}各乡镇事件发生记录</span>
- <span
- v-if="$store.state.addr.mapLevel == 'street'"
- >{{ $store.state.addr.selectAddr }}各村事件发生记录</span>
- </div>
- <dv-scroll-board
- :key="scrollBoardKey"
- class="scroll-event"
- :config="scrollEventConfig"
- ref="scrollBoard"
- @click="scrollEventClick"
- @mouseout="scrollEventOut"
- />
- </div>
- </section>
- <section class="right-wrap">
- <PickerAddr />
- <div v-if="showbase" class="xiaoban u-flex">
- <div class="title">基地查询:</div>
- <el-input v-model="baseinput" placeholder="请输入基地名称">
- <i class="el-icon-search el-input__icon" slot="suffix" @click="basesearch"></i>
- </el-input>
- </div>
- <div class="right_xiaoban">
- <div class="tab-box" v-if="showxiaoban">
- <div
- class="tab-btn"
- :class="classFunc(index)"
- @click="tabLink(index)"
- v-for="(item, index) in tabData"
- :key="index"
- >
- <span class="tab-span">{{ item.name }}</span>
- </div>
- </div>
- <div v-if="showxiaoban" class="xiaoban u-flex">
- <div class="tab-class-search" v-if="cur == 1">
- <!-- <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>
- <div class="tab-class-search" v-if="cur == 0">
- <!-- <div class="title">项目查询:</div> -->
- <el-input v-model="projectInput" placeholder="请输入项目名称">
- <i class="el-icon-search el-input__icon" slot="suffix" @click="projectSearch"></i>
- </el-input>
- </div>
- </div>
- <section
- v-if="showxiaoban || showbase"
- class="scroll-board-wrap"
- :class="{ close: showScrollBoard == true }"
- >
- <dv-scroll-board
- v-if="showbase"
- :key="scrollBoardKey"
- class="scroll-board-01 scroll-base"
- :config="scrollBaseListConfig"
- ref="scrollBaseList"
- @click="scrollBaseListClick"
- @mouseout="baseListClick"
- />
- <dv-scroll-board
- v-if="showxiaoban && cur == 1"
- :key="scrollBoardKey"
- class="scroll-board-01"
- :config="scrollBoardConfig"
- ref="scrollBoard"
- @click="scrollBoardClick"
- :style="scrollBoardStyle"
- />
- <dv-scroll-board
- v-if="showxiaoban && cur == 0"
- :key="scrollBoardKey"
- class="scroll-board-01"
- id="projectId"
- :config="scrollPeojectConfig"
- ref="scrollProjectBoard"
- @click="scrollProjectClick"
- @mouseout="scrollOutPro"
- :style="scrollBoardStyle"
- />
- <div class="scroll-board-tool" @click="toggleShowScrollBoard">
- <div class="inner">
- <img src="../assets/img/jiantou.png" alt />
- </div>
- </div>
- </section>
- </div>
- </section>
- <!-- </dv-full-screen-container> -->
- </div>
- </template>
- <script>
- import Map from '../components/amapPow.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,
- baseList,
- alarmDataApi,
- page2numerical,
- page2echarts01,
- page2echarts02,
- page2echarts03,
- page5numerical,
- typeSlideApi,
- page5echarts01,
- page5echarts02,
- page6numerical,
- page6echarts01,
- page6echarts02,
- eventList,
- smallClassDetail,
- smallInfo,
- eventDetail,
- financeBaseDetail,
- projectList,
- projectSmallClass
- } from '../service/index';
- import scrollBoardSchema from '../dataSchema/scrollBoardSchema';
- import scrollPeojectSchema from '../dataSchema/scrollPeojectSchema';
- import scrollBaseListSchema from '../dataSchema/scrollBaseListSchema';
- 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';
- import scrollEventSchema from '../dataSchema/scrollEventSchema';
- //柱状图颜色
- let colorArr = ['#00FAFD', '#FF4E46', '#FFAA00', '#19D800'];
- // 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 {
- tabData: [
- {
- id: 1,
- name: '项目查询'
- },
- {
- id: 2,
- name: '小班查询'
- }
- ],
- rowList: [],
- cur: 0,
- showxiaoban: true,
- showbase: false,
- showScrollBoard: false,
- alarData: {},
- 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,
- scrollBaseListConfig: scrollBaseListSchema,
- scrollPeojectConfig: scrollPeojectSchema,
- 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,
- scrollEventConfig: scrollEventSchema,
- xiaobaninput: '',
- projectInput: '',
- baseinput: ''
- };
- },
- created() {},
- computed: {
- ...mapGetters(['vuexCityList', 'vuexDistrictList', 'vuexStreetList'])
- },
- mounted() {
- this.getPageData();
- // this.getRightScrollData();
- setInterval(() => {
- this.getPageData();
- }, 1160000);
- 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);
- }
- },
- projectInput: {
- handler: function () {
- debounce(this.projectSearch, 500, false);
- }
- },
- baseinput: {
- handler: function () {
- debounce(this.basesearch, 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();
- },
- '$store.state.addr.mapLevel': {
- handler(val) {
- console.log(val);
- console.log(this.$store.state.addr.selectCity.prop);
- if (val === 'city' && this.$store.state.addr.selectCity.prop == '2') {
- this.jumpDistrict();
- }
- }
- },
- '$store.state.addr.selectProject'(val) {
- // console.log('addr.selectProject',val);
- this.getPageData();
- },
- },
- methods: {
- ...mapMutations([
- 'changeSearchSmallClass',
- 'changeEvenData',
- 'changeBaseDetail',
- 'changeSelectCity',
- 'changeSelectDistrict',
- 'changeSelectStreet',
- 'getProjectSmallClassMap',
- 'changeSelectProject'
- ]),
- addrChange(value) {
- console.log('addrChange', value);
- },
- navClick(index) {
- let pageName = this.navList[index - 1].en;
- if (pageName == 'sink' || pageName == 'circulation') {
- Message('暂未开放!');
- return;
- }
- 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.navList[index - 1].en == 'economics') {
- this.showbase = true;
- this.showxiaoban = false;
- } else if (this.navList[index - 1].en == 'event') {
- this.showbase = false;
- this.showxiaoban = false;
- } else {
- this.showbase = false;
- this.showxiaoban = true;
- }
- // 切换专题时,重置区域
- // this.$store.dispatch('searchArea', {
- // parentId: '520000',
- // name: '贵州省',
- // mapLevel: 'province'
- // });
- this.getPageData();
- },
- getPageData() {
- debounce(this.debounceGetData, 1000, true);
- },
- debounceGetData() {
- console.log('请求数据');
- // 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();
- this.getProjectScrollData();
- } else if (this.$store.state.addr.page == 'treeSpecies') {
- this.getPage2numerical();
- // this.getPage2echarts01();
- this.getPage2echarts02();
- this.getPage2echarts03();
- this.getRightScrollData();
- this.getProjectScrollData();
- } else if (this.$store.state.addr.page == 'economics') {
- this.getPage5numerical();
- // this.getTypeSlideData();
- this.getPage5echarts01();
- this.getPage5echarts02();
- this.getBaseList();
- } else if (this.$store.state.addr.page == 'event') {
- this.getPage6numerical();
- this.getPage6echarts01();
- this.getEventList();
- // 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- // 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 <= 5) {
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- // 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 <= 5) {
- 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,
- pageNum:1,
- pageSize:50,
- };
- 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 + '亩',
- element.id
- ]);
- });
- this.scrollBoardKey = Date.now();
- this.$refs.scrollBoard&&this.$refs.scrollBoard.updateRows(this.scrollBoardConfig.data);
- // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
- // this.scrollBoardConfig = res.data;
- })
- .catch((err) => {
- console.log('scrollBoard err', err);
- });
- },
- getProjectScrollData() {
- let param = {
- courseName: this.projectInput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId,
- pageNum:1,
- pageSize:50,
- };
- projectList(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'
- // }
- let that = this;
-
- this.scrollPeojectConfig.data = [];
- res.rows.forEach((element) => {
- this.scrollPeojectConfig.data.push([
- element.courseName,
- element.smallClassStock + 'm³',
- element.landArea + '亩',
- element.classNumber,
- element.id
- ]);
- });
- this.scrollBoardKey = Date.now();
- this.$refs.scrollProjectBoard.updateRows(
- this.scrollPeojectConfig.data
- );
- //监听是否有选中项目,有的话高亮
- let timer1 = setInterval(function(){ // 每 10 毫秒检查一下 html 是否已存在
- let domId = that.$store.state.addr.selectProject.ProjectID;
- let dom = document.getElementById(that.$store.state.addr.selectProject.ProjectID);
- // console.log('dom',domId);
- if(domId&&dom){
- // console.log('dom',dom.classList);
- if(dom.classList.contains('active')==true){
- // clearInterval(timer1);
- }else{
- dom.classList.add('active');
- }
-
- }
- },500);
- // setTimeout(() => {
- // this.$store.state.addr.selectProject.ProjectID&&document.getElementById(this.$store.state.addr.selectProject.ProjectID).classList.add('active');
- // }, 2000);
-
- // console.log('this.scrollBoardConfig.data', this.scrollBoardConfig.data);
- // this.scrollBoardConfig = res.data;
- })
- .catch((err) => {
- console.log('scrollProjectBoard err', err);
- });
- },
- getBaseList() {
- let param = {
- baseName: this.baseinput,
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- baseList(param)
- .then((res) => {
- this.scrollBaseListConfig.data = [];
- res.rows.forEach((element) => {
- let cateInfoList = element.cateInfoList;
- let cropName = '';
- for (let index = 0; index < cateInfoList.length; index++) {
- const item = cateInfoList[index];
- cropName += item.cropName + ',';
- }
- cropName = cropName.substring(0, cropName.lastIndexOf(','));
- this.scrollBaseListConfig.data.push([
- element.baseName,
- cropName || '暂无作物',
- element.baseArea + '亩',
- element.id
- ]);
- });
- this.scrollBoardKey = Date.now();
- })
- .catch((err) => {
- console.log('echarts01 err', err);
- });
- },
- getEventList() {
- let param = {
- cityId: this.$store.state.addr.selectCity.areaId,
- countyId: this.$store.state.addr.selectDistrict.areaId,
- townId: this.$store.state.addr.selectStreet.areaId
- };
- eventList(param)
- .then((res) => {
- this.scrollEventConfig.data = [];
- res.rows.forEach((element) => {
- this.scrollEventConfig.data.push([
- element.createTime.slice(5, 16),
- element.townName + element.villageName,
- this.eventTypeFilter(element.eventType),
- // element.createBy,
- this.eventStateFilter(element.state),
- element.id
- ]);
- });
- this.scrollBoardKey = Date.now();
- })
- .catch((err) => {
- console.log('getEventList err', err);
- });
- },
- eventTypeFilter(e) {
- if (e == '1') {
- return '火灾';
- } else if (e == '2') {
- return '砍伐';
- } else if (e == '3') {
- return '病虫害';
- } else if (e == '4') {
- return '偷盗林木';
- }
- },
- eventStateFilter(e) {
- if (e == '0') {
- return '未反馈';
- } else if (e == '1') {
- return '已反馈';
- }
- },
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- 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) => {
- // console.log('page2Char2 seriesList',seriesList);
- // console.log('page2Char2 next',next);
- obj[next.name] ? '' : (obj[next.name] = true && newArr.push(next));
- return newArr;
- }, []);
- seriesList.sort((star, next) => {
- // 按name的指定顺序排序,不排序可以删掉
- var order = ['杉木', '马尾松', '软阔', '硬阔'];
- return order.indexOf(star.name) - order.indexOf(next.name);
- });
- 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 &&
- 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 <= 5) {
- 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,
- courseId:this.$store.state.addr.selectProject.ProjectID,
- };
- 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;
- }, []);
- // console.log('seriesList',seriesList);
- seriesList.sort((star, next) => {
- // 按name的指定顺序排序,不排序可以删掉
- var order = ['杉木', '马尾松', '软阔', '硬阔'];
- return order.indexOf(star.name) - order.indexOf(next.name);
- });
- 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 &&
- 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 <= 5) {
- 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 <= 5) {
- 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 <= 5) {
- 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 = [];
- this.page6Char1.series[3].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);
- this.page6Char1.series[3].data.push(element.stealCount);
- });
- // console.log('x坐标', this.page6Char1.xAxis.data)
- //数量过小时隐藏滚动
- if (this.page6Char1.xAxis.data.length <= 5) {
- 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();
- },
- projectSearch() {
- // console.log('projectSearch');
- this.getProjectScrollData();
- // this.getPageData();
- },
- basesearch() {
- // console.log('xiaobansearch');
- this.getBaseList();
- this.getPageData();
- },
- scrollBoardClick(e) {
- let param = {
- id: e.row[4]
- };
- smallClassDetail(param).then((res) => {
- this.changeSearchSmallClass(res.data);
- console.log(res.data);
- this.alarData = res.data;
- // if (this.$store.state.addr.mapLevel == 'city') {
- // this.jumpDistrict();
- // } else {
- // this.vuexCityList.forEach((element) => {
- // if (res.data.cityId === element.areaId) {
- // this.changeSelectCity({
- // value: element.areaCode,
- // label: res.data.cityName,
- // areaId: element.areaId
- // });
- // this.$store.dispatch('searchArea', {
- // parentId: element.areaCode.substring(0, 6),
- // name: res.data.cityName,
- // mapLevel: 'city'
- // });
- // }
- // });
- // }
- });
- },
- removeAllClass(className) {
- //找到所有包含className的结点
- let nodeList = document.querySelectorAll(
- `.dv-scroll-board .${className}`
- );
- // let nodeList = document.getElementsByClassName('row-item');
- //删除这些标签对应的class
- Array.prototype.forEach.call(nodeList, (el) => {
- el&&el.classList.remove(className);
- });
- },
- scrollProjectClick(e) {
- console.log('scrollProjectClick',e);
- // 点击添加class
- // let removeAllClass = (className)=>{
- // //找到所有包含className的结点
- // let nodeList = document.querySelectorAll(`.dv-scroll-board .${className}`);
- // // let nodeList = document.getElementsByClassName('row-item');
- // //删除这些标签对应的class
- // Array.prototype.forEach.call(nodeList,(el)=>{
- // el.classList.remove(className)
- // })
- // }
- let proClass = document.getElementsByClassName('row-item');
- // proClass[e.rowIndex].style.background = 'rgb(4, 145, 110)';
- this.removeAllClass('active');
- // console.log('proClass',proClass);
- // proClass[e.rowIndex]&&proClass[e.rowIndex].classList.add('active');
- let rowId = e.row[4];
- this.changeSelectProject({ProjectID:rowId,ProjectName:e.row[0]});
- document.getElementById(rowId).classList.add('active');
- let param = {
- courseId: rowId
- // pageNum: 1,
- // pageSize: 20
- };
- projectSmallClass(param).then((res) => {
- if (res.code == 200) {
- this.getProjectSmallClassMap(res.rows);
- }
- });
- },
- jumpDistrict() {
- if (this.vuexDistrictList) {
- this.vuexDistrictList.forEach((element) => {
- if (this.alarData.countyId === element.areaId) {
- this.changeSelectDistrict({
- value: element.areaCode,
- label: this.alarData.cityName,
- areaId: element.areaId
- });
- this.$store.dispatch('searchArea', {
- parentId: element.areaCode.substring(0, 6),
- name: element.areaName,
- mapLevel: 'district'
- });
- }
- });
- }
- },
- scrollOut(e) {
- // console.log(e);
- this.changeSearchSmallClass({ name: false });
- },
- scrollOutPro(e) {
- // let proClass = document.getElementsByClassName('row-item')
- // proClass[e.rowIndex].style.background = '';
- },
- scrollBaseListClick(e) {
- console.log('scrollBaseListClick', e);
- let param = {
- baseId: e.row[3]
- };
- financeBaseDetail(param).then((res) => {
- this.changeBaseDetail(res.data);
- });
- },
- baseListClick() {
- this.changeBaseDetail({ name: false });
- },
- scrollEventClick(e) {
- let param = {
- id: e.row[4]
- };
- eventDetail(param).then((res) => {
- this.changeEvenData(res.data);
- });
- },
- scrollEventOut() {
- this.changeEvenData({ name: false });
- },
- toggleShowScrollBoard() {
- this.showScrollBoard = !this.showScrollBoard;
- },
- tabLink(e) {
- this.cur = e;
- if (this.cur == '1') {
- this.removeAllClass('active');
- }
- },
- classFunc(index) {
- if (this.cur == index) {
- return `active active${index}`;
- }
- }
- }
- };
- </script>
- <style lang='scss' scoped>
- @import url(./index.scss);
- .tab-box {
- // background-color: rgba(1, 33, 35, 0.7);
- // background: linear-gradient(90deg, rgba(0,99,113,0.9) 0%, #00ADAF 54%, rgba(0,50,57,0.9) 100%);
- background-color: rgba(0, 161, 173, 0.2);
- box-shadow: inset 0px -2px 9px -3px rgba(0, 250, 253, 0.4);
- width: 100%;
- .tab-btn {
- float: left;
- width: 148px;
- height: 46px;
- line-height: 46px;
- text-align: center;
- color: rgba(255, 255, 255, 0.6);
- &:first-of-type {
- text-indent: -10px;
- }
- cursor: pointer;
- &.active0 {
- background: url(../assets/img/tab-btn-first.png) no-repeat;
- }
- &.active1 {
- background: url(../assets/img/tab-btn-center.png) no-repeat;
- transform: translateX(-22px);
- }
- &.active {
- background-size: 100%;
- color: #00fafd;
- }
- .tab-span {
- display: inline-block;
- }
- }
- }
- .tab-class-search {
- // display: flex;
- height: 40px;
- width: 100%;
- align-items: center;
- margin: 0 15px;
- }
- /deep/ .row-item {
- line-height: normal !important;
- align-items: center;
- }
- /deep/ .dv-scroll-board .rows .ceil {
- white-space: normal;
- overflow: unset;
- text-overflow: unset;
- display: grid;
- height: 100%;
- align-items: center;
- }
- .right_xiaoban {
- background-color: rgba(1, 33, 35, 0.7);
- display: flex;
- flex-direction: column;
- /* justify-content: right; */
- // width: 59%;
- float: right;
- }
- .rowClass {
- box-shadow: inset 0px 0px 31px 1px rgba(0, 250, 253, 0.4);
- border-radius: 0px 0px 0px 0px;
- opacity: 1;
- border: 1px solid rgba(0, 250, 253, 1);
- background: #04916e;
- }
- </style>
|