| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175 |
- <template>
- <div>
- <div class="total222" style="height:770px">
- <a-tabs v-model:activeKey="activeKey" @change="changeTab">
- <a-tab-pane key="1">
- <template #tab>
- <span> 测站信息 </span>
- </template>
- <div style="display:flex;flex-direction: column;">
- <div>
- <div class="map-dialog-title">
- <img src="../../assets/images/weatheHome/icon-title.png" />
- 基本信息
- </div>
- <div>
- <a-row style="min-height: 100px; padding: 20px">
- <a-col :span="8" v-for="(item, index) in detailInfo?.basic_info" :key="index + 1">
- <div style="display: flex">
- <a-row style="width: 100%; height: 50px">
- <a-col :span="8">
- <div style="
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- width: 100%;
- height: 100%;
- background-color: #032448;
- border: 1px solid #014a9b;
- ">{{ Object.keys(item)[0] }}</div>
- </a-col>
- <a-col :span="16">
- <div style="
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- width: 100%;
- height: 100%;
- border: 1px solid #014a9b;
- ">{{ Object.values(item)[0] }}</div>
- </a-col>
- </a-row>
- </div>
- </a-col>
- </a-row>
- </div>
- </div>
- <div style="flex:1">
- <div class="map-dialog-title mg-10">
- <img src="../../assets/images/weatheHome/icon-title.png" />
- 监测信息
- <div class="map-dialog-tabp-list" v-if="detailInfo.st_type != 6">
- <!-- <div class="active-tabp">
- 杨村温度
- </div> -->
- <div style="font-size: 14px; color: #bed2ff" v-for="(item, index) in detailInfo.sensor"
- :key="item.senid" @click="setTabColor(item, index + 1)">{{ item.sensor_name }}</div>
- </div>
- </div>
- <div class="tabp-conetnt">
- <div class="tabp-conetnt-left hconetnt" v-if="detailInfo.st_type == 6">
- <a-collapse v-model:activeKey="activeMenu.activeKey" :bordered="false">
- <template #expandIcon="{ isActive }">
- <img class="left-collapse-icon"
- :style="{ transform: `rotate(${isActive ? '0' : '-90'}deg)`, marginTop: '-12px' }"
- src="../../assets/images/weatheHome/icon-bottom.png" />
- </template>
- <a-collapse-panel :key="index + 1" :header="ke" :style="activeMenu.customStyle"
- v-for="(item, ke, index) in tanshuiList">
- <ul class="collapse-ul">
- <li :class="''" v-for="(it, index2) in item.value" :key="it.senid"
- @click="setTabColor2(it, index, index2)">{{
- it.sensor_name
- }}</li>
- </ul>
- </a-collapse-panel>
- <!-- <a-collapse-panel key="2" header="4m 灌木层" :style="activeMenu.customStyle">
- <ul class="collapse-ul">
- <li>温度</li>
- <li>湿度</li>
- <li class="active">土壤热通量</li>
- </ul>
- </a-collapse-panel> -->
- </a-collapse>
- </div>
- <div class="tabp-conetnt-right">
- <!-- <div class="tabp-right-top">
- <div>PID:<span>4223456</span></div>
- <div>感器名称:<span>传感器1</span></div>
- <div>入库点号:<span>4223456</span></div>
- <div>基值:<span>4223456</span></div>
- <div>最大值:<span>4223456</span></div>
- <div>最小值:<span>4223456</span></div>
- <div>精度:<span>4223456</span></div>
- </div> -->
- <div class="tabp-right-query">
- <!-- <div style="margin-right: 10px">
- <span class="active">近一周</span>
- <span>近一月</span>
- <span>近三月</span>
- <span>近半年</span>
- </div> -->
- <a-radio-group v-model:value="value1" button-style="solid"
- style="margin-left: 30px; margin-right: 20px" @change="handleChange">
- <a-radio-button value="24">近24h</a-radio-button>
- <a-radio-button value="0.5">近一周</a-radio-button>
- <a-radio-button value="1">近一月</a-radio-button>
- <a-radio-button value="2">近三月</a-radio-button>
- <a-radio-button value="3">近半年</a-radio-button>
- </a-radio-group>
- <div>
- <a-range-picker :disabled-date="disabledDate" v-model:value="searchTime"
- valueFormat="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm" :placeholder="['开始时间', '结束时间']" />
- </div>
- <div>
- <a-button type="primary" @click="search(senid, sensor_name, dchar)">开始查询</a-button>
- </div>
- </div>
- <div class="tabp-right-query-echarts" id='ebox' v-show="!showNodata" :style="{
- flex: '1', width: '900px', height: '460px', zoom: `${1 / zooms}`, transform: `scale(${zooms})`, transformOrigin: '0 0'
- }
- ">
- <div id="query-echarts" :style="{
- width: '100%',
- height: '100%',
- }">
- </div>
- </div>
- <div v-show="showNodata" style="width: 100%; height: 310px; text-align: center">
- <img class="none-data" src="../../assets/images/weatheHome/none-data.png" />
- </div>
- </div>
- </div>
- </div>
- </div>
- </a-tab-pane>
- <a-tab-pane key="2">
- <template #tab>
- <span> 图片 </span>
- </template>
- <div class="tabp-conetnt">
- <div class="tabp-conetnt-left">
- <a-collapse v-model:activeKey="activeMenu.activeKey" :bordered="false">
- <template #expandIcon="{ isActive }">
- <img class="left-collapse-icon"
- :style="{ transform: `rotate(${isActive ? '0' : '-90'}deg)`, marginTop: '-12px' }"
- src="../../assets/images/weatheHome/icon-bottom.png" />
- </template>
- <a-collapse-panel :key="index + 1" v-for="(item, key, index) in imgtree" :header="key"
- :style="activeMenu.customStyle">
- <ul class="collapse-ul">
- <li v-for="(it, index2) in item" :key="item.id" @click="setTabColor3(it, index, index2)">{{
- it.img_name
- }}</li>
- </ul>
- </a-collapse-panel>
- <img v-if="imgtree.length == 0" style="width: 160px; margin: 0 auto;" lass="none-data"
- src="../../assets/images/weatheHome/none-data.png" />
- </a-collapse>
- </div>
- <div class="tabp-conetnt-right">
- <a-carousel arrows style="width:100%;position: absolute;top:0;" :beforeChange="setcolor" ref="varousel">
- <template #prevArrow>
- <div class="custom-slick-arrow" style="z-index: 9999; left: -30px">
- <left-circle-outlined />
- </div>
- </template>
- <template #nextArrow>
- <div class="custom-slick-arrow" style="right: -30px">
- <right-circle-outlined />
- </div>
- </template>
- <div v-for="(item, index) in imgList"><img class="carousel-img" :src="VITE_GLOB_BASE_IMG + item.img_url"
- :key="index + 1" /></div>
- <!-- <div>
- <img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" />
- </div>
- <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div>
- <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div> -->
- </a-carousel>
- <img v-if="imgList.length == 0" style="width: 300px; margin: 0 auto;" lass="none-data"
- src="../../assets/images/weatheHome/none-data.png" />
- <div v-if="imgList.length != 0" class="carousel-title">
- <div style="margin-right: 50px;">{{ imgname }}</div>
- <div>{{ imgindex }} / {{ imgList.length }}</div>
- </div>
- </div>
- </div>
- </a-tab-pane>
- <a-tab-pane key="3">
- <template #tab>
- <span> 视频监控 </span>
- </template>
- <div class="tabp-conetnt">
- <div class="tabp-conetnt-left">
- <a-collapse v-model:activeKey="activeMenu.activeKey" :bordered="false">
- <template #expandIcon="{ isActive }">
- <img class="left-collapse-icon"
- :style="{ transform: `rotate(${isActive ? '0' : '-90'}deg)`, marginTop: '-12px' }"
- src="../../assets/images/weatheHome/icon-bottom.png" />
- </template>
- <a-collapse-panel :key="index + 1" v-for="(item, key, index) in videoTree" :header="key"
- :style="activeMenu.customStyle">
- <ul class="collapse-ul">
- <li v-for="(it, index2) in item" :key="item.id" @click="setTabColor4(it, index, index2)">{{
- it.img_name
- }}</li>
- </ul>
- </a-collapse-panel>
- <img v-if="videoTree.length == 0" style="width: 160px; margin: 0 auto;" lass="none-data"
- src="../../assets/images/weatheHome/none-data.png" />
- </a-collapse>
- </div>
- <div class="tabp-conetnt-right">
- <a-carousel arrows style="width:100%;position: absolute;top:0;" :beforeChange="setcolorV" ref="varousel">
- <template #prevArrow>
- <div class="custom-slick-arrow" style="z-index: 9999; left: -30px">
- <left-circle-outlined />
- </div>
- </template>
- <template #nextArrow>
- <div class="custom-slick-arrow" style="right: -30px">
- <right-circle-outlined />
- </div>
- </template>
- <div v-for="(item, index) in videoList"><img class="carousel-img" :src="VITE_GLOB_BASE_IMG + item.img_url"
- :key="index + 1" /></div>
- <!-- <div>
- <img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" />
- </div>
- <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div>
- <div><img class="carousel-img" src="../../assets/images/weatheHome/test-img.png" /></div> -->
- </a-carousel>
- <img v-if="videoList.length == 0" style="width: 300px; margin: 0 auto;" lass="none-data"
- src="../../assets/images/weatheHome/none-data.png" />
- <div v-if="videoList.length != 0" class="carousel-title">
- <div style="margin-right: 50px;">{{ imgname1 }}</div>
- <div>{{ imgindex1 }} / {{ videoList.length }}</div>
- </div>
- </div>
- </div>
- </a-tab-pane>
- <template #renderTabBar="{ DefaultTabBar, ...props }">
- <component :is="DefaultTabBar" v-bind="props" :style="{ zIndex: 1, textAlign: 'center' }" />
- </template>
- </a-tabs>
- </div>
- </div>
- </template>
- <script setup>
- import { reactive, getCurrentInstance, onMounted, ref, watch, toRef, nextTick } from 'vue';
- import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
- import { getMonitorInfo } from '/@/api/swHome/index';
- import moment from 'moment';
- import $ from 'jquery';
- import eventBus from '/@/utils/eventBus';
- import { getAppEnvConfig } from '/@/utils/env';
- import { addResizeListener } from '/@/utils/event';
- const { VITE_GLOB_BASE_IMG } = getAppEnvConfig()
- let zooms = ref('')
- eventBus.on('progressHeight', (e) => {
- if (e > 1000 && e < 1200) {
- setBox(1, e)
- } else if (e > 1200) {
- setBox(2, e)
- } else {
- setBox(3, e)
- }
- zooms.value = document.getElementsByClassName("ant-modal")[0].style.zoom
- chart.dispose();
- setTimeout(() => {
- chart = echarts.init(document.getElementById('query-echarts'));
- echarts1();
- }, 400)
- });
- const setBox = (type, e) => {
- // alert(e)
- if (props.detailInfo.st_type == 6) {
- $('#ebox').css({ height: '440px', width: '1000px' })
- if (type == 3 && e == `calc(100% - 500px)`) {
- $('#ebox').css({ height: '440px', width: '1650px' })
- } else {
- $('#ebox').css({ height: '440px', width: '1000px' })
- }
- } else {
- $('#ebox').css({ height: '440px', width: '1200px' })
- if (type == 3 && e == `calc(100% - 500px)`) {
- $('#ebox').css({ height: '440px', width: '1900px' })
- } else {
- $('#ebox').css({ height: '440px', width: '1200px' })
- }
- }
- }
- const props = defineProps({
- detailInfo: Object,
- title: String
- });
- const tanshuiList = ref({});
- const senid = ref();
- const sensor_name = ref();
- const dchar = ref();
- // 图片展示
- const imgList = ref([])
- const imgtree = ref({})
- const videoList = ref([])
- const videoTree = ref({})
- const imgname = ref('')
- const imgindex = ref(1)
- const imgname1 = ref('')
- const imgindex1 = ref(1)
- watch(
- () => props.detailInfo,
- (newV) => {
- console.log(newV)
- senid.value = newV.sensor[0].senid;
- sensor_name.value = newV.sensor[0].sensor_name;
- dchar.value = newV.sensor[0].dchar;
- imgList.value = []
- videoList.value = []
- imgtree.value = []
- videoTree.value = []
- // 图片
- if (newV.pic_annex.length > 0) {
- console.log('初始数据',newV.pic_annex)
- let arr1 = JSON.parse(JSON.stringify(newV.pic_annex))
- arr1.forEach(i => {
- let arr = i.img_url.split('/')
- console.log(i)
- // i.type = arr[arr.length - 2]
- let obj = JSON.parse(JSON.stringify(i))
- i.type = obj.img_name
- i.img_name = arr[arr.length - 1]
- })
- imgList.value = arr1
- let obj = {}
- arr1.forEach((i, index) => {
- i.id = index + 1
- if (obj.hasOwnProperty(i.type)) {
- obj[i.type].push(i);
- } else {
- obj[i.type] = [];
- obj[i.type].push(i);
- }
- })
- imgtree.value = obj
- }
- if (newV.video.length > 0) {
- console.log('初始数据',newV.video)
- let arr1 = JSON.parse(JSON.stringify(newV.video))
- arr1.forEach(i => {
- let arr = i.img_url.split('/')
- console.log(i)
- // i.type = arr[arr.length - 2]
- let obj = JSON.parse(JSON.stringify(i))
- i.type = obj.img_name
- i.img_name = arr[arr.length - 1]
- })
- videoList.value = arr1
- let obj = {}
- arr1.forEach((i, index) => {
- i.id = index + 1
- if (obj.hasOwnProperty(i.type)) {
- obj[i.type].push(i);
- } else {
- obj[i.type] = [];
- obj[i.type].push(i);
- }
- })
- videoTree.value = obj
- }
- if (newV.st_type == 6) {
- let obj = {};
- newV.sensor?.forEach((i) => {
- if (obj.hasOwnProperty(i.ts_layer)) {
- obj[i.ts_layer].value.push(i);
- } else {
- obj[i.ts_layer] = {};
- obj[i.ts_layer].id = null;
- obj[i.ts_layer].value = [];
- obj[i.ts_layer].value.push(i);
- if (i.ts_layer.includes('m')) {
- obj[i.ts_layer].id = Number(i.ts_layer.split('m')[0])
- } else {
- obj[i.ts_layer].id = 0
- }
- }
- });
- // console.log(obj, 89);
- let sortedObjKeys = Object.keys(obj).sort((a, b) => {
- return obj[b].id - obj[a].id
- })
- let arr = {}
- sortedObjKeys.forEach(j => {
- arr[j] = obj[j]
- })
- tanshuiList.value = arr;
- // console.log(sortedObjKeys,{...arr}, 89);
- }
- },
- {
- deep: true,
- immediate: true,
- }
- );
- const varousel = ref('')
- const nowTime = ref('');
- onMounted(() => {
- setTimeout(() => {
- zooms.value = document.getElementsByClassName("ant-modal")[0].style.zoom
- }, 0);
- // setTimeout(() => {
- //
- // },0)
- $(`.map-dialog-tabp-list div:nth-child(1)`).css({
- background: 'linear-gradient(0deg, #00f7ff 0%, #007ff6 100%)',
- '-webkit-background-clip': 'text',
- '-webkit-text-fill-color': 'transparent',
- 'background-clip': 'text',
- 'text-fill-color': 'transparent',
- });
- nowTime.value = moment().format('YYYY-MM-DD HH:mm:ss');
- searchTime.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- search(senid.value, sensor_name.value, dchar.value);
- //
- console.log(varousel.value);
- });
- const xdata = ref([]);
- const ydata = ref([]);
- const showNodata = ref(false);
- // id,名字,单位
- const search = (id, name, dw) => {
- senid.value = id;
- sensor_name.value = name;
- dchar.value = dw;
- xdata.value = [];
- ydata.value = [];
- getMonitorInfo({ senid: senid.value, start_time: searchTime.value[0], end_time: searchTime.value[1] }).then((res) => {
- if (res.code == 200 && res.data.length > 0) {
- showNodata.value = false;
- res.data.forEach((item) => {
- xdata.value.push(item.time);
- ydata.value.push(item.factv);
- });
- } else {
- showNodata.value = true;
- }
- // alert(props.title)
- // props.title.split('(')[0]+
- tableTitle.value = name + '过程线' + '(' + moment(searchTime.value[0]).format('MM月DD日HH时') + '-' + moment(searchTime.value[1]).format('MM月DD日HH时') + ')'
- echarts1();
- });
- };
- const disabledDate = (current) => {
- return current > moment().valueOf();
- };
- const changeTab = () => {
- }
- const setcolor = (from, to) => {
- console.log(from)
- console.log(to)
- // $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
- // // console.log(imgList.value,2233)
- imgname.value = imgList.value[to].img_name
- imgindex.value = to + 1
- }
- const setcolorV = (from, to) => {
- console.log(from)
- console.log(to)
- // $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
- // // console.log(imgList.value,2233)
- imgname1.value = videoList.value[to].img_name
- imgindex1.value = to + 1
- }
- const setTabColor = (item, index) => {
- // console.log(item,87)
- senid.value = item.senid;
- sensor_name.value = item.sensor_name;
- dchar.value = item.dchar;
- $('.map-dialog-tabp-list div').css({ background: 'transparent', color: '#BED2FF', '-webkit-text-fill-color': '#BED2FF' });
- $(`.map-dialog-tabp-list div:nth-child(${index})`).css({
- background: 'linear-gradient(0deg, #00f7ff 0%, #007ff6 100%)',
- '-webkit-background-clip': 'text',
- '-webkit-text-fill-color': 'transparent',
- 'background-clip': 'text',
- 'text-fill-color': 'transparent',
- });
- // console.log(senid.value,sensor_name.value,dchar.value)
- search(senid.value, sensor_name.value, dchar.value);
- };
- const setTabColor2 = (item, index, index2) => {
- senid.value = item.senid;
- sensor_name.value = item.sensor_name;
- dchar.value = item.dchar;
- $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
- $(`.ant-collapse .ant-collapse-item:nth-child(${index + 1}) li:nth-child(${index2 + 1})`).css({ background: 'rgba(0, 94, 182, 0.24)' });
- // console.log(senid.value,sensor_name.value,dchar.value)
- search(senid.value, sensor_name.value, dchar.value);
- };
- const setTabColor3 = (item, index, index2) => {
- imgname.value = item.img_name
- $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
- $(`.ant-collapse .ant-collapse-item:nth-child(${index + 1}) li:nth-child(${index2 + 1})`).css({ background: 'rgba(0, 94, 182, 0.24)' });
- // console.log(senid.value,sensor_name.value,dchar.value)
- varousel.value.goTo(item.id - 1)
- };
- const setTabColor4 = (item, index, index2) => {
- imgname1.value = item.img_name
- $(`.ant-collapse .ant-collapse-item li`).css({ background: 'transparent' });
- $(`.ant-collapse .ant-collapse-item:nth-child(${index + 1}) li:nth-child(${index2 + 1})`).css({ background: 'rgba(0, 94, 182, 0.24)' });
- // console.log(senid.value,sensor_name.value,dchar.value)
- varousel.value.goTo(item.id - 1)
- };
- const handleChange = () => {
- searchTime.value = [];
- // console.log(value1.value)
- if (value1.value == 0.5) {
- searchTime.value = [moment().subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- } else if (value1.value == 1) {
- searchTime.value = [moment().subtract(30, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- } else if (value1.value == 2) {
- searchTime.value = [moment().subtract(3, 'month').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- } else if (value1.value == 3) {
- searchTime.value = [moment().subtract(6, 'month').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- } else if (value1.value == 24) {
- searchTime.value = [moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')];
- }
- };
- const value1 = ref('24');
- const searchTime = ref([]);
- const activeKey = ref('1');
- // 下拉菜单
- let activeMenu = reactive({
- activeKey: '1',
- customStyle: 'background:transparent;',
- });
- // 图表标题
- const tableTitle = ref('')
- // 引入图表插件
- const { proxy } = getCurrentInstance();
- const echarts = proxy.$echarts;
- function flowFn(max, min) {
- let maxValue = Math.ceil(max);
- let minValue = Math.floor(min);
- let interval = 0;
- console.log((max - min) / 5);
- if ((max - min) / 5 <= 1) {
- interval = 1;
- minValue = Math.floor(minValue);
- maxValue = Math.ceil(maxValue);
- if (maxValue - minValue == 1) {
- minValue = minValue - 2
- maxValue = maxValue + 2
- }
- if (maxValue - minValue == 2) {
- minValue = minValue - 2
- maxValue = maxValue + 1
- }
- if (maxValue - minValue == 3) {
- minValue = minValue - 1
- maxValue = maxValue + 1
- }
- if (maxValue - minValue == 4) {
- minValue = minValue - 1
- }
- } else {
- // 获取余数
- minValue = minValue - (5 - ((maxValue - minValue) % 5));
- interval = (maxValue - minValue) / 5;
- }
- return {
- interval: interval,
- maxValue: maxValue,
- minValue: minValue,
- };
- }
- function waterLevel(max, min) {
- let maxValue = Math.ceil(max);
- let minValue = Math.floor(min);
- let interval = 0;
- console.log((max - min) / 5);
- if ((max - min) / 5 <= 0.2) {
- interval = 0.2;
- maxValue = Math.floor(maxValue);
- maxValue = Math.ceil(maxValue);
- } else if ((max - min) / 5 <= 0.5) {
- interval = 0.5;
- maxValue = Math.floor(maxValue);
- maxValue = Math.ceil(maxValue);
- } else if ((max - min) / 5 <= 1) {
- interval = 0.5;
- maxValue = Math.floor(maxValue);
- maxValue = Math.ceil(maxValue);
- } else {
- // 获取余数
- minValue = minValue - (5 - ((maxValue - minValue) % 5));
- interval = (maxValue - minValue) / 5;
- }
- return {
- interval: interval,
- maxValue: maxValue,
- minValue: minValue,
- };
- }
- function echarts1() {
- // const chart = echarts.init(document.getElementById('query-echarts'));
- let max = Math.max(...ydata.value)
- let min = Math.min(...ydata.value)
- let liuliang2 = {}
- // 判断是否是雨量,还是水位,还是流量
- if (tableTitle.value.indexOf("雨量") != -1) {
- liuliang2 = {
- interval: null,
- maxValue: null,
- minValue: null,
- }
- }
- if (tableTitle.value.indexOf("水位") != -1) {
- liuliang2 = waterLevel(max, min);
- }
- if (tableTitle.value.indexOf("流量") != -1) {
- liuliang2 = flowFn(max, min);
- }
- var option;
- option = {
- title: {
- text: tableTitle.value,
- x: 'center',
- textStyle: {
- color: '#fff',
- fontSize: 16
- }
- },
- tooltip: {
- show: true,
- trigger: 'axis',
- formatter(params) {
- var relVal = params[0].name;
- for (var i = 0, l = params.length; i < l; i++) {
- console.log('tooltip数据值', params[i].value)
- //遍历出来的值一般是字符串,需要转换成数字,再进项tiFixed四舍五入
- relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + Number(params[i].value)
- }
- return relVal;
- },
- },
- dataZoom: [
- {
- type: "inside" //详细配置可见echarts官网
- },
- {
- type: "inside" //详细配置可见echarts官网
- },
- ],
- toolbox: {
- show: true,
- feature: {
- saveAsImage: {
- show: true,
- title: '保存图片',
- name: tableTitle.value,
- iconStyle: {
- borderColor: '#fff',
- },
- backgroundColor: "#021D33"
- }, // 保存图表
- },
- },
- // legend: {
- // // data: ['test1', 'test2', 'test3'],
- // textStyle: {
- // fontSize: 14, //字体大小
- // color: '#ffffff', //字体颜色
- // },
- // },
- grid: {
- top: '12%',
- left: '3%',
- right: '4%',
- bottom: '10%',
- containLabel: true,
- },
- xAxis: {
- type: 'category',
- boundaryGap: true,
- data: xdata.value,
- axisLabel: {
- //x轴文字的配置
- color: 'green',
- show: true,
- textStyle: {
- color: '#fff',
- },
- formatter: function (val) {
- var strs = val.split(''); //字符串数组
- var str = '';
- for (var i = 0, s; (s = strs[i++]);) {
- //遍历字符串数组
- if (i > 5 && i < 17) {
- str += s;
- }
- if (!(i % 10)) str += '\n'; //按需要求余
- }
- return str;
- },
- },
- },
- yAxis: {
- name: dchar.value,
- nameTextStyle: {
- color: '#fff',
- },
- // scale: true,
- type: 'value',
- axisLabel: {
- //x轴文字的配置
- show: true,
- textStyle: {
- color: '#fff',
- },
- formatter: function (value) {
- if (tableTitle.value.indexOf('水位') != -1) {
- return value.toFixed(2);
- } else if (tableTitle.value.indexOf('流量') != -1) {
- if (value < 100) {
- return value.toPrecision(3)
- } else {
- return Number(value.toPrecision(3))
- }
- } else {
- return value.toFixed(1);
- }
- },
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: 'dotted', //设置网格线类型 dotted:虚线 solid:实线
- width: 1, //y轴线的宽度
- color: '#484849',
- },
- show: true, //隐藏或显示
- },
- interval: liuliang2.interval, // 步长
- min: liuliang2.minValue,
- max: liuliang2.maxValue,
- },
- series: [
- {
- name: sensor_name.value,
- type: sensor_name.value.includes('雨量') ? 'bar' : 'line',
- stack: 'Total',
- smooth: true,
- data: ydata.value,
- barMaxWidth: 30
- },
- ],
- };
- option && chart.setOption(option);
- }
- var chart = null
- onMounted(() => {
- setBox()
- chart = echarts.init(document.getElementById('query-echarts'));
- });
- </script>
- <style lang="less" scoped>
- // 修改组件样式
- ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab-active) {
- // background: url('../../assets/images/sjx1.png') no-repeat 42px 9px;
- background: url('../../assets/images/weatheHome/active-bar1.png') no-repeat;
- // width: 45px;
- background-size: 100%;
- height: 40px;
- width: 169px;
- color: #c9d1d9;
- }
- ::v-deep(.total222 .ant-tabs-nav > div > div:nth-child(2).ant-tabs-tab-active) {
- // background: url('../../assets/images/sjx1.png') no-repeat 42px 9px;
- // background: url('../../../assets/images/tab.png') no-repeat;
- // width: 45px;
- // background-position: 6px 3px;
- background-size: 100% 100%;
- height: 42px;
- // line-height: 42px;
- // margin-left: -6px;
- }
- // ::v-deep(.total222 .ant-tabs-nav > div > div:nth-child(2).ant-tabs-tab-active span) {
- // position: relative;
- // // top: 10px !important;
- // }
- .total222 {
- margin-top: 20px;
- }
- ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab) {
- // background-position: 6px 3px;
- background-size: 100% 100%;
- height: 40px;
- // line-height: 42px;
- padding: 12px 0px 12px 0px;
- margin: 0;
- width: 165px;
- }
- ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab span) {
- position: relative;
- top: -4px;
- color: #377dff;
- }
- ::v-deep(.total222 .ant-tabs-nav .ant-tabs-tab-active span) {
- color: #c9d1d9 !important;
- }
- ::v-deep(.ant-tabs-top-bar) {
- margin-bottom: 0px !important;
- }
- ::v-deep(.ant-tabs-ink-bar) {
- visibility: hidden;
- }
- ::v-deep(.ant-collapse-borderless) {
- background-color: transparent !important;
- }
- ::v-deep(.ant-collapse-borderless > .ant-collapse-item) {
- border: 0px !important;
- }
- ::v-deep(.ant-tabs-top > .ant-tabs-nav::before,
- .ant-tabs-bottom > .ant-tabs-nav::before,
- .ant-tabs-top > div > .ant-tabs-nav::before,
- .ant-tabs-bottom > div > .ant-tabs-nav::before) {
- border-bottom: 0px;
- }
- ::v-deep(.ant-tabs) {
- color: #fff;
- }
- ::v-deep(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) {
- color: #ffe75c;
- }
- ::v-deep(.ant-tabs-tab) {
- // font-size: 18px;
- // font-weight: bold;
- font-size: 16px;
- font-weight: normal !important;
- }
- ::v-deep(.ant-tabs-bar) {
- border-bottom: 0px solid #303030 !important;
- }
- ::v-deep(.ant-tabs-nav) {
- background: url('../../assets/images/weatheHome/bar-bg1.png') no-repeat;
- background-size: 100%;
- width: 505px !important;
- height: 48px !important;
- padding-top: 3px;
- margin: 0 auto;
- }
- // 修改组件样式结束
- .map-dialog-title {
- font-size: 16px;
- color: #d8e5ff;
- position: relative;
- img {
- display: inline-block;
- vertical-align: middle;
- position: relative;
- top: -3px;
- }
- }
- .map-dialog-table {
- ul {
- border: 1px solid #014a9b;
- margin: 10px 20px;
- li {
- display: flex;
- border-top: 1px solid #014a9b;
- line-height: 50px;
- text-align: center;
- color: #bed2ff;
- font-size: 14px;
- div {
- border-left: 1px solid #014a9b;
- }
- div:nth-child(1) {
- border-left: 0px solid #014a9b;
- }
- div:nth-child(1),
- div:nth-child(3),
- div:nth-child(5) {
- width: 10%;
- background: rgba(0, 50, 105, 0.3);
- }
- div:nth-child(2),
- div:nth-child(4),
- div:nth-child(6) {
- width: 20%;
- }
- }
- li:nth-child(1) {
- border-top: 0px solid #014a9b;
- }
- }
- }
- .mg-10 {
- margin-top: 20px;
- }
- .map-dialog-tabp-list {
- position: absolute;
- display: flex;
- left: 100px;
- color: #fff;
- top: 0px;
- &>div {
- // width: 189px;
- margin-left: 30px;
- margin-top: 3px;
- cursor: pointer;
- text-align: center;
- flex-shrink: 0;
- }
- .active-tabp {
- font-size: 14px;
- background: linear-gradient(0deg, #00f7ff 0%, #007ff6 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- text-fill-color: transparent;
- position: relative;
- img {
- width: 100%;
- position: absolute;
- // bottom: -100px;
- }
- }
- }
- .tabp-conetnt {
- height: 100%;
- margin-top: 20px;
- display: flex;
- height: 100%;
- overflow-y: auto;
- .hconetnt {
- height: 480px !important;
- overflow-y: auto;
- }
- .tabp-conetnt-left {
- width: 14%;
- height: 100%;
- margin-left: 20px;
- // padding: 20px;
- background: linear-gradient(180deg, #022d5d 0%, rgba(0, 35, 74, 0.91) 100%);
- overflow: auto;
- ::v-deep(.ant-collapse) {
- border: none;
- }
- ::v-deep(.ant-collapse-header) {
- background: linear-gradient(90deg, rgba(0, 124, 240, 0.24) 0%, rgba(216, 216, 216, 0) 100%);
- color: #fff;
- font-size: 14px;
- }
- }
- .tabp-conetnt-right {
- // height: 100%;
- font-size: 14px;
- margin-left: 40px;
- margin-right: 40px;
- flex: 1;
- position: relative;
- overflow: hidden;
- height: 680px;
- }
- }
- .tabp-right-top {
- width: 100%;
- display: flex;
- color: #bed2ff;
- justify-content: space-between;
- span {
- color: #ffffff;
- }
- }
- .collapse-ul {
- li {
- margin-bottom: 10px;
- padding-left: 20px;
- color: #bed2ff;
- cursor: pointer;
- }
- .liactive {
- background: rgba(0, 94, 182, 0.24);
- }
- }
- .tabp-right-query {
- // height: 100%;
- margin-top: 10px;
- display: flex;
- &>div:nth-child(1) {
- border: 1px solid #00346e;
- span {
- border-left: 1px solid #00346e;
- display: inline-block;
- padding: 5px 10px;
- cursor: pointer;
- }
- span:nth-child(1) {
- border-left: 0px solid #00346e;
- }
- .active {
- background-color: rgb(38, 99, 255);
- }
- }
- &>div:nth-child(3) {
- margin-left: 20px;
- }
- ::v-deep(.ant-radio-button-wrapper) {
- border: none;
- }
- ::v-deep(.ant-input) {
- border: 1px solid #00346e !important;
- }
- }
- ::v-deep .tabp-right-query .ant-input {
- height: 37px;
- }
- ::v-deep .tabp-right-query .ant-btn {
- height: 37px;
- }
- // 轮播样式开始
- .ant-carousel :deep(.slick-slide) {
- text-align: center;
- height: 750px;
- // line-height: 800px;
- background: transparent;
- overflow: hidden;
- color: #fff;
- }
- .ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
- width: 25px;
- height: 25px;
- font-size: 25px;
- color: #fff;
- background-color: rgba(31, 45, 61, 0.11);
- opacity: 1;
- }
- .ant-carousel :deep(.custom-slick-arrow:before) {
- display: none;
- }
- .ant-carousel :deep(.custom-slick-arrow:hover) {
- opacity: 0.5;
- }
- .ant-carousel :deep(.slick-slide h3) {
- color: #fff;
- }
- ::v-deep .ant-carousel .slick-dots li.slick-active button {
- background-color: #fff !important;
- }
- ::v-deep .ant-carousel .slick-dots li button {
- background-color: #fff !important;
- }
- ::v-deep .ant-carousel .slick-next:hover {
- // background-color: #000 !important;
- color: #fff !important;
- }
- ::v-deep .ant-carousel .slick-prev:hover {
- color: #fff !important;
- }
- .carousel-img {
- // width: 100%;
- height: 680px;
- margin: 0 auto;
- }
- .carousel-title {
- position: absolute;
- left: 20px;
- bottom: 0px;
- z-index: 9999;
- color: #bed2ff;
- display: flex;
- justify-content: space-between;
- }
- // 轮播样式结束
- .collapse-video-ul {
- li {
- text-align: center;
- line-height: 32px;
- margin-top: 10px;
- }
- .video-active {
- background: linear-gradient(90deg, rgba(100, 255, 255, 0.29) 0%, rgba(100, 255, 255, 0) 100%);
- }
- }
- #query-echarts {
- margin-top: 16px;
- }
- .none-data {
- margin: 20px auto;
- }
- </style>
|