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

        <TableHeader area>
            <template #select>
 <el-form-item label="监测点性质:">
                    <el-select v-model="tableStore.table.params.powerFlag" filterable multiple collapse-tags clearable
                        placeholder="请选择监测点性质">
                        <el-option v-for="item in terminalstatus" :key="item.value" :label="item.label"
                            :value="item.value">
                        </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>




                <el-form-item label="上报类型:">
                    <el-select v-model="tableStore.table.params.monitorFlag" filterable multiple collapse-tags clearable
                        placeholder="请选择上报类型">
                        <el-option v-for="item in communicationstatus" :key="item.value" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>


            </template>

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



    </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/run/devicemessage'
})
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 communicationstatus = [
    { value: 2, label: "全部" },
    { value: 1, label: "灿能上报" },
    { value: 0, label: "非灿能上报" },
]
//终端状态
const terminalstatus = [
    { value: 2, label: "全部" },
    { value: 1, label: "非电网侧" },
    { value: 0, label: "电网侧" },
]


const tableStore = new TableStore({
    url: '/device-boot/runManage/getTerminalLedger',
    method: 'POST',
    isWebPaging: true,
    column: [
        {
            field: 'index',
            title: '序号',
            width: '80',
            formatter: (row: any) => {
                return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
            }
        },
        { field: 'areaName', title: '区域' },
        { field: 'gdName', title: '地级区' },
        {
            field: 'bdName',
            title: '供电公司',
            minWidth: 100
        },
        { field: 'objName', title: '监测点对象名称', minWidth: 240 },
        { field: 'manufacturer', title: '厂家', minWidth: 100 },
        { field: 'scale', title: '电压等级', minWidth: 100 },
        { field: 'businessType', title: '行业类型', minWidth: 100 },

        { field: 'devName', title: '终端名称', minWidth: 80 },
        { field: 'ip', title: '网络参数', minWidth: 100 },
        { field: 'lineName', title: '监测点名称', minWidth: 100 },
        { field: 'loadType', title: '干扰源类型', minWidth: 100 },


    ],

    loadCallback: () => {
        tableStore.table.data.map((item: any) => {
            item.onlineEvaluate == 3.14159 ? item.onlineEvaluate = '/' : item.onlineEvaluate <= 0.6 ? item.onlineEvaluate = '差' : item.onlineEvaluate <= 0.9 ? item.onlineEvaluate = '良' : item.onlineEvaluate <= 1 ? item.onlineEvaluate = '优' : '/'
        })
    }
})
tableStore.table.params.statisticalType = classificationData[0]
tableStore.table.params.serverName = "harmonic-boot"
tableStore.table.params.monitorFlag = 2
tableStore.table.params.powerFlag = '2'
tableStore.table.params.evaluate = ''
tableStore.table.params.powerFlag = 2

tableStore.table.params.scale = []
tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = []
const wp = ref({})

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





</script>
