班组bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2025-10-30 10:47:09
|
||||
* @LastEditTime: 2025-11-10 16:07:01
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -13,8 +13,12 @@
|
||||
:to_data="toData"
|
||||
@add-btn="add"
|
||||
@remove-btn="remove"
|
||||
pid="pid"
|
||||
:defaultProps="{ label: 'name' }"
|
||||
pid="fid"
|
||||
:node_key="'uniqueId'"
|
||||
:defaultProps="{
|
||||
label: 'name',
|
||||
children: 'children',
|
||||
}"
|
||||
height="450px"
|
||||
style="padding-bottom: 20px"
|
||||
:mode="mode"
|
||||
@@ -43,16 +47,34 @@ export default {
|
||||
this.fromData = [];
|
||||
this.toData = [];
|
||||
getGroupPlanTree().then((res) => {
|
||||
this.fromData = res.data;
|
||||
this.fromData.forEach((item) => {
|
||||
res.data.forEach((item) => {
|
||||
item.productionLineId = 0;
|
||||
});
|
||||
this.fromData = this.generateUniqueData(res.data);
|
||||
this.$nextTick(() => {
|
||||
this.toData = val.bindLineTree || [];
|
||||
this.getFilterLeftData(this.fromData, this.toData); //编辑时组件有bug,左边相同数据不消失
|
||||
});
|
||||
});
|
||||
},
|
||||
generateUniqueData(data) {
|
||||
return data.map((node) => this.processNode(node));
|
||||
},
|
||||
processNode(node) {
|
||||
// 创建唯一ID:类型-原始ID
|
||||
const uniqueId = node.id + node.type;
|
||||
if (node.type > 0) {
|
||||
node.fid = node.pid + node.type - 1;
|
||||
}
|
||||
|
||||
return {
|
||||
...node,
|
||||
uniqueId,
|
||||
children: node.children
|
||||
? node.children.map((child) => this.processNode(child))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
// 监听穿梭框组件添加
|
||||
add(fromData, toData, obj) {
|
||||
console.log('fromData:', fromData);
|
||||
|
||||
Reference in New Issue
Block a user