小程序打卡数据

This commit is contained in:
lSun 2024-12-03 16:27:38 +08:00
parent df2446a182
commit 3ae00361e9
2 changed files with 404 additions and 0 deletions

38
src/api/process/wechat.js Normal file
View File

@ -0,0 +1,38 @@
import request from '@/utils/request'
// 查询列表
export function list(query) {
return request({
url: '/system/wechat/list',
method: 'get',
params: query
})
}
// 查询用户列表列表
export function userList(query) {
return request({
url: '/system/wechat/userList',
method: 'get',
params: query
})
}
// 导出
export function exportWechatReport(query) {
return request({
url: '/system/export/exportWechatReport',
method: 'get',
responseType: 'blob',
params: query
})
}
export function exportWorkReport(query) {
return request({
url: '/system/wechat/export',
method: 'get',
responseType: 'blob',
params: query
})
}

View File

@ -0,0 +1,366 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名:">
<el-input v-model="queryParams.userName" style="width: 200px;" maxlength="50"></el-input>
</el-form-item>
<el-form-item label="日期:">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="onChangeTime"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList">
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="userName"/>
<el-table-column label="打卡天数" align="center" prop="days"/>
<el-table-column label="今日是否考勤" align="center" prop="isToday"/>
<el-table-column label="操作" align="center" class-name="small-padding">
<template slot-scope="scope">
<el-button
size="mini"
v-hasPermi="['flow:wechat:list']"
@click="handleView(scope.row)"
>查看
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 单用户的表格 -->
<el-dialog :title="title" :visible.sync="open" width="65%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-row>
<el-form-item label="日期:">
<el-date-picker
v-model="dateRangeDialog"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="onChangeTimes"
></el-date-picker>
<el-button type="primary" style="margin-left: 10px" icon="el-icon-search" size="mini" @click="handleQuerys">
搜索
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">重置</el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExports"
>导出
</el-button>
</el-form-item>
</el-row>
</el-form>
<el-table v-loading="loading" :data="tableDialogList">
<el-table-column label="序号" align="center" width="70" type="index">
<template slot-scope="scope">
<span>{{ (queryParamsDialog.pageNum - 1) * queryParamsDialog.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="userName" width="90"/>
<el-table-column label="日期" align="center" prop="attCurrentDay" :show-overflow-tooltip="true" width="170">
</el-table-column>
<el-table-column label="打卡时间" align="center" prop="attCurrentTime" width="180"/>
<el-table-column label="考勤状态" align="center" prop="toWorkAttStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.att_status" :value="scope.row.attStatus"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="errorRemake" width="160"/>
</el-table>
<pagination
v-show="totalDialog>0"
:total="totalDialog"
:page.sync="queryParamsDialog.pageNum"
:limit.sync="queryParamsDialog.pageSize"
/>
</el-dialog>
</div>
</template>
<script>
import {list, exportWorkReport, userList, exportWechatReport} from "@/api/process/wechat";
export default {
name: "Wechat",
dicts: ['att_status'],
data() {
return {
userInfo: this.$store.state.user,
orgList: this.$store.state.user.orgList,
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
totalDialog: 0,
//
tableList: [],
tableDialogList: [],
//
title: "",
//
open: false,
isEdit: false,
isView: false,
userList: [],
//
dateRange: [],
dateRangeDialog: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startDate: undefined,
endDate: undefined,
userName: undefined,
},
queryParamsDialog: {
pageNum: 1,
pageSize: 10,
startDate: undefined,
endDate: undefined,
userId: undefined,
},
userIdDialog:"",
//
form: {},
//
rules: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
if (this.dateRange && this.dateRange.length > 0) {
this.queryParams.startDate = this.dateRange[0]
this.queryParams.endDate = this.dateRange[1]
} else {
this.queryParams.startDate = undefined
this.queryParams.endDate = undefined
}
list(this.queryParams).then(response => {
this.tableList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
//
cancel() {
this.open = false;
this.isEdit = false;
this.reset();
},
//
reset() {
this.form = {
userId: this.userInfo.id,
userName: this.userInfo.name,
orgId: undefined,
leaveStartDate: undefined,
leaveStartInterval: undefined,
leaveEndDate: undefined,
leaveEndInterval: undefined,
leaveDuration: undefined,
hostUserId: [],
orgHeadUserIdList: [],
travelers: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.queryParams = {
pageNum: 1,
pageSize: 10,
startDate: undefined,
endDate: undefined,
userName: undefined,
};
this.resetForm("queryForm");
this.handleQuery();
},
/** 重置按钮操作 */
resetQuerys() {
this.dateRangeDialog = [];
this.queryParamsDialog = {
pageNum: 1,
pageSize: 10,
startDate: undefined,
endDate: undefined,
userId: undefined,
};
this.resetForm("form");
this.handleQuerys();
},
handleView(row) {
this.tableDialogList = [];
//
this.open = true;
this.title = '查看'
var startDate;
var endDate;
if (this.dateRange && this.dateRange.length > 0) {
this.dateRangeDialog = this.dateRange
startDate = this.dateRange[0]
endDate = this.dateRange[1]
} else {
startDate = undefined
endDate = undefined
}
this.queryParamsDialog = {
pageNum: 1,
pageSize: 10,
startDate: startDate,
endDate: endDate,
userId: row.userId,
}
this.userIdDialog = row.userId;
userList(this.queryParamsDialog).then(response => {
this.tableDialogList = response.rows;
this.totalDialog = response.total;
this.loading = false;
})
},
/** 搜索按钮操作 */
handleQuerys() {
if (this.dateRangeDialog && this.dateRangeDialog.length > 0) {
this.queryParams.startDate = this.dateRangeDialog[0]
this.queryParams.endDate = this.dateRangeDialog[1]
} else {
this.queryParams.startDate = undefined
this.queryParams.endDate = undefined
}
this.queryParams.userId = this.userIdDialog
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
userList(this.queryParams).then(response => {
this.tableDialogList = response.rows;
this.totalDialog = response.total;
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
exportWorkReport(this.queryParams).then(res => {
this.downloadFile({
fileName: `小程序打卡数据报表_${new Date().getTime()}.xlsx`,
fileData: res,
fileType: 'application/vnd.ms-excel;charset=utf-8'
})
})
},
/** 导出按钮操作 */
handleExports() {
exportWechatReport(this.queryParamsDialog).then(res => {
this.downloadFile({
fileName: `小程序打卡数据_查看_${new Date().getTime()}.xlsx`,
fileData: res,
fileType: 'application/vnd.ms-excel;charset=utf-8'
})
})
},
onChangeTime(val) {
console.log(val)
if (val.length > 0) {
const [val_1, val_2] = val;
this.queryParams.startDate = val_1;
this.queryParams.endDate = val_2;
} else {
this.queryParams.startDate = '';
this.queryParams.endDate = '';
}
},
onChangeTimes(val) {
console.log(val)
if (val.length > 0) {
const [val_1, val_2] = val;
this.queryParamsDialog.startDate = val_1;
this.queryParamsDialog.endDate = val_2;
} else {
this.queryParamsDialog.startDate = '';
this.queryParamsDialog.endDate = '';
}
}
}
};
</script>