<template>
    <div>
        <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="预算单号" prop="subpackage_budget_code" show-overflow-tooltip />
                    <el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
                    <el-table-column label="项目编码" prop="project_code" show-overflow-tooltip />
                    <el-table-column label="剩余预算工作量" prop="residue_num" show-overflow-tooltip />
                    <el-table-column label="预算总工作量" prop="total_num" show-overflow-tooltip />
                    <el-table-column label="预算总金额" prop="total_amount" show-overflow-tooltip />
                    <el-table-column label="备注" prop="remark" show-overflow-tooltip />
                </el-table>

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

const props = defineProps({
    project_id: Number
})
// 查询条件
const queryParams = reactive({
    // name: ''
    project_id: props.project_id
});

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

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

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

getLists();
</script>