Leave.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <script setup lang="ts">
  2. import { ref, nextTick, onMounted, onUnmounted } from 'vue'
  3. import { UserFilled } from '@element-plus/icons-vue'
  4. import { ElMessage } from 'element-plus'
  5. import TableBase from '@/components/TableBase/index.vue'
  6. import { ColumnProps } from '@/components/TableBase/interface/index'
  7. import { Leave_List, Leave_Approval } from '@/api/workAttendance/index'
  8. import { GlobalStore } from '@/stores/index'
  9. const globalStore = GlobalStore()
  10. const TableRef = ref()
  11. const columns: ColumnProps[] = [{ prop: 'T_user_name', label: '姓名', name: 'T_user_name' }]
  12. interface UserInfoIn {
  13. T_user_name: string
  14. T_dept: string
  15. T_post: string
  16. T_type_name: string
  17. T_start_time: string
  18. T_end_time: string
  19. T_text: string
  20. Id: string
  21. T_duration: string
  22. }
  23. const userInfo = ref<UserInfoIn>({
  24. T_user_name: '',
  25. T_dept: '',
  26. T_post: '',
  27. T_type_name: '',
  28. T_start_time: '',
  29. T_end_time: '',
  30. T_text: '',
  31. Id: '',
  32. T_duration: ''
  33. })
  34. const initParam = {
  35. User_tokey: globalStore.GET_User_tokey
  36. }
  37. const getSalaryParams = (row: any) => {
  38. userInfo.value = { ...row }
  39. }
  40. const LeaveUser = async (T_State: number) => {
  41. if (!userInfo.value.Id) return
  42. const params = {
  43. User_tokey: globalStore.GET_User_tokey,
  44. T_id: userInfo.value.Id,
  45. T_State
  46. }
  47. const res: any = await Leave_Approval(params)
  48. if (res.Code === 200) {
  49. if (T_State) {
  50. ElMessage({
  51. type: 'success',
  52. message: '审核通过!'
  53. })
  54. } else {
  55. ElMessage({
  56. type: 'warning',
  57. message: '审核不通过!'
  58. })
  59. }
  60. nextTick(() => {
  61. TableRef.value.getTableList()
  62. userInfo.value = {} as UserInfoIn
  63. })
  64. }
  65. }
  66. let cardHeight = ref(0)
  67. const resize = () => {
  68. const height = document.documentElement.clientHeight
  69. cardHeight.value = height - 4 * 12 - 140 - 60
  70. }
  71. onMounted(() => {
  72. resize()
  73. window.onresize = resize
  74. })
  75. onUnmounted(() => {
  76. window.onresize = null
  77. })
  78. </script>
  79. <template>
  80. <div class="Leave">
  81. <div style="width: 290px">
  82. <TableBase
  83. ref="TableRef"
  84. :columns="columns"
  85. :requestApi="Leave_List"
  86. :initParam="initParam"
  87. layout="prev, pager, next"
  88. :rowClick="getSalaryParams"
  89. >
  90. <template #table-header>
  91. <h3 class="title">待处理</h3>
  92. </template>
  93. <template #T_user_name="{ row }">
  94. <el-button type="primary" text @click="getSalaryParams(row)">{{ row.T_user_name }}</el-button>
  95. </template>
  96. </TableBase>
  97. </div>
  98. <el-row class="h-100 f-1 margin-left-3">
  99. <el-col :span="24" class="h-100" style="overflow: hidden">
  100. <el-card class="m-b-3 b-show-0">
  101. <h3 class="title m-b-5">员工基本信息</h3>
  102. <div class="info-content">
  103. <el-avatar shape="square" size="large" :icon="UserFilled" />
  104. <div class="info-name">
  105. <h4 class="m-b-3">名字:{{ userInfo.T_user_name }}</h4>
  106. </div>
  107. </div>
  108. </el-card>
  109. <el-card class="m-b-3 b-show-0" :style="{ height: cardHeight + 'px' }">
  110. <el-descriptions title="请假申请" :column="1" size="large" border>
  111. <el-descriptions-item label="请假类型:"
  112. ><el-text class="mx-1" type="primary">{{
  113. userInfo.T_type_name ? userInfo.T_type_name : '-'
  114. }}</el-text></el-descriptions-item
  115. >
  116. <el-descriptions-item label="开始时间:"
  117. ><el-text class="mx-1" type="primary">{{
  118. userInfo.T_start_time ? userInfo.T_type_name : '-'
  119. }}</el-text></el-descriptions-item
  120. >
  121. <el-descriptions-item label="结束时间:" :span="2"
  122. ><el-text class="mx-1" type="primary">{{
  123. userInfo.T_end_time ? userInfo.T_end_time : '-'
  124. }}</el-text></el-descriptions-item
  125. >
  126. <el-descriptions-item label="请假时长:">
  127. <el-text class="mx-1" type="primary">{{ userInfo.T_duration ? userInfo.T_duration : '-' }}</el-text>
  128. </el-descriptions-item>
  129. <el-descriptions-item label="内容:">
  130. <el-text class="mx-1" type="primary">{{ userInfo.T_text ? userInfo.T_text : '-' }}</el-text>
  131. </el-descriptions-item>
  132. </el-descriptions>
  133. <div class="btn">
  134. <el-button type="primary" @click="LeaveUser(1)">通过</el-button>
  135. <el-button type="danger" @click="LeaveUser(0)">不通过</el-button>
  136. </div>
  137. </el-card>
  138. </el-col>
  139. </el-row>
  140. </div>
  141. </template>
  142. <style scoped lang="scss">
  143. .Leave {
  144. display: flex;
  145. overflow: hidden;
  146. .b-show-0 {
  147. box-shadow: none;
  148. }
  149. .title {
  150. width: 100%;
  151. text-align: center;
  152. }
  153. .btn {
  154. margin-top: 2rem;
  155. display: flex;
  156. justify-content: space-around;
  157. }
  158. .info-content {
  159. display: flex;
  160. color: #303133;
  161. .info-name {
  162. display: flex;
  163. // flex-direction: column;
  164. align-items: center;
  165. padding-left: 0.75rem;
  166. span:first-child {
  167. margin-right: 2rem;
  168. }
  169. }
  170. }
  171. }
  172. </style>