Overtime.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <script setup lang="ts">
  2. import { ref, nextTick } from 'vue'
  3. import { ElMessage } from 'element-plus'
  4. import { GlobalStore } from '@/stores/index'
  5. import { getFormatDuration } from '@/utils/common'
  6. import { UserFilled } from '@element-plus/icons-vue'
  7. import TableBase from '@/components/TableBase/index.vue'
  8. import { ColumnProps } from '@/components/TableBase/interface/index'
  9. import { Overtime_List, Overtime_Approval } from '@/api/workAttendance/index'
  10. import { useTablePublic, OvertimeUserInfoIn } from '@/hooks/useTablePublic'
  11. const TableRef = ref()
  12. const globalStore = GlobalStore()
  13. const initParam = { User_tokey: globalStore.GET_User_tokey }
  14. const columns: ColumnProps[] = [{ prop: 'T_user_name', label: '姓名' }]
  15. const { tableRowClassName } = useTablePublic()
  16. const tableRowClassNameHandle = (data: any): any => tableRowClassName(data.row.Id, userInfo.value.Id)
  17. const userInfo = ref<OvertimeUserInfoIn>({
  18. T_uid: '',
  19. T_user_name: '',
  20. T_dept: '',
  21. T_post: '',
  22. T_type_name: '',
  23. T_start_time: '',
  24. T_end_time: '',
  25. T_text: '',
  26. Id: '',
  27. T_prove_img: '',
  28. T_duration: ''
  29. })
  30. const getSalaryParams = (row: any) => {
  31. userInfo.value.Id = ''
  32. setTimeout(() => {
  33. userInfo.value = { ...row }
  34. }, 100)
  35. }
  36. const LeaveUser = async (T_State: number) => {
  37. if (!userInfo.value.Id) return
  38. const params = {
  39. User_tokey: globalStore.GET_User_tokey,
  40. T_id: userInfo.value.Id,
  41. T_State
  42. }
  43. const res: any = await Overtime_Approval(params)
  44. if (res.Code === 200) {
  45. if (T_State) {
  46. ElMessage.success('审核通过!')
  47. } else {
  48. ElMessage.warning('审核不通过!')
  49. }
  50. nextTick(() => {
  51. TableRef.value.getTableList()
  52. userInfo.value = {} as OvertimeUserInfoIn
  53. })
  54. }
  55. }
  56. </script>
  57. <template>
  58. <div class="Overtime">
  59. <div style="width: 290px" class="Overtime-table">
  60. <TableBase
  61. ref="TableRef"
  62. :columns="columns"
  63. :requestApi="Overtime_List"
  64. :initParam="initParam"
  65. layout="prev, pager, next"
  66. :rowClick="getSalaryParams"
  67. :tableRowClassName="tableRowClassNameHandle"
  68. >
  69. <template #table-header>
  70. <h3 class="title">待处理</h3>
  71. </template>
  72. </TableBase>
  73. </div>
  74. <transition
  75. leave-active-class="animate__animated animate__fadeOutRight"
  76. enter-active-class="animate__animated animate__fadeInLeft"
  77. >
  78. <div class="Overtime-container" v-if="userInfo.Id">
  79. <el-card class="m-b-3 b-show-0">
  80. <h3 class="title-user m-b-5">员工基本信息</h3>
  81. <div class="info-content">
  82. <el-avatar shape="square" size="large" :icon="UserFilled" />
  83. <div class="info-name">
  84. <h4 class="m-b-3">名字:{{ userInfo.T_user_name }}</h4>
  85. </div>
  86. </div>
  87. <div class="Overtime-content">
  88. <div>
  89. 开始时间:<el-tag v-if="userInfo.T_start_time" type="success" effect="dark">
  90. {{ userInfo.T_start_time }}
  91. </el-tag>
  92. </div>
  93. <div>
  94. 结束时间:<el-tag v-if="userInfo.T_end_time" type="success" effect="dark">
  95. {{ userInfo.T_end_time }}
  96. </el-tag>
  97. </div>
  98. <div>
  99. 加班时长:<el-tag v-if="userInfo.T_duration" type="success" effect="dark">
  100. {{ getFormatDuration(userInfo.T_duration as any) }}
  101. </el-tag>
  102. </div>
  103. <div style="display: flex">
  104. <span>取证:</span>
  105. <el-image
  106. v-if="userInfo.T_prove_img"
  107. style="width: 200px"
  108. :preview-src-list="[userInfo.T_prove_img]"
  109. :preview-teleported="true"
  110. :src="userInfo.T_prove_img"
  111. fit="cover"
  112. />
  113. <span v-else>无</span>
  114. </div>
  115. <div>
  116. <span class="ml-3 w-35 text-gray-600 inline-flex items-center">内容:</span>
  117. {{ userInfo.T_text }}
  118. </div>
  119. </div>
  120. <div class="btn">
  121. <el-button type="primary" @click="LeaveUser(1)">通过</el-button>
  122. <el-button type="danger" @click="LeaveUser(0)">不通过</el-button>
  123. </div>
  124. </el-card>
  125. </div>
  126. <!-- <el-row class="h-100 f-1 margin-left-3" v-if="userInfo.Id">
  127. <el-col :span="24" class="h-100" style="overflow: hidden; display: flex; flex-direction: column">
  128. <el-card class="m-b-3 b-show-0">
  129. <h3 class="title-user m-b-5">员工基本信息</h3>
  130. <div class="info-content">
  131. <el-avatar shape="square" size="large" :icon="UserFilled" />
  132. <div class="info-name">
  133. <h4 class="m-b-3">名字:{{ userInfo.T_user_name }}</h4>
  134. </div>
  135. </div>
  136. </el-card>
  137. <el-card class="b-show-0 f-1">
  138. <el-row>
  139. <el-col :span="12"
  140. ><div>
  141. 开始时间:<el-tag v-if="userInfo.T_start_time" type="success" effect="dark">
  142. {{ userInfo.T_start_time }}
  143. </el-tag>
  144. </div></el-col
  145. >
  146. <el-col :span="12"
  147. ><div>
  148. 结束时间:<el-tag v-if="userInfo.T_end_time" type="success" effect="dark">
  149. {{ userInfo.T_end_time }}
  150. </el-tag>
  151. </div></el-col
  152. >
  153. </el-row>
  154. <el-row>
  155. <el-col :span="12"
  156. ><div>
  157. 加班时长:<el-tag v-if="userInfo.T_duration" type="success" effect="dark">
  158. {{ getFormatDuration(userInfo.T_duration as any) }}
  159. </el-tag>
  160. </div></el-col
  161. >
  162. </el-row>
  163. <el-row>
  164. <el-col style="display: flex">
  165. 取证:
  166. <img v-if="userInfo.T_prove_img" :src="userInfo.T_prove_img" class="img" />
  167. <span v-else>无</span>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col>
  172. <span class="ml-3 w-35 text-gray-600 inline-flex items-center">内容:</span>
  173. {{ userInfo.T_text }}
  174. </el-col>
  175. </el-row>
  176. <div class="btn">
  177. <el-button type="primary" @click="LeaveUser(1)">通过</el-button>
  178. <el-button type="danger" @click="LeaveUser(0)">不通过</el-button>
  179. </div>
  180. </el-card>
  181. </el-col>
  182. </el-row> -->
  183. </transition>
  184. </div>
  185. </template>
  186. <style scoped lang="scss">
  187. @import '@/styles/var.scss';
  188. .Overtime-container {
  189. z-index: 0;
  190. width: 100%;
  191. height: 100%;
  192. display: flex;
  193. justify-content: center;
  194. .el-card {
  195. width: 50%;
  196. height: 60%;
  197. border-radius: 12px;
  198. h3 {
  199. font-size: 24px;
  200. text-align: center;
  201. }
  202. :deep(.el-card__body) {
  203. display: flex;
  204. flex-direction: column;
  205. height: 100%;
  206. }
  207. }
  208. .Overtime-content {
  209. flex: 1;
  210. display: flex;
  211. flex-direction: column;
  212. overflow: auto;
  213. // justify-content: space-between;
  214. margin-top: 20px;
  215. font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 微软雅黑, Arial,
  216. sans-serif;
  217. font-size: 14px;
  218. div {
  219. margin-bottom: 10px;
  220. }
  221. }
  222. }
  223. .Overtime {
  224. display: flex;
  225. height: 100%;
  226. .Overtime-table {
  227. @include f-direction;
  228. z-index: 1;
  229. :deep(.table-header) {
  230. margin-bottom: 0;
  231. }
  232. }
  233. overflow: hidden;
  234. .img {
  235. width: 200px;
  236. }
  237. .b-show-0 {
  238. box-shadow: none;
  239. font-size: 16px;
  240. font-weight: 500;
  241. .el-row {
  242. margin-bottom: 10px;
  243. .el-col {
  244. padding: 15px;
  245. }
  246. }
  247. }
  248. :deep(.el-card .el-card__body) {
  249. font-weight: bold;
  250. // color: var(--el-text-color-secondary);
  251. }
  252. .f-1 {
  253. flex: 1;
  254. }
  255. .title {
  256. width: 100%;
  257. text-align: center;
  258. }
  259. .btn {
  260. margin-top: 1rem;
  261. display: flex;
  262. justify-content: end;
  263. }
  264. .info-content {
  265. display: flex;
  266. // color: #606266;
  267. .info-name {
  268. display: flex;
  269. // flex-direction: column;
  270. align-items: center;
  271. padding-left: 0.75rem;
  272. span:first-child {
  273. margin-right: 2rem;
  274. }
  275. }
  276. }
  277. }
  278. </style>