<template>
    <div class="default-main">

        <TableHeader date-picker area showExport>
            <template #select>
                <!-- <el-form-item label="统计类型:">
                    <el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">
                        <el-option v-for="item in classificationData" :key="item.id" :label="item.name" :value="item">
                        </el-option>
                    </el-select>
                </el-form-item> -->
                <el-form-item label="电压等级">
                    <el-select v-model="tableStore.table.params.scale" filterable multiple collapse-tags clearable
                        placeholder="请选择电压等级" value-key="id">
                        <el-option v-for="item in voltageleveloption" :key="item.id" :label="item.name" :value="item">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="终端厂家">
                    <el-select v-model="tableStore.table.params.manufacturer" filterable multiple collapse-tags
                        clearable placeholder="请选择终端厂家" value-key="id">
                        <el-option v-for="item in terminaloption" :key="item.id" :label="item.name" :value="item">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="干扰源类型">
                    <el-select v-model="tableStore.table.params.loadType" filterable multiple collapse-tags clearable
                        placeholder="请选择干扰源类型" value-key="id">
                        <el-option v-for="item in interfereoption" :key="item.id" :label="item.name" :value="item">
                        </el-option>
                    </el-select>
                </el-form-item>


            </template>

        </TableHeader>
        <Table ref="tableRef" isGroup />



    </div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData'
import TableHeader from '@/components/table/header/index.vue'
const dictData = useDictData()
defineOptions({
    name: 'harmonic-boot/detailedAnalysis/station'
})
const view = ref(true)
const classificationData = dictData.getBasicData('Statistical_Type', ["Report_Type"])
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const terminaloption = dictData.getBasicData('Dev_Manufacturers')
const interfereoption = dictData.getBasicData('Interference_Source')


const tableStore = new TableStore({
    url: '/harmonic-boot/detailAnalysis/warnSubstationDetail',
    method: 'POST',
    column: [
        {
            field: 'index',
            title: '序号',
            width: '80',
            formatter: (row: any) => {
                return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
            }
        },
        { field: 'provinceCompany', title: '地级区', minWidth: "100px", },
        { field: 'cityCompany', title: '地区公司', minWidth: "100px", },
        { field: 'plantName', title: '变电站名称', minWidth: "180px", },
        { field: 'plantVoltageLevel', title: '电压等级', minWidth: "100px", },
        { field: 'onlineMonitorCounts', title: '在线监测点数量(个)', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "90px", },
        { field: 'alertMonitorCounts', title: '告警监测点数量(个)', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "90px", },
        { field: 'alertCounts', title: '告警次数', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
        { field: 'alertAlarmFrequency', title: '告警频次(次/点)', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "90px", },
        {
            title: '各项稳态指标告警频次(次/点)', children: [
                { field: 'frequencyDeviation', title: '频率偏差', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'voltageDeviation', title: '电压偏差', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'harmonicVoltage', title: '谐波电压', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'harmonicCurrent', title: '谐波电流', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'threePhaseVoltageUnbalance', title: '三相电压不平衡度', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "130px", },
                { field: 'flicker', title: '闪变', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'negative', title: '负序电流', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'interHarmonic', title: '间谐波电压', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
            ]
        }, {
            title: '各项暂态指标告警频次(次/点)', children: [
                { field: 'shortInterruption', title: '短时中断', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'voltageDip', title: '电压暂降', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
                { field: 'voltageSwell', title: '电压暂升', formatter: (row: any) => { return row.cellValue == -1 ? '/' : row.cellValue }, minWidth: "80px", },
            ]
        },


    ],

    loadCallback: () => {

    }
})
tableStore.table.params.statisticalType = classificationData[0]
tableStore.table.params.powerFlag = 2
tableStore.table.params.monitorFlag = 2
tableStore.table.params.scale = []
tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = []
const wp = ref({})

provide('tableStore', tableStore)
onMounted(() => {
    tableStore.index()
})





</script>
