<template>
    <el-container>
        <el-header>
            <div class="left-panel">
                <el-button type="primary" @click="handleAdd">新增</el-button>
            </div>
        </el-header>
        <el-main class="nopadding">
            <scTable
            ref="table"
            :apiObj="API.hrm.empneed.list"
            row-key="id"
            stripe
            :query="query"
            @row-click="(row)=>{t_id=row.id;mode='show';drawerVisible=true;}"
            >
            <el-table-column label="部门" prop="dept_need_name" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="入职日期" prop="join_date" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="审批状态" width="200" show-overflow-tooltip>
                <template #default="scope">
                                <el-tag :type="actStateEnum[scope.row.ticket_?.act_state]?.type">
                        {{ actStateEnum[scope.row.ticket_?.act_state]?.text }}
                    </el-tag>
            <el-tag type="info" effect="plain">{{ scope.row.ticket_?.state_.name }}</el-tag>

                </template>
            </el-table-column>
            </scTable>
        </el-main>
    </el-container>
    <el-drawer title="员工需求审核" v-model="drawerVisible" :size="'80%'" destroy-on-close>
        <empneed_form :mode="mode" :t_id="t_id"></empneed_form>
    </el-drawer>
</template>
<script setup>
import { ref } from 'vue'
import API from '@/api'
import empneed_form from './empneed_form.vue'
import { actStateEnum, interveneTypeEnum } from "@/utils/enum.js";
const query = ref({});
const drawerVisible = ref(false);
const mode = ref('add');
const t_id = ref(null);
const handleAdd = () => {
    mode.value = 'add';
    drawerVisible.value = true;
}
</script>