<template>
    <div class="default-main">
        <TableHeader datePicker>
            <template v-slot:select>
                <el-form-item label="设备名称">
                    <el-input v-model="tableStore.table.params.searchValue" placeholder="请输入设备名称" />
                </el-form-item>
            </template>
        </TableHeader>
        <Table ref="tableRef" :isGroup="true" />
    </div>
</template>
<script setup lang="ts">
import { Plus } from '@element-plus/icons-vue'
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'

defineOptions({
    name: 'govern/log/debug'
})
const tableStore = new TableStore({
    url: '/cs-device-boot/process/queryPage',
    method: 'POST',
    column: [
        { title: '设备名称', field: 'devName', align: 'center' },
        { title: '操作用户', field: 'operatorName', align: 'center' },
        { title: '操作内容', field: 'processName', align: 'center', width: '300' },
        { title: '开始时间', field: 'startTime', align: 'center' },
        { title: '结束时间', field: 'endTime', align: 'center' }
    ],

    loadCallback: () => {
        tableStore.table.data.forEach((item: any) => {
            item.result = item.result === 1 ? '成功' : '失败'
            for (let key in item) {
                if (typeof item[key] !== 'number') {
                    item[key] = item[key] || '/'
                }
            }
        })
    }
})

provide('tableStore', tableStore)
tableStore.table.params.searchState = 0
tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = ''
tableStore.table.params.searchValue = ''
onMounted(() => {
    tableStore.index()
})

const addMenu = () => {}
</script>
