<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="客户名称" prop="name">
                    <el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入客户名称" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none" v-loading="pager.loading" shadow="never">
            <div class="mt-4">
                <el-table :data="pager.lists" @cell-click="handleCurrentChange">
                    <el-table-column label="序号" type="index" />
                    <el-table-column label="年份" property="years" />
                    <el-table-column label="一级科目" property="subject1" />
                    <el-table-column label="二级科目" property="subject2" />
                    <el-table-column label="一月" property="month1" />
                    <el-table-column label="二月" property="month2" />
                    <el-table-column label="三月" property="month3" />
                    <el-table-column label="四月" property="month4" />
                    <el-table-column label="五月" property="month5" />
                    <el-table-column label="六月" property="month6" />
                    <el-table-column label="七月" property="month7" />
                    <el-table-column label="八月" property="month8" />
                    <el-table-column label="九月" property="month9" />
                    <el-table-column label="十月" property="month10" />
                    <el-table-column label="十一月" property="month11" />
                    <el-table-column label="十二月" property="month12" />

                </el-table>

            </div>
            <div class="flex mt-4 justify-end">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>
  
<script lang="ts" setup>
import { usePaging } from "@/hooks/usePaging"
import { useDictData } from "@/hooks/useDictOptions"
import { apiCustomdetailDetail } from '@/api/cost_budget'
import { defineEmits } from "vue"

// 查询条件
const queryParams = reactive({
    name: ''
});


// 选中数据
const emits = defineEmits(["customEvent"]);

// 选中数据子父传递
const handleCurrentChange = (value: any) => {
    emits("customEvent", value);
};

// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiCustomdetailDetail,
    params: queryParams,
});

getLists();
</script>