123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <script setup lang="ts">
- import { ElMessage } from 'element-plus'
- import { GlobalStore } from '@/stores/index'
- import { getFormatDuration } from '@/utils/common'
- import { UserFilled } from '@element-plus/icons-vue'
- import TableBase from '@/components/TableBase/index.vue'
- import { ref, nextTick, onMounted, onUnmounted } from 'vue'
- import { ColumnProps } from '@/components/TableBase/interface/index'
- import { Leave_List, Leave_Approval } from '@/api/workAttendance/index'
- const TableRef = ref()
- const globalStore = GlobalStore()
- const columns: ColumnProps[] = [{ prop: 'T_user_name', label: '姓名', name: 'T_user_name' }]
- interface UserInfoIn {
- T_user_name: string
- T_dept: string
- T_post: string
- T_type_name: string
- T_start_time: string
- T_end_time: string
- T_text: string
- Id: string
- T_duration: number
- }
- const userInfo = ref<UserInfoIn>({
- T_user_name: '',
- T_dept: '',
- T_post: '',
- T_type_name: '',
- T_start_time: '',
- T_end_time: '',
- T_text: '',
- Id: '',
- T_duration: 0
- })
- const initParam = {
- User_tokey: globalStore.GET_User_tokey
- }
- const getSalaryParams = (row: any) => {
- userInfo.value = { ...row }
- }
- const LeaveUser = async (T_State: number) => {
- if (!userInfo.value.Id) return
- const params = {
- User_tokey: globalStore.GET_User_tokey,
- T_id: userInfo.value.Id,
- T_State
- }
- const res: any = await Leave_Approval(params)
- if (res.Code === 200) {
- if (T_State) {
- ElMessage.success('审核通过!')
- } else {
- ElMessage.warning('审核不通过!')
- }
- TableRef.value.getTableList()
- userInfo.value = {} as UserInfoIn
- }
- }
- let cardHeight = ref(0)
- const resize = () => {
- const height = document.documentElement.clientHeight
- cardHeight.value = height - 3 * 12 - 140 - 60
- }
- onMounted(() => {
- resize()
- window.onresize = resize
- })
- onUnmounted(() => {
- window.onresize = null
- })
- </script>
- <template>
- <div class="Leave">
- <div style="width: 290px">
- <TableBase
- ref="TableRef"
- :columns="columns"
- :requestApi="Leave_List"
- :initParam="initParam"
- layout="prev, pager, next"
- :rowClick="getSalaryParams"
- >
- <template #table-header>
- <h3 class="title">待处理</h3>
- </template>
- <template #T_user_name="{ row }">
- <el-button type="primary" text @click="getSalaryParams(row)">{{ row.T_user_name }}</el-button>
- </template>
- </TableBase>
- </div>
- <transition
- leave-active-class="animate__animated animate__bounceOutRight"
- enter-active-class="animate__animated animate__bounceInDown"
- >
- <el-row class="h-100 f-1 margin-left-3" v-if="userInfo.Id">
- <el-col :span="24" class="h-100" style="overflow: hidden">
- <el-card class="m-b-3 b-show-0">
- <h3 class="title-user m-b-5">员工基本信息</h3>
- <div class="info-content">
- <el-avatar shape="square" size="large" :icon="UserFilled" />
- <div class="info-name">
- <h4 class="m-b-3">名字:{{ userInfo.T_user_name }}</h4>
- </div>
- </div>
- </el-card>
- <el-card class="m-b-3 b-show-0" :style="{ height: cardHeight + 'px' }">
- <el-descriptions title="请假申请" :column="1" size="large" border>
- <el-descriptions-item label="请假类型:"
- ><el-text class="mx-1" type="primary">{{
- userInfo.T_type_name ? userInfo.T_type_name : '-'
- }}</el-text></el-descriptions-item
- >
- <el-descriptions-item label="开始时间:"
- ><el-text class="mx-1" type="primary">{{
- userInfo.T_start_time ? userInfo.T_type_name : '-'
- }}</el-text></el-descriptions-item
- >
- <el-descriptions-item label="结束时间:" :span="2"
- ><el-text class="mx-1" type="primary">{{
- userInfo.T_end_time ? userInfo.T_end_time : '-'
- }}</el-text></el-descriptions-item
- >
- <el-descriptions-item label="请假时长:">
- <el-text class="mx-1" type="primary">{{
- userInfo.T_duration ? getFormatDuration(userInfo.T_duration) : '-'
- }}</el-text>
- </el-descriptions-item>
- <el-descriptions-item label="内容:">
- <el-text class="mx-1" type="primary">{{ userInfo.T_text ? userInfo.T_text : '-' }}</el-text>
- </el-descriptions-item>
- </el-descriptions>
- <div class="btn">
- <el-button type="primary" @click="LeaveUser(1)">通过</el-button>
- <el-button type="danger" @click="LeaveUser(0)">不通过</el-button>
- </div>
- </el-card>
- </el-col>
- </el-row>
- </transition>
- </div>
- </template>
- <style scoped lang="scss">
- .Leave {
- display: flex;
- overflow: hidden;
- .b-show-0 {
- box-shadow: none;
- }
- .title {
- width: 100%;
- text-align: center;
- }
- .title-user {
- text-align: left;
- }
- .btn {
- margin-top: 2rem;
- display: flex;
- justify-content: end;
- }
- .info-content {
- display: flex;
- color: #303133;
- .info-name {
- display: flex;
- align-items: center;
- padding-left: 0.75rem;
- }
- }
- }
- </style>
|