<template>
    <div>
        <div class="coentent">
            <div class="contents-area">
                <div class="areas">
                    <div v-if="active==0">
                        <div class="headers">
                            <div class="headers-name">研发人员考勤情况</div>
                            <div>
                                <el-form :inline="true" :model="form" class="demo-form-inline">
                                    <el-form-item label="年度选择" size="small" style="position: relative;top: -3px;">
                                        <el-select v-model="form.year" placeholder="请选择" class="selects">
                                            <el-option v-for="item in yearOptions" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                   
                                   
                                    <el-form-item>
                                        <el-button type="primary" @click="btnDownload" size="small" class="tianjia">下载模版</el-button>
                                    </el-form-item>
                                </el-form>
                            </div>
                        </div>
                        <div class="content-table">
                            <el-table 
                                :data="tableData" 
                                :header-cell-style="{ background: '#EDEFFE', color: '#363636', textAlign: 'center' }"
                                :row-style="getRowStyle"
                                border 
                                style="width: 100%">
                                <el-table-column prop="month" label="月份" width="100" align="center"></el-table-column>
                                <el-table-column prop="personCount" label="人数"  align="center"></el-table-column>
                                <el-table-column prop="attendanceDays" label="合计在勤天数"  align="center"></el-table-column>
                                <el-table-column prop="businessTripDays" label="合计出差天数" align="center"></el-table-column>
                                <el-table-column prop="totalAttendanceDays" label="合计总出勤天数"  align="center"></el-table-column>
                                <el-table-column prop="leaveDays" label="合计请假天数"  align="center"></el-table-column>
                                <el-table-column prop="uploadStatus" label="上传情况"  align="center">
                                    <template slot-scope="scope">
                                        <span :class="scope.row.uploadStatus === '已上传' ? 'status-uploaded' : 'status-not-uploaded'">
                                            {{ scope.row.uploadStatus }}
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column fixed="right" label="操作" align="center" >
                                    <template slot-scope="scope">
                                        <el-button @click="handleDetail(scope.row)" type="text" size="small" style="color: #5165f7;">详情</el-button>
                                        <el-button @click="handleUpload(scope.row)" type="text" size="small" style="color: #5165f7;">上传</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
                            <div class="footer">
                                <el-pagination 
                                    @size-change="handleSizeChange" 
                                    @current-change="handleCurrentChange"
                                    :current-page="currentPage" 
                                    :page-sizes="[100, 200, 300, 400]" 
                                    :page-size="100"
                                    layout="total, sizes, prev, pager, next, jumper" 
                                    :total="400">
                                </el-pagination>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            active: 0,
            currentPage: 1,
            form: {
                year: '2025'
            },
            yearOptions: [
                {
                    value: '2023',
                    label: '2023'
                },
                {
                    value: '2024',
                    label: '2024'
                },
                {
                    value: '2025',
                    label: '2025'
                },
                {
                    value: '2026',
                    label: '2026'
                }
            ],
            tableData: [
                {
                    month: '一',
                    personCount: '30',
                    attendanceDays: '620',
                    businessTripDays: '12',
                    totalAttendanceDays: '632',
                    leaveDays: '5',
                    uploadStatus: '已上传'
                },
                {
                    month: '二',
                    personCount: '30',
                    attendanceDays: '660',
                    businessTripDays: '24',
                    totalAttendanceDays: '654',
                    leaveDays: '0',
                    uploadStatus: '已上传'
                },
                {
                    month: '三',
                    personCount: '30',
                    attendanceDays: '672',
                    businessTripDays: '28',
                    totalAttendanceDays: '643',
                    leaveDays: '0',
                    uploadStatus: '已上传'
                },
                {
                    month: '四',
                    personCount: '30',
                    attendanceDays: '620',
                    businessTripDays: '9',
                    totalAttendanceDays: '432',
                    leaveDays: '0',
                    uploadStatus: '已上传'
                },
                {
                    month: '五',
                    personCount: '30',
                    attendanceDays: '500',
                    businessTripDays: '12',
                    totalAttendanceDays: '500',
                    leaveDays: '3',
                    uploadStatus: '已上传'
                },
                {
                    month: '六',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                },
                {
                    month: '七',
                    personCount: '30',
                    attendanceDays: '620',
                    businessTripDays: '8',
                    totalAttendanceDays: '632',
                    leaveDays: '0',
                    uploadStatus: '已上传'
                },
                {
                    month: '八',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                },
                {
                    month: '九',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                },
                {
                    month: '十',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                },
                {
                    month: '十一',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                },
                {
                    month: '十二',
                    personCount: '-',
                    attendanceDays: '-',
                    businessTripDays: '-',
                    totalAttendanceDays: '-',
                    leaveDays: '-',
                    uploadStatus: '未上传'
                }
            ]
        }
    },
    methods: {
        getRowStyle({ row, rowIndex }) {
            return {}
        },
        handleDetail(row) {
            this.$router.push('/personnelEdint')
            // 跳转到详情页面
        },
        handleUpload(row) {
           // this.$router.push('/examstatusEdint')
            // 处理上传逻辑
        },
        btnDownload() {
            console.log('下载模版')
            // 处理下载模版逻辑
        },
        handleSizeChange() {
            // 处理分页大小变化
        },
        handleCurrentChange() {
            // 处理当前页变化
        }
    }
}
</script>
<style>
.el-tooltip__popper.is-dark {
    color: #F04B4B !important;
    background: #FCF1EB !important;
}

.el-tooltip__popper .popper__arrow {
    border-top-color: #FCF1EB !important;
    /* 上方箭头 */
}

.el-tooltip__popper .popper__arrow::after {
    border-top-color: #FCF1EB !important;
}

/* 其他方向的箭头（按需添加） */
.el-tooltip__popper[x-placement^='bottom'] .popper__arrow {
    border-bottom-color: #FCF1EB !important;
}

.el-tooltip__popper[x-placement^='left'] .popper__arrow {
    border-left-color: #FCF1EB !important;
}

.el-tooltip__popper[x-placement^='right'] .popper__arrow {
    border-right-color: #FCF1EB !important;
}
</style>
<style scoped>
.areas {
    padding-bottom: 15px;
    width: 97%;
    margin: 0 auto;
    padding-top: 20px;
}

.active {
    color: #5165f7 !important;
}

.heng {
    width: 20px;
    height: 6px;
    background: #5165f7;
    margin: 0 auto;
    margin-top: 6px;
}

.header-table {
    cursor: pointer;
}

.contentss-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    width: 150px;
}

.contentss {
    width: 97%;
    margin: 0 auto;
    padding-top: 12px;
}

.contents-area {
    width: 100%;
    background: white;
    margin-top: 20px;
}

.header-title {
    position: relative;
    top: 20px;
    left: 25px;
}

.numbers {
    position: relative;
    top: -7px;
    color: #2AB95F;
}

.number-name2 {
    margin-top: 8px;
    font-size: 14px;
    color: #979BBC;
}

.number-name {
    font-weight: bold;
    font-size: 25px;
    color: #17192C;
}

.header-names {
    display: flex;
    width: 82%;
    justify-content: space-between;
    margin: 0 auto;
    padding-top: 20px;
}



.header-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 97%;
    margin: 0 auto;
}

.content-header {
    width: 100%;
    background: white;
    padding-bottom: 22px;
}


.footer {
    display: flex;
    justify-content: end;
    margin-top: 20px;
}

.tianjia {
    position: relative;
    top: -9px;
    background-color: #5065F6;
}

.tianjia2 {
    position: relative;
    top: -9px;
    background-color: #EDEFFE;
    color: #5065F6;
}

::v-deep .el-table thead {
    background-color: #EDEFFE !important;
    color: #363636 !important;
}

::v-deep .el-table__header th {
    background-color: #EDEFFE !important;
    color: #363636 !important;
}


.formitem {
    position: relative;
    top: -5px;
}

::deep .el-form-item__label {
    font-size: 15px !important;
}

.selects {
    width: 100px;
    border: 1px solid #3333;
}

.headers-name {
    font-size: 15px;
    position: relative;
    top: 14px;
}

.headers {
    display: flex;
    justify-content: space-between;
}

.status-uploaded {
    color: #67C23A;
}

.status-not-uploaded {
    background: #F56C6C;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    display: inline-block;
}

::v-deep .el-table__body tr:hover > td {
    background-color: transparent !important;
}

::v-deep .el-table__body tr.el-table__row--striped td {
    background-color: transparent;
}
</style>

