flx:修改
This commit is contained in:
parent
029d0f969d
commit
3aa2ec1aa7
@ -296,6 +296,27 @@ Vue.use(vuescroll, {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
const scrollDirective = {
|
||||||
|
bind(el, binding) {
|
||||||
|
const handler = binding.value;
|
||||||
|
const scrollHandler = (event) => {
|
||||||
|
handler(event);
|
||||||
|
};
|
||||||
|
// 存储滚动处理函数,方便后续解绑
|
||||||
|
el._scrollHandler = scrollHandler;
|
||||||
|
window.addEventListener('scroll', scrollHandler);
|
||||||
|
},
|
||||||
|
unbind(el) {
|
||||||
|
if (el._scrollHandler) {
|
||||||
|
window.removeEventListener('scroll', el._scrollHandler);
|
||||||
|
delete el._scrollHandler;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮权限控制指令
|
||||||
|
Vue.directive('scroll', scrollDirective);
|
||||||
|
|
||||||
|
|
||||||
// 按钮权限控制指令
|
// 按钮权限控制指令
|
||||||
Vue.directive('permission', {
|
Vue.directive('permission', {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="attendanceManage fullHeight whiteBlock" ref="attendanceManage">
|
<div class="attendanceManage fullHeight whiteBlock" ref="attendanceManage">
|
||||||
<vue-scroll style="width: 100%; height: 100%">
|
<vue-scroll style="width: 100%; height: 100%" ref="scrollDiv">
|
||||||
<el-form
|
<el-form
|
||||||
:inline="true"
|
:inline="true"
|
||||||
:model="formInline"
|
:model="formInline"
|
||||||
@ -15,6 +15,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="formInline.type == 1">
|
<el-form-item v-if="formInline.type == 1">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
ref="monthPicker"
|
||||||
value-format="yyyy-MM"
|
value-format="yyyy-MM"
|
||||||
v-model="formInline.monthTime"
|
v-model="formInline.monthTime"
|
||||||
type="monthrange"
|
type="monthrange"
|
||||||
@ -28,6 +29,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-else-if="formInline.type == 2">
|
<el-form-item v-else-if="formInline.type == 2">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
ref="monthPicker"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
v-model="formInline.dayTime"
|
v-model="formInline.dayTime"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
@ -41,6 +43,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select
|
<el-select
|
||||||
|
ref="enterpriseTypeSelectRef"
|
||||||
filterable
|
filterable
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
v-model="formInline.enterpriseTypeId"
|
v-model="formInline.enterpriseTypeId"
|
||||||
@ -56,6 +59,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select
|
<el-select
|
||||||
|
ref="enterpriseSelectRef"
|
||||||
filterable
|
filterable
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
v-model="formInline.enterpriseId"
|
v-model="formInline.enterpriseId"
|
||||||
@ -73,6 +77,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select
|
<el-select
|
||||||
|
ref="teamSelectRef"
|
||||||
filterable
|
filterable
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
v-model="formInline.teamId"
|
v-model="formInline.teamId"
|
||||||
@ -89,6 +94,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select
|
<el-select
|
||||||
|
ref="departmentSelectRef"
|
||||||
filterable
|
filterable
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
v-model="formInline.departmentId"
|
v-model="formInline.departmentId"
|
||||||
@ -280,7 +286,31 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.scrollDiv.$el.children[0].addEventListener(
|
||||||
|
"scroll",
|
||||||
|
this.handleScroll,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleScroll(e) {
|
||||||
|
console.log("滚动了", this.$refs.enterpriseTypeSelectRef);
|
||||||
|
// 时间框隐藏
|
||||||
|
if (this.$refs.monthPicker && this.$refs.monthPicker.pickerVisible) {
|
||||||
|
this.$refs.monthPicker.handleClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下拉框隐藏
|
||||||
|
const objRefList = ["enterpriseTypeSelectRef", "enterpriseSelectRef", "teamSelectRef", "departmentSelectRef"];
|
||||||
|
objRefList.forEach((item) => {
|
||||||
|
if (this.$refs[item] && this.$refs[item].visible) {
|
||||||
|
this.$refs[item].blur();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
initDate() {
|
initDate() {
|
||||||
this.getCountWorkerDailyAttendanceStatisticsV2();
|
this.getCountWorkerDailyAttendanceStatisticsV2();
|
||||||
this.getListData();
|
this.getListData();
|
||||||
|
|||||||
@ -420,6 +420,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-circle-check"
|
icon="el-icon-circle-check"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:loading="exportLoading"
|
||||||
@click="onSumbit"
|
@click="onSumbit"
|
||||||
>确定</el-button
|
>确定</el-button
|
||||||
>
|
>
|
||||||
@ -543,6 +544,7 @@ export default {
|
|||||||
title: "进出场打卡",
|
title: "进出场打卡",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
exportLoading: false,
|
||||||
videoTypeList: [],
|
videoTypeList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -554,6 +556,7 @@ export default {
|
|||||||
onSumbit() {
|
onSumbit() {
|
||||||
this.$refs.exportSettingInfo.validate((valid) => {
|
this.$refs.exportSettingInfo.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.exportLoading = true;
|
||||||
const requestData = {
|
const requestData = {
|
||||||
...this.exportSettingInfo,
|
...this.exportSettingInfo,
|
||||||
startDate: this.exportSettingInfo.startDate[0],
|
startDate: this.exportSettingInfo.startDate[0],
|
||||||
@ -600,12 +603,25 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// 处理错误
|
// 处理错误
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.exportLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
initExportSetting() {
|
||||||
|
this.exportSettingInfo = {
|
||||||
|
startDate: [],
|
||||||
|
downloadType: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
// 导出设置
|
// 导出设置
|
||||||
handleExportSetting() {
|
handleExportSetting() {
|
||||||
|
this.initExportSetting(); // 重置导出设置表单信息
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.exportSettingInfo.clearValidate(); // 重置表单验证信息
|
||||||
|
});
|
||||||
this.exportSettingDialog = true;
|
this.exportSettingDialog = true;
|
||||||
},
|
},
|
||||||
handleSelectionChange(row) {
|
handleSelectionChange(row) {
|
||||||
@ -659,27 +675,27 @@ export default {
|
|||||||
this.countWorkerDailyInfo = [
|
this.countWorkerDailyInfo = [
|
||||||
{
|
{
|
||||||
title: "当日进场",
|
title: "当日进场",
|
||||||
countNum: res.inServiceCount,
|
countNum: res.result.inServiceCount,
|
||||||
content: "当日在职人数之和",
|
content: "当日在职人数之和",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "当日出勤",
|
title: "当日出勤",
|
||||||
countNum: res.attendanceCount,
|
countNum: res.result.attendanceCount,
|
||||||
content: "累加当日的总出勤人数之和",
|
content: "累加当日的总出勤人数之和",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "当日缺勤",
|
title: "当日缺勤",
|
||||||
countNum: res.absentCount,
|
countNum: res.result.absentCount,
|
||||||
content: "累加当日的未出勤人数之和",
|
content: "累加当日的未出勤人数之和",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "出勤率",
|
title: "出勤率",
|
||||||
countNum: res.attendanceRate,
|
countNum: res.result.attendanceRate,
|
||||||
content: "当日出勤人数*1.0/当日在职人数",
|
content: "当日出勤人数*1.0/当日在职人数",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "当日退场",
|
title: "当日退场",
|
||||||
countNum: res.leftCount,
|
countNum: res.result.leftCount,
|
||||||
content: "当日退场人数之和",
|
content: "当日退场人数之和",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -326,7 +326,7 @@ export default {
|
|||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
data: result.map((item) => item.absence),
|
data: result.map((item) => item.attendance),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "累计缺勤",
|
name: "累计缺勤",
|
||||||
@ -343,7 +343,7 @@ export default {
|
|||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
data: result.map((item) => item.attendance),
|
data: result.map((item) => item.absence),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
dataZoom: [
|
dataZoom: [
|
||||||
@ -423,17 +423,17 @@ export default {
|
|||||||
this.countWorkerDailyInfo = [
|
this.countWorkerDailyInfo = [
|
||||||
{
|
{
|
||||||
title: "在职",
|
title: "在职",
|
||||||
countNum: res.inServe,
|
countNum: res.result.inServe,
|
||||||
content: "在职天数",
|
content: "在职天数",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "出勤",
|
title: "出勤",
|
||||||
countNum: res.attendance,
|
countNum: res.result.attendance,
|
||||||
content: "出勤天数",
|
content: "出勤天数",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "缺勤",
|
title: "缺勤",
|
||||||
countNum: res.absence,
|
countNum: res.result.absence,
|
||||||
content: "缺勤天数",
|
content: "缺勤天数",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -143,7 +143,7 @@
|
|||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span
|
<span
|
||||||
style="cursor: pointer;color: #5181F6;"
|
style="cursor: pointer; color: #5181f6"
|
||||||
@click="handleSelectionChange(scope.row)"
|
@click="handleSelectionChange(scope.row)"
|
||||||
>{{ scope.row.workerName }}</span
|
>{{ scope.row.workerName }}</span
|
||||||
>
|
>
|
||||||
@ -324,6 +324,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-circle-check"
|
icon="el-icon-circle-check"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:loading="isLoading"
|
||||||
@click="onSumbit"
|
@click="onSumbit"
|
||||||
>确定</el-button
|
>确定</el-button
|
||||||
>
|
>
|
||||||
@ -477,6 +478,7 @@ export default {
|
|||||||
title: "每日明细",
|
title: "每日明细",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
isLoading: false,
|
||||||
enterpriseListData: [],
|
enterpriseListData: [],
|
||||||
showTime: [],
|
showTime: [],
|
||||||
itemKey: "",
|
itemKey: "",
|
||||||
@ -676,20 +678,25 @@ export default {
|
|||||||
onSumbit() {
|
onSumbit() {
|
||||||
this.$refs.exportSettingInfo.validate((valid) => {
|
this.$refs.exportSettingInfo.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.isLoading = true;
|
||||||
const requestData = {
|
const requestData = {
|
||||||
...this.exportSettingInfo,
|
...this.exportSettingInfo,
|
||||||
startDate: this.exportSettingInfo.startDate[0],
|
startDate: this.exportSettingInfo.startDate[0],
|
||||||
endDate: this.exportSettingInfo.startDate[1],
|
endDate: this.exportSettingInfo.startDate[1],
|
||||||
projectSn: this.projectSn,
|
projectSn: this.projectSn,
|
||||||
}
|
};
|
||||||
fetch(this.$http.defaults.baseURL + 'xmgl/workerDailyAttendanceStatisticsV2/exportWorkerDailyAttendancesStaticsByMonthXls', {
|
fetch(
|
||||||
|
this.$http.defaults.baseURL +
|
||||||
|
"xmgl/workerDailyAttendanceStatisticsV2/exportWorkerDailyAttendancesStaticsByMonthXls",
|
||||||
|
{
|
||||||
method: "post",
|
method: "post",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: this.$store.state.userInfo.token,
|
Authorization: this.$store.state.userInfo.token,
|
||||||
"Content-Type": "application/json", // 设置请求头的内容类型为JSON
|
"Content-Type": "application/json", // 设置请求头的内容类型为JSON
|
||||||
},
|
},
|
||||||
body: JSON.stringify(requestData),
|
body: JSON.stringify(requestData),
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// 处理响应
|
// 处理响应
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@ -699,12 +706,26 @@ export default {
|
|||||||
})
|
})
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
console.log("导出成功");
|
console.log("导出成功");
|
||||||
|
const groupByTypeName = {
|
||||||
|
1: "按项目",
|
||||||
|
2: "按参建单位",
|
||||||
|
3: "按班组/部门",
|
||||||
|
4: "按人员",
|
||||||
|
}
|
||||||
|
let objName = "";
|
||||||
|
if(this.exportSettingInfo.groupByType == 1 || this.exportSettingInfo.groupByType == 3) {
|
||||||
|
const find = this.downloadTypeList.find(item => item.id == this.exportSettingInfo.downloadType)
|
||||||
|
objName = find ? `-${find.title}` : ``;
|
||||||
|
} else if(this.exportSettingInfo.groupByType == 2) {
|
||||||
|
const find = this.enterpriseListData.find(item => item.id == this.exportSettingInfo.enterpriseId)
|
||||||
|
objName = find ? `-${find.enterpriseName}` : "";
|
||||||
|
}
|
||||||
// 创建一个下载链接
|
// 创建一个下载链接
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
// 创建一个<a>元素
|
// 创建一个<a>元素
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = '考勤月报.xlsx'; // 指定下载文件的文件名
|
link.download = `考勤月报-${groupByTypeName[this.exportSettingInfo.groupByType]}${objName}.xlsx`; // 指定下载文件的文件名
|
||||||
// 模拟点击下载链接
|
// 模拟点击下载链接
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
@ -718,12 +739,27 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// 处理错误
|
// 处理错误
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
}).finally(() => {
|
||||||
|
this.isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
initExportSetting() {
|
||||||
|
this.exportSettingInfo = {
|
||||||
|
groupByType: 1,
|
||||||
|
startDate: [],
|
||||||
|
downloadType: "",
|
||||||
|
enterpriseId: "",
|
||||||
|
hourValBegin: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
// 导出设置
|
// 导出设置
|
||||||
handleExportSetting() {
|
handleExportSetting() {
|
||||||
|
this.initExportSetting(); // 重置导出设置表单信息
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.exportSettingInfo.clearValidate(); // 重置表单验证信息
|
||||||
|
});
|
||||||
this.exportSettingDialog = true;
|
this.exportSettingDialog = true;
|
||||||
},
|
},
|
||||||
handleSelectionChange(row) {
|
handleSelectionChange(row) {
|
||||||
|
|||||||
@ -129,7 +129,7 @@
|
|||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span
|
<span
|
||||||
style="cursor: pointer;color: #5181F6;"
|
style="cursor: pointer; color: #5181f6"
|
||||||
@click="handleSelectionChange(scope.row)"
|
@click="handleSelectionChange(scope.row)"
|
||||||
>{{ scope.row.workerName }}</span
|
>{{ scope.row.workerName }}</span
|
||||||
>
|
>
|
||||||
@ -574,7 +574,54 @@ export default {
|
|||||||
onSumbit() {},
|
onSumbit() {},
|
||||||
// 导出设置
|
// 导出设置
|
||||||
handleExportSetting() {
|
handleExportSetting() {
|
||||||
this.exportSettingDialog = true;
|
// this.exportSettingDialog = true;
|
||||||
|
const requestData = {
|
||||||
|
// ...this.exportSettingInfo,
|
||||||
|
// startDate: this.exportSettingInfo.startDate[0],
|
||||||
|
// endDate: this.exportSettingInfo.startDate[1],
|
||||||
|
projectSn: this.projectSn,
|
||||||
|
idList: this.$refs.multipleTable.selection.map((item) => item.id),
|
||||||
|
};
|
||||||
|
fetch(
|
||||||
|
this.$http.defaults.baseURL + "xmgl/workerAttendance/exportXls",
|
||||||
|
{
|
||||||
|
method: "post",
|
||||||
|
headers: {
|
||||||
|
Authorization: this.$store.state.userInfo.token,
|
||||||
|
"Content-Type": "application/json", // 设置请求头的内容类型为JSON
|
||||||
|
},
|
||||||
|
body: JSON.stringify(requestData),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
// 处理响应
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error("导出失败");
|
||||||
|
}
|
||||||
|
return response.blob();
|
||||||
|
})
|
||||||
|
.then((blob) => {
|
||||||
|
console.log("导出成功");
|
||||||
|
// 创建一个下载链接
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
// 创建一个<a>元素
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.download = "人员考勤.xlsx"; // 指定下载文件的文件名
|
||||||
|
// 模拟点击下载链接
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
// 释放URL对象
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
// 处理导出的文件
|
||||||
|
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||||
|
this.exportSettingDialog = false; // 关闭对话框
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// 处理错误
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleSelectionChange(row) {
|
handleSelectionChange(row) {
|
||||||
this.multipleSelection = row;
|
this.multipleSelection = row;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user