更新班组

This commit is contained in:
2025-10-19 00:38:48 +08:00
parent 6c46083d4a
commit 4e801873b9
23 changed files with 3332 additions and 0 deletions

View File

@@ -0,0 +1,209 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-10-19 00:09:11
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="节假日名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
:disabled="detail"
placeholder="请输入节假日名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日历类型" prop="calendarType">
<el-select
v-model="dataForm.calendarType"
:disabled="detail"
style="width: 100%">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期类型" prop="dateType">
<el-select
style="width: 100%"
:disabled="detail"
v-model="dataForm.dateType">
<el-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期" prop="dateTime">
<el-date-picker
:disabled="detail"
style="width: 100%"
v-if="dataForm.dateType == 1"
key="date"
v-model="dataForm.dateDay"
type="date"
placeholder="选择日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"></el-date-picker>
<el-date-picker
:disabled="detail"
style="width: 100%"
v-else
key="daterange"
v-model="dataForm.dateDayArr"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否每年重复" prop="repeat">
<el-select
v-model="dataForm.repeat"
:disabled="detail"
style="width: 100%">
<el-option
v-for="item in options3"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { createHoliday, updateHoliday,deleteHolidayn } from '@/api/group/holidaySetting';
export default {
components: {},
data() {
return {
dataForm: {
id: undefined,
name: undefined,
calendarType: 1,
dateType: 1,
dateDay: undefined,
dateDayArr: [],
repeat: true,
},
detail: false,
options1: [
{
value: 1,
label: '公历(阳历)',
},
{
value: 2,
label: '农历(阴历)',
},
],
options2: [
{
value: 1,
label: '单天',
},
{
value: 2,
label: '时间段',
},
],
options3: [
{
value: false,
label: '否,本年度有效',
},
{
value: true,
label: '是,每年循环生效',
},
],
dataRule: {
name: [
{ required: true, message: '节假日名称不能为空', trigger: 'blur' },
],
calendarType: [
{ required: true, message: '日历类型不能为空', trigger: 'change' },
],
dateType: [
{ required: true, message: '日期类型不能为空', trigger: 'change' },
],
dateDay: [
{ required: true, message: '日期不能为空', trigger: 'change' },
],
dateDayArr: [
{ required: true, message: '日期不能为空', trigger: 'change' },
],
repeat: [
{
required: true,
message: '是否每年重复不能为空',
trigger: 'change',
},
],
},
};
},
methods: {
init(id, detail) {
this.dataForm.id = id || undefined;
this.detail = detail || false;
},
editHoliday(){
this.detail = false
},
deleteHoliday(){
deleteHolidayn(this.dataForm.id).then(res=>{
console.log(res)
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
updateHoliday(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshPage');
});
return;
}
// 添加的提交
createHoliday(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshPage');
});
});
},
},
};
</script>

View File

@@ -0,0 +1,181 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import { parseTime } from '@/filter/code-filter';
import { deptHolidayLogList } from '@/api/group/holidaySetting';
const tableProps = [
{
prop: 'createTime',
label: '操作时间',
filter: parseTime
},
{
prop: 'opPeopleName',
label: '操作人'
},
{
prop: 'opType',
label: '操作类型',
filter: (val)=>{return val?['','创建','删除','修改','-','-'][val]:'-'}
},
{
prop: 'name',
label: '节假日名称'
},
{
prop: 'opDet',
label: '修改内容'
},
{
prop: 'planType',
label: '更新排班计划',
filter: (val)=>{return val?['','是','否','无排班计划'][val]:'-'}
},
];
export default {
data() {
return {
listQuery: { //分页
pageSize: 10,
pageNo: 1,
total: 1,
},
tableProps,
tableData: [],
formConfig: [
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'createTime',
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'opPeopleName',
},
{
type: 'select',
label: '操作类型',
selectOptions: [
{
id: 1,
name: '创建',
},
{
id: 2,
name: '删除',
},
{
id: 3,
name: '修改',
},
{
id: 4,
name: '解除继承',
},
{
id: 5,
name: '恢复继承',
},
],
param: 'opType',
},
{
type: 'select',
label: '更新排班计划',
selectOptions: [
{
id: 1,
name: '是',
},
{
id: 2,
name: '否',
},
{
id: 3,
name: '无排班计划',
},
],
param: 'planType',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
],
};
},
created() {},
methods: {
// 获取数据列表
getDataList() {
deptHolidayLogList(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.createTime = val.createTime || [];
this.listQuery.planType = val.planType || undefined;
this.listQuery.opType = val.opType || undefined;
this.listQuery.opPeopleName = val.opPeopleName || undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -0,0 +1,473 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2025-10-19 00:35:24
* @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="16">
<div style="height: 40px; font-size: 16px">
<span style="color: #409eff; font-weight: 600">
{{ showDeptName }}
</span>
节假日设置
</div>
</el-col>
<el-col :span="8">
<div style="float: right">
<el-button
size="small"
type="primary"
style="margin-right: 10px"
@click="addHoliday">
新增节假日
</el-button>
<el-button size="small" @click="holidayLog">
节假日变更记录
</el-button>
</div>
</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 style="float: right">
<el-button
size="small"
type="primary"
@click="startDay = new Date()">
跳转到今天
</el-button>
</el-form-item>
</el-form>
<el-tag
type="warning"
closable
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="calenderArea">
<el-calendar v-model="startDay">
<template slot="dateCell" slot-scope="{ data }">
<div v-if="data.type === 'current-month'" @click="showDetail">
<!-- 日期 -->
<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-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>
</el-col>
</el-row>
</div>
</template>
</el-calendar>
</div>
</div>
</el-col>
<base-dialog
:dialogTitle="dialogTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="cancel"
@confirm="handleConfirm"
:destroy-on-close="true"
width="40%">
<add-or-updata
ref="addOrUpdataRef"
@refreshPage="getHolidayPage"></add-or-updata>
<template #footer>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button
v-if="!detail"
size="small"
class="btnTextStyle"
@click="cancel">
取消
</el-button>
<el-button
v-if="!detail"
type="primary"
class="btnTextStyle"
size="small"
@click="handleConfirm">
确定
</el-button>
<el-button
v-if="detail"
size="small"
type="primary"
class="btnTextStyle"
@click="editHoliday">
修改
</el-button>
<el-button
v-if="detail"
class="btnTextStyle"
size="small"
@click="deleteHoliday">
删除
</el-button>
</el-col>
</el-row>
</slot>
</template>
</base-dialog>
<base-dialog
dialogTitle="节假日变更记录"
:dialogVisible="logVisible"
@cancel="cancelLog"
:destroy-on-close="true"
width="70%">
<holiday-log ref="holidayLogRef"></holiday-log>
<template #footer>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="cancelLog">
取消
</el-button>
</el-col>
</el-row>
</slot>
</template>
</base-dialog>
</el-row>
</template>
<script>
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 addOrUpdata from './add-or-updata.vue';
import holidayLog from './holidayLog';
export default {
name: '',
components: {
addOrUpdata,
holidayLog,
},
data() {
return {
startDay: '', // 查询参数
// 部门树选项
deptOptions: undefined,
// 查询的部门名称
deptName: undefined,
// 选择的部门名称
showDeptName: undefined,
deptId: undefined,
defaultProps: {
children: 'children',
label: 'name',
},
dialogTitle: undefined,
addOrUpdateVisible: false,
detail: false,
logVisible: false,
};
},
watch: {
// 根据名称筛选部门树
deptName(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.startDay = new Date();
// 查询用户个人信息
getUserProfile().then((response) => {
this.showDeptName = response.data.dept.name || '';
this.deptId = response.data.dept.id || '';
this.getHolidayPage();
});
this.getTreeselect();
},
methods: {
getHolidayPage() {
deptHolidayList({ deptId: this.deptId }).then((response) => {});
},
// 切换月份
selectMonth() {
console.log(this.startDay);
this.getHolidayPage();
},
/** 查询部门下拉树结构 */
getTreeselect() {
listSimpleDepts().then((response) => {
// 处理 deptOptions 参数
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.deptId = data.id;
this.showDeptName = data.name;
this.getHolidayPage();
},
//获取农历
getLunarDate(solarDate) {
try {
const [year, month, day] = solarDate.split('-').map(Number);
const date = new Date(year, month - 1, day);
const lunar = solarToLunar(date);
// 将数字月份和日期转换为中文
const monthMap = {
1: '正',
2: '二',
3: '三',
4: '四',
5: '五',
6: '六',
7: '七',
8: '八',
9: '九',
10: '十',
11: '冬',
12: '腊',
};
const dayMap = {
1: '初一',
2: '初二',
3: '初三',
4: '初四',
5: '初五',
6: '初六',
7: '初七',
8: '初八',
9: '初九',
10: '初十',
11: '十一',
12: '十二',
13: '十三',
14: '十四',
15: '十五',
16: '十六',
17: '十七',
18: '十八',
19: '十九',
20: '二十',
21: '廿一',
22: '廿二',
23: '廿三',
24: '廿四',
25: '廿五',
26: '廿六',
27: '廿七',
28: '廿八',
29: '廿九',
30: '三十',
};
// 返回 "三月初四" 格式
return `${monthMap[lunar.month]}${dayMap[lunar.day]}`;
} catch (error) {
console.log(error);
return '';
}
},
addHoliday() {
this.addOrUpdateVisible = true;
this.detail = false;
this.dialogTitle = '新增节假日';
this.$nextTick(() => {
this.$refs.addOrUpdataRef.init();
});
},
holidayLog() {
this.logVisible = true;
this.$nextTick(() => {
this.$refs.holidayLogRef.getDataList();
});
},
cancel() {
this.addOrUpdateVisible = false;
},
handleConfirm() {
this.$refs.addOrUpdataRef.dataFormSubmit();
},
showDetail(id) {
this.addOrUpdateVisible = true;
this.detail = true;
this.dialogTitle = '节假日详情';
this.$nextTick(() => {
this.$refs.addOrUpdataRef.init(id, true);
});
},
editHoliday() {
this.detail = false;
this.$nextTick(() => {
this.$refs.addOrUpdataRef.editHoliday();
});
},
deleteHoliday() {
this.$nextTick(() => {
this.$refs.addOrUpdataRef.deleteHoliday();
});
},
cancelLog() {
this.logVisible = false;
},
},
};
</script>
<style lang="scss">
.head-container {
padding: 20px 10px 0;
background-color: #fff;
min-height: calc(100vh - 120px - 8px);
border-radius: 8px;
}
.groupTeamScheduling {
.operationArea {
padding: 14px 10px 0 16px;
margin-bottom: 8px;
background-color: #fff;
border-radius: 8px;
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
.el-form-item {
margin-bottom: 10px;
}
}
// 日历
.calenderArea {
padding: 14px 10px 0 20px;
background-color: #fff;
border-radius: 8px;
min-height: calc(100vh - 120px - 8px - 168px);
.el-calendar__body {
padding: 10px 16px 16px 0;
}
.el-calendar__header {
display: none;
}
.el-calendar-table > thead {
height: 48px;
font-size: 20px;
font-weight: 500;
color: #000000;
background-color: rgba(242, 244, 249, 1);
}
.el-calendar-table__row {
height: 133px;
.prev,
.next {
pointer-events: none;
}
.is-selected,
.is-today {
background-color: #e4f0fd;
}
.el-calendar-day {
padding: 0;
height: 100%;
:hover {
background-color: #e4f0fd;
}
.dateStyle {
font-size: 20px;
font-weight: 500;
color: #000000;
text-align: left;
height: 133px;
line-height: 28px;
padding: 10px;
.lunar-date {
display: inline-block;
font-size: 12px;
color: #909399;
}
.work-tip {
background: #87c1ff;
color: white;
font-size: 18px;
width: 30px;
text-align: center;
float: right;
}
}
}
}
}
}
</style>