From 81e426e19db140e630f45409c1569fe16dbcc33f Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期二, 18 五月 2021 15:25:19 +0800 Subject: [PATCH] 修复点击弹窗bug --- src/components/BaseNav/WasteGas/HourData.vue | 294 +++++++++++++++++++--------------------------------------- 1 files changed, 97 insertions(+), 197 deletions(-) diff --git a/src/components/BaseNav/WasteGas/HourData.vue b/src/components/BaseNav/WasteGas/HourData.vue index 0fb69f2..593e75f 100644 --- a/src/components/BaseNav/WasteGas/HourData.vue +++ b/src/components/BaseNav/WasteGas/HourData.vue @@ -1,46 +1,38 @@ -<!-- 灏忔椂鏁版嵁 --> <template> - <div id="Tab"> - <PublicDataStandard :dataStandard="dataStandard"></PublicDataStandard> - <div class="form-echrts"> - <div class="from-search"> - <div class="pickerMon"> - <div class="pickerData"> - <span> 寮�濮嬫椂闂�:</span> - <span class="pickerTable"> - <el-date-picker type="datetime" v-model="formInline.timeStart"></el-date-picker> - </span> - </div> - <div class="pickerData"> - <span>缁撴潫鏃堕棿:</span> - <span class="pickerTable"> - <el-date-picker type="datetime" v-model="formInline.timeEnd"></el-date-picker> - </span> - </div> - </div> - <div class="detailbtn">鏌ヨ</div> - <div class="detailbtn">鏄庣粏琛�</div> - </div> - <div style="width:5rem;height:1.5rem;" id="echarts" ref="wastegashour"></div> + <div class="echarts-box"> + <div class="tab-scroll"> + <PublicDataStandard :dataStandard="dataStandard"></PublicDataStandard> </div> - <!-- 鏄庣粏寮规 --> - <!-- <el-dialog :visible.sync="dialogVisible"--> - <!-- :append-to-body="true"--> - <!-- width="68%"--> - <!-- center--> - <!-- v-dialogDrag--> - <!-- >--> - <!-- <div class="el-dialog-div" style="height: 500px">--> - <!-- <public-detailed-list v-bind="$attrs"></public-detailed-list>--> - <!-- </div>--> - <!-- </el-dialog>--> + <div class="echarts-form"> + <span class="demonstration">寮�濮嬫椂闂达細</span> + <el-date-picker v-model="formData.timeStart" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" size="mini"></el-date-picker> + <span class="demonstration">缁撴潫鏃堕棿锛�</span> + <el-date-picker v-model="formData.timeEnd" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" size="mini"></el-date-picker> + <span class="demonstration">閲囨牱鐐规暟锛�</span> + <el-select v-model="formData.region" placeholder="璇烽�夋嫨" size="mini" > + <el-option v-for="(item,index) in formData.regionList" :key="index" :label="item" :value="item"></el-option> + </el-select> + <el-button @click="querySearch">鏌ヨ</el-button> + <el-button @click="ScheduleShow">鏄庣粏琛�</el-button> + </div> + <div class="echarts-chart"> + <div ref="wastegashour"></div> + </div> + <span class="time-select">{{ formData.timeStart }}鏃垛�攞{ formData.timeEnd }}鏃�</span> + <!-- 鏄庣粏寮规--> + <el-dialog :visible.sync="showSchedule" :modal="false" v-dialogDrag> + <div class="el-dialog-div" style="height: 200px"> + <Scheduleof></Scheduleof> + </div> + </el-dialog> </div> </template> <script> -// import PublicDetailedList from '@components/BaseNav/PublicBounced/common/echarts/PublicDetailedList' +import Scheduleof from '@components/BaseNav/WasteGas/Scheduleof' import PublicDataStandard from '../PublicDataStandard' +import 'dayjs/locale/es' import dayjs from 'dayjs' import mapApi from '@/api/mapApi' @@ -48,7 +40,8 @@ name: 'HourData', components: { // PublicDetailedList - PublicDataStandard + PublicDataStandard, + Scheduleof }, data () { return { @@ -94,10 +87,13 @@ val: null } }], - formInline: { - timeStart: null, - timeEnd: null + formData: { + region: '25', + regionList: [25, 50, 75, 100], + timeStart: dayjs().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss'), + timeEnd: dayjs().format('YYYY-MM-DD HH:mm:ss') }, + showSchedule: false, dataType: 2, myChart: null, exhbzz: null, @@ -111,19 +107,23 @@ }) }, methods: { + ScheduleShow () { + this.showSchedule = !this.showSchedule + }, + querySearch () { + console.log('鏌ヨ') + this.initnData() + }, async initnData () { - // 鐢ㄤ簬鎺ュ彛鏁版嵁璇锋眰鐨勫弬鏁� 寮�濮�/缁撴潫鏃堕棿 || 鍙�夋嫨鏌ヨ鐨勫紑濮�/缁撴潫鏃堕棿 - this.formInline.timeEnd = dayjs().format('YYYY-MM-DD HH:mm:ss') - this.formInline.timeStart = dayjs().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss') const data = { onLineMonEmissPointId: 23, monItemId: 28, - beginTime: this.formInline.timeStart, - endTime: this.formInline.timeEnd, + beginTime: this.formData.timeStart, + endTime: this.formData.timeEnd, dataType: this.dataType } const result = (await mapApi.getWasteGasMonData(data)).Result.DataInfo - console.log(result) + // console.log(result) this.get24HourDate(result) }, get24HourDate (res) { @@ -272,7 +272,7 @@ iconurl = 'image://../assets/imgs/legend/grn.png' } else if (nameList[l] === '娓╁害') { iconurl = 'image://../assets/imgs/legend/WenDu.png' - } else { + } else if (nameList[l] === '搴熸皵娴侀噺') { iconurl = 'image://../assets/imgs/legend/VOCs.png' } @@ -316,12 +316,9 @@ } else if (nameList[j] === '鐑熷皹') { zdcbcolor = 'red' zxcolor = '#f48183' - } else if (nameList[j] === '娓╁害') { + } else if (nameList[j] === '搴熸皵娴侀噺') { zdcbcolor = 'red' - zxcolor = '#F206FF' - } else { - zdcbcolor = 'red' - zxcolor = '#9ACD32' + zxcolor = '#8fdc6e' } const ydata = { name: nameList[j], @@ -346,6 +343,7 @@ }, CreateChart (id, title, legend, xdata, ydatas, yname, jcdID, datatype) { this.myChart = this.$echarts.init(this.$refs.wastegashour) + this.myChart.clear() // this.myChart .clear() let dataUnit = '' if (datatype === 1) { @@ -353,6 +351,8 @@ } else { dataUnit = '姘旈噺(m鲁/h)' } + + const bzzList = this.exhbzzList const serLists = [] for (let j = 0; j < ydatas.length; j++) { @@ -365,7 +365,7 @@ } for (let i = 0; i < ydatas.length; i++) { - // const zdcbcolor = ydatas[i].zdcbcolor + const zdcbcolor = ydatas[i].zdcbcolor const bzz = ydatas[i].bzz let obj if (bzz == null) { @@ -375,31 +375,33 @@ symbolSize: 10, // 澶у皬 smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾� yAxisIndex: 1, - // itemStyle: { - // normal: { - // color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹� - // let biaozhuiz - // for (let i = 0; i < exhbzzList.length; i++) { - // if (exhbzzList[i].name === c.seriesName) { - // biaozhuiz = exhbzzList[i].bzhui - // } - // } - // if (c.value > 999999999999) { - // return zdcbcolor - // } else { - // return '#33c95f' - // } - // }, - // lineStyle: { // 鎶樼嚎鐨勯鑹� - // color: ydatas[i].zxcolor, - // width: 5 - // }, - // borderColor: ydatas[i].zxcolor, // 鎶樼偣杈规鐨勯鑹� - // label: { // 鏄剧ず鍊� - // show: false - // } - // } - // }, + itemStyle: { + normal: { + color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹� + let biaozhuiz + for (let i = 0; i < bzzList.length; i++) { + if (bzzList[i].name === c.seriesName) { + biaozhuiz = bzzList[i].bzhui + } + } + if (c.value[1] > biaozhuiz) { + return zdcbcolor + } else if (c.value[1] > biaozhuiz * 0.9) { + return '#FFA500' + } else { + return '#33c95f' + } + }, + lineStyle: { // 鎶樼嚎鐨勯鑹� + color: ydatas[i].zxcolor, + width: 5 + }, + borderColor: ydatas[i].zxcolor, // 鎶樼偣杈规鐨勯鑹� + label: { // 鏄剧ず鍊� + show: false + } + } + }, type: 'line', data: ydatas[i].data } @@ -411,21 +413,21 @@ smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾� itemStyle: { normal: { - // color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹� - // let biaozhuiz - // for (let i = 0; i < exhbzzList.length; i++) { - // if (exhbzzList[i].name == c.seriesName) { - // biaozhuiz = exhbzzList[i].bzhui - // } - // } - // if (c.value > biaozhuiz) { - // return zdcbcolor - // } else if (c.value > biaozhuiz * 0.9) { - // return '#FFA500' - // } else { - // return '#33c95f' - // } - // }, + color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹� + let biaozhuiz + for (let i = 0; i < bzzList.length; i++) { + if (bzzList[i].name === c.seriesName) { + biaozhuiz = bzzList[i].bzhui + } + } + if (c.value[1] > biaozhuiz) { + return zdcbcolor + } else if (c.value[1] > biaozhuiz * 0.9) { + return '#FFA500' + } else { + return '#33c95f' + } + }, lineStyle: { // 鎶樼嚎鐨勯鑹� color: ydatas[i].zxcolor, width: 5 @@ -509,7 +511,7 @@ maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#f48183;"></span>' } else if (seriesName === '娓╁害') { maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#F206FF;"></span>' - } else { + } else if (seriesName === '搴熸皵娴侀噺') { maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#4ec99c;"></span>' } s += maker + seriesName + ':' + valueFliter + '<br />' @@ -525,7 +527,7 @@ }, grid: { // 缃戞牸 top: '20%', - left: '5%' + left: '15%' // containLabel: true }, legend: { // 鍥句緥 @@ -619,7 +621,7 @@ type: 'value', name: dataUnit, max: function (value) { - const ma = value.max > 120 ? value.max : 120 + const ma = value.max > 12 ? value.max : 12 return parseInt(ma) }, axisLabel: { @@ -650,106 +652,4 @@ </script> <style scoped lang="less"> -.animation { - .infomation { - padding: 0.02rem 0.04rem; - - .grid-content { - font-size: 0.08rem; - background-color: #2e4967; - text-align: center; - border-radius: 0.01rem; - height: 0.15rem; - line-height: 0.15rem; - margin-right: 0.04rem; - padding: 0 0.04rem - } - } -} - -.form-echrts { - width: 100%; - border-top: 1px solid #396d83; - //margin: 10px 10px 10px 10px; - .from-search { - display: flex; - padding: 0.02rem; - - > div { - margin-left: 10px - } - - .pickerMon { - display: flex; - - > div:first-child { - margin-right: 10px; - } - - .pickerData { - flex: 1; - display: flex; - - > span { - line-height: 22px - } - - .pickerTable { - margin-left: 3px; - } - } - } - - /deep/ .el-date-editor--datetime { - width: 100%; - } - - /deep/ .el-input__inner { - position: relative; - width: 1rem; - background-color: #2e4967; - color: #fff; - font-size: 0.08rem; - height: 0.15rem; - padding: 0; - border: none; - z-index: 9999; - text-align: center; - //padding-left:20px ; - //padding: 0!important; - } - - /deep/ .el-input__icon { - display: block; - width: 1rem; - height: 0.15rem; - line-height: 0.15rem; - cursor: pointer; - font-size: 0; - } - - input::-webkit-calendar-picker-indicator { - opacity: 100; - } - - .detailbtn { - background-color: #2e4967; - text-align: center; - padding: 0 7px; - height: 0.15rem; - line-height: 0.15rem; - border-radius: 4px; - margin-right: 6px; - } - } - - .el-dialog-div { - overflow: auto; - } - - #echarts { - margin: 0; - padding: 0; - } -} </style> -- Gitblit v1.8.0