<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="客户名称" prop="custom_name">
                    <el-input class="w-[280px]" v-model="queryParams.custom_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="客户名称" prop="custom_name" show-overflow-tooltip />
                    <el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
                    <el-table-column label="标书编号" prop="bid_document_no" show-overflow-tooltip />
                    <el-table-column label="招标公司名称" width="120" prop="invite_tenders_company_name" show-overflow-tooltip />
                    <el-table-column label="投标公司名称" width="120" prop="bid_company_name" show-overflow-tooltip />
                    <el-table-column label="购买人员" prop="buyer" show-overflow-tooltip />
                    <el-table-column label="购买标书金额" width="120" prop="amount" show-overflow-tooltip />
                    <el-table-column label="招标项目资金来源" width="150" prop="bidding_project_fund_source" show-overflow-tooltip />
                    <el-table-column label="投标时间" prop="bidding_time" show-overflow-tooltip />
                    <el-table-column label="购买标书时间" prop="buy_date" width="120" show-overflow-tooltip />
                    <el-table-column label="招标方式" prop="bid_type" width="100" show-overflow-tooltip />
                    <el-table-column label="投标地址" prop="bid_address" show-overflow-tooltip width="100" />
                    <el-table-column label="是否需要保证金" prop="is_margin" show-overflow-tooltip />
                    <el-table-column label="保证金金额" prop="margin_amount" width="100" show-overflow-tooltip />
                    <!-- <el-table-column label="招标项目慨况" prop="bid_project_overview" show-overflow-tooltip />
                    <el-table-column label="项目简介" prop="project_desc" show-overflow-tooltip />
                    <el-table-column label="附件" prop="annex" 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 { apiBidBuyBiddingDocumentLists } from '@/api/bid_buy_bidding_document'
import { defineEmits } from "vue"
const props = defineProps({
    project_id: {
        type: String
    }
})

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

// 获取字典数据
const { dictData } = useDictData('construction_funds_sources,bidding_method,whether_status')
// 选中数据
const emits = defineEmits(["customEvent"]);

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

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

getLists();
</script>