<template>
    <div style="display: flex; flex-direction: column; height: 100%">
        <el-form :inline="true">
            <el-form-item label="多监测点">
                <el-checkbox v-model="checked" @change="checkChange" />
            </el-form-item>
            <el-form-item label="统计时间">
                <DatePicker ref="datePickerRef"></DatePicker>
            </el-form-item>
            <el-form-item label="指标类型:">
                <el-select v-model="formData.condition" multiple collapse-tags :multiple-limit="5" filterable
                    placeholder="请选择指标" @change="conditionChange">
                    <el-option-group v-for="group in indexOptions" :key="group.label" :label="group.label">
                        <el-option v-for="item in group.options" :key="item.value" :label="item.label"
                            :value="item.value"></el-option>
                    </el-option-group>
                </el-select>
            </el-form-item>
            <el-form-item label="数值类型:">
                <el-select style="width: 100%" v-model="formData.valueType" placeholder="请选择类型" filterable>
                    <el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
                        :value="item.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="谐波次数:" v-if="showXieBoCiShu">
                <el-select style="width: 100%" v-model="formData.harmonic" placeholder="请选择谐波" filterable>
                    <el-option v-for="item in harmonicOptions" :key="item.value" :label="item.label"
                        :value="item.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item v-if="showJianXieBoCiShu" label="间谐波次数:">
                <el-select style="width: 100%" v-model="formData.inHarmonic" placeholder="请选择间谐波" filterable>
                    <el-option v-for="item in inharmonicOptions" :key="item.value" :label="item.label"
                        :value="item.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="init" icon="el-icon-Search">查询</el-button>
            </el-form-item>
        </el-form>
        <div style="flex: 1; overflow-y: scroll" class="mt10" v-loading="loading">
            <my-echart :options="item.option" v-for="item in list" :style="height" />
        </div>
    </div>
</template>

<script setup lang="ts">
import { nextTick, onMounted, reactive, ref } from 'vue'
import DatePicker from '@/components/form/datePicker/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useMonitoringPoint } from '@/stores/monitoringPoint'
import { indexOptions, harmonicOptions, inharmonicOptions } from '@/utils/dictionary'
import { getHistoryResult } from '@/api/harmonic-boot/harmonic'
import { mainHeight } from '@/utils/layout'
import { yMethod } from '@/utils/echartMethod'
const datePickerRef = ref()
const monitoringPoint = useMonitoringPoint()
const checked = ref(monitoringPoint.state.showCheckBox)
const loading = ref(true)
const formData = reactive<{
    lineId: string[]
    searchBeginTime: string
    searchEndTime: string
    condition: string[]
    valueType: number
    harmonic: number
    inHarmonic: number
    ptType: number
}>({
    lineId: [],
    searchBeginTime: '',
    searchEndTime: '',
    condition: ['10', '11', '12'],
    valueType: 1,
    harmonic: 2,
    inHarmonic: 1,
    ptType: 0
})
const height: any = ref(mainHeight(200, 1))
const options = ref({})
const traceability = ref<any>([])
const list = ref<any>([])
const showXieBoCiShu = ref(false)
const showJianXieBoCiShu = ref(false)
const typeOptions = ref([
    { label: '平均值', value: 1 },
    { label: '最小值', value: 2 },
    { label: '最大值', value: 3 },
    { label: 'cp95值', value: 4 }
])
onMounted(() => {
    datePickerRef.value.setTheDate(5)
    init()
})
const checkChange = () => {
    if (checked.value) {
        monitoringPoint.setShowCheckBox(true)
    } else {
        monitoringPoint.setShowCheckBox(false)
        init()
    }
}
const init = () => {
    loading.value = true
    formData.lineId = checked.value ? monitoringPoint.state.lineIds : [monitoringPoint.state.lineId]
    formData.searchBeginTime = datePickerRef.value.timeValue[0]
    formData.searchEndTime = datePickerRef.value.timeValue[1]
    let directionValue = formData.condition.findIndex(item => {
        if (item === '39') {
            item = '50'
            return true
        } else {
            return false
        }
    })
    getHistoryResult(formData).then((res: any) => {
        if (directionValue >= 0) {
            res.data[directionValue].targetName = '谐波电流方向'
            traceability.value = [(res.data as [])[directionValue]]
        }
        list.value = []
        shujuchuli(res)
        loading.value = false
    }).catch(() => { loading.value = false })
}
const shujuchuli = (res: any) => {
    let shujuData = res.data
    shujuData.forEach((item: any, i: number) => {
        let [min, max] = yMethod([ ...(item.value.map(arr => arr.slice(1)).flat()),item.topLimit,,item.lowerLimit])
      
        //判断是否存在暂降点
        if (item.eventDetail !== null || item.eventDetail.length === 0) {
            //向项别中添加暂降点
            let chufa = []
            item.phaiscType.push('暂态触发点')
            //判断是否有限值(有上下限)
            if (item.topLimit !== 0 && item.lowerLimit !== 0) {
                item.phaiscType.push('上限')
                item.phaiscType.push('下限')
                if (item.minValue !== null && item.maxValue !== null) {
                    //最小值等于下限值

                    //图列为A,B,C,暂降,上限,下限
                    if (item.phaiscType.length == 6) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let topLimit = []
                        let lowerLimit = []
                        item.maxValue = max
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //上下限值
                                topLimit.push([item.value[j][0], item.topLimit])
                                lowerLimit.push([item.value[j][0], item.lowerLimit])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([
                                    item.eventDetail[k].time,
                                    item.minValue.toFixed(3),
                                    item.eventDetail[k].id,
                                    99
                                ])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            topLimit: topLimit,
                            lowerLimit: lowerLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,暂降,上限,下限
                    if (item.phaiscType.length == 4) {
                        let gvalue = []
                        let topLimit = []
                        let lowerLimit = []
                        item.maxValue = max
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //上下限值
                                topLimit.push([item.value[j][0], item.topLimit])
                                lowerLimit.push([item.value[j][0], item.lowerLimit])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([
                                    item.eventDetail[k].time,
                                    item.minValue.toFixed(3),
                                    item.eventDetail[k].id,
                                    99
                                ])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            gvalue: gvalue,
                            topLimit: topLimit,
                            lowerLimit: lowerLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //有上限值
            if (item.topLimit !== 0 && item.lowerLimit == 0) {
                item.phaiscType.push('上限')
                if (item.minValue !== null && item.maxValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,暂降,上限
                    if (item.phaiscType.length == 5) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let topLimit = []
                        item.maxValue = max
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //上限值
                                topLimit.push([item.value[j][0], item.topLimit])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([
                                    item.eventDetail[k].time,
                                    item.minValue.toFixed(3),
                                    item.eventDetail[k].id,
                                    99
                                ])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            topLimit: topLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,暂降,上限
                    if (item.phaiscType.length == 3) {
                        let gvalue = []
                        let topLimit = []
                        item.maxValue = max
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //上限值
                                topLimit.push([item.value[j][0], item.topLimit])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([item.eventDetail[k].time, item.minValue.toFixed(3)])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            gvalue: gvalue,
                            topLimit: topLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //有下限值
            if (item.topLimit == 0 && item.lowerLimit !== 0) {
                item.phaiscType.push('下限')
                if (item.minValue !== null && item.maxValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,暂降,下限
                    if (item.phaiscType.length == 5) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let lowerLimit = []
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //下限值
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([item.eventDetail[k].time, item.minValue.toFixed(3)])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            lowerLimit: lowerLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,暂降,下限
                    if (item.phaiscType.length == 3) {
                        let gvalue = []
                        let lowerLimit = []
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //下限值
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([item.eventDetail[k].time, item.minValue.toFixed(3)])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            gvalue: gvalue,
                            lowerLimit: lowerLimit,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //无限值
            if (item.topLimit == 0 && item.lowerLimit == 0) {
                if (item.minValue !== null && item.maxValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,暂降
                    if (item.phaiscType.length == 4) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([
                                    item.eventDetail[k].time,
                                    item.minValue.toFixed(3),
                                    item.eventDetail[k].id,
                                    99
                                ])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue > 1 ? (item.minValue - 0.5).toFixed(3) : item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,暂降
                    if (item.phaiscType.length == 2) {
                        let gvalue = []
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        //不存在一个暂降点或1个 //处理暂降点
                        if (item.eventDetail.length > 0) {
                            for (let k = 0; k < item.eventDetail.length; k++) {
                                chufa.push([
                                    item.eventDetail[k].time,
                                    item.minValue.toFixed(3),
                                    item.eventDetail[k].id,
                                    99
                                ])
                            }
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            gvalue: gvalue,
                            chufa: chufa
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
        } else if (item.eventDetail == null) {
            //判断是否有限值(有上下限)
            if (item.topLimit !== 0 && item.lowerLimit !== 0) {
                item.phaiscType.push('上限')
                item.phaiscType.push('下限')
                if (item.minValue !== null && item.maxValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,上限,下限
                    if (item.phaiscType.length == 5) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let topLimit = []
                        let lowerLimit = []
                        item.maxValue = max
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //上下限值
                                topLimit.push([item.value[j][0], item.topLimit.toFixed(3)])
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            topLimit: topLimit,
                            lowerLimit: lowerLimit
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,上限,下限
                    if (item.phaiscType.length == 3) {
                        let gvalue = []
                        let topLimit = []
                        let lowerLimit = []
                        item.maxValue = max
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //上下限值
                                topLimit.push([item.value[j][0], item.topLimit.toFixed(3)])
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            gvalue: gvalue,
                            topLimit: topLimit,
                            lowerLimit: lowerLimit,
                            chufa: []
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //有上限值
            if (item.topLimit !== 0 && item.lowerLimit == 0) {
                item.phaiscType.push('上限')
                if (item.minValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,上限
                    if (item.phaiscType.length == 4) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let topLimit = []
                        item.maxValue = max
                        // item.minValue=item.lowerLimit
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //上限值
                                topLimit.push([item.value[j][0], item.topLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            maxValue: item.maxValue.toFixed(3),
                            minValue: item.minValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            topLimit: topLimit
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,上限
                    if (item.phaiscType.length == 2) {
                        let gvalue = []
                        let topLimit = []
                        item.maxValue = max
                        // item.minValue=item.lowerLimit
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //上限值
                                topLimit.push([item.value[j][0], item.topLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            gvalue: gvalue,
                            topLimit: topLimit
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //有下限值
            if (item.topLimit == 0 && item.lowerLimit !== 0) {
                item.phaiscType.push('下限')
                if (item.minValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C,下限
                    if (item.phaiscType.length == 4) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        let lowerLimit = []
                        // item.maxValue=item.topLimit
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                                //下限值
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue,
                            lowerLimit: lowerLimit
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等,下限
                    if (item.phaiscType.length == 2) {
                        let gvalue = []
                        let lowerLimit = []
                        // item.maxValue=item.topLimit
                        item.minValue = min
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                                //下限值
                                lowerLimit.push([item.value[j][0], item.lowerLimit.toFixed(3)])
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            gvalue: gvalue,
                            lowerLimit: lowerLimit
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
            //无限值
            if (item.topLimit == 0 && item.lowerLimit == 0) {
                if (item.minValue !== null) {
                    //最小值等于下限值
                    //图列为A,B,C
                    if (item.phaiscType.length == 3) {
                        let avalue = []
                        let bvalue = []
                        let cvalue = []
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    avalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    avalue.push([])
                                }
                                //判断存在缺失值b
                                if (item.value[j][2] != undefined) {
                                    bvalue.push([item.value[j][0], item.value[j][2].toFixed(3)])
                                } else {
                                    bvalue.push([])
                                }
                                //判断存在缺失值c
                                if (item.value[j][3] != undefined) {
                                    cvalue.push([item.value[j][0], item.value[j][3].toFixed(3)])
                                } else {
                                    cvalue.push([])
                                }
                            }
                            //数据为空
                        } else {
                            avalue = []
                            bvalue = []
                            cvalue = []
                        }

                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            avalue: avalue,
                            bvalue: bvalue,
                            cvalue: cvalue
                        }
                        list.value.push(shuju)
                    }
                    //图列为频率等
                    if (item.phaiscType.length == 1) {
                        let gvalue = []
                        //判断数据是否存在
                        if (item.value !== null) {
                            for (let j = 0; j < item.value.length; j++) {
                                //判断存在缺失值a
                                if (item.value[j][1] != undefined) {
                                    gvalue.push([item.value[j][0], item.value[j][1].toFixed(3)])
                                } else {
                                    gvalue.push([])
                                }
                            }
                            //数据为空
                        } else {
                            gvalue = []
                        }
                        let shuju = {
                            id: 'qushifenx' + i,
                            title: item.lineName + '--' + item.targetName,
                            targetName: item.targetName,
                            legend: item.phaiscType,
                            valueName: item.unit[0],
                            minValue: item.minValue.toFixed(3),
                            maxValue: item.maxValue.toFixed(3),
                            gvalue: gvalue
                        }
                        list.value.push(shuju)
                    }
                } else {
                    let shuju = {
                        id: 'qushifenx' + i,
                        title: item.lineName + '--' + item.targetName,
                        targetName: item.targetName,
                        legend: item.phaiscType,
                        valueName: item.unit[0],
                        minValue: null,
                        avalue: [],
                        bvalue: [],
                        cvalue: [],
                        topLimit: [],
                        lowerLimit: [],
                        chufa: []
                    }
                    list.value.push(shuju)
                }
            }
        }
    })
    rendering()
}
const rendering = () => {
    height.value = mainHeight(200, list.value.length > 1 ? 2 : 1)

    list.value.forEach((item: any) => {
        let opitonserise: any[] = []
        item.legend.forEach((item2: any) => {
            if (item.avalue !== undefined && (item2 == 'A相' || item2 == 'AB相' || item2 == '零序电压')) {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color: '#DAA520'
                        }
                    },

                    data: item.avalue
                }
                opitonserise.push(data)
            } else if (item.bvalue !== undefined && (item2 == 'B相' || item2 == 'BC相' || item2 == '正序电压')) {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color: '#2E8B57'
                        }
                    },

                    data: item.bvalue
                }
                opitonserise.push(data)
            } else if (item.cvalue !== undefined && (item2 == 'C相' || item2 == 'CA相' || item2 == '负序电压')) {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#A52a2a'
                        }
                    },
                    data: item.cvalue
                }
                opitonserise.push(data)
            } else if (item.topLimit !== undefined && item2 == '上限') {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color: '#FF33FF',
                            lineStyle: {
                                width: 2,
                                color: '#FF33FF',
                                type: 'dotted' //'dotted'虚线 'solid'实线
                            }
                        }
                    },
                    data: item.topLimit
                }
                opitonserise.push(data)
            } else if (item.lowerLimit !== undefined && item2 == '下限') {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#3399FF',
                            lineStyle: {
                                width: 2,
                                color: '#3399FF',
                                type: 'dotted' //'dotted'虚线 'solid'实线
                            }
                        }
                    },
                    data: item.lowerLimit
                }
                opitonserise.push(data)
            } else if (item.chufa !== undefined && item2 == '暂态触发点') {
                let data = {
                    name: item2,
                    type: 'scatter',
                    symbol: `image://` + new URL('@/assets/point.png', import.meta.url).href,
                    symbolSize: 16,
                    itemStyle: {
                        width: '22px',
                        height: '22px'
                    },
                    data: item.chufa
                }
                opitonserise.push(data)
            } else if (item.gvalue !== undefined && item2 == '频率') {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    smooth: true,
                    itemStyle: {
                        normal: {
                            color: '#990099',
                            lineStyle: {
                                width: 2,
                                color: '#990099',
                                type: 'solid' //'dotted'虚线 'solid'实线
                            }
                        }
                    },
                    data: item.gvalue
                }
                opitonserise.push(data)
            } else if (item.gvalue !== undefined && item2 == '负序电流') {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#999933'
                        }
                    },
                    data: item.gvalue
                }
                opitonserise.push(data)
            } else if (item.gvalue !== undefined && item2 == '三相电压不平衡度') {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#FF6600'
                        }
                    },
                    data: item.gvalue
                }
                opitonserise.push(data)
            } else if (
                item.gvalue !== undefined &&
                (item2 == '三相总有功功率' || item2 == '三相总无功功率' || item2 == '三相总视在功率')
            ) {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#0033ff'
                        }
                    },
                    data: item.gvalue
                }
                opitonserise.push(data)
            } else if (item.gvalue !== undefined && (item2 == '总视在功率因数' || item2 == '总位移功率因数')) {
                let data = {
                    name: item2,
                    symbol: 'none',
                    symbolSize: 5,
                    type: 'line',
                    barWidth: 22,
                    itemStyle: {
                        normal: {
                            color: '#00FF00'
                        }
                    },

                    data: item.gvalue
                }
                opitonserise.push(data)
            }
            // else {
            //     opitonserise.push([])
            // }
        })
        if (item.valueName == undefined) {
            item.valueName = '无'
        }
        //console.log('渲染数据体',opitonserise)
        item.serise = opitonserise
    })
    getEcharts()
}
const getEcharts = () => {


    list.value.forEach((item: any, i: number) => {
        item.option = {
            backgroundColor: '#fff',
            title: {
                left: 'center',
                text: item.title
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    //type: "shadow",
                    type: 'cross', // 默认为直线，可选为：'line' | 'shadow'
                    label: {
                        color: '#fff',
                        fontSize: 16
                    }
                },
                textStyle: {
                    color: '#fff',
                    fontStyle: 'normal',
                    opacity: 0.35,
                    fontSize: 14
                },
                backgroundColor: 'rgba(0,0,0,0.55)',

                formatter: function (params: any) {
                    let tips = ''
                    tips += '时刻:' + params[0].data[0] + '</br/>'
                    for (let i = 0; i < params.length; i++) {
                        if (params[i].seriesName == '暂态触发点') {
                            tips += ''
                            return tips
                        }
                        if (params[i].seriesName == 'A相谐波电流方向') {
                            tips +=
                                params[i].value[1] > 0
                                    ? 'A相谐波电流方向:流入<br/>'
                                    : params[i].value[1] == 0
                                        ? 'A相谐波电流方向:无<br/>'
                                        : 'A相谐波电流方向:流出<br/>'
                        } else if (params[i].seriesName == 'B相谐波电流方向') {
                            tips +=
                                params[i].value[1] > 0
                                    ? 'B相谐波电流方向:流入<br/>'
                                    : params[i].value[1] == 0
                                        ? 'B相谐波电流方向:无<br/>'
                                        : 'B相谐波电流方向:流出<br/>'
                        } else if (params[i].seriesName == 'C相谐波电流方向') {
                            tips +=
                                params[i].value[1] > 0
                                    ? 'C相谐波电流方向:流入<br/>'
                                    : params[i].value[1] == 0
                                        ? 'C相谐波电流方向:无<br/>'
                                        : 'C相谐波电流方向:流出<br/>'
                        } else if (params[i].seriesName == '总谐波电流方向') {
                            tips +=
                                params[i].value[1] > 0
                                    ? '总谐波电流方向:流入<br/>'
                                    : params[i].value[1] == 0
                                        ? '总谐波电流方向:无<br/>'
                                        : '总谐波电流方向:流出<br/>'
                        } else if (params[i].seriesName == '正序电压') {
                            let str = (params[i].value[1] * 1).toString()
                            let reg = str.indexOf('.') > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g
                            let str1 = str.replace(reg, '$1,')
                            tips += params[i].seriesName + ':' + str1 + 'kV<br/>'
                        } else if (params[i].seriesName == '零序电压' || params[i].seriesName == '负序电压') {
                            let str = (params[i].value[1] * 1).toString()
                            let reg = str.indexOf('.') > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g
                            let str1 = str.replace(reg, '$1,')
                            tips += params[i].seriesName + ':' + str1 + 'V<br/>'
                        } else if (params[i].seriesName !== '正序电压') {
                            let str = (params[i].value[1] * 1).toString()
                            let reg = str.indexOf('.') > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g
                            let str1 = str.replace(reg, '$1,')
                            tips += params[i].seriesName + ':' + str1 + '<br/>'
                        } else {
                            let str = (params[i].value[2] * 1).toString()
                            let reg = str.indexOf('.') > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g
                            let str1 = str.replace(reg, '$1,')
                            tips += params[i].seriesName + ':' + str1 + '<br/>'

                            let str2 = (params[i].value[3] * 1).toString()
                            let reg2 = str2.indexOf('.') > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g
                            let str12 = str.replace(reg2, '$1,')
                            // if(params[i].seriesName){

                            // }
                            tips += params[i].seriesName + ':' + str12 + '<br/>'
                        }
                    }

                    return tips
                }
            },
            legend: {
                left: '140px',
                verticalAlign: 'top',
                enabled: true,
                itemDistance: 5,
                textStyle: {
                    rich: {
                        a: {
                            verticalAlign: 'middle'
                        }
                    },

                    padding: [0, 0, 0, 0] //[上、右、下、左]
                }
            },
            xAxis: [
                {
                    type: 'time',
                    axisLine: {
                        show: true,
                        onZero: false
                    },
                    axisLabel: {
                        textStyle: {
                            fontFamily: 'dinproRegular'
                        }
                    }
                }
            ],
            toolbox: {
                show: true,
                feature: {
                    dataZoom: {
                        // bottom: '10px',
                        yAxisIndex: 'none'
                    }
                }
            },
            yAxis: [
                {
                    type: 'value',

                    min: item.minValue,
                    max: item.maxValue,
                    name: item.valueName,
                    axisLabel: {
                        interval: 0,
                        formatter: function (value: any) {
                            return value.toFixed(3)
                        },
                        left: '20px'
                    },

                    axisLine: {
                        show: true,
                        onZero: false, //-----------重点
                        lineStyle: {}
                    },
                    splitLine: {
                        lineStyle: {
                            // 使用深浅的间隔色
                            type: 'dashed',
                            opacity: 0.5
                        }
                    }
                }
            ],
            series: item.serise
        }
        let aValues = []
        let bValues = []
        let CValues = []
        let ZValues = []

        if (
            traceability.value.length > 0 &&
            traceability.value[0].value != null &&
            traceability.value[0].value.length > 0
        ) {
            for (let i = 0; i < traceability.value[0].value.length; i++) {
                let T = traceability.value[0].value[i][0]
                let A = traceability.value[0].value[i][1]
                let B = traceability.value[0].value[i][2]
                let C = traceability.value[0].value[i][3]
                let Z = A + B + C
                aValues.push([T, A > 0 ? 1 : A == 0 ? 0 : -1])
                bValues.push([T, B > 0 ? 1 : B == 0 ? 0 : -1])
                CValues.push([T, C > 0 ? 1 : C == 0 ? 0 : -1])
                ZValues.push([T, Z > 0 ? 1 : Z == 0 ? 0 : -1])
            }
        }

        if (item.targetName == '谐波电流方向') {
            item.option.tooltip.axisPointer = null
            item.option.yAxis[0] = {
                type: 'value',
                interval: 1,
                min: -2, //最小值
                max: 2,
                axisLine: {
                    show: true,
                    onZero: false //-----------重点
                },
                splitLine: {
                    lineStyle: {
                        // 使用深浅的间隔色
                        type: 'dashed',
                        opacity: 0.5
                    }
                },
                axisLabel: {
                    formatter: function (value: any) {
                        if (value == 0) {
                            return '无'
                        } else if (value == -1) {
                            return '流出'
                        } else if (value == 1) {
                            return '流入'
                        }
                    }
                }
            }
            item.option.series = [
                {
                    name: 'A相谐波电流方向',
                    type: 'line',

                    data: aValues,
                    symbol: 'none',
                    symbolSize: 0,
                    itemStyle: {
                        normal: {
                            color: '#DAA520'
                        }
                    }
                },
                {
                    name: 'B相谐波电流方向',
                    type: 'line',

                    data: bValues,
                    symbol: 'none',
                    symbolSize: 0,
                    itemStyle: {
                        normal: {
                            color: '#2E8B57'
                        }
                    }
                },
                {
                    name: 'C相谐波电流方向',
                    type: 'line',

                    data: CValues,
                    symbol: 'none',
                    symbolSize: 0,
                    itemStyle: {
                        normal: {
                            color: '#A52a2a'
                        }
                    }
                },
                {
                    name: '总谐波电流方向',
                    type: 'line',

                    data: ZValues,
                    symbol: 'none',
                    symbolSize: 0,
                    itemStyle: {
                        normal: {
                            color: '#0033ff'
                        }
                    }
                }
            ]
        }
    })
}
const conditionChange = () => {
    //判断一个指标时
    if (formData.condition.length == 1) {
        if (
            formData.condition.includes('40') ||
            formData.condition.includes('43') ||
            formData.condition.includes('44') ||
            formData.condition.includes('50') ||
            formData.condition.includes('39') ||
            formData.condition.includes('51') ||
            formData.condition.includes('52') ||
            formData.condition.includes('45')
        ) {
            showXieBoCiShu.value = true
        } else {
            showXieBoCiShu.value = false
        }
        if (
            formData.condition.includes('46') ||
            //formData.condition.includes('47') ||
            // formData.condition.includes('48') ||
            formData.condition.includes('49')
        ) {
            showJianXieBoCiShu.value = true
        } else {
            showJianXieBoCiShu.value = false
        }
    }
    //判断2个指标时
    if (formData.condition.length == 2) {
        if (
            formData.condition.includes('40') ||
            formData.condition.includes('43') ||
            formData.condition.includes('44') ||
            (formData.condition.includes('45') && formData.condition.includes('46')) ||
            //formData.condition.includes('47') ||
            // formData.condition.includes('48') ||
            formData.condition.includes('49') ||
            formData.condition.includes('50') ||
            formData.condition.includes('39') ||
            formData.condition.includes('51') ||
            formData.condition.includes('52')
        ) {
            showXieBoCiShu.value = true
            showJianXieBoCiShu.value = true
        }
        if (
            formData.condition.includes('40') ||
            formData.condition.includes('43') ||
            formData.condition.includes('44') ||
            formData.condition.includes('45') ||
            formData.condition.includes('50') ||
            formData.condition.includes('39') ||
            formData.condition.includes('51') ||
            formData.condition.includes('52')
        ) {
            showXieBoCiShu.value = true
        } else {
            showXieBoCiShu.value = false
        }
        if (
            formData.condition.includes('46') ||
            //formData.condition.includes('47') ||
            // formData.condition.includes('48') ||
            formData.condition.includes('49')
        ) {
            showJianXieBoCiShu.value = true
        } else {
            showJianXieBoCiShu.value = false
        }
    }
    //判断3个指标时
    if (formData.condition.length == 3) {
        if (
            (formData.condition.includes('40') ||
                formData.condition.includes('43') ||
                formData.condition.includes('44') ||
                formData.condition.includes('50') ||
                formData.condition.includes('39') ||
                formData.condition.includes('51') ||
                formData.condition.includes('52') ||
                formData.condition.includes('45')) &&
            (formData.condition.includes('46') ||
                //formData.condition.includes('47') ||
                // formData.condition.includes('48') ||
                formData.condition.includes('49'))
        ) {
            showXieBoCiShu.value = true
            showJianXieBoCiShu.value = true
        } else {
            showXieBoCiShu.value = false
            showJianXieBoCiShu.value = false
        }
        if (
            formData.condition.includes('46') ||
            //formData.condition.includes('47') ||
            // formData.condition.includes('48') ||
            formData.condition.includes('49')
        ) {
            showJianXieBoCiShu.value = true
        } else {
            showJianXieBoCiShu.value = false
        }
        if (
            formData.condition.includes('40') ||
            formData.condition.includes('43') ||
            formData.condition.includes('44') ||
            formData.condition.includes('45') ||
            formData.condition.includes('50') ||
            formData.condition.includes('39') ||
            formData.condition.includes('51') ||
            formData.condition.includes('52')
        ) {
            showXieBoCiShu.value = true
        } else {
            showXieBoCiShu.value = false
        }
    }
    //判断无指标时
    if (formData.condition.length == 0) {
        showJianXieBoCiShu.value = false
        showXieBoCiShu.value = false
    }
    //根据指标判断值类型
    if (formData.condition.includes('60') || formData.condition.includes('61') || formData.condition.includes('62')) {
        typeOptions.value = [{ label: '平均值', value: 1 }]
        formData.valueType = 1
    } else {
        typeOptions.value = [
            { label: '平均值', value: 1 },
            { label: '最小值', value: 2 },
            { label: '最大值', value: 3 },
            { label: 'cp95值', value: 4 }
        ]
    }
}
</script>
<style></style>
