<template>
    <div>
        <el-row>
            <el-col :span="24">
                <div class="Top" ref="top">
                    <el-form :inline="true" class="demo-form-inline">
                        <Area @click="handleNodeClick"></Area>
                        <el-form-item>
                            <Timslot @time="time" ref="Timslot"></Timslot>
                        </el-form-item>

                        

                        <!-- <el-form-item label="干扰源名称">
                            <el-select v-model="value11" placeholder="请选择">
                                <el-option
                                    v-for="item in option11"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item> -->

                        <el-form-item>
                            <el-button type="primary" class="ml10" icon="el-icon-search" @click="steady">
                                查询
                            </el-button>
                            <el-button type="primary" icon="el-icon-download" @click="dc">导出</el-button>
                        </el-form-item>
                    </el-form>
                    <el-tabs
                        v-loading="loading"
                        :tab-position="tabPosition"
                        v-model="active"
                        @tab-click="handleClick111"
                    >
                        <el-tab-pane label="稳态指标" name="first">
                            <el-tabs :tab-position="tabPosition" v-model="active_active" @tab-click="handleClick11">
                                <el-tab-pane label="超标监测点数(个)" name="first-first">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            stripe
                                            ref="classification1"
                                            :data="serialData1"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData1[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.harmonicName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                >
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="日均"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index].overLimitMeasurementAverage
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="累计"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index].overLimitMeasurementAccrued
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-tab-pane label="超标监测点数占比(%)" name="first-second">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            stripe
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            :data="serialData1"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification2"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData1[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.harmonicName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                >
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="日均"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index]
                                                                        .overLimitMeasurementRatioAverage
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="累计"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index]
                                                                        .overLimitMeasurementRatioAccrued
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-tab-pane label="平均超标天数" name="first-third">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            stripe
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            :data="serialData1"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification3"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                align="center"
                                                width="200"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData1[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.harmonicName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                    min-width="150"
                                                >
                                                    <template slot-scope="scope">
                                                        <span>
                                                            {{ scope.row.columns[index].averageOverDay }}
                                                        </span>
                                                    </template>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-col :span="24">
                                    <div class="box" v-loading="isLoading3">
                                        <div id="electr5" style="width: 100%"></div>
                                    </div>
                                </el-col>
                            </el-tabs>
                        </el-tab-pane>
                        <el-tab-pane label="暂态指标" name="second">
                            <el-tabs :tab-position="tabPosition" v-model="active_active" @tab-click="handleClick222">
                                <el-tab-pane label="超标监测点数(个)" name="second-first">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            stripe
                                            :data="serialData2"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification11"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData2[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.eventName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                >
                                                    <vxe-table-colgroup title="日均" align="center" min-width="90">
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{ scope.row.columns[index].eventMeasurementAverage }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                    <vxe-table-colgroup title="累计" align="center" min-width="90">
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{ scope.row.columns[index].eventMeasurementAccrued }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-tab-pane label="超标监测点数占比(%)" name="second-second">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            stripe
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            :data="serialData2"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification22"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData2[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.eventName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                >
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="日均"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index]
                                                                        .eventMeasurementRatioAverage
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                    <vxe-table-colgroup
                                                        field="columns"
                                                        title="累计"
                                                        align="center"
                                                        min-width="90"
                                                    >
                                                        <template slot-scope="scope">
                                                            <span>
                                                                {{
                                                                    scope.row.columns[index]
                                                                        .eventMeasurementRatioAccrued
                                                                }}
                                                            </span>
                                                        </template>
                                                    </vxe-table-colgroup>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-tab-pane label="暂态发生次数" name="second-third">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            stripe
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            :data="serialData2"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification33"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>

                                            <template v-for="(item, index) in serialData2[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.eventName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                    min-width="150"
                                                >
                                                    <template slot-scope="scope">
                                                        <span>
                                                            {{ scope.row.columns[index].eventCount }}
                                                        </span>
                                                    </template>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                                <el-tab-pane label="暂态发生频次" name="second-fourth">
                                    <el-col :span="24">
                                        <vxe-table
                                            size="mini"
                                            stripe
                                            :row-config="{ isCurrent: true, isHover: true }"
                                            border
                                            :data="serialData2"
                                            :height="height"
                                            style="width: 100%"
                                            v-loading="isLoading"
                                            header-cell-class-name="table_header"
                                               @cell-click="cellClickEvent"
                                            :cell-style="cellStyle"
                                            ref="classification44"
                                        >
                                            <vxe-table-colgroup
                                                field="rowName"
                                                title="名称"
                                                width="200"
                                                align="center"
                                            ></vxe-table-colgroup>
                                            <template v-for="(item, index) in serialData2[0].columns">
                                                <vxe-table-colgroup
                                                    :title="item.eventName"
                                                    :key="index"
                                                    show-overflow-tooltip
                                                    align="center"
                                                    min-width="150"
                                                >
                                                    <template slot-scope="scope">
                                                        <span>
                                                            {{ scope.row.columns[index].eventFreq }}
                                                        </span>
                                                    </template>
                                                </vxe-table-colgroup>
                                            </template>
                                        </vxe-table>
                                    </el-col>
                                </el-tab-pane>
                            </el-tabs>
                            <el-col :span="24">
                                <!-- <div class="box" ref="getHeight" v-loading="isLoading3"> -->
                                <div
                                    class="box"
                                    ref="getHeight"
                                    v-loading="isLoading3"
                                    id="electr6"
                                    style="width: 100%"
                                ></div>
                                <!-- </div> -->
                            </el-col>
                        </el-tab-pane>
                    </el-tabs>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import Area from '@/views/components/Area/Area.vue'

import { dicData } from '@/assets/commjs/dictypeData'
import {
    getPwRStatHarmonicOrg,
    getPwRStatHarmonicOrgIcon,
    getPwAllRStatEventOrg,
    getPwAllRStatEventOrgIcon
} from '@/api/Distributionnetwork-analysis/IndicatorClassification/IndicatorClassification.js'

import Timslot from './Timeslot.vue'
export default {
    components: { Area, Timslot },
    data() {
        return {
            id: JSON.parse(window.sessionStorage.getItem('Info')).deptId,
            type: '',
            tabLabel: '超标监测点数(个)',
            tab: '',
            echarts2data: { data: [] },
            option11: '',
            option22: '',
            value11: '',
            value22: '',
            kai: true,
            start: '',
            end: '',
            active_active: 'first-first',
            zoom: undefined, //图表焦点校验
            vh: '',
            height: null,
            device: '',
            getHeight: '',
            tabPosition: 'top',
            active: 'first',
            loading: false,
            isLoading: false,
            isLoading2: false,
            isLoading3: false,
            isLoading4: false,
            serialData2: [{ columns: [] }],
            serialData1: [{ columns: [] }],
            max: 0,
            rowName:''
        }
    },
    created() {},
    mounted() {
        this.setHeight()
        window.addEventListener('resize', this.setHeight)
        //echarts图表调用
        this.getCensus()
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.setHeight)
    },
    methods: {
        setHeight() {
            this.height = window.sessionStorage.getItem('appheight') / 2 - 160
            this.zoom = 1 / document.body.style.zoom

            let domID5 = document.getElementById('electr5')
            let domID6 = document.getElementById('electr6')

            setTimeout(() => {
                ;(domID5.style.width = window.sessionStorage.getItem('appwidth') + 'px'),
                    (domID5.style.height = window.sessionStorage.getItem('appheight') / 2 - 50 + 'px')
            }, 0)
            setTimeout(() => {
                ;(domID6.style.width = window.sessionStorage.getItem('appwidth') + 'px'),
                    (domID6.style.height = window.sessionStorage.getItem('appheight') / 2 - 50 + 'px')
            }, 0)
        },
        dc() {
            if (this.active_active == 'first-first') {
                this.$refs.classification1.exportData({
                    filename: 'export1', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData1 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'first-second') {
                this.$refs.classification2.exportData({
                    filename: 'export2', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData1 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'first-third') {
                this.$refs.classification3.exportData({
                    filename: 'export3', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData1 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'second-first') {
                this.$refs.classification11.exportData({
                    filename: 'export4', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData2 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'second-second') {
                this.$refs.classification22.exportData({
                    filename: 'export5', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData2 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'second-third') {
                this.$refs.classification33.exportData({
                    filename: 'export6', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData2 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
            if (this.active_active == 'second-fourth') {
                this.$refs.classification44.exportData({
                    filename: 'export7', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    isFooter: true,
                    data: this.serialData2 // 数据源 // 过滤那个字段导出 // columnFilterMethod: function(column, $columnIndex) { //   return !(column.$columnIndex === 0 ) //   // 0是复选框 不导出 // }
                })
            }
        },
        handleClick111(tab) {
            this.tab = tab

            if (tab.paneName == 'second') {
                this.active_active = 'second-first'
                this.tabLabel = '超标监测点数(个)'
                this.account()
            } else {
                this.active_active = 'first-first'
                this.tabLabel = '超标监测点数(个)'
                this.account1()
            }
        },
        handleClick11(tab, click) {
            this.tabLabel = tab.label
            this.getCensus()
        },
        handleClick222(tab, click) {
            this.tabLabel = tab.label
            this.getCensus()
        },
        time(val) {
            ;(this.start = val[0]), (this.end = val[1])
            this.type = val[2]
            if (this.kai) {
                this.account1()
            }
        },
        handleNodeClick(data) {
            this.id = data.id
        },

        //方法调用获取稳态指标超标统计数据接口
        steady() {
            this.loading = true
            if (this.tab.paneName == 'second') {
                getPwAllRStatEventOrgIcon({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    id: this.id,
                    stasisID: this.value11
                }).then(res => {
                    if (res.code == 'A0001') {
                        ;(this.echarts2data = { data: [] }), this.getCensus()
                    } else {
                        // res.data.forEach(i=>{
                        //   i.
                        // })
                        this.echarts2data = res
                        this.getCensus()
                    }
                })

                getPwAllRStatEventOrg({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    id: this.id
                }).then(res => {
                    this.isLoading = false
                    this.serialData2 = res.data
                })
            } else {
                getPwRStatHarmonicOrgIcon({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    id: this.id,
                    stasisID: this.value11
                }).then(res => {
                    if (res.code == 'A0001') {
                        ;(this.echarts2data = { data: [] }), this.getCensus()
                    } else {
                        this.echarts2data = res
                        this.getCensus()
                    }
                })

                getPwRStatHarmonicOrg({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    id: this.id
                }).then(res => {
                    this.isLoading = false
                    if (res.code == 'A0001') {
                        this.serialData1 = [{ columns: [] }]
                    } else {
                        this.serialData1 = res.data
                    }
                })
            }
            setTimeout(() => {
                this.loading = false
            }, 100)
        },
        cellStyle(row, column, rowIndex, columnIndex) {
            if (row.columnIndex == 2 || row.columnIndex == 3 || row.columnIndex == 4 || row.columnIndex == 5) {
                return 'font-weight: 100;'
            }
        },
        //监测终端统计echarts图表
        async getCensus() {
            this.max = 0
            this.isLoading3 = true

            let echarts = require('echarts')
            let domID5 = document.getElementById('electr5')
            let domID6 = document.getElementById('electr6')

            setTimeout(() => {
                ;(domID5.style.width = window.sessionStorage.getItem('appwidth') + 'px'),
                    (domID5.style.height = window.sessionStorage.getItem('appheight') / 2 - 50 + 'px')

                this.isLoading3 = false
            }, 0)
            setTimeout(() => {
                ;(domID6.style.width = window.sessionStorage.getItem('appwidth') + 'px'),
                    (domID6.style.height = window.sessionStorage.getItem('appheight') / 2 - 50 + 'px')

                this.isLoading3 = false
            }, 0)

            let myChart5 = echarts.init(domID5)
            let myChart6 = echarts.init(domID6)
            let list = []
            let list1 = []
            let list2 = []
            if (this.tab.paneName == 'second') {
                if (this.tabLabel == '超标监测点数(个)') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.eventMeasurementAverage > this.max) {
                            this.max = i1.eventMeasurementAverage
                        }
                        if (i1.eventMeasurementAverage > this.max) {
                            this.max = i1.eventMeasurementAccrued
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.eventMeasurementAverage == 0) {
                            i.eventMeasurementAverage = this.max * 0.03
                        }
                        if (i.eventMeasurementAccrued == 0) {
                            i.eventMeasurementAccrued = this.max * 0.03
                        }
                    })
                    this.echarts2data.data.forEach(i => {
                        list.push(i.eventName)
                        list1.push(i.eventMeasurementAverage)
                        list2.push(i.eventMeasurementAccrued)
                    })
                } else if (this.tabLabel == '超标监测点数占比(%)') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.eventMeasurementRatioAverage > this.max) {
                            this.max = i1.eventMeasurementRatioAverage
                        }
                        if (i1.eventMeasurementRatioAccrued > this.max) {
                            this.max = i1.eventMeasurementRatioAccrued
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.eventMeasurementRatioAverage == 0) {
                            i.eventMeasurementRatioAverage = this.max * 0.03
                        }
                        if (i.eventMeasurementRatioAccrued == 0) {
                            i.eventMeasurementRatioAccrued = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.eventName)
                        list1.push(i.eventMeasurementRatioAverage)
                        list2.push(i.eventMeasurementRatioAccrued)
                    })
                } else if (this.tabLabel == '暂态发生次数') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.eventCount > this.max) {
                            this.max = i1.eventCount
                        }
                        if (i1.eventCount > this.max) {
                            this.max = i1.eventCount
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.eventCount == 0) {
                            i.eventCount = this.max * 0.03
                        }
                        if (i.eventCount == 0) {
                            i.eventCount = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.eventName)
                        list1.push(i.eventCount)
                        list2.push(i.eventCount)
                    })
                } else if (this.tabLabel == '暂态发生频次') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.eventFreq > this.max) {
                            this.max = i1.eventFreq
                        }
                        if (i1.eventFreq > this.max) {
                            this.max = i1.eventFreq
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.eventFreq == 0) {
                            i.eventFreq = this.max * 0.03
                        }
                        if (i.eventFreq == 0) {
                            i.eventFreq = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.eventName)
                        list1.push(i.eventFreq)
                        list2.push(i.eventFreq)
                    })
                }
            } else {
                if (this.tabLabel == '超标监测点数(个)') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.overLimitMeasurementAverage > this.max) {
                            this.max = i1.overLimitMeasurementAverage
                        }
                        if (i1.overLimitMeasurementAccrued > this.max) {
                            this.max = i1.overLimitMeasurementAccrued
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.overLimitMeasurementAverage == 0) {
                            i.overLimitMeasurementAverage = this.max * 0.03
                        }
                        if (i.overLimitMeasurementAccrued == 0) {
                            i.overLimitMeasurementAccrued = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.rowName)
                        list1.push(i.overLimitMeasurementAverage)
                        list2.push(i.overLimitMeasurementAccrued)
                    })
                } else if (this.tabLabel == '超标监测点数占比(%)') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.overLimitMeasurementRatioAccrued > this.max) {
                            this.max = i1.overLimitMeasurementRatioAccrued
                        }
                        if (i1.overLimitMeasurementRatioAverage > this.max) {
                            this.max = i1.overLimitMeasurementRatioAverage
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.overLimitMeasurementRatioAccrued == 0) {
                            i.overLimitMeasurementRatioAccrued = this.max * 0.03
                        }
                        if (i.overLimitMeasurementRatioAverage == 0) {
                            i.overLimitMeasurementRatioAverage = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.rowName)
                        list1.push(i.overLimitMeasurementRatioAccrued)
                        list2.push(i.overLimitMeasurementRatioAverage)
                    })
                } else if (this.tabLabel == '平均超标天数') {
                    this.echarts2data.data.forEach(i1 => {
                        if (i1.averageOverDay > this.max) {
                            this.max = i1.averageOverDay
                        }
                        if (i1.averageOverDay > this.max) {
                            this.max = i1.averageOverDay
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        if (i.averageOverDay == 0) {
                            i.averageOverDay = this.max * 0.03
                        }
                        if (i.averageOverDay == 0) {
                            i.averageOverDay = this.max * 0.03
                        }
                    })

                    this.echarts2data.data.forEach(i => {
                        list.push(i.rowName)
                        list1.push(i.averageOverDay)
                        list2.push(i.averageOverDay)
                    })
                }
            }

            let _this = this
            let echartsColor = JSON.parse(window.localStorage.echartsColor)
            let option1 = {
                title: {
                    text: this.rowName,
                    top: 20,
                    left: 'center'
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow',
                        label: {
                            color: '#fff',
                            fontSize: 16
                        }
                    },
                    textStyle: {
                        color: '#fff',
                        fontStyle: 'normal',
                        opacity: 0.35,
                        fontSize: 14
                    },
                    backgroundColor: 'rgba(0,0,0,0.35)',
                    borderWidth: 0,
                    formatter: function (params) {
                        var tips = ''
                        tips += params[0].name + '</br/>'
                        for (var i = 0; i < params.length; i++) {
                            if (params[i].value == _this.max * 0.03) {
                                tips += params[i].seriesName + ':暂无数据<br/>'
                            } else {
                                tips += params[i].seriesName + ':' + params[i].value + '<br/>'
                            }
                        }
                        return tips
                    }
                },
                legend: {
                    data: ['日均', '累计'],
                    right: '2%',
                        top: 20,
                    itemWidth: 16,
                    itemHeight: 16,
                    itemGap: 28,
                    textStyle: {
                        color: echartsColor.WordColor,
                        rich: {
                            a: {
                                verticalAlign: 'middle'
                            }
                        },

                        padding: [2, 0, 0, 0] //[上、右、下、左]
                    }
                },
                grid: {
                    top: '15%',
                    right: '3%',
                    left: '3%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        data: list,
                        axisLine: {
                            lineStyle: {
                                color: echartsColor.thread
                            }
                        },
                        axisLabel: {
                            color: echartsColor.WordColor,
                            rotate: 30,   interval: 0,
                        }
                    }
                ],
                yAxis: [
                    {
                        name: '单位：个',
                        nameTextStyle: {
                            color: echartsColor.WordColor
                        },
                        minInterval: 1,
                        type: 'value',
                        axisLine: {
                            show: true,
                            lineStyle: {
                                color: echartsColor.thread
                            }
                        },
                        axisLabel: {
                            color: echartsColor.WordColor
                        },
                        splitLine: {
                            lineStyle: {
                                // 使用深浅的间隔色
                                color: [echartsColor.thread],
                                type: 'dashed',
                                opacity: 0.5
                            }
                        }
                    }
                ],
                // dataZoom: [
                //     {
                //         show: true,
                //         height: 12,
                //         xAxisIndex: [0],
                //         bottom: '6%',
                //         start: 0,
                //         end: 100,
                //         handleIcon:
                //             'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                //         handleSize: '110%',
                //         handleStyle: {
                //             color: '#d3dee5'
                //         },
                //         textStyle: {
                //             color: '#fff'
                //         },
                //         borderColor: '#90979c'
                //     },
                //     {
                //         type: 'inside',
                //         show: true,
                //         height: 15,
                //         start: 0,
                //         end: 100
                //     }
                // ],
                series: [
                    {
                        name: '日均',
                        type: 'bar',
                        barMinHeight: 5,
                        data: list1,
                        barGap: 0.4,
                        barMaxWidth: 30, //最大宽度
                        label: {
                            show: true,
                            position: 'top',
                            textStyle: {
                                //数值样式
                                color: echartsColor.WordColor
                            },

                            fontSize: 12
                        },
                        itemStyle: {
                            normal: {
                                color: function (params) {
                                    // console.log(params,'1111111111111111111111');
                                    if (params.data == 0) {
                                        return '#ccc'
                                    } else {
                                        return echartsColor.FigureColor[0]
                                    }
                                }
                            }
                        }
                    },
                    {
                        name: '累计',
                        type: 'bar',
                        barMinHeight: 5,
                        data: list2,
                        barGap: 0.4,
                        barMaxWidth: 30, //最大宽度
                        label: {
                            show: true,
                            position: 'top',
                            textStyle: {
                                //数值样式
                                color: echartsColor.WordColor
                            },

                            fontSize: 12
                        },
                        itemStyle: {
                            normal: {
                                color: function (params) {
                                    // console.log(params,'1111111111111111111111');
                                    if (params.data == 0) {
                                        return '#ccc'
                                    } else {
                                        return echartsColor.FigureColor[1]
                                    }
                                }
                            }
                            // normal: { show: true, color: echartsColor.FigureColor[1] },
                        }
                    }
                ]
            }
            if (this.tabLabel == '平均超标天数' || this.tabLabel == '暂态发生频次' || this.tabLabel == '暂态发生次数') {
                option1 = {
                    title: {
                    text: this.rowName,
                    top: 20,
                    left: 'center'
                },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow',
                            label: {
                                color: '#fff',
                                fontSize: 16
                            }
                        },
                        textStyle: {
                            color: '#fff',
                            fontStyle: 'normal',
                            opacity: 0.35,
                            fontSize: 14
                        },
                        backgroundColor: 'rgba(0,0,0,0.35)',
                        borderWidth: 0,
                        formatter: function (params) {
                            var tips = ''
                            tips += params[0].name + '</br/>'
                            for (var i = 0; i < params.length; i++) {
                                if (params[i].value == _this.max * 0.03) {
                                    tips += params[i].seriesName + ':暂无数据<br/>'
                                } else {
                                    tips += params[i].seriesName + ':' + params[i].value + '<br/>'
                                }
                            }
                            return tips
                        }
                    },
                    legend: {
                        data: ['日均'],
                        right: '2%',
                        top: 20,
                        itemWidth: 16,
                        itemHeight: 16,
                        itemGap: 28,
                        textStyle: {
                            color: echartsColor.WordColor,
                            rich: {
                                a: {
                                    verticalAlign: 'middle'
                                }
                            },

                            padding: [2, 0, 0, 0] //[上、右、下、左]
                        }
                    },
                    grid: {
                        top: '15%',
                    right: '3%',
                    left: '3%',
                    bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [
                        {
                            type: 'category',
                            data: list,
                            axisLine: {
                                lineStyle: {
                                    color: echartsColor.thread
                                }
                            },
                            axisLabel: {
                                color: echartsColor.WordColor
                            }
                        }
                    ],
                    yAxis: [
                        {
                            name: '单位：个',
                            nameTextStyle: {
                                color: echartsColor.WordColor
                            },
                            minInterval: 1,
                            type: 'value',
                            axisLine: {
                                show: true,
                                lineStyle: {
                                    color: echartsColor.thread
                                }
                            },
                            axisLabel: {
                                color: echartsColor.WordColor
                            },
                            splitLine: {
                                lineStyle: {
                                    // 使用深浅的间隔色
                                    color: [echartsColor.thread],
                                    type: 'dashed',
                                    opacity: 0.5
                                }
                            }
                        }
                    ],
                    dataZoom: [
                        {
                            show: true,
                            height: 12,
                            xAxisIndex: [0],
                            bottom: '6%',
                            start: 0,
                            end: 100,
                            handleIcon:
                                'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                            handleSize: '110%',
                            handleStyle: {
                                color: '#d3dee5'
                            },
                            textStyle: {
                                color: '#fff'
                            },
                            borderColor: '#90979c'
                        },
                        {
                            type: 'inside',
                            show: true,
                            height: 15,
                            start: 0,
                            end: 100
                        }
                    ],
                    series: [
                        {
                            name: '日均',
                            type: 'bar',
                            data: list1,
                            barMinHeight: 5,
                            barGap: 0.4,
                            barMaxWidth: 30, //最大宽度
                            label: {
                                show: true,
                                position: 'top',
                                textStyle: {
                                    //数值样式
                                    color: echartsColor.WordColor
                                },

                                fontSize: 12
                            },
                            itemStyle: {
                                normal: {
                                    color: function (params) {
                                        // console.log(params,'1111111111111111111111');
                                        if (params.data == 0) {
                                            return '#ccc'
                                        } else {
                                            return echartsColor.FigureColor[0]
                                        }
                                    }
                                }
                            }
                        }
                    ]
                }
            }
            option1 && myChart5.setOption(option1, true)
            window.echartsArr.push(myChart5)
            option1 && myChart6.setOption(option1, true)
            window.echartsArr.push(myChart6)

            setTimeout(function () {
                myChart5.resize()
            }, 0)
            setTimeout(function () {
                myChart6.resize()
            }, 0)
        },

        //方法调用台账统计数据接口
        account1() {
            var code11 = 'Steady_Statis' //干扰源类型

            this.option11 = dicData(code11, [], 1)
            this.option11.shift()

            this.value11 = this.option11[0].id
            this.rowName=this.option11[0].name

            this.kai = false
            // this.isLoading = true;
            // this.isLoading2 = true;
            //监测终端统计单位表格数据

            getPwRStatHarmonicOrg({
                id: JSON.parse(window.sessionStorage.getItem('Info')).deptId,
                type: this.$refs.Timslot.intervald,
                startTime: this.start,
                endTime: this.end
            }).then(res => {
                this.serialData1 = res.data
                getPwRStatHarmonicOrgIcon({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    stasisID: this.value11,
                    id: JSON.parse(window.sessionStorage.getItem('Info')).deptId
                }).then(res => {
                    this.echarts2data = res
                    this.getCensus()
                })
            })
        },
        account() {
            var code11 = 'Event_Statis' //干扰源类型

            this.option11 = dicData(code11, [], 1)
            this.option11.shift()

            this.value11 = this.option11[0].id
            this.rowName=this.option11[0].name
            this.kai = false
            // this.isLoading = true;
            // this.isLoading2 = true;
            //监测终端统计单位表格数据

            getPwAllRStatEventOrg({
                id: JSON.parse(window.sessionStorage.getItem('Info')).deptId,
                type: this.$refs.Timslot.intervald,
                startTime: this.start,
                endTime: this.end
            }).then(res => {
                this.serialData2 = res.data
                getPwAllRStatEventOrgIcon({
                    type: this.$refs.Timslot.intervald,
                    startTime: this.start,
                    endTime: this.end,
                    stasisID: this.value11,
                    id: JSON.parse(window.sessionStorage.getItem('Info')).deptId
                }).then(res => {
                    this.echarts2data = res
                    this.getCensus()
                })
            })
        },
        // 点击行
        cellClickEvent({ row, column }) {
            this.rowName=row.rowName
            this.option11.map(item => (item.name == row.rowName ? (this.value11 = item.id) : ''))
            this.steady()
        }
    }
}
</script>

<style lang="less" scoped></style>
