<template>
    <el-dialog v-model="dialogVisible" title="频率_额定工作条件下的检测_详情" v-bind="dialogBig">
        <!-- <el-descriptions :column="5" border>
            <el-descriptions-item label="脚本名称">测试</el-descriptions-item>
            <el-descriptions-item label="参照标准名称">GBT 19862</el-descriptions-item>
            <el-descriptions-item label="标准推行年份">2025</el-descriptions-item>
            <el-descriptions-item label="模板类型">模版</el-descriptions-item>
            <el-descriptions-item label="值类型">相对值</el-descriptions-item>
        </el-descriptions> -->
        <!-- tableData?.channelList -->
        <el-tabs type="border-card">
            <el-tab-pane :label="`L${item}`" v-for="item in 3">
                <div class="tabPane">
                    <el-descriptions :column="4" border>
                        <el-descriptions-item label-align="right" label="电压有效值(%)">
                            {{
                                tableData?.channelList[item * 2 - 2].famp == null
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 2].famp
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="电压相角(°)">
                            {{
                                tableData?.channelList[item * 2 - 2].fphase
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 2].fphase
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="电流有效值(%)">
                            {{
                                tableData?.channelList[item * 2 - 1].famp == null
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 1].famp
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="电流相角(°)">
                            {{
                                tableData?.channelList[item * 2 - 1].fphase == null
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 1].fphase
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="变动频度(次/min)">
                            {{ tableData?.channelList[item * 2 - 2].flickerData.fchagFre || '/' }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="变动量(%)">
                            {{ tableData?.channelList[item * 2 - 2].flickerData.fchagValue || '/' }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="波类型">
                            {{
                                tableData?.channelList[item * 2 - 2].flickerData.fchagValue == ''
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 2].flickerData.waveFluType
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="占空比(%)">
                            {{
                                tableData?.channelList[item * 2 - 2].flickerData.fchagValue == ''
                                    ? '/'
                                    : tableData?.channelList[item * 2 - 2].flickerData.fdutyCycle
                            }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="设定幅度(%)">
                            {{ tableData?.channelList[item * 2 - 2].dipData.ftransValue || '/' }}
                        </el-descriptions-item>
                        <el-descriptions-item label-align="right" label="持续时间(s)">
                            {{ tableData?.channelList[item * 2 - 2].dipData.retainTime || '/' }}
                        </el-descriptions-item>
                    </el-descriptions>
                    <!-- <el-descriptions :column="3" title="谐波电压" border class="mt10">
                        <div v-for="k in tableData?.channelList[item * 2 - 2].harmList">
                            <el-descriptions-item label-align="right" label="次数">{{ k.harm }}</el-descriptions-item>
                            <el-descriptions-item label-align="right" label="谐波含有率(%)">{{k.famp}}</el-descriptions-item>
                            <el-descriptions-item label-align="right" label="谐波相角(°)">{{k.fphase}}</el-descriptions-item>
                        </div>
                    </el-descriptions>
                    <el-descriptions :column="3" title="谐波电流" border class="mt10">
                         <div v-for="k in tableData?.channelList[item * 2 - 2].harmList">
                            <el-descriptions-item label-align="right" label="次数">{{ k.harm }}</el-descriptions-item>
                            <el-descriptions-item label-align="right" label="谐波含有率(%)">{{k.famp}}</el-descriptions-item>
                            <el-descriptions-item label-align="right" label="谐波相角(°)">{{k.fphase}}</el-descriptions-item>
                        </div>
                    </el-descriptions> -->
                    <div style="display: flex" class="mt10">
                        <el-tabs type="border-card" style="flex: 1">
                            <el-tab-pane label="谐波电压">
                                <el-table
                                    :data="tableData?.channelList[item * 2 - 2].harmList"
                                    border
                                    size="small"
                                    :header-cell-style="{
                                        textAlign: 'center',
                                        backgroundColor: '#003078',
                                        color: '#fff'
                                    }"
                                    stripe
                                    :cell-style="{ textAlign: 'center' }"
                                    height="250px"
                                >
                                    <el-table-column prop="harm" label="次数" />
                                    <el-table-column prop="famp" label="谐波含有率(%)" />
                                    <el-table-column prop="fphase" label="谐波相角(°)" />
                                </el-table>
                            </el-tab-pane>
                        </el-tabs>
                        <el-tabs type="border-card" class="ml10" style="flex: 1">
                            <el-tab-pane label="谐波电流">
                                <el-table
                                    :data="tableData?.channelList[item * 2 - 1].harmList"
                                    border
                                    size="small"
                                    :header-cell-style="{
                                        textAlign: 'center',
                                        backgroundColor: '#003078',
                                        color: '#fff'
                                    }"
                                    stripe
                                    :cell-style="{ textAlign: 'center' }"
                                    height="250px"
                                >
                                    <el-table-column prop="harm" label="次数" />
                                    <el-table-column prop="famp" label="谐波含有率(%)" />
                                    <el-table-column prop="fphase" label="谐波相角(°)" />
                                </el-table>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                    <div style="display: flex" class="mt10">
                        <el-tabs type="border-card" style="flex: 1">
                            <el-tab-pane label="间谐波电压">
                                <el-table
                                    :data="tableData1"
                                    border
                                    size="small"
                                    :header-cell-style="{
                                        textAlign: 'center',
                                        backgroundColor: '#003078',
                                        color: '#fff'
                                    }"
                                    stripe
                                    :cell-style="{ textAlign: 'center' }"
                                    height="250px"
                                >
                                    <el-table-column prop="name" label="次数" />
                                    <el-table-column prop="value" label="间谐波含有率(%)" />
                                    <el-table-column prop="errorFlag" label="间谐波相角(°)" />
                                </el-table>
                            </el-tab-pane>
                        </el-tabs>
                        <el-tabs type="border-card" class="ml10" style="flex: 1">
                            <el-tab-pane label="间谐波电流">
                                <el-table
                                    :data="tableData1"
                                    border
                                    size="small"
                                    :header-cell-style="{
                                        textAlign: 'center',
                                        backgroundColor: '#003078',
                                        color: '#fff'
                                    }"
                                    stripe
                                    :cell-style="{ textAlign: 'center' }"
                                    height="250px"
                                >
                                    <el-table-column prop="name" label="次数" />
                                    <el-table-column prop="value" label="间谐波含有率(%)" />
                                    <el-table-column prop="errorFlag" label="间谐波相角(°)" />
                                </el-table>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                </div>
            </el-tab-pane>

            <el-tab-pane label="参考设定值列表">L3</el-tab-pane>
        </el-tabs>
    </el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { dialogBig } from '@/utils/elementBind'
const dialogVisible = ref(false)

const tableData: any = ref({})
const open = (row: any) => {
    console.log('🚀 ~ open ~ row:', row)
    tableData.value = row
    dialogVisible.value = true
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
:deep(.el-descriptions__cell) {
    width: 12.5%;
}
:deep(.tabPane) {
    height: 550px;
    overflow-y: auto;
}
</style>
