<template>
    <TableHeader datePicker ref="refheader" showExport>
        <template v-slot:select>
            <el-form-item label="关键词">
                <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入前置服务器名称，ip" />
            </el-form-item>

        </template>
    </TableHeader>
    <!-- <div style="height: 300px;"> -->
    <Table ref="tableRef" :isGroup="true" />
    <!-- </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 TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout'

const props = defineProps(['deviceTree'])

const refheader = ref()

const tableStore = new TableStore({
    url: '/cs-harmonic-boot/eventUser/frontWarnInfo',
    method: 'POST',
    exportName: '前置告警',
    publicHeight: 65,
    column: [
        {
            title: '序号',
            width: 80,
            formatter: (row: any) => {
                return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
            }
        },
        { title: '前置服务器名称', field: 'lineId', align: 'center' ,minWidth: 120 },
        { title: '前置服务器ip', field: 'wavePath', align: 'center' ,minWidth: 100 },
        { title: '进程号', field: 'clDid', align: 'center',minWidth: 60  },
        { title: '发生时刻', field: 'startTime', align: 'center', minWidth: 180, sortable: true },
       
        {
            title: '事件描述',
            field: 'tag',
            minWidth: 350
        },
         {
            title: '告警代码',
            field: 'code',
            align: 'center',minWidth: 100 ,
            

            formatter: (row: any) => {
                 return row.cellValue ? '\u200B' + row.cellValue : '/'
            },
            sortable: true
        },

    ],
    beforeSearchFun: () => {}
})

provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => {
    if (item.children.length == 0) {
        deviceTreeOptions.value.splice(index, 1)
    }
})

onMounted(() => {
    tableStore.index()
})
setTimeout(() => {
    // tableStore.table.height = mainHeight(200).height as any
}, 0)

</script>
<style></style>
