<template>
    <div>
        <!-- <el-card class="!border-none" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="查询" prop="project_name">
                    <el-input class="w-[280px]" v-model="queryParams.project_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="序号" property="name" />
                    <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="project_role_name" show-overflow-tooltip />
                    <el-table-column label="人员" prop="admin_name" show-overflow-tooltip />
                    <el-table-column label="工时单价" prop="working_unit_price" 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 { listToProject } from '@/api/project_member'
import { defineEmits } from "vue"
const props = defineProps({
    project_id: {
        type: String
    }
})

// console.log(props.project_id)
// 查询条件
const queryParams = reactive({
    project_id: props.project_id,

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


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

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

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

getLists();
</script>