班组bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2025-11-11 10:29:18
|
||||
* @LastEditTime: 2025-11-27 14:06:11
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -213,6 +213,7 @@ export default {
|
||||
deptId: undefined,
|
||||
},
|
||||
detail: false,
|
||||
inherited: true,
|
||||
options1: [
|
||||
{
|
||||
value: 1,
|
||||
@@ -330,11 +331,12 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
init(deptId, val, detail) {
|
||||
init(deptId, val, detail, inherited) {
|
||||
this.dataForm.deptId = deptId || undefined;
|
||||
this.dataForm.id = val.holidayId || undefined;
|
||||
this.dataForm.inherited = val.isInherit || false;
|
||||
this.detail = detail || false;
|
||||
this.inherited = inherited; //编辑的时候,该部门如果是自定义的,但这个val数据是继承的,修改之后,则变成自定义的inherited
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
@@ -469,6 +471,9 @@ export default {
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
if (!this.inherited) {
|
||||
this.dataForm.inherited = false;
|
||||
}
|
||||
updateHoliday(this.dataForm).then((res) => {
|
||||
if (!res.data.updateFlag) {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
|
||||
@@ -2,283 +2,284 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2024-07-01 14:54:06
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2025-11-11 14:29:10
|
||||
* @LastEditTime: 2025-11-24 16:11:20
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-row :gutter="10" style="background-color: #f2f4f9">
|
||||
<!--部门数据-->
|
||||
<el-col :span="4">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
placeholder="请输入部门名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px" />
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="handleNodeClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<div class="groupTeamScheduling">
|
||||
<div class="operationArea">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div style="height: 40px; font-size: 16px">
|
||||
<span style="color: #409eff; font-weight: 600">
|
||||
{{ showDeptName }}
|
||||
</span>
|
||||
节假日设置
|
||||
<span
|
||||
:style="{
|
||||
color: inherited ? '#67c23a' : '#b5b839',
|
||||
fontSize: '12px',
|
||||
fontWeight: 600,
|
||||
}"
|
||||
v-show="ishasParent">
|
||||
{{ inherited ? '继承模式' : '自定义模式' }}
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" v-if="!ishasParent">
|
||||
<div style="float: right">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
style="margin-right: 10px"
|
||||
v-hasPermi="['base:group-holiday:create']"
|
||||
@click="addHoliday">
|
||||
新增节假日
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
v-hasPermi="['base:group-holiday-log:query']"
|
||||
@click="holidayLog">
|
||||
节假日变更记录
|
||||
</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" v-else style="text-align: right">
|
||||
<div
|
||||
class="app-container"
|
||||
style="
|
||||
background-color: #f2f4f9;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 5fr;
|
||||
gap: 10px;
|
||||
">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
placeholder="请输入部门名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px" />
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="handleNodeClick" />
|
||||
</div>
|
||||
<div class="groupTeamScheduling">
|
||||
<div class="operationArea">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div style="height: 40px; font-size: 16px">
|
||||
<span style="color: #409eff; font-weight: 600">
|
||||
{{ showDeptName }}
|
||||
</span>
|
||||
节假日设置
|
||||
<span
|
||||
:style="{
|
||||
color: inherited ? '#67c23a' : '#b5b839',
|
||||
fontSize: '12px',
|
||||
fontWeight: 600,
|
||||
}"
|
||||
v-show="ishasParent">
|
||||
{{ inherited ? '继承模式' : '自定义模式' }}
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" v-if="!ishasParent">
|
||||
<div style="float: right">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="inherited"
|
||||
style="margin-right: 10px"
|
||||
v-hasPermi="['base:group-holiday:create']"
|
||||
@click="addHoliday">
|
||||
新增节假日
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="success"
|
||||
:disabled="inherited"
|
||||
v-hasPermi="['base:group-holiday:update']"
|
||||
@click="reExtends">
|
||||
恢复继承
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="warning"
|
||||
:disabled="!inherited"
|
||||
v-hasPermi="['base:group-holiday:update']"
|
||||
@click="disExtends">
|
||||
解除继承
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="inherited"
|
||||
v-hasPermi="['base:group-holiday-log:query']"
|
||||
@click="holidayLog">
|
||||
节假日变更记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" v-else style="text-align: right">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="inherited"
|
||||
v-hasPermi="['base:group-holiday:create']"
|
||||
@click="addHoliday">
|
||||
新增节假日
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="success"
|
||||
:disabled="inherited"
|
||||
v-hasPermi="['base:group-holiday:update']"
|
||||
@click="reExtends">
|
||||
恢复继承
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="warning"
|
||||
:disabled="!inherited"
|
||||
v-hasPermi="['base:group-holiday:update']"
|
||||
@click="disExtends">
|
||||
解除继承
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="inherited"
|
||||
v-hasPermi="['base:group-holiday-log:query']"
|
||||
@click="holidayLog">
|
||||
节假日变更记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="operationArea">
|
||||
<el-form :inline="true" class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item label="月份选择">
|
||||
<el-date-picker
|
||||
v-model="startDay"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
size="small"
|
||||
@change="selectMonth"
|
||||
:clearable="false"
|
||||
style="width: 120px"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="继承上一级的节假日" v-show="ishasParent">
|
||||
<div
|
||||
style="
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background-color: #67c23a;
|
||||
border-radius: 3px;
|
||||
"></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="本级自定义的节假日" v-show="ishasParent">
|
||||
<div
|
||||
style="
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background-color: #b5b839;
|
||||
border-radius: 3px;
|
||||
"></div>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="(startDay = new Date()), getHolidayPage()">
|
||||
跳转到今天
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div v-if="!ishasParent">
|
||||
<el-tag
|
||||
type="warning"
|
||||
closable
|
||||
v-if="showTag1"
|
||||
@close="handleClose(1)"
|
||||
style="margin-bottom: 10px; color: black">
|
||||
<i class="el-icon-warning" style="color: #ffbd02"></i>
|
||||
当前节假日设置为组织架构中最高层级配置,默认自动继承至下属部门。子部门可选择
|
||||
<span style="color: red">解除继承</span>
|
||||
设置后进行独立修改,解除后不再继承上级设置
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="operationArea">
|
||||
<el-form :inline="true" class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item label="月份选择">
|
||||
<el-date-picker
|
||||
v-model="startDay"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
size="small"
|
||||
@change="selectMonth"
|
||||
:clearable="false"
|
||||
style="width: 120px"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="继承上一级的节假日" v-show="ishasParent">
|
||||
<div
|
||||
style="
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background-color: #67c23a;
|
||||
border-radius: 3px;
|
||||
"></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="本级自定义的节假日" v-show="ishasParent">
|
||||
<div
|
||||
style="
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background-color: #b5b839;
|
||||
border-radius: 3px;
|
||||
"></div>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="(startDay = new Date()), getHolidayPage()">
|
||||
跳转到今天
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div v-if="!ishasParent">
|
||||
<div v-else>
|
||||
<div v-if="inherited">
|
||||
<el-tag
|
||||
type="warning"
|
||||
closable
|
||||
v-if="showTag1"
|
||||
@close="handleClose(1)"
|
||||
v-if="showTag2"
|
||||
@close="handleClose(2)"
|
||||
style="margin-bottom: 10px; color: black">
|
||||
<i class="el-icon-warning" style="color: #ffbd02"></i>
|
||||
当前节假日设置为组织架构中最高层级配置,默认自动继承至下属部门。子部门可选择
|
||||
当前部门继承上级节假日设置,默认不可修改。可通过
|
||||
<span style="color: red">解除继承</span>
|
||||
设置后进行独立修改,解除后不再继承上级设置
|
||||
进行自定义,解除后将不再继承。
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="inherited">
|
||||
<el-tag
|
||||
type="warning"
|
||||
closable
|
||||
v-if="showTag2"
|
||||
@close="handleClose(2)"
|
||||
style="margin-bottom: 10px; color: black">
|
||||
<i class="el-icon-warning" style="color: #ffbd02"></i>
|
||||
当前部门继承上级节假日设置,默认不可修改。可通过
|
||||
<span style="color: red">解除继承</span>
|
||||
进行自定义,解除后将不再继承。
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-tag
|
||||
type="warning"
|
||||
closable
|
||||
v-if="showTag3"
|
||||
@close="handleClose(3)"
|
||||
style="margin-bottom: 10px; color: black">
|
||||
<i class="el-icon-warning" style="color: #ffbd02"></i>
|
||||
当前部门已解除继承,节假日可自由配置。点击
|
||||
<span style="color: red">恢复继承</span>
|
||||
将清空当前设置并同步上级节假日。
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-tag
|
||||
type="warning"
|
||||
closable
|
||||
v-if="showTag3"
|
||||
@close="handleClose(3)"
|
||||
style="margin-bottom: 10px; color: black">
|
||||
<i class="el-icon-warning" style="color: #ffbd02"></i>
|
||||
当前部门已解除继承,节假日可自由配置。点击
|
||||
<span style="color: red">恢复继承</span>
|
||||
将清空当前设置并同步上级节假日。
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 日历区域 -->
|
||||
<div class="calenderArea">
|
||||
<el-calendar v-model="startDay">
|
||||
<template slot="dateCell" slot-scope="{ data }">
|
||||
<div v-if="data.type === 'current-month'">
|
||||
<!-- 日期 -->
|
||||
<div
|
||||
class="dateStyle"
|
||||
@click="
|
||||
new Date(data.day).getTime() >=
|
||||
new Date().setHours(0, 0, 0, 0) &&
|
||||
(!ishasParent || !inherited) &&
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
?.isHoliday &&
|
||||
showDetail(
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
)
|
||||
">
|
||||
<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"
|
||||
: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="
|
||||
</div>
|
||||
<!-- 日历区域 -->
|
||||
<div class="calenderArea">
|
||||
<el-calendar v-model="startDay">
|
||||
<template slot="dateCell" slot-scope="{ data }">
|
||||
<div v-if="data.type === 'current-month'">
|
||||
<!-- 日期 -->
|
||||
<div
|
||||
class="dateStyle"
|
||||
@click="
|
||||
new Date(data.day).getTime() >=
|
||||
new Date().setHours(0, 0, 0, 0) &&
|
||||
(!ishasParent || !inherited) &&
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
?.isHoliday &&
|
||||
showDetail(HolidayList[Number(data.day.split('-')[2]) - 1])
|
||||
">
|
||||
<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"
|
||||
:style="{
|
||||
backgroundColor: HolidayList[
|
||||
Number(data.day.split('-')[2]) - 1
|
||||
]?.isHoliday
|
||||
? '#67C23A'
|
||||
: '#409EFF',
|
||||
}">
|
||||
{{
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
?.isHoliday
|
||||
">
|
||||
<div
|
||||
class="holiday-div"
|
||||
:style="{
|
||||
backgroundColor: ishasParent
|
||||
? HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
.isInherit
|
||||
? '#67c23a'
|
||||
: '#b5b839'
|
||||
: '',
|
||||
}">
|
||||
{{
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
?.holidayName
|
||||
}}
|
||||
<span
|
||||
class="holiday-div-btn"
|
||||
v-if="
|
||||
(!ishasParent || !inherited) &&
|
||||
new Date(data.day).getTime() >=
|
||||
new Date().setHours(0, 0, 0, 0)
|
||||
">
|
||||
<i class="el-icon-more" style="color: #fff"></i>
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
style="font-size: 20px; font-weight: 500; text-align: left">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
{{ Number(data.day.split('-')[2]) }}
|
||||
<span style="font-size: 12px">
|
||||
{{ getLunarDate(data.day) }}
|
||||
</span>
|
||||
? '假'
|
||||
: '班'
|
||||
}}
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- 显示假期名和操作 -->
|
||||
<el-col
|
||||
:span="24"
|
||||
v-if="
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]?.isHoliday
|
||||
">
|
||||
<div
|
||||
class="holiday-div"
|
||||
:style="{
|
||||
backgroundColor: ishasParent
|
||||
? HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
.isInherit
|
||||
? '#67c23a'
|
||||
: '#b5b839'
|
||||
: '',
|
||||
}">
|
||||
{{
|
||||
HolidayList[Number(data.day.split('-')[2]) - 1]
|
||||
?.holidayName
|
||||
}}
|
||||
<span
|
||||
class="holiday-div-btn"
|
||||
v-if="
|
||||
(!ishasParent || !inherited) &&
|
||||
new Date(data.day).getTime() >=
|
||||
new Date().setHours(0, 0, 0, 0)
|
||||
">
|
||||
<i class="el-icon-more" style="color: #fff"></i>
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
</el-calendar>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
style="font-size: 20px; font-weight: 500; text-align: left">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
{{ Number(data.day.split('-')[2]) }}
|
||||
<span style="font-size: 12px">
|
||||
{{ getLunarDate(data.day) }}
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
</el-calendar>
|
||||
</div>
|
||||
</el-col>
|
||||
</div>
|
||||
<base-dialog
|
||||
:dialogTitle="dialogTitle"
|
||||
:dialogVisible="addOrUpdateVisible"
|
||||
@@ -352,7 +353,7 @@
|
||||
</slot>
|
||||
</template>
|
||||
</base-dialog>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -453,13 +454,43 @@ export default {
|
||||
// 遍历部门,判断当前帐号的部门是否有为最上级
|
||||
const nowDept = response.data.filter((i) => i.id == this.topDeptId);
|
||||
this.ishasParent = nowDept[0].hasParent;
|
||||
this.parentId = nowDept.parentId;
|
||||
this.parentId = nowDept[0].parentId;
|
||||
|
||||
// 处理 deptOptions 参数
|
||||
this.deptOptions = [];
|
||||
this.deptOptions.push(...this.handleTree(response.data, 'id'));
|
||||
this.deptOptions.push(...this.handleTree1(response.data, 'id'));
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.setCurrentKey(this.deptId);
|
||||
});
|
||||
});
|
||||
},
|
||||
//大整数精度丢失
|
||||
handleTree1(data, fid) {
|
||||
const id = fid || 'id';
|
||||
const parentId = 'parentId';
|
||||
const children = 'children';
|
||||
const rootId =
|
||||
data
|
||||
.map((item) => item[parentId].toString())
|
||||
.reduce((min, current) => {
|
||||
if (current.length < min.length) return current;
|
||||
if (current.length > min.length) return min;
|
||||
return current < min ? current : min;
|
||||
}) || 0;
|
||||
//对源数据深度克隆
|
||||
const cloneData = JSON.parse(JSON.stringify(data));
|
||||
//循环所有项
|
||||
const treeData = cloneData.filter((father) => {
|
||||
let branchArr = cloneData.filter((child) => {
|
||||
//返回每一项的子级数组
|
||||
return father[id] == child[parentId];
|
||||
});
|
||||
branchArr.length > 0 ? (father.children = branchArr) : '';
|
||||
//返回第一层
|
||||
return father[parentId] == rootId;
|
||||
});
|
||||
return treeData !== '' ? treeData : data;
|
||||
},
|
||||
// 根据部门id查询该部门是否是继承
|
||||
getSet() {
|
||||
getSet({ id: this.deptId }).then((res) => {
|
||||
@@ -643,6 +674,7 @@ export default {
|
||||
type: 'info',
|
||||
message: '已取消',
|
||||
});
|
||||
this.getSet();
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -676,7 +708,7 @@ export default {
|
||||
this.detail = true;
|
||||
this.dialogTitle = '节假日详情';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdataRef.init(this.deptId, val, true);
|
||||
this.$refs.addOrUpdataRef.init(this.deptId, val, true, this.inherited); //编辑的时候,该部门如果是自定义的,但这个val数据是继承的,修改之后,则变成自定义的inherited
|
||||
});
|
||||
},
|
||||
editHoliday() {
|
||||
@@ -709,7 +741,7 @@ export default {
|
||||
.head-container {
|
||||
padding: 20px 10px 0;
|
||||
background-color: #fff;
|
||||
min-height: calc(100vh - 120px - 8px);
|
||||
height: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.groupTeamScheduling {
|
||||
|
||||
Reference in New Issue
Block a user