<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" width="55" />
                    <el-table-column label="材料大类" prop="material_first_level" show-overflow-tooltip />
                    <el-table-column label="材料中类" prop="material_second_level" show-overflow-tooltip />
                    <el-table-column label="材料小类" prop="material_three_level" show-overflow-tooltip />
                    <el-table-column label="材料名称" prop="material_name" show-overflow-tooltip />
                    <el-table-column label="材料编码" prop="material_code" show-overflow-tooltip />
                    <el-table-column label="规格型号" prop="material_specs" show-overflow-tooltip />
                    <el-table-column label="品牌" prop="material_brand" show-overflow-tooltip />
                    <el-table-column label="参数说明" prop="material_parameter_description" show-overflow-tooltip />
                    <el-table-column label="单位" prop="material_unit" show-overflow-tooltip />
                    <el-table-column label="申请数量" prop="apply_num" show-overflow-tooltip />
                    <el-table-column label="预算数量" prop="num" show-overflow-tooltip />
                    <el-table-column label="剩余预算数量" prop="residual_num" show-overflow-tooltip />
                    <el-table-column label="备注" prop="remark" show-overflow-tooltip />
                </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 { MaterialbudgetDetailLists } from '@/api/project_material_budget_detail'


import { defineEmits } from "vue"
import { timeFormat } from '@/utils/util'
const props = defineProps({
    project_id: {
        type: String
    }
})
// 查询条件
const queryParams = reactive({


    project_id: props.project_id
});
const { dictData } = useDictData('')

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

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

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

});

getLists();
</script>