flx:修改

This commit is contained in:
Rain_ 2025-08-22 15:27:37 +08:00
parent 029d0f969d
commit 3aa2ec1aa7
7 changed files with 802 additions and 240 deletions

View File

@ -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', {

View File

@ -1,6 +1,6 @@
<template>
<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
:inline="true"
:model="formInline"
@ -15,6 +15,7 @@
</el-form-item>
<el-form-item v-if="formInline.type == 1">
<el-date-picker
ref="monthPicker"
value-format="yyyy-MM"
v-model="formInline.monthTime"
type="monthrange"
@ -28,6 +29,7 @@
</el-form-item>
<el-form-item v-else-if="formInline.type == 2">
<el-date-picker
ref="monthPicker"
value-format="yyyy-MM-dd"
v-model="formInline.dayTime"
type="daterange"
@ -41,6 +43,7 @@
</el-form-item>
<el-form-item>
<el-select
ref="enterpriseTypeSelectRef"
filterable
:clearable="true"
v-model="formInline.enterpriseTypeId"
@ -56,6 +59,7 @@
</el-form-item>
<el-form-item>
<el-select
ref="enterpriseSelectRef"
filterable
:clearable="true"
v-model="formInline.enterpriseId"
@ -73,6 +77,7 @@
</el-form-item>
<el-form-item>
<el-select
ref="teamSelectRef"
filterable
:clearable="true"
v-model="formInline.teamId"
@ -89,6 +94,7 @@
</el-form-item>
<el-form-item>
<el-select
ref="departmentSelectRef"
filterable
:clearable="true"
v-model="formInline.departmentId"
@ -280,7 +286,31 @@ export default {
deep: true,
},
},
mounted() {
this.$nextTick(() => {
this.$refs.scrollDiv.$el.children[0].addEventListener(
"scroll",
this.handleScroll,
true
);
});
},
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() {
this.getCountWorkerDailyAttendanceStatisticsV2();
this.getListData();

View File

@ -420,6 +420,7 @@
<el-button
icon="el-icon-circle-check"
type="primary"
:loading="exportLoading"
@click="onSumbit"
>确定</el-button
>
@ -543,6 +544,7 @@ export default {
title: "进出场打卡",
},
],
exportLoading: false,
videoTypeList: [],
};
},
@ -554,6 +556,7 @@ export default {
onSumbit() {
this.$refs.exportSettingInfo.validate((valid) => {
if (valid) {
this.exportLoading = true;
const requestData = {
...this.exportSettingInfo,
startDate: this.exportSettingInfo.startDate[0],
@ -600,12 +603,25 @@ export default {
.catch((error) => {
//
console.error(error);
})
.finally(() => {
this.exportLoading = false;
});
}
});
},
initExportSetting() {
this.exportSettingInfo = {
startDate: [],
downloadType: "",
};
},
//
handleExportSetting() {
this.initExportSetting(); //
this.$nextTick(() => {
this.$refs.exportSettingInfo.clearValidate(); //
});
this.exportSettingDialog = true;
},
handleSelectionChange(row) {
@ -659,27 +675,27 @@ export default {
this.countWorkerDailyInfo = [
{
title: "当日进场",
countNum: res.inServiceCount,
countNum: res.result.inServiceCount,
content: "当日在职人数之和",
},
{
title: "当日出勤",
countNum: res.attendanceCount,
countNum: res.result.attendanceCount,
content: "累加当日的总出勤人数之和",
},
{
title: "当日缺勤",
countNum: res.absentCount,
countNum: res.result.absentCount,
content: "累加当日的未出勤人数之和",
},
{
title: "出勤率",
countNum: res.attendanceRate,
countNum: res.result.attendanceRate,
content: "当日出勤人数*1.0/当日在职人数",
},
{
title: "当日退场",
countNum: res.leftCount,
countNum: res.result.leftCount,
content: "当日退场人数之和",
},
];

View File

@ -326,7 +326,7 @@ export default {
},
]),
},
data: result.map((item) => item.absence),
data: result.map((item) => item.attendance),
},
{
name: "累计缺勤",
@ -343,7 +343,7 @@ export default {
},
]),
},
data: result.map((item) => item.attendance),
data: result.map((item) => item.absence),
},
],
dataZoom: [
@ -423,17 +423,17 @@ export default {
this.countWorkerDailyInfo = [
{
title: "在职",
countNum: res.inServe,
countNum: res.result.inServe,
content: "在职天数",
},
{
title: "出勤",
countNum: res.attendance,
countNum: res.result.attendance,
content: "出勤天数",
},
{
title: "缺勤",
countNum: res.absence,
countNum: res.result.absence,
content: "缺勤天数",
},
];

View File

@ -143,7 +143,7 @@
>
<template slot-scope="scope">
<span
style="cursor: pointer;color: #5181F6;"
style="cursor: pointer; color: #5181f6"
@click="handleSelectionChange(scope.row)"
>{{ scope.row.workerName }}</span
>
@ -324,6 +324,7 @@
<el-button
icon="el-icon-circle-check"
type="primary"
:loading="isLoading"
@click="onSumbit"
>确定</el-button
>
@ -477,6 +478,7 @@ export default {
title: "每日明细",
},
],
isLoading: false,
enterpriseListData: [],
showTime: [],
itemKey: "",
@ -676,20 +678,25 @@ export default {
onSumbit() {
this.$refs.exportSettingInfo.validate((valid) => {
if (valid) {
this.isLoading = true;
const requestData = {
...this.exportSettingInfo,
startDate: this.exportSettingInfo.startDate[0],
endDate: this.exportSettingInfo.startDate[1],
projectSn: this.projectSn,
}
fetch(this.$http.defaults.baseURL + 'xmgl/workerDailyAttendanceStatisticsV2/exportWorkerDailyAttendancesStaticsByMonthXls', {
method: "post",
headers: {
Authorization: this.$store.state.userInfo.token,
"Content-Type": "application/json", // JSON
},
body: JSON.stringify(requestData),
})
};
fetch(
this.$http.defaults.baseURL +
"xmgl/workerDailyAttendanceStatisticsV2/exportWorkerDailyAttendancesStaticsByMonthXls",
{
method: "post",
headers: {
Authorization: this.$store.state.userInfo.token,
"Content-Type": "application/json", // JSON
},
body: JSON.stringify(requestData),
}
)
.then((response) => {
//
if (!response.ok) {
@ -699,12 +706,26 @@ export default {
})
.then((blob) => {
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);
// <a>
const link = document.createElement("a");
link.href = url;
link.download = '考勤月报.xlsx'; //
link.download = `考勤月报-${groupByTypeName[this.exportSettingInfo.groupByType]}${objName}.xlsx`; //
//
document.body.appendChild(link);
link.click();
@ -718,12 +739,27 @@ export default {
.catch((error) => {
//
console.error(error);
}).finally(() => {
this.isLoading = false;
});
}
});
},
initExportSetting() {
this.exportSettingInfo = {
groupByType: 1,
startDate: [],
downloadType: "",
enterpriseId: "",
hourValBegin: "",
};
},
//
handleExportSetting() {
this.initExportSetting(); //
this.$nextTick(() => {
this.$refs.exportSettingInfo.clearValidate(); //
});
this.exportSettingDialog = true;
},
handleSelectionChange(row) {

View File

@ -129,7 +129,7 @@
>
<template slot-scope="scope">
<span
style="cursor: pointer;color: #5181F6;"
style="cursor: pointer; color: #5181f6"
@click="handleSelectionChange(scope.row)"
>{{ scope.row.workerName }}</span
>
@ -574,7 +574,54 @@ export default {
onSumbit() {},
//
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) {
this.multipleSelection = row;