<template>
    <el-dialog v-model="dialogVisible" draggable title="完整性不足详情" width="1000">
        <TableHeader :showReset="false" ref="TableHeaderRef" showCustomColumn>
            <template #select>
                <el-form-item label="筛选数据">
                    <el-input v-model="tableStore.table.params.searchValue" clearable placeholder="请输入关键字" />
                </el-form-item>
            </template>
            <template #operation>
                <!-- <el-button type="primary" icon="el-icon-Plus">新增</el-button> -->
                <!-- <back-component /> -->
            </template>
        </TableHeader>
        <Table ref="tableRef"></Table>
    </el-dialog>
</template>
<script setup lang="ts">
import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue'
import Table from '@/components/table/index.vue'
import { mainHeight } from '@/utils/layout'
import { ref, reactive } from 'vue'
const num = ref(0)
const dialogVisible = ref(false)
const tableStore = new TableStore({
    url: '/advance-boot/responsibility/userDataIntegrityList',
    method: 'POST',
    publicHeight: 547,
    column: [
        { title: '序号', field: 'index', width: 80, formatter: (row: any) => {
            return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
        }
        },
        { title: '数据名', field: 'name' },
        { title: '用户名', field: 'userName' },
        { title: '测量点局号', field: 'lineNo' },
        { title: '日期', field: 'updateTime' },
        {
            title: '完整性(%)',
            field: 'integrity',
            formatter: (row: any) => {
                return Math.floor(row.cellValue * 10000) / 100
            }
        }
    ],
    loadCallback: () => {
        setTimeout(() => {
            tableStore.table.height = mainHeight(0, 2).height as any
            // console.log("🚀 ~ setTimeout ~  tableStore.table.height:", tableStore.table.height)
        }, 0)
        //   setTimeout(() => {  tableStore.table.height = 'calc((100vh) / 2)'}, 1000)
    }
})

provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
const open = (id: string) => {
    tableStore.table.params.userDataId = id
    dialogVisible.value = true

    tableStore.index()
}

defineExpose({ open })
</script>
<style lang="scss" scoped></style>
