更新
This commit is contained in:
@@ -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);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user