<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 type="selection" width="55" />
                    <el-table-column label="序号" type="index" width="55" />
                    <el-table-column label="项目类型" prop="name" show-overflow-tooltip />
                    <el-table-column label="文档大类" prop="large_category" show-overflow-tooltip />
                    <el-table-column label="文档中类" prop="middle_category" show-overflow-tooltip />
                    <el-table-column label="文档小类" prop="small_category" show-overflow-tooltip />
                    <el-table-column label="文档名称" prop="name" show-overflow-tooltip />
                    <el-table-column label="文档描述" prop="describe" show-overflow-tooltip />
                    <el-table-column label="必传" show-overflow-tooltip>
                        <template #default="{ row }">

                            {{ row.is_upload == 1 ? '是' : '否' }}

                        </template>
                    </el-table-column>

                </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 { apiProjectdocumentLists } from '@/api/project_document_set'


import { defineEmits } from "vue"
import { timeFormat } from '@/utils/util'

// 查询条件
const queryParams = reactive({
    name: '',

});
const { dictData } = useDictData('')

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

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

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

});

getLists();
</script>