<template>
    <el-tabs v-model="active" class="demo-tabs">

        <el-tab-pane label="项目人员" name="first-1">
            <myTable :baseData="baseData" v-if="active == 'first-1'" :project="project" editPath="project_personnel">
            </myTable>
        </el-tab-pane>
        <el-tab-pane label="劳动合同" name="first-2">
            <myTable :baseData="baseData5" v-if="active == 'first-2'" :project="project" editPath="project_labor_contract">
            </myTable>
        </el-tab-pane>
        <el-tab-pane label="保险记录" name="first-3">
            <myTable :baseData="baseData1" v-if="active == 'first-3'" :project="project"
                editPath="project_insurance_management"></myTable>
        </el-tab-pane>
        <el-tab-pane label="项目考勤" name="first-4">
            <myTable :baseData="baseData2" v-if="active == 'first-4'" :project="project"
                editPath="project_attendance_record"></myTable>
        </el-tab-pane>
        <el-tab-pane label="考勤明细" name="first-5">
            <myTable :baseData="baseData3" v-if="active == 'first-5'" :project="project"
                editPath="project_attendance_detail"></myTable>
        </el-tab-pane>
        <el-tab-pane label="工资付款" name="first-6">
            <myTable :baseData="baseData4" v-if="active == 'first-6'" :project="project" editPath="project_salary_payment">
            </myTable>
        </el-tab-pane>
    </el-tabs>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import myTable from "./myTable.vue"
import { projectpersonnelLists } from '@/api/project_personnel'
import { projectlaborcontractLists } from '@/api/project_labor_contract'
import { insurancemanagementLists } from '@/api/project_insurance_management'
import { attendanceRecordLists } from '@/api/project_attendance_record'
import { attendancedetailLists } from '@/api/project_attendance_detail'
import { projectsalaryDetailLists } from '@/api/project_salary_detail'

const active = ref('first-1')
const props = defineProps({
    project: Object
})

const baseData = reactive({
    fetchFun: projectpersonnelLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '姓名', prop: 'name' },
        { label: '身份证号', prop: 'idcard' },
        { label: '手机号', prop: 'mobile' },
        { label: '工种', prop: 'work_type_text' },
        { label: '人工单价', prop: 'unit_price' },
        { label: '每日生活费', prop: 'price' },
        { label: '期初收入', prop: 'opening_income' },
        { label: '日结收入', prop: 'daily_income' },
        { label: '完工量收入', prop: 'work_income' },
        { label: '总收入', prop: 'total_income' },
        { label: '总支出', prop: 'pay_out' },
        { label: '余额', prop: 'balance' },
    ]
})

const baseData1 = reactive({
    fetchFun: insurancemanagementLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目编码', prop: 'project_code' },
        { label: '项目名称', prop: 'project_name' },
        { label: '姓名', prop: 'person_name' },
        { label: '身份证号', prop: 'person_idcard' },
        { label: '投保日期', prop: 'insurance_date' },
        { label: '到期日期', prop: 'due_date' },
        { label: '保险种类', prop: 'type' },
        { label: '保单号', prop: 'insurance_no' },
        { label: '保费（元）', prop: 'insurance' },
        { label: '投保金额（万元）', prop: 'insured_amount' },
        { label: '保险公司', prop: 'insurance_company' },
        { label: '保单明细', prop: 'insurance_detail' },
        { label: '发票编号', prop: 'invoice_no' },
        { label: '经办人', prop: 'handler' },

    ]
})

const baseData2 = reactive({
    fetchFun: attendanceRecordLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '日记工单号', prop: 'attendance_code' },
        { label: '日期', prop: 'attendance_date' },
        { label: '出勤人数', prop: 'competitor_contacts_phone' },
        { label: '记工数量', prop: 'work_record_num_total' },
        { label: '日工资合计', prop: 'daily_salary_total' },
        { label: '日生活费合计', prop: 'daily_living_total' },
        { label: '日补贴合计', prop: 'daily_subsidy_total' },
        { label: '日其它合计', prop: 'daily_other_total' },
        { label: '日收入合计', prop: 'daily_income_total' },
        { label: '备注', prop: 'remark' },

    ]
})

const baseData3 = reactive({
    fetchFun: attendancedetailLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '日记工单号', prop: 'attendance_code' },
        { label: '日期', prop: 'attendance_date' },
        { label: '姓名', prop: 'person_name' },
        { label: '身份证号', prop: 'person_idcard' },
        { label: '工种', prop: 'work_type_text' },
        { label: '上班时间', prop: 'work_start_time' },
        { label: '下班时间', prop: 'work_end_time' },
        { label: '记工数量', prop: 'work_record_num' },
        { label: '日工资', prop: 'daily_salary' },
        { label: '日生活费', prop: 'daily_living' },
        { label: '日补贴', prop: 'daily_subsidy' },
        { label: '日其它', prop: 'daily_other' },
        { label: '日收入', prop: 'daily_income' },
        { label: '备注', prop: 'remark' },

    ]
})

const baseData4 = reactive({
    fetchFun: projectsalaryDetailLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '工资付款单号', prop: 'payment_code' },
        { label: '日期', prop: 'apply_date' },
        { label: '姓名', prop: 'person_name' },
        { label: '身份证号', prop: 'person_idcard' },
        { label: '工种', prop: 'person_work_type_text' },
        { label: '总收入', prop: 'total_income' },
        { label: '总支出', prop: 'total_pay_out' },
        { label: '未发放', prop: 'balance' },
        { label: '本次付款金额', prop: 'apply_amount' },
        { label: '备注', prop: 'remark' },

    ]
})

const baseData5 = reactive({
    fetchFun: projectlaborcontractLists,
    tit: "",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '项目名称', prop: 'project_name' },
        { label: '身份证号', prop: 'person_idcard' },
        { label: '合同状态', prop: 'contract_status_text' },
        { label: '合同类别', prop: 'contract_type_text' },
        { label: '合同名称', prop: 'contract_title_text' },
        { label: '合同签定日期', prop: 'signing_date' },
        { label: '起始时间', prop: 'start_date' },
        { label: '终止时间', prop: 'end_date' },
    ]
})

</script>