更新班组

This commit is contained in:
2025-10-24 11:42:24 +08:00
parent 67b6b88863
commit 31bafae4aa
17 changed files with 1865 additions and 257 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2025-10-19 00:35:24
* @LastEditTime: 2025-10-23 13:52:52
* @Description:
-->
<template>
@@ -73,12 +73,13 @@
<el-button
size="small"
type="primary"
@click="startDay = new Date()">
@click="startDay = new Date(),getHolidayPage()">
跳转到今天
</el-button>
</el-form-item>
</el-form>
<el-tag
v-if="topDeptId == deptId"
type="warning"
closable
style="margin-bottom: 10px; color: black">
@@ -92,15 +93,61 @@
<div class="calenderArea">
<el-calendar v-model="startDay">
<template slot="dateCell" slot-scope="{ data }">
<div v-if="data.type === 'current-month'" @click="showDetail">
<div v-if="data.type === 'current-month'">
<!-- 日期 -->
<div class="dateStyle">
<el-row :gutter="20">
<!-- 公历和农历 -->
<el-col :span="18">
{{ Number(data.day.split('-')[2]) }}
<div class="lunar-date">{{ getLunarDate(data.day) }}</div>
</el-col>
<el-col :span="6"><div class="work-tip"></div></el-col>
<!-- 显示假或班 -->
<el-col :span="6">
<div
class="work-tip"
:style="{
backgroundColor: HolidayList[
Number(data.day.split('-')[2]) - 1
]?.isHoliday
? '#67C23A'
: '#409EFF',
}">
{{
HolidayList[Number(data.day.split('-')[2]) - 1]
?.isHoliday
? '假'
: '班'
}}
</div>
</el-col>
<!-- 显示假期名和操作 -->
<el-col
:span="24"
v-if="
HolidayList[Number(data.day.split('-')[2]) - 1]
?.isHoliday
">
<div
class="holiday-div"
@click="
new Date(data.day).getTime() > Date.now() &&
showDetail(
HolidayList[Number(data.day.split('-')[2]) - 1]
.holidayId
)
">
{{
HolidayList[Number(data.day.split('-')[2]) - 1]
?.holidayName
}}
<span
class="holiday-div-btn"
v-if="new Date(data.day).getTime() > Date.now()">
<i class="el-icon-more" style="color: #fff"></i>
</span>
</div>
</el-col>
</el-row>
</div>
</div>
@@ -126,11 +173,12 @@
:dialogVisible="addOrUpdateVisible"
@cancel="cancel"
@confirm="handleConfirm"
:before-close="cancel"
:destroy-on-close="true"
width="40%">
<add-or-updata
ref="addOrUpdataRef"
@refreshPage="getHolidayPage"></add-or-updata>
@refreshPage="successSubmit"></add-or-updata>
<template #footer>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
@@ -174,6 +222,7 @@
dialogTitle="节假日变更记录"
:dialogVisible="logVisible"
@cancel="cancelLog"
:before-close="cancelLog"
:destroy-on-close="true"
width="70%">
<holiday-log ref="holidayLogRef"></holiday-log>
@@ -196,9 +245,8 @@
import moment from 'moment';
import { solarToLunar } from 'chinese-lunar';
import { listSimpleDepts } from '@/api/system/dept';
import { getUserProfile } from '@/api/system/user';
import { deptHolidayList } from '@/api/group/holidaySetting';
import { deptHolidayList, getEnableData } from '@/api/group/holidaySetting';
import addOrUpdata from './add-or-updata.vue';
import holidayLog from './holidayLog';
@@ -212,12 +260,14 @@ export default {
data() {
return {
startDay: '', // 查询参数
HolidayList: [],
// 部门树选项
deptOptions: undefined,
// 查询的部门名称
deptName: undefined,
// 选择的部门名称
showDeptName: undefined,
topDeptId: undefined, // 保存当前用户的部门id为最高级部门id
deptId: undefined,
defaultProps: {
children: 'children',
@@ -240,6 +290,7 @@ export default {
// 查询用户个人信息
getUserProfile().then((response) => {
this.showDeptName = response.data.dept.name || '';
this.topDeptId = response.data.dept.id || ''; // 保存当前用户的部门id为最高级部门id
this.deptId = response.data.dept.id || '';
this.getHolidayPage();
});
@@ -247,16 +298,31 @@ export default {
},
methods: {
getHolidayPage() {
deptHolidayList({ deptId: this.deptId }).then((response) => {});
const now = new Date(this.startDay);
const year = now.getFullYear();
const month = now.getMonth();
const startTime = `${year}-${String(month + 1).padStart(2, '0')}-01`;
const lastDate = new Date(year, month + 1, 0).getDate();
const endTime = `${year}-${String(month + 1).padStart(2, '0')}-${String(
lastDate
).padStart(2, '0')}`;
this.HolidayList = [];
deptHolidayList({
deptId: this.deptId,
startTime: Date.parse(startTime),
endTime: Date.parse(endTime),
}).then((res) => {
this.HolidayList = res.data;
});
},
// 切换月份
selectMonth() {
console.log(this.startDay);
this.getHolidayPage();
},
/** 查询部门下拉树结构 */
getTreeselect() {
listSimpleDepts().then((response) => {
getEnableData().then((response) => {
// 处理 deptOptions 参数
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
@@ -342,7 +408,7 @@ export default {
this.detail = false;
this.dialogTitle = '新增节假日';
this.$nextTick(() => {
this.$refs.addOrUpdataRef.init();
this.$refs.addOrUpdataRef.init(this.deptId);
});
},
holidayLog() {
@@ -352,8 +418,13 @@ export default {
});
},
cancel() {
this.getHolidayPage();
this.addOrUpdateVisible = false;
},
successSubmit() {
this.cancel();
this.getHolidayPage();
},
handleConfirm() {
this.$refs.addOrUpdataRef.dataFormSubmit();
},
@@ -362,7 +433,7 @@ export default {
this.detail = true;
this.dialogTitle = '节假日详情';
this.$nextTick(() => {
this.$refs.addOrUpdataRef.init(id, true);
this.$refs.addOrUpdataRef.init(this.deptId, id, true);
});
},
editHoliday() {
@@ -465,6 +536,20 @@ export default {
text-align: center;
float: right;
}
.holiday-div {
background-color: #67c23a;
border-radius: 3px;
height: 25px;
text-align: center;
line-height: 24px;
color: #fff;
.holiday-div-btn {
float: right;
transform: rotate(90deg);
font-size: 14px;
pointer-events: none;
}
}
}
}
}