<template>
    <div>

        <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="payment_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="apply_date" show-overflow-tooltip />
                    <el-table-column label="姓名" prop="person_name" show-overflow-tooltip />
                    <el-table-column label="身份证号" prop="person_idcard" show-overflow-tooltip />
                    <el-table-column label="工种" prop="person_work_type_text" show-overflow-tooltip />
                    <el-table-column label="总收入" prop="total_income" show-overflow-tooltip />
                    <el-table-column label="总支出" prop="total_pay_out" show-overflow-tooltip />
                    <el-table-column label="未发放" prop="balance" show-overflow-tooltip />
                    <el-table-column label="本次申请付款金额" prop="apply_amount" show-overflow-tooltip />
                    <el-table-column label="备注" prop="remark" show-overflow-tooltip />
                    <!-- <el-table-column label="银行卡号" prop="handler" 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 name="projectLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { projectsalaryDetailLists } from '@/api/project_salary_detail'
import { timeFormat } from '@/utils/util'
import { getAllProjectTypes } from '@/api/projecttype'
const protype = reactive([])
import feedback from '@/utils/feedback'
// import EditPopup from './edit.vue'
// import DetailPopup from './detail.vue'
// const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
// const editRef = shallowRef<InstanceType<typeof EditPopup>>()
// // 是否显示编辑框
// const showEdit = ref(false)
// const showDtail = ref(false)

// 查询条件
const queryParams = reactive({
    type: '',
    insurance_no: '',
    insurance_company: '',
    invoice_no: '',
    handler: '',

})



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

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

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

// // 添加
// const handleAdd = async () => {
//     showEdit.value = true
//     await nextTick()
//     editRef.value?.open('add')
// }


// // 编辑
// const handleEdit = async (data: any) => {
//     console.log(data.id)
//     let res = await projectsalaryDetailDetail({ id: data.id })
//     showEdit.value = true
//     await nextTick()
//     editRef.value?.open('edit')
//     editRef.value?.setFormData(res)
// }

// // 删除
// const handleDelete = async (id: number | any[]) => {
//     await feedback.confirm('确定要删除？')
//     await projectsalaryDetailDelete({ id })
//     getLists()
// }
// const handledetail = async (data: any) => {
//     let res = await projectsalaryDetailDetail({ id: data.id })
//     showDtail.value = true
//     await nextTick()
//     detailRef.value?.open()
//     detailRef.value?.setFormData(res)
// }


getLists()
</script>

