
<template>
    <div class="detail-popup">
        <popup ref="popupRef" title="考勤记录" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
            <el-form ref="formRef" :model="formData">
                <div style="margin-bottom: 30px;font-size: 16px;">{{ formData.attendance_code }}</div>
                <div style="margin-bottom: 30px;font-size: 16px;">{{ formData.attendance_date }}</div>
                <el-card class="mb-2">
                    <el-table :data="formData.attendance_detail">
                        <el-table-column label="姓名" prop="name" show-overflow-tooltip />
                        <el-table-column label="姓名" prop="idcard" show-overflow-tooltip />
                        <el-table-column label="工种" prop="work_type_text" show-overflow-tooltip />
                        <el-table-column label="工作开始时间" prop="work_start_time" show-overflow-tooltip />
                        <el-table-column label="工作结束时间" prop="work_end_time" show-overflow-tooltip />
                        <el-table-column label="记工数量" prop="work_record_num" show-overflow-tooltip />
                        <el-table-column label="日工资" prop="daily_salary" show-overflow-tooltip />
                        <el-table-column label="日生活费" prop="daily_living" show-overflow-tooltip />
                        <el-table-column label="日补贴" prop="daily_subsidy" show-overflow-tooltip />
                        <el-table-column label="日其它" prop="daily_other" show-overflow-tooltip />
                        <el-table-column label="日收入" prop="daily_income" show-overflow-tooltip />
                        <el-table-column label="备注" prop="invoice_no" show-overflow-tooltip />

                    </el-table>

                </el-card>
            </el-form>
        </popup>
    </div>
</template>

<script lang="ts" setup name="customdetail">

import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCustomDetail } from '@/api/custom'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
    dictData: {
        type: Object as PropType<Record<string, any[]>>,
        default: () => ({})
    }
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const formDataannex = reactive([])


const datas = reactive({
    provinceOptions: [],
    cityOptions: [],
    areaOptions: [],
});


// 表单数据
const formData = reactive({

})



// 获取详情
const setFormData = async (data: Record<any, any>) => {
    Object.assign(formData, data)
    if (data.annex && data.annex.length > 0) {

        const arry1 = data.annex.map((item: any, index: any) => {
            return {
                name: `文件${index + 1}`,
                uri: item
            };
        });
        Object.assign(formDataannex, arry1)


    }


}

const getDetail = async (row: Record<string, any>) => {
    const data = await apiCustomDetail({
        id: row.id
    })
    setFormData(data)
}


// 提交按钮
const handleSubmit = async () => {
    popupRef.value?.close()

}

//打开弹窗
const open = () => {
    console.log('1111111')
    popupRef.value?.open()
}

// 关闭回调
const handleClose = () => {
    emit('close')
}








defineExpose({
    open,
    setFormData,
    getDetail
})
</script>
<style lang="scss" scoped>
.tit {
    font-size: 1.2em;
    margin-bottom: 10px;
}

:deep(.my-label) {
    width: 150px;
}
</style>
