Commit e8fbb105 authored by Mac's avatar Mac

1

parent d46f7d80
......@@ -65,7 +65,7 @@
/>
<span class="q-ml-sm">{{ item.Name }}</span>
</div>
<q-icon name="cancel" @click="delItem(index)"></q-icon>
<q-icon name="cancel" @click="delItem(item.Id,index)"></q-icon>
</div>
</div>
</div>
......@@ -86,7 +86,7 @@ interface parmas {
[key: string]: any
}
interface SelectParams{
Id:number,
Id:string,
Name:string
}
export default {
......@@ -141,6 +141,7 @@ export default {
setup(props, ctx) {
let tree = ref<any>(null);
let list = ref<Array<string>>([])
let keys = ref<Array<string>>([])
let selectArray = ref<Array<SelectParams>>([])
let hideDialog = () => {
ctx.emit("update:modelValue", false)
......@@ -168,8 +169,42 @@ export default {
},100)
}
let delItem = (i: number) => {
props.defaultArray.splice(i, 1)
let delItemitem=(arr: parmas)=>{
console.log(arr,'arr')
arr.map(x=>{
if(x.ChildList && x.ChildList){
delItemitem(x.ChildList)
}else{
keys.value.push(x.newId)
}
})
}
let delItemArray =(arr: parmas,Id:string)=>{
for(let i = 0;i<arr.length;i++){
let j = arr[i]
if(j.newId == Id){
if(j.ChildList && j.ChildList.length>0){
console.log(j.ChildList)
delItemitem(j.ChildList)
}
}else{
if(j.ChildList && j.ChildList.length>0){
delItemArray(j.ChildList,Id)
}
}
}
}
let delItem = (Id: string,i:number) => {
keys.value = []
delItemArray(props.treeData,Id)
tree.value.setTicked (keys.value,false)
selectArray.value.splice(i, 1)
}
......@@ -181,7 +216,9 @@ export default {
delItem,
list,
getselectArray,
selectArray
selectArray,
delItemArray,
delItemitem
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment