This commit is contained in:
2025-10-30 13:37:52 +08:00
parent d859ba62c8
commit c9c8f82910
31 changed files with 1485 additions and 397 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-11 14:27:37
* @LastEditors: zwq
* @LastEditTime: 2025-10-15 16:47:28
* @LastEditTime: 2025-10-29 17:12:04
* @Description:
-->
<template>
@@ -12,6 +12,9 @@
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
ref="groupTableRef"
:id="'groupTableSelectRef'"
row-key="id"
:selectWidth="55"
@selection-change="selectChange"
:table-props="tableProps"
@@ -46,6 +49,7 @@ const tableProps = [
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
];
@@ -84,22 +88,52 @@ export default {
name: '',
},
selectedList: [],
deptId: undefined
selectedArr: [], //已选的班组,从父组件传过来的
deptId: undefined,
};
},
created() {},
methods: {
init(id){
this.deptId = id
this.getDataList()
},
init(id, tableData) {
this.deptId = id;
this.selectedArr = tableData || [];
this.$nextTick(() => {
this.getDataList();
});
},
// 获取数据列表
getDataList() {
this.urlOptions
.getDataListURL(this.deptId)
.then((response) => {
this.tableData = response.data;
this.urlOptions.getDataListURL(this.deptId).then((response) => {
this.tableData = response.data;
this.$nextTick(() => {
if (this.selectedArr.length > 0) {
this.setSelectedRows();
}
});
});
},
setSelectedRows() {
const table = this.$refs.groupTableRef.$children[0];
// 先清空选择
table.clearSelection();
this.selectedArr.forEach((item) => {
const rowInTable = this.tableData.find((i) => i.id === item.id);
if (rowInTable) {
//这里一定要用table.tableData这样才是指向同一个数组
this.$set(table.store.states, 'selection', [
...table.store.states.selection,
table.tableData.find((i) => i.id === item.id),
]);
}
});
// 强制更新视图
this.$nextTick(() => {
table.$forceUpdate();
this.$forceUpdate();
});
},
buttonClick(val) {
switch (val.btnName) {
@@ -115,9 +149,25 @@ export default {
selectChange(val) {
this.selectedList = val;
},
// 判断两个数组是否有重复的 id
hasDuplicateIds(arr1, arr2) {
const idSet = new Set(arr1.map((item) => item.id));
return arr2.some((item) => idSet.has(item.id));
},
dataFormSubmit() {
if (this.selectedList && this.selectedList.length > 0) {
const haveData = this.hasDuplicateIds(
this.selectedArr,
this.selectedList
);
if (haveData) {
this.$message('请不要重复添加数组');
return;
}
this.$emit('refreshTableData', this.selectedList);
} else if (this.selectedArr.length > 0) {
this.$message('请不要重复添加数组');
}
},
},

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-13 15:07:24
* @LastEditors: zwq
* @LastEditTime: 2025-10-24 09:19:17
* @LastEditTime: 2025-10-29 15:28:52
* @Description:
-->
<template>
@@ -111,7 +111,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="6" v-if="dataForm.shiftType>1">
<el-form-item label="同班次连排" prop="shiftSustainedNum">
<el-input
v-model="dataForm.shiftSustainedNum"
@@ -289,6 +289,7 @@
:dialogVisible="addOrUpdateVisible1"
@cancel="cancel1"
@confirm="handleConfirm1"
:before-close="cancel1"
:destroy-on-close="true"
append-to-body
width="40%">
@@ -301,6 +302,7 @@
:dialogVisible="addOrUpdateVisible2"
@cancel="cancel2"
@confirm="handleConfirm2"
:before-close="cancel2"
:destroy-on-close="true"
append-to-body
width="40%">
@@ -313,6 +315,7 @@
:dialogVisible="addOrUpdateVisible3"
@cancel="cancel3"
@confirm="handleConfirm3"
:before-close="cancel3"
:destroy-on-close="true"
append-to-body
width="50%">
@@ -391,6 +394,7 @@ const tableProps2 = [
{
prop: 'lineName',
label: '产线及工段',
showOverflowtooltip: true,
},
];
@@ -510,6 +514,16 @@ export default {
{
type: 'bind',
btnName: '绑定产线',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'isProduction',
value: true,
},
],
},
},
{
type: 'delete',
@@ -640,6 +654,12 @@ export default {
this.$message('部门不能为空');
return;
}
const compareDate = this.compareDates(this.dataForm.startDay,this.dataForm.endDay)
if (compareDate > 0 ) {
this.$message('开始时间不能大于结束时间');
return;
}
createStepOne(this.dataForm).then((res) => {
if (!this.dataForm.id) {
this.dataForm.id = res.data;
@@ -754,6 +774,19 @@ export default {
setDataForm() {
this.$refs.deptSelect.setID(this.dataForm.deptId);
},
//比较时间,开始时间在结束时间前
compareDates(date1, date2) {
const d1 = date1;
const d2 = date2;
if (d1 === d2) {
return 0; // 日期相等
} else if (d1 < d2) {
return -1; // date1 在 date2 之前
} else {
return 1; // date1 在 date2 之后
}
},
//第二步
//设置第二部班次
setTWOclass() {
@@ -830,7 +863,7 @@ export default {
addNewGroup() {
this.addOrUpdateVisible2 = true;
this.$nextTick(() => {
this.$refs.addGroupRef.init(this.dataForm.deptId);
this.$refs.addGroupRef.init(this.dataForm.deptId,this.tableData2);
});
},
cancel1() {

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-10-16 16:37:40
* @LastEditTime: 2025-10-30 10:47:09
* @Description:
-->
<template>
@@ -16,7 +16,7 @@
pid="pid"
:defaultProps="{ label: 'name' }"
height="450px"
style="padding-bottom:20px"
style="padding-bottom: 20px"
:mode="mode"
filter
openAll></tree-transfer>
@@ -39,7 +39,7 @@ export default {
},
methods: {
init(val) {
this._pageIndex = val._pageIndex-1;
this._pageIndex = val._pageIndex - 1;
this.fromData = [];
this.toData = [];
getGroupPlanTree().then((res) => {
@@ -47,21 +47,41 @@ export default {
this.fromData.forEach((item) => {
item.productionLineId = 0;
});
this.$nextTick(() => {
this.toData = val.bindLineTree || [];
this.getFilterLeftData(this.fromData, this.toData); //编辑时组件有bug左边相同数据不消失
});
});
},
// 监听穿梭框组件添加
add(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData,obj);
console.log('toData:', toData, obj);
},
// 监听穿梭框组件移除
remove(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
/** 消除组件左边与右边选中数据相同项 */
// 处理过滤数据
getFilterLeftData(data, selData) {
for (let i = data.length - 1; i >= 0; i--) {
for (let j = selData.length - 1; j >= 0; j--) {
if (data[i] && data[i].id === selData[j].id) {
// 当id相等可以删除的情况 即:没有子级可以删除;
if (!data[i].children || data[i].children.length == 0) {
data.splice(i, 1);
} else {
this.getFilterLeftData(data[i].children, selData[j].children);
}
}
}
}
},
// 表单提交
dataFormSubmit() {
this.$emit('refreshTableData', this._pageIndex,this.toData);
this.$emit('refreshTableData', this._pageIndex, this.toData);
},
},
};

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2025-10-11 14:27:37
* @LastEditors: zwq
* @LastEditTime: 2025-10-23 16:31:41
* @LastEditTime: 2025-10-29 14:50:16
* @Description:
-->
<template>
@@ -59,12 +59,14 @@
<el-button
type="primary"
size="small"
v-hasPermi="['base:group-scheduling-plan:query']"
@click="buttonClick({ btnName: 'search' })">
查询
</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
<span class="separateStyle"
v-hasPermi="['base:group-scheduling-plan:query']"></span>
</el-form-item>
<el-form-item>
<el-button size="small" @click="buttonClick({ btnName: 'reset' })">
@@ -72,13 +74,15 @@
</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
<span class="separateStyle"
v-hasPermi="['base:group-scheduling-plan:create']"></span>
</el-form-item>
<el-form-item>
<el-button
type="success"
size="small"
:plain="true"
v-hasPermi="['base:group-scheduling-plan:create']"
@click="buttonClick({ btnName: 'add' })">
新增
</el-button>
@@ -264,6 +268,7 @@ export default {
},
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-plan:update')?
{
type: 'edit',
btnName: '编辑',
@@ -277,7 +282,8 @@ export default {
},
],
},
},
}:undefined,
this.$auth.hasPermi('base:group-scheduling-plan:delete')?
{
type: 'delete',
btnName: '删除',
@@ -291,7 +297,8 @@ export default {
},
],
},
},
}:undefined,
this.$auth.hasPermi('base:group-scheduling-plan:query')?
{
type: 'detail',
btnName: '查看',
@@ -305,7 +312,8 @@ export default {
},
],
},
},
}:undefined,
this.$auth.hasPermi('base:group-scheduling-plan:delete')?
{
type: 'cancel',
btnName: '作废',
@@ -319,7 +327,8 @@ export default {
},
],
},
},
}:undefined,
this.$auth.hasPermi('base:group-holiday:update')?
{
type: 'sync',
btnName: '同步节假日',
@@ -332,17 +341,18 @@ export default {
value: 2,
},
{
type: 'updateFlag',
name: 'status',
type: 'equal',
name: 'updateFlag',
value: true,
},
],
},
},
}:undefined,
this.$auth.hasPermi('base:group-scheduling-plan:create')?
{
type: 'copy',
btnName: '复制',
},
}:undefined,
].filter((v) => v),
tableData: [],
options: [