<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.transfer.list"
            row-key="id"
            stripe
            :query="query"
            @row-click="(row)=>{t_id=row.id;mode='show';drawerVisible=true;}"
            >
            <el-table-column label="员工" prop="employee_name" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="岗位" prop="post_name" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="原部门" prop="original_dept" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="入职部门" prop="new_dept" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="跨部门调动" prop="is_change" width="80" show-overflow-tooltip>
                <template #default="scope">
                    {{scope.row.is_change?'是':'否'}}
                </template>
            </el-table-column>
            <el-table-column label="跨部门调动" prop="is_change" width="80" show-overflow-tooltip>
                <template #default="scope">
                    {{scope.row.is_promotion?'是':'否'}}
                </template>
            </el-table-column>
            <el-table-column label="原岗位" prop="original_post" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="入职岗位" prop="new_post" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="调岗日期" prop="transfer_date" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="个人工作内容" prop="content" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="调岗原因" prop="transfer_reason" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="调岗日期" prop="transfer_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>
        <transfer_form :mode="mode" :t_id="t_id"></transfer_form>
    </el-drawer>
</template>
<script setup>
import { ref } from 'vue'
import API from '@/api'
import transfer_form from './transfer_form.vue'
import { actStateEnum } 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>