<template>
    <el-dialog draggable v-model="dialogVisible" :title="title" width="1200px">
        <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="监测点详情" name="tab1">
                <el-descriptions :column="3" border label-width="150px">
                    <el-descriptions-item label="项目工程">
                        {{ details.areaName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="项目单位">
                        {{ details.gdName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="所属变电站">
                        {{ details.bdName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="电压等级">
                        {{ details.scale }}
                    </el-descriptions-item>
                    <el-descriptions-item label="终端厂家">
                        {{ details.manufacturer }}
                    </el-descriptions-item>
                    <el-descriptions-item label="终端名称">
                        {{ details.devName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="网络参数">
                        {{ details.ip }}
                    </el-descriptions-item>
                    <el-descriptions-item label="监测点名称">
                        {{ details.lineName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="监测点序号">
                        {{ details.id }}
                    </el-descriptions-item>
                    <el-descriptions-item label="通讯状态">
                        {{ details.comFlag }}
                    </el-descriptions-item>
                    <el-descriptions-item label="干扰源类型">
                        {{ details.loadType }}
                    </el-descriptions-item>
                    <el-descriptions-item label="监测点对象名称">
                        {{ details.objName }}
                    </el-descriptions-item>
                    <el-descriptions-item label="接线方式">
                        {{ details.ptType }}
                    </el-descriptions-item>
                    <el-descriptions-item label="PT变比">
                        {{ details.pt }}
                    </el-descriptions-item>
                    <el-descriptions-item label="CT变比">
                        {{ details.ct }}
                    </el-descriptions-item>
                    <el-descriptions-item label="基准容量(MVA)">
                        {{ details.standardCapacity }}
                    </el-descriptions-item>
                    <el-descriptions-item label="供电设备容量(MVA)">
                        {{ details.devCapacity }}
                    </el-descriptions-item>
                    <el-descriptions-item label="最小短路容量(MW)">
                        {{ details.shortCapacity }}
                    </el-descriptions-item>
                    <el-descriptions-item label="用户协议容量(MW)">
                        {{ details.dealCapacity }}
                    </el-descriptions-item>
                </el-descriptions>
            </el-tab-pane>
            <el-tab-pane label="监测点限值" name="tab2">
                <el-descriptions :column="3" border label-width="250px">
                    <el-descriptions-item label="电压偏差上限值(%)">
                        {{ limitValue.voltageDev }}
                    </el-descriptions-item>
                    <el-descriptions-item label="电压偏差下限值(%)">
                        {{ limitValue.uvoltageDev }}
                    </el-descriptions-item>
                    <el-descriptions-item label="频率偏差限值(Hz)">
                        {{ limitValue.freqDev }}
                    </el-descriptions-item>
                    <el-descriptions-item label="三相电压不平衡度限值(%)">
                        {{ limitValue.ubalance }}
                    </el-descriptions-item>
                    <el-descriptions-item label="负序电流限值(A)">
                        {{ limitValue.ineg }}
                    </el-descriptions-item>
                    <el-descriptions-item label="长时闪变限值(%)">
                        {{ limitValue.flicker }}
                    </el-descriptions-item>
                    <el-descriptions-item label="电压总畸变率限值(%)">
                        {{ limitValue.uaberrance }}
                    </el-descriptions-item>
                    <el-descriptions-item label="奇次谐波电压含有率限值(%)">
                        {{ limitValue.oddHarm }}
                    </el-descriptions-item>
                    <el-descriptions-item label="偶次谐波电压含有率限值(%)">
                        {{ limitValue.evenHarm }}
                    </el-descriptions-item>
                    <el-descriptions-item label="3次谐波电流幅值限值(A)">
                        {{ limitValue.iharm3 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="4次谐波电流幅值限值(A)">
                        {{ limitValue.iharm4 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="5次谐波电流幅值限值(A)">
                        {{ limitValue.iharm5 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="6次谐波电流幅值限值(A)">
                        {{ limitValue.iharm6 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="7次谐波电流幅值限值(A)">
                        {{ limitValue.iharm7 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="8次谐波电流幅值限值(A)">
                        {{ limitValue.iharm8 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="9次谐波电流幅值限值(A)">
                        {{ limitValue.iharm9 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="10次谐波电流幅值限值(A)">
                        {{ limitValue.iharm10 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="11次谐波电流幅值限值(A)">
                        {{ limitValue.iharm11 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="12次谐波电流幅值限值(A)">
                        {{ limitValue.iharm12 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="13次谐波电流幅值限值(A)">
                        {{ limitValue.iharm13 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="14次谐波电流幅值限值(A)">
                        {{ limitValue.iharm14 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="15次谐波电流幅值限值(A)">
                        {{ limitValue.iharm15 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="16次谐波电流幅值限值(A)">
                        {{ limitValue.iharm16 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="17次谐波电流幅值限值(A)">
                        {{ limitValue.iharm17 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="18次谐波电流幅值限值(A)">
                        {{ limitValue.iharm18 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="19次谐波电流幅值限值(A)">
                        {{ limitValue.iharm19 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="20次谐波电流幅值限值(A)">
                        {{ limitValue.iharm20 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="21次谐波电流幅值限值(A)">
                        {{ limitValue.iharm21 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="22次谐波电流幅值限值(A)">
                        {{ limitValue.iharm22 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="23次谐波电流幅值限值(A)">
                        {{ limitValue.iharm23 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="24次谐波电流幅值限值(A)">
                        {{ limitValue.iharm24 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="25次谐波电流幅值限值(A)">
                        {{ limitValue.iharm25 }}
                    </el-descriptions-item>
                    <el-descriptions-item label="0.5-1.5次间谐波电压含有率限值(%)">
                        {{ limitValue.inUharm }}
                    </el-descriptions-item>
                    <el-descriptions-item label="2.5-15.5次谐波电压含有率限值(%)">
                        {{ limitValue.inUharm16 }}
                    </el-descriptions-item>
                </el-descriptions>
            </el-tab-pane>
        </el-tabs>
    </el-dialog>
</template>
<script lang="ts" setup>
import { ref, inject } from 'vue'
import { getLineOverLimitData, getLineDetailData } from '@/api/device-boot/line'
const dialogVisible = ref(false)
const title = ref('')
const activeName = ref('tab1')
const details: any = ref([])
const limitValue: any = ref([])
const open = (data: any) => {
    details.value = []
    limitValue.value = []
    activeName.value = 'tab1'
    title.value = data.name.replace(/（[^）]*）/g, '') + '_详情'

    getLineDetailData(data.id).then(res => {
        details.value = res.data
        res.data.objName ? (title.value = res.data.objName + '_' + title.value) : ''
    })
    getLineOverLimitData(data.id).then(res => {
        limitValue.value = res.data
    })

    dialogVisible.value = true
}
const handleClick = (tab: any, event: Event) => {}
defineExpose({ open })
</script>
<style lang="scss" scoped>
:deep(.el-upload-list__item) {
    width: 400px;
}
</style>
