Overtime.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 { Overtime_List, Overtime_Approval } from '@/api/workAttendance/index'
  8. import { getFormatDuration } from '@/utils/common'
  9. import { GlobalStore } from '@/stores/index'
  10. const globalStore = GlobalStore()
  11. const TableRef = ref()
  12. const columns: ColumnProps[] = [{ prop: 'T_user_name', label: '姓名', name: 'T_user_name' }]
  13. interface UserInfoIn {
  14. T_user_name: string
  15. T_dept: string
  16. T_post: string
  17. T_type_name: string
  18. T_start_time: string
  19. T_end_time: string
  20. T_text: string
  21. Id: string
  22. T_duration: string
  23. T_prove_img: string
  24. }
  25. const userInfo = ref<UserInfoIn>({
  26. T_user_name: '',
  27. T_dept: '',
  28. T_post: '',
  29. T_type_name: '',
  30. T_start_time: '',
  31. T_end_time: '',
  32. T_text: '',
  33. Id: '',
  34. T_prove_img: '',
  35. T_duration: ''
  36. })
  37. const initParam = {
  38. User_tokey: globalStore.GET_User_tokey
  39. }
  40. const getSalaryParams = (row: any) => {
  41. console.log(row)
  42. userInfo.value = { ...row, T_prove_img: 'https://erposs.baozhida.cn' + row.T_prove_img }
  43. }
  44. const LeaveUser = async (T_State: number) => {
  45. if (!userInfo.value.Id) return
  46. const params = {
  47. User_tokey: globalStore.GET_User_tokey,
  48. T_id: userInfo.value.Id,
  49. T_State
  50. }
  51. const res: any = await Overtime_Approval(params)
  52. if (res.Code === 200) {
  53. if (T_State) {
  54. ElMessage.success('审核通过!')
  55. } else {
  56. ElMessage.warning('审核不通过!')
  57. }
  58. nextTick(() => {
  59. TableRef.value.getTableList()
  60. userInfo.value = {} as UserInfoIn
  61. })
  62. }
  63. }
  64. let cardHeight = ref(0)
  65. const resize = () => {
  66. const height = document.documentElement.clientHeight
  67. cardHeight.value = height - 3 * 12 - 140 - 60 - 6
  68. }
  69. onMounted(() => {
  70. resize()
  71. window.onresize = resize
  72. })
  73. onUnmounted(() => {
  74. window.onresize = null
  75. })
  76. </script>
  77. <template>
  78. <div class="Leave">
  79. <div style="width: 290px">
  80. <TableBase
  81. ref="TableRef"
  82. :columns="columns"
  83. :requestApi="Overtime_List"
  84. :initParam="initParam"
  85. layout="prev, pager, next"
  86. :rowClick="getSalaryParams"
  87. >
  88. <template #table-header>
  89. <h3 class="title">待处理</h3>
  90. </template>
  91. <template #T_user_name="{ row }">
  92. <el-button type="primary" text @click="getSalaryParams(row)">{{ row.T_user_name }}</el-button>
  93. </template>
  94. </TableBase>
  95. </div>
  96. <el-row class="h-100 f-1 margin-left-3">
  97. <el-col :span="24" class="h-100" style="overflow: hidden">
  98. <el-card class="m-b-3 b-show-0">
  99. <h3 class="title m-b-5">员工基本信息</h3>
  100. <div class="info-content">
  101. <el-avatar shape="square" size="large" :icon="UserFilled" />
  102. <div class="info-name">
  103. <h4 class="m-b-3">名字:{{ userInfo.T_user_name }}</h4>
  104. </div>
  105. </div>
  106. </el-card>
  107. <el-card class="m-b-3 b-show-0" :style="{ height: cardHeight + 'px' }">
  108. <el-row>
  109. <el-col :span="12"
  110. ><div>
  111. 开始时间:<el-tag v-if="userInfo.T_start_time" type="success" effect="dark">
  112. {{ userInfo.T_start_time }}
  113. </el-tag>
  114. </div></el-col
  115. >
  116. <el-col :span="12"
  117. ><div>
  118. 结束时间:<el-tag v-if="userInfo.T_end_time" type="success" effect="dark">
  119. {{ userInfo.T_end_time }}
  120. </el-tag>
  121. </div></el-col
  122. >
  123. </el-row>
  124. <el-row>
  125. <el-col :span="12"
  126. ><div>
  127. 加班时长:<el-tag v-if="userInfo.T_duration" type="success" effect="dark">
  128. {{ getFormatDuration(userInfo.T_duration as any) }}
  129. </el-tag>
  130. </div></el-col
  131. >
  132. </el-row>
  133. <el-row>
  134. <el-col style="display: flex">
  135. 取证:
  136. <img :src="userInfo.T_prove_img" class="img" />
  137. </el-col>
  138. </el-row>
  139. <el-row>
  140. <el-col>
  141. <span class="ml-3 w-35 text-gray-600 inline-flex items-center">内容:</span>
  142. <el-input
  143. v-model="userInfo.T_text"
  144. :autosize="{ minRows: 4, maxRows: 6 }"
  145. type="textarea"
  146. placeholder="Please input"
  147. />
  148. </el-col>
  149. </el-row>
  150. <div class="btn">
  151. <el-button type="primary" @click="LeaveUser(1)">通过</el-button>
  152. <el-button type="danger" @click="LeaveUser(0)">不通过</el-button>
  153. </div>
  154. </el-card>
  155. </el-col>
  156. </el-row>
  157. </div>
  158. </template>
  159. <style scoped lang="scss">
  160. .Leave {
  161. display: flex;
  162. overflow: hidden;
  163. .img {
  164. width: 200px;
  165. }
  166. .b-show-0 {
  167. box-shadow: none;
  168. font-size: 16px;
  169. font-weight: 500;
  170. .el-row {
  171. margin-bottom: 10px;
  172. .el-col {
  173. padding: 15px;
  174. }
  175. }
  176. }
  177. .title {
  178. width: 100%;
  179. text-align: center;
  180. }
  181. .btn {
  182. margin-top: 2rem;
  183. display: flex;
  184. justify-content: end;
  185. }
  186. .info-content {
  187. display: flex;
  188. color: #303133;
  189. .info-name {
  190. display: flex;
  191. // flex-direction: column;
  192. align-items: center;
  193. padding-left: 0.75rem;
  194. span:first-child {
  195. margin-right: 2rem;
  196. }
  197. }
  198. }
  199. }
  200. </style>