班组bug #455

Merged
zwq merged 1 commits from projects/line-new-zwq into projects/line-new 2025-11-28 16:29:25 +08:00
15 changed files with 874 additions and 576 deletions
Showing only changes of commit ffa0b2e8dd - Show all commits

View File

@@ -26,6 +26,13 @@ export function getGroup(id) {
method: 'get'
})
}
// 检查更新-生产班组
export function updateIsProduction(id) {
return request({
url: '/base/group-team/updateIsProduction?id=' + id,
method: 'get'
})
}
// 获得班组基础信息分页
export function getGroupPage(query) {

View File

@@ -16,7 +16,7 @@ export default {
},
tableData: [], //table数据
listQuery: { //分页
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
},

View File

@@ -176,13 +176,15 @@ service.interceptors.response.use(async res => {
+ '<div>5 分钟搭建本地环境</div>',
})
return Promise.reject(new Error(msg))
} else if (code === 400) {
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
} else if (code !== 200) {
if (msg === '无效的刷新令牌') { // hard coding忽略这个提示直接登出
console.log(msg)
} else {
Notification.error({
title: msg
})
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
}
return Promise.reject('error')
} else {

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-23 13:43:55
* @LastEditors: zwq
* @LastEditTime: 2025-11-10 10:39:33
* @LastEditTime: 2025-11-14 21:13:10
* @Description:
-->
<template>
@@ -59,7 +59,7 @@ export default {
},
created() {},
methods: {
init(det) {
init(det, detSort) {
this.tableData = det;
//返回计划名和id
const arr = det.map((item) => {
@@ -77,7 +77,19 @@ export default {
map.set(item.planId, item);
}
});
this.groupClassArr = Array.from(map.values());
const newArr = Array.from(map.values());
// 创建B数组中id的顺序映射
const orderMap = new Map();
detSort.forEach((item, index) => {
orderMap.set(item, index);
});
// 根据B的顺序对A进行排序
this.groupClassArr = [...newArr].sort((a, b) => {
const orderA = orderMap.get(a.planId);
const orderB = orderMap.get(b.planId);
return orderA - orderB;
});
},
},
};

View File

@@ -2,13 +2,19 @@
* @Author: zwq
* @Date: 2025-10-23 13:43:55
* @LastEditors: zwq
* @LastEditTime: 2025-11-10 10:40:13
* @LastEditTime: 2025-11-25 09:39:43
* @Description:
-->
<template>
<el-row :gutter="10" style="background-color: #f2f4f9">
<!--部门数据-->
<el-col :span="4">
<div
class="app-container"
style="
background-color: #f2f4f9;
padding: 0;
display: grid;
grid-template-columns: 1fr 5fr;
gap: 10px;
">
<div class="head-container">
<el-tabs v-model="activeName" stretch @tab-click="tabsClick">
<el-tab-pane label="部门" name="first"></el-tab-pane>
@@ -28,6 +34,7 @@
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick" />
@@ -46,13 +53,12 @@
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree1"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick1" />
</div>
</div>
</el-col>
<el-col :span="20">
<div class="groupTeamScheduling">
<div class="operationArea">
<el-form :inline="true" class="demo-form-inline">
@@ -71,10 +77,15 @@
v-if="activeName == 'first'">
提示排班日历仅展示当前选中部门的节假日设置若休假日中仍有排班则表示下级组织已通过自定义假期进行排班
</span>
<span v-else>
组长:{{ showTeamName?.leaderName || '-' }} 组长电话:{{
showTeamName?.leaderPhone || '-'
}}
<span v-else style="margin-left: 10px">
组长:
<span style="font-weight: 600; margin: 0 10px">
{{ showTeamName?.leaderName || '-' }}
</span>
组长电话:
<span style="font-weight: 600; margin: 0 10px">
{{ showTeamName?.leaderPhone || '-' }}
</span>
</span>
</el-form-item>
<el-form-item style="float: right">
@@ -128,9 +139,7 @@
effect="dark"
content="本日节假日变更已影响当前排班计划,但尚未同步,请及时处理。"
placement="top">
<i
class="el-icon-warning"
style="color: #f56c6c"></i>
<i class="el-icon-warning" style="color: #f56c6c"></i>
</el-tooltip>
</div>
</div>
@@ -159,8 +168,7 @@
<div
class="holiday-div"
:style="{
backgroundColor:
holidayDivColor[item?.classesCode],
backgroundColor: holidayDivColor[item?.classesCode],
}"
@click="
holidayLog(
@@ -168,6 +176,8 @@
?.det,
HolidayList[Number(data.day.split('-')[2]) - 1]
?.date,
HolidayList[Number(data.day.split('-')[2]) - 1]
?.detSort
)
"
:title="
@@ -207,7 +217,6 @@
</el-calendar>
</div>
</div>
</el-col>
<base-dialog
:dialogTitle="dialogTitle"
:dialogVisible="logVisible"
@@ -228,7 +237,7 @@
</slot>
</template>
</base-dialog>
</el-row>
</div>
</template>
<script>
@@ -339,13 +348,43 @@ export default {
getEnableData().then((response) => {
// 处理 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);
});
});
listByDeptId(this.topDept.id).then((response) => {
this.groupOptions = [];
this.groupOptions.push(...response.data);
});
},
//大整数精度丢失
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;
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
@@ -358,8 +397,14 @@ export default {
leaderName: this.groupOptions[0].leaderName || '-',
leaderPhone: this.groupOptions[0].leaderPhone || '-',
};
this.$nextTick(() => {
this.$refs.tree1.setCurrentKey(this.teamId);
});
} else if (this.activeName == 'first') {
this.deptId = this.topDept.id;
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.deptId);
});
}
this.getHolidayPage();
},
@@ -441,11 +486,11 @@ export default {
return '';
}
},
holidayLog(det, date) {
holidayLog(det, date, detSort) {
this.dialogTitle = this.showDeptName + '-' + date + '-排班详情';
this.logVisible = true;
this.$nextTick(() => {
this.$refs.holidayLogRef.init(det);
this.$refs.holidayLogRef.init(det, detSort);
});
},
cancelLog() {
@@ -459,8 +504,8 @@ export default {
.head-container {
padding: 20px 10px 0;
background-color: #fff;
min-height: calc(100vh - 120px - 8px);
border-radius: 8px;
height: 100%;
}
.groupTeamScheduling {
.operationArea {

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-11 14:27:37
* @LastEditors: zwq
* @LastEditTime: 2025-11-10 16:20:13
* @LastEditTime: 2025-11-14 22:00:10
* @Description:
-->
<template>
@@ -104,7 +104,7 @@ export default {
// 获取数据列表
getDataList() {
this.urlOptions.getDataListURL(this.formInline).then((response) => {
this.tableData = response.data.list;
this.tableData = response.data.list.filter(item=>item.enabled===1);
this.tableData.forEach(item=>item.teamId= item.id)
this.$nextTick(() => {
if (this.selectedArr.length > 0) {

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-13 15:07:24
* @LastEditors: zwq
* @LastEditTime: 2025-11-11 15:32:04
* @LastEditTime: 2025-11-27 14:41:59
* @Description:
-->
<template>
@@ -138,7 +138,14 @@
<el-tag type="warning" style="color: black" v-if="!isClassTimePass">
<i class="el-icon-warning" style="color: #ffbd02"></i>
两班倒和三班倒的班次设置时间
<span style="color: red">不能重叠且必须连续覆盖24小时</span>
<span style="color: red">不能重叠</span>
在24小时
</el-tag>
<el-tag type="warning" style="color: black" v-if="!covers24Hours">
<i class="el-icon-warning" style="color: #ffbd02"></i>
两班倒和三班倒的班次设置时间,班次时间
<span style="color: red">必须连续</span>
在24小时
</el-tag>
</small-title>
<base-table
@@ -531,7 +538,8 @@ export default {
btnName: '编辑',
},
].filter((v) => v),
isClassTimePass: true, //修改班次时间后,需要判断时间是否有覆盖,且是否覆盖24小时
isClassTimePass: true, //修改班次时间后,需要判断时间是否有重叠,且是否24小时内 true是没问题的
covers24Hours: true, //修改班次时间后需要判断时间是否覆盖24小时连续的时间 true是没问题的
tableData1: [],
tableProps2,
tableBtn2: [
@@ -623,7 +631,7 @@ export default {
methods: {
init(id, isEdit) {
this.dataForm.id = id || undefined;
this.isEdit = isEdit || false
this.isEdit = isEdit || false;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
@@ -638,8 +646,10 @@ export default {
if (item.isProduction) {
lineName = this.setLineName(item.bindLineTree);
}
this.$set(this.tableData2[index], 'lineName', lineName);
this.$set(this.tableData2[index], 'lineName', lineName.join(';'));
});
this.stepNum = 3;
this.getThreeGroup(7); // 第三步,进来加载预览排班,默认7天预览周期
});
} else {
getCode().then((res) => {
@@ -757,7 +767,7 @@ export default {
}
//班次验证
if (!this.isClassTimePass) {
if (!this.isClassTimePass || !this.covers24Hours) {
this.$message('班次内时间有误,请重新填写!');
return;
}
@@ -777,9 +787,10 @@ export default {
data.groupPlanClassesBaseVOList.push(obj);
});
data.groupPlanTeamBaseVOList = []; //排班-班组信息list
this.tableData2.forEach((item) => {
this.tableData2.forEach((item, index) => {
const obj = {
teamId: item.id,
sort: index + 1,
teamId: item.teamId || item.id,
name: item.name,
leaderName: item.leaderName,
leaderPhone: item.leaderPhone,
@@ -788,9 +799,13 @@ export default {
data.groupPlanTeamBaseVOList.push(obj);
});
createStepTwo(data).then((res) => {
if (res.code === 200 || res.code === 0) {
this.stepNum += 1;
this.$emit('setSN', this.stepNum);
this.getThreeGroup(7); // 第三步,进来加载预览排班,默认7天预览周期
} else {
this.$message(res.msg);
}
});
return;
}
@@ -799,7 +814,7 @@ export default {
data.groupPlanTeamBaseVOList = []; //排班-班组信息list
this.tableData2.forEach((item) => {
const obj = {
teamId: item.id,
teamId: item.teamId || item.id,
name: item.name,
bindData: JSON.stringify(item.bindLineTree),
};
@@ -943,6 +958,57 @@ export default {
return start1Min < end2Min && end1Min > start2Min;
}
},
/**
* 检查多个班次是否连续覆盖24小时
* @param {Array} shifts - 班次数组每个班次包含startTime和endTime
* @returns {boolean} 是否连续覆盖24小时
*/
isCover24Hours(shifts) {
if (!shifts || shifts.length === 0) return false;
const totalMinutes = 24 * 60;
// 将班次转换为时间段对象
const intervals = shifts.map((shift) => ({
start: this.timeToMinutes(shift.startTime),
end: this.timeToMinutes(shift.endTime),
}));
// 处理跨天情况如果结束时间小于开始时间加上24小时
const normalizedIntervals = intervals.map((interval) => {
let { start, end } = interval;
if (end < start) {
end += totalMinutes;
}
return { start, end, originalEnd: interval.end };
});
// 按开始时间排序
normalizedIntervals.sort((a, b) => a.start - b.start);
// 检查是否连续覆盖
let coveredUntil = normalizedIntervals[0].end;
let hasGap = false;
for (let i = 1; i < normalizedIntervals.length; i++) {
const current = normalizedIntervals[i];
// 如果当前班次的开始时间大于已覆盖的结束时间,说明有间隔
if (current.start > coveredUntil) {
hasGap = true;
break;
}
// 更新已覆盖的结束时间
coveredUntil = Math.max(coveredUntil, current.end);
}
// 检查是否覆盖完整的24小时
const firstStart = normalizedIntervals[0].start;
// 判断条件没有间隔且覆盖时间达到24小时
return !hasGap && coveredUntil - firstStart >= totalMinutes;
},
//编辑班次
handleClick1(val) {
this.addOrUpdateVisible1 = true;
@@ -1023,7 +1089,7 @@ export default {
this.tableData1.forEach((item, index) => {
item.sort = index + 1;
});
//修改班次时间后,需要判断时间是否有覆盖,且是否覆盖24小时,isTimeOverlap方法返回false才是校验通过
//修改班次时间后,需要判断时间是否有重叠,且是否24小时,isTimeOverlap方法返回false才是校验通过
if (this.dataForm.shiftType == 2) {
const twoClass = this.tableData1.map(({ startTime, endTime }) => ({
startTime,
@@ -1061,6 +1127,11 @@ export default {
);
this.isClassTimePass = !(result1 || result2 || result3);
}
//修改班次时间后两班倒和三班倒需要判断时间是否连续覆盖24小时内
if (this.dataForm.shiftType > 1) {
this.covers24Hours = this.isCover24Hours(this.tableData1);
console.log(1111, this.covers24Hours);
}
this.cancel1();
},
refreshTableData2(val) {
@@ -1069,39 +1140,45 @@ export default {
},
refreshTableData3(index, val) {
this.tableData2[index].bindLineTree = val;
let lineName = '';
lineName = this.setLineName(val);
let lineName = this.setLineName(val);
if (lineName) {
this.$set(this.tableData2[index], 'lineName', lineName);
this.$set(this.tableData2[index], 'lineName', lineName.join(';'));
}
this.cancel3();
},
//提取绑定的产线工段名展示出来
setLineName(val) {
if (!val || val.length === 0) return '';
setLineName(data) {
const paths = [];
const currentLevelNames = val.map((item) => item.name);
const processNode = (node, currentPath = []) => {
const newPath = [...currentPath, node.name];
// 处理当前层级显示
let currentDisplay = '';
if (currentLevelNames.length > 1) {
currentDisplay = `(${currentLevelNames.join(' 、 ')})`;
} else {
currentDisplay = currentLevelNames[0];
}
// 查找所有子节点(取第一个有子节点的元素)
const childNode = val.find(
(item) => item.children && item.children.length > 0
if (node.children && node.children.length > 0) {
// 检查子节点是否都是叶子节点
const allChildrenAreLeaves = node.children.every(
(child) => !child.children || child.children.length === 0
);
if (childNode) {
const childPath = this.setLineName(childNode.children);
if (childPath) {
return `${currentDisplay} / ${childPath}`;
}
}
return currentDisplay;
if (allChildrenAreLeaves && node.children.length > 1) {
// 如果所有子节点都是叶子节点且多于1个用括号合并显示
const leafNames = node.children
.map((child) => child.name)
.join(' 、 ');
paths.push(`${newPath.join('/')}/(${leafNames})`);
} else if (allChildrenAreLeaves && node.children.length === 1) {
// 只有一个叶子子节点,用括号显示
paths.push(`${newPath.join('/')}/${node.children[0].name}`);
} else {
// 继续处理子节点
node.children.forEach((child) => processNode(child, newPath));
}
} else {
// 没有子节点的节点如原片产线1用括号显示
paths.push(`${currentPath.join('/')}/${node.name}`);
}
};
data.forEach((node) => processNode(node));
return paths;
},
//第三步
// 进来加载预览排班

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-11-10 16:07:01
* @LastEditTime: 2025-11-25 15:49:17
* @Description:
-->
<template>
@@ -62,9 +62,9 @@ export default {
},
processNode(node) {
// 创建唯一ID类型-原始ID
const uniqueId = node.id + node.type;
const uniqueId = node.type+'L'+node.id;
if (node.type > 0) {
node.fid = node.pid + node.type - 1;
node.fid = (node.type - 1)+'L'+node.pid;
}
return {

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-21 14:27:23
* @LastEditors: zwq
* @LastEditTime: 2025-11-10 17:07:54
* @LastEditTime: 2025-11-25 15:14:53
* @Description:
-->
<template>
@@ -150,25 +150,45 @@ export default {
this.infoData = {};
getPlan(id).then((res) => {
this.infoData = res.data || {};
this.tableData1 = res.data?.groupPlanClassesBaseVOList.sort((a, b) => a.sort - b.sort);
this.tableData1 = res.data?.groupPlanClassesBaseVOList.sort(
(a, b) => a.sort - b.sort
);
this.tableData2 = res.data?.groupPlanTeamBaseVOList;
this.tableData2.forEach((item, index) => {
let lineName = '';
lineName = this.setLineName(item.bindLineTree, lineName);
this.$set(this.tableData2[index], 'lineName', lineName.slice(0, -1));
if (item.isProduction) {
lineName = this.setLineName(item.bindLineTree);
}
this.$set(this.tableData2[index], 'lineName', lineName);
});
});
},
//提取绑定的产线工段名展示出来
setLineName(val, lineName) {
val.forEach((item) => {
lineName += item.name + '';
if (item.children && item.children.length > 0) {
const childName = this.setLineName(item.children, lineName);
lineName = childName;
setLineName(val) {
if (!val || val.length === 0) return '';
const currentLevelNames = val.map((item) => item.name);
// 处理当前层级显示
let currentDisplay = '';
if (currentLevelNames.length > 1) {
currentDisplay = `(${currentLevelNames.join(' 、 ')})`;
} else {
currentDisplay = currentLevelNames[0];
}
});
return lineName;
// 查找所有子节点(取第一个有子节点的元素)
const childNode = val.find(
(item) => item.children && item.children.length > 0
);
if (childNode) {
const childPath = this.setLineName(childNode.children);
if (childPath) {
return `${currentDisplay} / ${childPath}`;
}
}
return currentDisplay;
},
},
};

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-13 15:07:24
* @LastEditors: zwq
* @LastEditTime: 2025-11-05 08:51:13
* @LastEditTime: 2025-11-28 09:56:09
* @Description:
-->
<template>
@@ -33,6 +33,7 @@
v-model="formInline.startDay"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"></el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endDay">
@@ -40,6 +41,7 @@
v-model="formInline.endDay"
size="small"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"></el-date-picker>
</el-form-item>
<el-form-item label="部门" prop="deptId">
@@ -396,12 +398,12 @@ export default {
},
],
formInline: {
code: '',
name: '',
startDay: '',
endDay: '',
deptId: '',
status: '',
code: null,
name: null,
startDay: null,
endDay: null,
deptId: null,
status: null,
},
stepNum: 1, // 新增编辑时当前第几步
detailVisible: false,
@@ -419,29 +421,29 @@ export default {
buttonClick(val) {
switch (val.btnName) {
case 'search':
const date1 = new Date(this.formInline.startDay).getTime();
const date2 = new Date(this.formInline.endDay).getTime();
if (date1 > date2) {
if (this.formInline.startDay > this.formInline.endDay) {
this.$message('开始时间不得晚于结束时间');
return;
}
this.listQuery = {
pageNo: 1,
pageSize: 10,
pageSize: 20,
total: 1,
...this.formInline,
};
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetFields();
this.formInline.name = null;
this.formInline.code = null;
this.formInline.deptId = null;
this.$refs.deptSelect.clear();
this.formInline.status = null;
this.formInline.startDay = null;
this.formInline.endDay = null;
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};
@@ -490,6 +492,7 @@ export default {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.stepNum = 3;
this.$refs.addOrUpdate.init(val.data.id, true);
});
} else if (val.type === 'delete') {
@@ -505,6 +508,16 @@ export default {
this.getDataList();
});
} else if (val.type === 'sync') {
this.$confirm(
'当前节假日包含尚未同步的节假日变更,是否立即将上述节假日同步更新到排班计划?',
'同步节假日',
{
confirmButtonText: '确认同步',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
updateScheduleLater({
planId: val.data.id,
logId: val.data.updateLogId,
@@ -512,6 +525,14 @@ export default {
this.$modal.msgSuccess('同步节假日成功');
this.getDataList();
});
})
.catch((res) => {
this.getDataList();
this.$message({
type: 'info',
message: '已取消',
});
});
} else if (val.type === 'copy') {
copyPlan(val.data.id).then((res) => {
this.$modal.msgSuccess('复制成功');

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-10-31 15:47:16
* @LastEditTime: 2025-11-27 14:49:34
* @Description:
-->
<template>
@@ -25,6 +25,7 @@
<el-col :span="8">
<el-form-item label="班组名称" prop="name">
<el-input
:disabled="nameDisable"
v-model="dataForm.name"
clearable
placeholder="请输入班组名称" />
@@ -78,6 +79,7 @@
<el-form-item label="生产班组" prop="isProduction">
<el-select
style="width: 100%"
@change="setIsProduction"
v-model="dataForm.isProduction"
placeholder="请选择是否为生产班组">
<el-option
@@ -109,6 +111,7 @@ import {
updateGroup,
getGroup,
getCode,
updateIsProduction,
} from '@/api/group/groupSetting';
export default {
@@ -139,6 +142,7 @@ export default {
remark: undefined,
},
setData: true,
nameDisable: false, //班组被使用时,班组名称不能修改
leaderArr: [],
options: [
{
@@ -157,9 +161,7 @@ export default {
name: [
{ required: true, message: '班组名称不能为空', trigger: 'blur' },
],
deptId: [
{ required: true, message: '部门不能为空', trigger: 'blur' },
],
deptId: [{ required: true, message: '部门不能为空', trigger: 'blur' }],
leaderId: [
{ required: true, message: '组长不能为空', trigger: 'change' },
],
@@ -191,6 +193,40 @@ export default {
},
setDataForm() {
this.$refs.deptSelect.setID(this.dataForm.deptId);
this.nameDisable = false;
updateIsProduction(this.dataForm.id).then(({ data }) => {
if (data) {
this.$notify({
title: '警告',
message: '当前班组仍参与排班计划或正在执行工单。班组名称不能修改',
type: 'warning',
});
this.nameDisable = true;
}
});
},
setIsProduction() {
// 修改的提交
if (this.dataForm.id && this.nameDisable) {
this.$confirm(
'当前班组仍参与排班计划或正在执行工单。<br/>修改<strong> 是否是生产班组 </strong>不会自动更新排班内容,可能导致排班信息与班组属性不一致,请注意核查!<br/>是否确认修改是否是生产班组?',
'修改是否是生产班组',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '确认修改',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {})
.catch((res) => {
this.$message({
type: 'info',
message: '已取消',
});
this.dataForm.isProduction = !this.dataForm.isProduction;
});
}
},
setLeaderName(val) {
this.leaderArr.map((item) => {

View File

@@ -1,14 +1,21 @@
<!--
* @Author: zwq
* @Date: 2025-10-11 14:41:12
* @LastEditors: zwq
* @LastEditTime: 2025-11-27 14:19:39
* @Description:
-->
<template>
<el-switch
@change="changeStatus"
size="small"
v-model="list.enabled"
v-model="injectData.enabled"
:active-value="1"
:inactive-value="0"></el-switch>
</template>
<script>
import { updateGroup } from '@/api/group/groupSetting';
import { updateGroup, updateIsProduction } from '@/api/group/groupSetting';
export default {
props: {
injectData: {
@@ -17,17 +24,51 @@ export default {
},
},
data() {
return {
list: this.injectData,
};
return {};
},
created() {},
methods: {
changeStatus(val) {
const data = { ...this.injectData, enabled: val };
updateGroup(data).then((res) => {
const pdata = { ...this.injectData, enabled: val };
updateIsProduction(this.injectData.id).then(({ data }) => {
if (data) {
this.$confirm(
'当前班组仍参与排班计划或正在执行工单。<br/>修改<strong> 班组状态 </strong>不会自动更新排班内容,可能导致排班信息与班组属性不一致,请注意核查!<br/>是否确认修改班组状态?',
'更新班组状态',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '确认修改',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
updateGroup(pdata).then((res) => {
if (res.code === 0 || res.code === 200) {
this.$modal.msgSuccess('修改成功');
this.$emit('emitData');
} else {
this.$modal.msg(res.msg);
}
});
})
.catch((res) => {
this.$emit('emitData');
this.$message({
type: 'info',
message: '已取消',
});
});
} else {
updateGroup(pdata).then((res) => {
if (res.code === 0 || res.code === 200) {
this.$modal.msgSuccess('修改成功');
this.$emit('emitData');
} else {
this.$modal.msg(res.msg);
}
});
}
});
},
},

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-11 14:27:37
* @LastEditors: zwq
* @LastEditTime: 2025-10-29 14:44:41
* @LastEditTime: 2025-11-14 21:50:40
* @Description:
-->
<template>
@@ -212,7 +212,7 @@ export default {
case 'search':
this.listQuery = {
pageNo: 1,
pageSize: 10,
pageSize: 20,
total: 1,
...this.formInline,
};
@@ -225,7 +225,7 @@ export default {
this.$refs.deptSelect.clear();
this.formInline.leaderName = null;
this.listQuery = {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
};

View File

@@ -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('修改成功');

View File

@@ -2,13 +2,19 @@
* @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="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"
@@ -23,12 +29,11 @@
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick" />
</div>
</el-col>
<el-col :span="20">
<div class="groupTeamScheduling">
<div class="operationArea">
<el-row>
@@ -198,9 +203,7 @@
(!ishasParent || !inherited) &&
HolidayList[Number(data.day.split('-')[2]) - 1]
?.isHoliday &&
showDetail(
HolidayList[Number(data.day.split('-')[2]) - 1]
)
showDetail(HolidayList[Number(data.day.split('-')[2]) - 1])
">
<el-row :gutter="20">
<!-- 公历和农历 -->
@@ -231,8 +234,7 @@
<el-col
:span="24"
v-if="
HolidayList[Number(data.day.split('-')[2]) - 1]
?.isHoliday
HolidayList[Number(data.day.split('-')[2]) - 1]?.isHoliday
">
<div
class="holiday-div"
@@ -278,7 +280,6 @@
</el-calendar>
</div>
</div>
</el-col>
<base-dialog
:dialogTitle="dialogTitle"
:dialogVisible="addOrUpdateVisible"
@@ -352,7 +353,7 @@
</slot>
</template>
</base-dialog>
</el-row>
</div>
</template>
<script>
@@ -453,12 +454,42 @@ 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() {
@@ -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 {