<template>
    <div>
        <div>
            <TableHeader area datePicker ref="TableHeaderRef" />
            <Table ref="tableRef" />
            <!-- 审核 -->

            <planAdd ref="planAddRef" @onsubmit="tableStore.index()" />
        </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 planAdd from './planAdd.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useDictData } from '@/stores/dictData'

const dictData = useDictData()

const TableHeaderRef = ref()
const planAddRef = ref()
const tableStore = new TableStore({
    url: '/process-boot/rGeneralSurveyPlan/queryPlanAudit',
    publicHeight: 65,
    method: 'POST',
    column: [
        { field: 'orgName', title: '所属单位' },
        { field: 'planNo', title: '普测计划编号' },
        { field: 'planName', title: '普测计划名称' },
        { field: 'planStartTime', title: '开始时间' },
        { field: 'planEndTime', title: '结束时间' },
        { field: 'subCount', title: '普测变电站数量' },
        {
            title: '操作',
            width: '120',
            render: 'buttons',
            buttons: [
                {
                    name: 'edit',
                    title: '审核',
                    type: 'primary',

                    icon: 'el-icon-Plus',
                    render: 'basicButton',
                    click: row => {
                        planAddRef.value.open('计划审核', row)
                    }
                }
            ]
        }
    ],

    beforeSearchFun: () => {
        tableStore.table.params.planStartTime = tableStore.table.params.searchBeginTime
        tableStore.table.params.planEndTime = tableStore.table.params.searchEndTime
        tableStore.table.params.orgNo = tableStore.table.params.deptIndex
        tableStore.table.params.currentPage = tableStore.table.params.pageNum
    }
})

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