|
@@ -1,33 +1,92 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
|
|
-import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
-import TableBase from '@/components/TableBase/index.vue'
|
|
|
+import { View } from '@element-plus/icons-vue'
|
|
|
+import { getFormatDuration } from '@/utils/common'
|
|
|
import { User_List } from '@/api/user/index'
|
|
|
import { GlobalStore } from '@/stores/index'
|
|
|
+import Drawer from '@/components/Drawer/index.vue'
|
|
|
+import TableBase from '@/components/TableBase/index.vue'
|
|
|
+import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
|
|
+import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
+import { Leave_User_list, Overtime_User_list, Overtime_Stat } from '@/api/workAttendance/index'
|
|
|
+
|
|
|
+let clientHeight = ref(0)
|
|
|
+const TableData = ref([])
|
|
|
const globalStore = GlobalStore()
|
|
|
+const TableRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
+const leaveRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
+const overtimeRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
+const remainingTimeRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
+const drawerLeaveRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
+const drawerOvertimeRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
+
|
|
|
const columns: ColumnProps[] = [{ prop: 'T_name', label: '姓名', name: 'T_name' }]
|
|
|
const overtimeColums: ColumnProps[] = [
|
|
|
- { prop: 'T_name', label: '姓名', name: 'T_name' },
|
|
|
- { prop: 'T_dept_name', label: '姓名', name: 'T_name' },
|
|
|
- { prop: 'T_post_name', label: '姓名', name: 'T_name' },
|
|
|
- { prop: 'T_phone', label: '姓名', name: 'T_name' },
|
|
|
- { prop: 'T_dept', label: '姓名', name: 'T_name' },
|
|
|
- { prop: 'T_post', label: '姓名', name: 'T_name' }
|
|
|
+ { prop: 'T_start_time', label: '开始时间' },
|
|
|
+ { prop: 'T_end_time', label: '结束时间' },
|
|
|
+ { prop: 'T_duration', label: '时长', name: 'T_duration' },
|
|
|
+ { prop: 'T_State', label: '审核', name: 'T_State' },
|
|
|
+ { prop: 'T_approver_name', label: '处理人' },
|
|
|
+ { prop: 'operation', label: '操作', width: 200, fixed: 'right' }
|
|
|
+]
|
|
|
+const remainingTimeColums: ColumnProps[] = [
|
|
|
+ { prop: 'T_duration', label: '时长', name: 'T_duration' },
|
|
|
+ { prop: 'RemainingTime', label: '剩余时长', name: 'RemainingTime' },
|
|
|
+ { prop: 'T_type_name', label: '事项' },
|
|
|
+ { prop: 'T_approver_name', label: '处理人' },
|
|
|
+ { prop: 'UpdateTime', label: '时间' }
|
|
|
+]
|
|
|
+const leaveColums: ColumnProps[] = [
|
|
|
+ { prop: 'T_type_name', label: '请假类型' },
|
|
|
+ { prop: 'T_start_time', label: '开始时间' },
|
|
|
+ { prop: 'T_end_time', label: '结束时间' },
|
|
|
+ { prop: 'T_duration', label: '请假时长', name: 'T_duration' },
|
|
|
+ { prop: 'T_text', label: '理由' },
|
|
|
+ { prop: 'T_State', label: '审核', name: 'T_State' },
|
|
|
+ { prop: 'T_approver_name', label: '处理人' },
|
|
|
+ { prop: 'operation', label: '操作', width: 200, fixed: 'right' }
|
|
|
]
|
|
|
-const remainingTimeColums: ColumnProps[] = []
|
|
|
-const leaveColums: ColumnProps[] = []
|
|
|
+
|
|
|
const initParam = {
|
|
|
User_tokey: globalStore.GET_User_tokey,
|
|
|
T_name: '',
|
|
|
T_dept: ''
|
|
|
}
|
|
|
+const userInitParam = reactive({
|
|
|
+ User_tokey: globalStore.GET_User_tokey,
|
|
|
+ T_uuid: ''
|
|
|
+})
|
|
|
const userInfo = reactive({
|
|
|
squareUrl: 'https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png',
|
|
|
name: '',
|
|
|
T_dept: '',
|
|
|
T_post: ''
|
|
|
})
|
|
|
-let clientHeight = ref(0)
|
|
|
+
|
|
|
+// 加班记录
|
|
|
+let url = ''
|
|
|
+let srcList: string[] = []
|
|
|
+const OvertimeEmptyObject = {
|
|
|
+ T_start_time: '',
|
|
|
+ T_end_time: '',
|
|
|
+ T_text: ''
|
|
|
+} as Record<string, unknown>
|
|
|
+const OvertimeInfo = ref(OvertimeEmptyObject)
|
|
|
+// 请假记录
|
|
|
+const LeaveInfo = ref<Record<string, string>>({
|
|
|
+ T_type_name: '',
|
|
|
+ T_start_time: '',
|
|
|
+ T_end_time: '',
|
|
|
+ T_duration: '',
|
|
|
+ T_text: ''
|
|
|
+})
|
|
|
+
|
|
|
+const userInfoAssign = (row: any) => {
|
|
|
+ userInitParam.T_uuid = row.T_uuid
|
|
|
+ userInfo.name = row.T_name
|
|
|
+ userInfo.T_dept = row.T_dept_name
|
|
|
+ userInfo.T_post = row.T_post_name
|
|
|
+}
|
|
|
+
|
|
|
const onContentResize = () => {
|
|
|
const height = document.documentElement.clientHeight
|
|
|
clientHeight.value = height - 140 - 60 - 3 * 12
|
|
@@ -38,29 +97,97 @@ onMounted(() => {
|
|
|
})
|
|
|
onUnmounted(() => (window.onresize = null))
|
|
|
const onResizeItem = () => 336
|
|
|
-const onResize = () => {
|
|
|
- const height = document.documentElement.clientHeight
|
|
|
- const table_header = document.querySelector('.table-header') as HTMLDivElement
|
|
|
- return height - table_header.clientHeight - 20 - 60 - 12
|
|
|
+// 点击行
|
|
|
+const getSalaryParams = (row: any) => {
|
|
|
+ if (row.T_uuid === userInitParam.T_uuid) return
|
|
|
+ userInfoAssign(row)
|
|
|
+ leaveRef.value && leaveRef.value.searchTable()
|
|
|
+ overtimeRef.value && overtimeRef.value.searchTable()
|
|
|
+ remainingTimeRef.value && remainingTimeRef.value.searchTable()
|
|
|
+}
|
|
|
+// 获取数据
|
|
|
+const getTableData = async () => {
|
|
|
+ const res: any = await User_List({ ...initParam })
|
|
|
+ TableData.value = res.Data.Data
|
|
|
+ pageable.total = res.Data.Num
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ await getTableData()
|
|
|
+ let userInfoFirst: any = TableData.value[0]
|
|
|
+ userInfoAssign(userInfoFirst)
|
|
|
+})
|
|
|
+// 分页
|
|
|
+const pageable = reactive({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+ small: false,
|
|
|
+ disabled: false
|
|
|
+})
|
|
|
+const handleSizeChange = (val: number) => {
|
|
|
+ pageable.pageSize = val
|
|
|
+ TableRef.value && TableRef.value.getTableList()
|
|
|
+}
|
|
|
+const handleCurrentChange = (val: number) => {
|
|
|
+ pageable.pageNum = val
|
|
|
+ TableRef.value && TableRef.value.getTableList()
|
|
|
+}
|
|
|
+// 查看加班记录
|
|
|
+const viewOvertime = (row: any) => {
|
|
|
+ url = 'https://erposs.baozhida.cn' + row.T_prove_img
|
|
|
+ srcList.push(url)
|
|
|
+ OvertimeInfo.value = { ...row }
|
|
|
+ console.log(OvertimeInfo.value)
|
|
|
+ drawerOvertimeRef.value && drawerOvertimeRef.value.openDrawer()
|
|
|
+}
|
|
|
+const closerOvertime = () => {
|
|
|
+ drawerOvertimeRef.value && drawerOvertimeRef.value.closeDrawer()
|
|
|
+ drawerLeaveRef.value && drawerLeaveRef.value.closeDrawer()
|
|
|
+ nextTick(() => {
|
|
|
+ url = ''
|
|
|
+ srcList = []
|
|
|
+ LeaveInfo.value = {}
|
|
|
+ OvertimeInfo.value = {}
|
|
|
+ })
|
|
|
+}
|
|
|
+// 查看请假
|
|
|
+const viewoLeave = (row: any) => {
|
|
|
+ LeaveInfo.value = { ...row }
|
|
|
+ console.log(LeaveInfo.value)
|
|
|
+ LeaveInfo.value.T_duration = getFormatDuration(row.T_duration)
|
|
|
+ drawerLeaveRef.value && drawerLeaveRef.value.openDrawer()
|
|
|
+}
|
|
|
+type Fn = () => void
|
|
|
+const callbackDrawer = (done: Fn) => {
|
|
|
+ done()
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="records">
|
|
|
- <div style="width: 290px">
|
|
|
- <TableBase
|
|
|
+ <div class="userTable">
|
|
|
+ <el-table
|
|
|
ref="TableRef"
|
|
|
- :columns="columns"
|
|
|
- :requestApi="User_List"
|
|
|
- :initParam="initParam"
|
|
|
- layout="total, prev, pager, next"
|
|
|
- :onResize="onResize"
|
|
|
+ class="h-100"
|
|
|
+ style="width: 100%; height: 100%; flex: 1"
|
|
|
+ :data="TableData"
|
|
|
+ @row-click="getSalaryParams"
|
|
|
>
|
|
|
- <template #table-header> <h4 class="title">待处理</h4> </template>
|
|
|
- <template #T_name="{ row }">
|
|
|
- <el-button type="primary" text>{{ row.T_name }}</el-button>
|
|
|
- </template>
|
|
|
- </TableBase>
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ v-for="item in columns"
|
|
|
+ :label="item.label"
|
|
|
+ :prop="item.prop"
|
|
|
+ :key="item.prop"
|
|
|
+ />
|
|
|
+ </el-table>
|
|
|
+ <Pagination
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :pageable="pageable"
|
|
|
+ :handleSizeChange="handleSizeChange"
|
|
|
+ :handleCurrentChange="handleCurrentChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
<el-row class="h-100 f-1 margin-left-3">
|
|
|
<el-col :span="24" class="h-100" style="overflow: hidden">
|
|
@@ -80,55 +207,67 @@ const onResize = () => {
|
|
|
<div class="content" :style="{ height: clientHeight + 'px' }">
|
|
|
<div>
|
|
|
<div class="content-table-item">
|
|
|
- <el-text class="font-large" size="large" type="success">加班记录:</el-text>
|
|
|
-
|
|
|
+ <el-tag class="mx-1 font-large" type="success" effect="dark">加班记录:</el-tag>
|
|
|
<TableBase
|
|
|
- ref="TableRef"
|
|
|
- border
|
|
|
+ ref="overtimeRef"
|
|
|
+ v-if="userInitParam.T_uuid"
|
|
|
:columns="overtimeColums"
|
|
|
- :requestApi="User_List"
|
|
|
- :initParam="initParam"
|
|
|
+ :requestApi="Overtime_User_list"
|
|
|
+ :initParam="userInitParam"
|
|
|
:onResize="onResizeItem"
|
|
|
:displayHeader="true"
|
|
|
layout="prev, pager, next"
|
|
|
>
|
|
|
- <template #T_name="{ row }">
|
|
|
- <el-button type="primary" text>{{ row.T_name }}</el-button>
|
|
|
+ <template #T_State="{ row }">
|
|
|
+ <el-tag v-if="row.T_State === 1" type="success">通过</el-tag>
|
|
|
+ <el-tag v-else-if="row.T_State === 2" type="warning">未通过</el-tag>
|
|
|
+ <el-tag v-else type="danger">待审核</el-tag>
|
|
|
+ </template>
|
|
|
+ <template #T_duration="{ row }">{{ getFormatDuration(row.T_duration) }}</template>
|
|
|
+ <template #right="{ row }">
|
|
|
+ <el-button type="success" size="small" link :icon="View" @click="viewOvertime(row)">查看</el-button>
|
|
|
</template>
|
|
|
</TableBase>
|
|
|
</div>
|
|
|
<div class="content-table-item">
|
|
|
- <el-text class="font-large" size="large" type="warning">剩余总时长:1小时 19分</el-text>
|
|
|
-
|
|
|
<TableBase
|
|
|
- ref="TableRef"
|
|
|
- border
|
|
|
- :columns="overtimeColums"
|
|
|
- :requestApi="User_List"
|
|
|
- :initParam="initParam"
|
|
|
+ ref="remainingTimeRef"
|
|
|
+ v-if="userInitParam.T_uuid"
|
|
|
+ :columns="remainingTimeColums"
|
|
|
+ :requestApi="Overtime_Stat"
|
|
|
+ :initParam="userInitParam"
|
|
|
:onResize="onResizeItem"
|
|
|
- :displayHeader="true"
|
|
|
layout="prev, pager, next"
|
|
|
>
|
|
|
- <template #T_name="{ row }">
|
|
|
- <el-button type="primary" text>{{ row.T_name }}</el-button>
|
|
|
+ <template #table-header="{ pageable }">
|
|
|
+ <el-tag class="mx-1" effect="dark">
|
|
|
+ 剩余总时长:{{ getFormatDuration(pageable.RemainingTime as number) }}
|
|
|
+ </el-tag>
|
|
|
</template>
|
|
|
+ <template #T_duration="{ row }">{{ getFormatDuration(row.T_duration) }}</template>
|
|
|
+ <template #RemainingTime="{ row }">{{ getFormatDuration(row.RemainingTime) }}</template>
|
|
|
</TableBase>
|
|
|
</div>
|
|
|
<div class="content-table-item">
|
|
|
- <el-text class="font-large" size="large" type="danger">请假记录:</el-text>
|
|
|
+ <el-tag class="mx-1 font-large" type="danger" effect="dark">请假记录:</el-tag>
|
|
|
<TableBase
|
|
|
- ref="TableRef"
|
|
|
- border
|
|
|
- :columns="overtimeColums"
|
|
|
- :requestApi="User_List"
|
|
|
- :initParam="initParam"
|
|
|
+ ref="leaveRef"
|
|
|
+ v-if="userInitParam.T_uuid"
|
|
|
+ :columns="leaveColums"
|
|
|
+ :requestApi="Leave_User_list"
|
|
|
+ :initParam="userInitParam"
|
|
|
:onResize="onResizeItem"
|
|
|
:displayHeader="true"
|
|
|
layout="prev, pager, next"
|
|
|
>
|
|
|
- <template #T_name="{ row }">
|
|
|
- <el-button type="primary" text>{{ row.T_name }}</el-button>
|
|
|
+ <template #T_State="{ row }">
|
|
|
+ <el-tag v-if="row.T_State === 1" type="success">通过</el-tag>
|
|
|
+ <el-tag v-else-if="row.T_State === 2" type="warning">未通过</el-tag>
|
|
|
+ <el-tag v-else type="danger">待审核</el-tag>
|
|
|
+ </template>
|
|
|
+ <template #T_duration="{ row }">{{ getFormatDuration(row.T_duration as number) }}</template>
|
|
|
+ <template #right="{ row }">
|
|
|
+ <el-button type="success" size="small" link :icon="View" @click="viewoLeave(row)">查看</el-button>
|
|
|
</template>
|
|
|
</TableBase>
|
|
|
</div>
|
|
@@ -136,42 +275,66 @@ const onResize = () => {
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <Drawer ref="drawerOvertimeRef" :handleClose="callbackDrawer">
|
|
|
+ <template #header="{ params }">
|
|
|
+ <h4 :id="params.titleId" :class="params.titleClass">加班记录</h4>
|
|
|
+ </template>
|
|
|
+ <div>
|
|
|
+ <el-descriptions :column="1" size="large" border>
|
|
|
+ <el-descriptions-item label="开始时间:"
|
|
|
+ ><el-text class="mx-1" type="primary">{{ OvertimeInfo.T_start_time }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="结束时间:"
|
|
|
+ ><el-text class="mx-1" type="primary">{{ OvertimeInfo.T_end_time }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="取证:" :span="2">
|
|
|
+ <el-image
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ :src="url"
|
|
|
+ :zoom-rate="1.2"
|
|
|
+ :preview-src-list="srcList"
|
|
|
+ :initial-index="4"
|
|
|
+ fit="cover"
|
|
|
+ /></el-descriptions-item>
|
|
|
+ <el-descriptions-item label="内容:">
|
|
|
+ <el-text class="mx-1" type="primary">{{ OvertimeInfo.T_text }}</el-text>
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ <div class="btn">
|
|
|
+ <el-button type="primary" @click="closerOvertime">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Drawer>
|
|
|
+ <Drawer ref="drawerLeaveRef" :handleClose="callbackDrawer">
|
|
|
+ <template #header="{ params }">
|
|
|
+ <h4 :id="params.titleId" :class="params.titleClass">请假记录</h4>
|
|
|
+ </template>
|
|
|
+ <div>
|
|
|
+ <el-descriptions :column="1" size="large" border>
|
|
|
+ <el-descriptions-item label="请假类型:"
|
|
|
+ ><el-text class="mx-1" type="danger">{{ LeaveInfo.T_type_name }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="开始时间:"
|
|
|
+ ><el-text class="mx-1" type="primary">{{ LeaveInfo.T_start_time }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="结束时间:"
|
|
|
+ ><el-text class="mx-1" type="primary">{{ LeaveInfo.T_end_time }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="请假时长:"
|
|
|
+ ><el-text class="mx-1" type="primary">{{ LeaveInfo.T_duration }}</el-text></el-descriptions-item
|
|
|
+ >
|
|
|
+ <el-descriptions-item label="内容:">
|
|
|
+ <el-text class="mx-1" type="primary">{{ LeaveInfo.T_text }}</el-text>
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ <div class="btn">
|
|
|
+ <el-button type="primary" @click="closerOvertime">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-.records {
|
|
|
- display: flex;
|
|
|
- overflow: hidden;
|
|
|
- .title {
|
|
|
- width: 100%;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .content {
|
|
|
- width: 99.9%;
|
|
|
- height: 700px;
|
|
|
- background: #fff;
|
|
|
- overflow-y: auto;
|
|
|
- .content-table-item {
|
|
|
- padding: 20px;
|
|
|
- .font-large {
|
|
|
- font-size: var(--el-font-size-extra-large);
|
|
|
- margin-bottom: 10px;
|
|
|
- display: inline-block;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- .info-content {
|
|
|
- display: flex;
|
|
|
- color: #303133;
|
|
|
- .info-name {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- padding-left: 0.75rem;
|
|
|
- span:first-child {
|
|
|
- margin-right: 2rem;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+@import './index.scss';
|
|
|
</style>
|