<template>
    <div>
        <div>
            <TableHeader area ref="TableHeaderRef">
                <template #select>
                    <el-form-item label="终端名称">
                        <el-select v-model="tableStore.table.params.searchState" placeholder="请选择终端名称">
                            <el-option
                                v-for="item in uploadData"
                                :key="item.id"
                                :label="item.label"
                                :value="item.id"
                            ></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="生产厂家">
                        <el-select v-model="tableStore.table.params.searchStat1e" placeholder="请选择生产厂家">
                            <el-option
                                v-for="item in uploadData"
                                :key="item.id"
                                :label="item.label"
                                :value="item.id"
                            ></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="检测结果">
                        <el-select v-model="tableStore.table.params.searchState3" placeholder="请输入检测结果">
                            <el-option
                                v-for="item in uploadData"
                                :key="item.id"
                                :label="item.label"
                                :value="item.id"
                            ></el-option>
                        </el-select>
                    </el-form-item>
                </template>
                <template #operation>
                    <el-button icon="el-icon-Download" type="primary">导出</el-button>
                    <el-button icon="el-icon-Upload" type="primary">上传检测报告</el-button>
                </template>
            </TableHeader>
            <Table ref="tableRef" />
        </div>
    </div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { mainHeight } from '@/utils/layout'
import { useDictData } from '@/stores/dictData'
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'

const dictData = useDictData()
const uploadData = [
    {
        id: 0,

        label: '未上传'
    },
    {
        id: 1,

        label: '已上传'
    }
]

const dialogVisible = ref(false)
const TableHeaderRef = ref()
const title = ref('')

const ruleFormRef = ref()
const tableStore = new TableStore({
    url: '/system-boot/area/areaSelect',
    publicHeight: 85,
    method: 'POST',
    column: [
        { width: '60', type: 'checkbox' },
       
        { field: 'id', title: '终端编号' },
        { field: 'name', title: '上产厂家' },
        { field: 'orgName', title: '安装位置' },
        { field: 'inspectionUnit', title: '送检单位' },
        { field: 'testResults', title: '检测结果' },
        { field: 'nextInspectionTime', title: '下次监测时间' },
        {
            title: '操作',
            width: '180',
            render: 'buttons',
            fixed: 'right',
            buttons: [
                {
                    name: 'edit',
                    title: '下载原始数据报告',
                    type: 'primary',
                    icon: 'el-icon-EditPen',
                    render: 'basicButton',
                    disabled: row => {
                        return row.originalReport == null
                    },
                    click: row => {}
                },
                {
                    name: 'edit',
                    title: '下载检测报告',
                    type: 'primary',
                    icon: 'el-icon-EditPen',
                    render: 'basicButton',
                    disabled: row => {
                        return row.inspectionReport == null
                    },
                    click: row => {}
                }
            ]
        }
    ],

    loadCallback: () => {
        tableStore.table.data = [
            {
                status: 2
            }
        ]
    }
})

tableStore.table.params.searchState = ''
tableStore.table.params.searchValue = ''
tableStore.table.params.type = ''

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