|
@@ -1,28 +1,188 @@
|
|
|
<template>
|
|
|
- <div class="attendanceCenter"> 部门考勤 </div>
|
|
|
+ <div class="attendanceCenterDep">
|
|
|
+ <h1>考勤统计表</h1>
|
|
|
+ <div class="depSearch">
|
|
|
+ <div class="searBox">
|
|
|
+ <span class="span">部门:</span>
|
|
|
+ <el-tree-select
|
|
|
+ v-model="fromParams.deptId"
|
|
|
+ :data="deptList"
|
|
|
+ :props="defaultProps"
|
|
|
+ check-strictly
|
|
|
+ node-key="id"
|
|
|
+ placeholder="请选择部门"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="searBox">
|
|
|
+ <span class="span">月份:</span>
|
|
|
+ <el-date-picker v-model="fromParams.month" type="month" placeholder="请选择月份" />
|
|
|
+ </div>
|
|
|
+ <div class="searBox">
|
|
|
+ <span class="span">人员:</span>
|
|
|
+ <el-input v-model="fromParams.userName" placeholder="请输入人员名称" />
|
|
|
+ </div>
|
|
|
+ <div class="searBtns">
|
|
|
+ <el-button @click="querysClick" type="primary" style="background: #3485ff">
|
|
|
+ <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
|
|
|
+ 查询</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary">
|
|
|
+ <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
|
|
|
+ 导出</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="depTable">
|
|
|
+ <el-table :data="tableData" style="width: 100%">
|
|
|
+ <el-table-column prop="index" label="序号" width="80" />
|
|
|
+ <el-table-column prop="dep" label="部门" />
|
|
|
+ <el-table-column prop="name" label="姓名" />
|
|
|
+ <!-- <el-table-column label="Delivery Info">
|
|
|
+ <el-table-column prop="name" label="Name" width="120" />
|
|
|
+ <el-table-column label="Address Info">
|
|
|
+ <el-table-column prop="state" label="State" width="120" />
|
|
|
+ <el-table-column prop="city" label="City" width="120" />
|
|
|
+ <el-table-column prop="address" label="Address" />
|
|
|
+ <el-table-column prop="zip" label="Zip" width="120" />
|
|
|
+ </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
+
|
|
|
+ <el-table-column prop="1" label="旷工" />
|
|
|
+ <el-table-column prop="1" label="迟到" />
|
|
|
+ <el-table-column prop="1" label="早退" />
|
|
|
+ <el-table-column prop="1" label="出差" />
|
|
|
+ <el-table-column prop="1" label="事假" />
|
|
|
+ <el-table-column prop="1" label="调休" />
|
|
|
+ <el-table-column prop="1" label="病假" />
|
|
|
+ <el-table-column prop="1" label="年假" />
|
|
|
+ <el-table-column prop="1" label="产假" />
|
|
|
+ <el-table-column prop="1" label="其他" />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import OaCalendar from '@/views/OaSystem/components/OaCalendar/index.vue'
|
|
|
-import { useAppStore } from '@/store/modules/app'
|
|
|
-import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
|
defineOptions({ name: 'AttendanceDep' })
|
|
|
-const { wsCache } = useCache()
|
|
|
-const appStore = useAppStore()
|
|
|
-const user = wsCache.get(CACHE_KEY.USER)
|
|
|
-const userName = user.user.nickname ? user.user.nickname : 'Admin'
|
|
|
-const calendarList = ref([])
|
|
|
+import * as DeptApi from '@/api/system/dept'
|
|
|
+import { defaultProps, handleTree } from '@/utils/tree'
|
|
|
+import * as MineApi from '@/api/oa/attendanceCenter'
|
|
|
+import {
|
|
|
+ isAttendNormal,
|
|
|
+ isArrayDelRepeat,
|
|
|
+ allArrayCalendar,
|
|
|
+ isArrayDelOrNickname,
|
|
|
+ allDeptsArr
|
|
|
+} from './attendAuth'
|
|
|
+import moment from 'moment'
|
|
|
+const fromParams: any = ref({
|
|
|
+ deptId: '',
|
|
|
+ month: '',
|
|
|
+ userName: ''
|
|
|
+})
|
|
|
+const deptList = ref<Tree[]>([]) // 树形结构
|
|
|
+const tableData = ref([
|
|
|
+ {
|
|
|
+ date: '2016-05-03',
|
|
|
+ name: 'Tom',
|
|
|
+ state: 'California',
|
|
|
+ city: 'Los Angeles',
|
|
|
+ address: 'No. 189, Grove St, Los Angeles',
|
|
|
+ zip: 'CA 90036'
|
|
|
+ }
|
|
|
+])
|
|
|
+const initTreeDeps = async () => {
|
|
|
+ deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
|
+}
|
|
|
+const querysClick = async () => {
|
|
|
+ // initInsMouth()
|
|
|
+ let month = fromParams.value.month
|
|
|
+ let toMoseMonths: any = []
|
|
|
+ toMoseMonths[0] = moment(month).startOf('months').format('YYYY-MM-DD') + ' 00:00:00'
|
|
|
+ toMoseMonths[1] = moment(month).endOf('months').format('YYYY-MM-DD') + ' 23:59:59'
|
|
|
+ initInsMouth(toMoseMonths)
|
|
|
+}
|
|
|
+const initInsMouth = async (date: any) => {
|
|
|
+ let params = {
|
|
|
+ attendanceTime: date, // 考勤时间
|
|
|
+ attendanceStatus: '', // 考勤状态,示例值(2)
|
|
|
+ attendanceType: '', // 考勤类型(1:上午;2:下午),示例值(1)
|
|
|
+ otherMinute: '', // 其他考勤状态分钟(除了出勤)
|
|
|
+ nickname: fromParams.value.userName, //用户昵称
|
|
|
+ deptId: fromParams.value.deptId //部门ID
|
|
|
+ }
|
|
|
+ initWorkDay(date).then((restall) => {
|
|
|
+ MineApi.getWorkdaySheetList(params).then((res) => {
|
|
|
+ let namesArr: any = isArrayDelOrNickname(res)
|
|
|
+ let resArr: any = res
|
|
|
+ resArr.forEach((item: any) => {
|
|
|
+ item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
|
|
|
+ })
|
|
|
+ let arr = allDeptsArr(restall, resArr, namesArr)
|
|
|
+ // console.log(arr)
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+const initWorkDay = async (date: any) => {
|
|
|
+ let params = {
|
|
|
+ dateDay: date, // 日期(数组)
|
|
|
+ dayOfWeek: '', // 星期几
|
|
|
+ holidayRemark: '', // 节假备注,示例值(国庆节)
|
|
|
+ isworkday: '', // 是否工作日
|
|
|
+ year: '', // 年份
|
|
|
+ month: '', // 月份
|
|
|
+ week: '' // 周
|
|
|
+ }
|
|
|
+ const res = await MineApi.getWorkdayList(params)
|
|
|
+ let arr = res
|
|
|
+ arr.forEach((item: any) => {
|
|
|
+ item.date = moment(item.dateDay).format('YYYY-MM-DD')
|
|
|
+ })
|
|
|
|
|
|
-const titleOne = ref('浙江万维')
|
|
|
-onMounted(() => {})
|
|
|
+ return await arr
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ let toMonth = moment().format('YYYY-MM')
|
|
|
+ fromParams.value.month = toMonth
|
|
|
+ // 加载部门树
|
|
|
+ initTreeDeps()
|
|
|
+ let toMoseMonths: any = []
|
|
|
+ toMoseMonths[0] = moment().startOf('months').format('YYYY-MM-DD') + ' 00:00:00'
|
|
|
+ toMoseMonths[1] = moment().endOf('months').format('YYYY-MM-DD') + ' 23:59:59'
|
|
|
+ initInsMouth(toMoseMonths)
|
|
|
+})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-h1 {
|
|
|
- font-size: 20px;
|
|
|
- margin-bottom: 20px;
|
|
|
-}
|
|
|
-.attendanceCenter {
|
|
|
+.attendanceCenterDep {
|
|
|
width: 100%;
|
|
|
- height: 100%;
|
|
|
- padding: 15px 220px;
|
|
|
+ height: calc(100% - 15px);
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-top: 15px;
|
|
|
+ padding: 15px 30px;
|
|
|
+ h1 {
|
|
|
+ font-size: 20px;
|
|
|
+ color: #121518;
|
|
|
+ font-weight: 600;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+ .depSearch {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ .searBox {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 25px;
|
|
|
+ .span {
|
|
|
+ white-space: nowrap;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .depTable {
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 100px);
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|