<template>
    <div>
        <el-card class="!border-none mb-4" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="提交人" prop="commitor">
                    <el-input class="w-[280px]" v-model="queryParams.commitor" clearable placeholder="请输入提交人" />
                </el-form-item>
                <el-form-item label="发票编号" prop="invoice_no">
                    <el-input class="w-[280px]" v-model="queryParams.invoice_no" clearable placeholder="请输入发票编号" />
                </el-form-item>
                <el-form-item label="发票类型" prop="invoice_type">
                    <el-select class="w-[280px]" v-model="queryParams.invoice_type" clearable placeholder="请选择发票类型">

                        <el-option v-for="(item, index) in dictData.invoice_type" :key="index" :label="item.name" :value="item.value" />
                    </el-select>
                </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" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" />
                    <el-table-column label="序号" type="index" width="55" />
                    <el-table-column label="合同编号" prop="contract_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="supplier_name" show-overflow-tooltip />
                    <el-table-column label="签订日期" prop="supplier_name" show-overflow-tooltip />
                    <el-table-column label="实际合同金额" prop="apply_date" show-overflow-tooltip />
                    <el-table-column label="已付款金额" prop="applier" show-overflow-tooltip />
                    <el-table-column label="已开票金额" prop="payment_amount" show-overflow-tooltip />
                    <el-table-column label="收票未付款" prop="invoice_amount" show-overflow-tooltip />
                    <el-table-column label="付款未收票" prop="amount_excluding_tax" 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 name="projectLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { adminpaymentsLists, adminpaymentsDelete, adminpaymentsDetail } from '@/api/administrativePayments'
import { timeFormat } from '@/utils/util'

import feedback from '@/utils/feedback'




// 查询条件
const queryParams = reactive({
    commitor: '',
    invoice_no: '',
    invoice_type: '',

})



// 选中数据
const selectData = ref<any[]>([])

// 表格选择后回调事件
const handleSelectionChange = (val: any[]) => {
    selectData.value = val.map(({ id }) => id)
}

// 获取字典数据
const { dictData } = useDictData('pay_type')
// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: adminpaymentsLists,
    params: queryParams
})



getLists()
</script>
