Commit e8fbb105 authored by Mac's avatar Mac

1

parent d46f7d80
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
/> />
<span class="q-ml-sm">{{ item.Name }}</span> <span class="q-ml-sm">{{ item.Name }}</span>
</div> </div>
<q-icon name="cancel" @click="delItem(index)"></q-icon> <q-icon name="cancel" @click="delItem(item.Id,index)"></q-icon>
</div> </div>
</div> </div>
</div> </div>
...@@ -86,7 +86,7 @@ interface parmas { ...@@ -86,7 +86,7 @@ interface parmas {
[key: string]: any [key: string]: any
} }
interface SelectParams{ interface SelectParams{
Id:number, Id:string,
Name:string Name:string
} }
export default { export default {
...@@ -141,6 +141,7 @@ export default { ...@@ -141,6 +141,7 @@ export default {
setup(props, ctx) { setup(props, ctx) {
let tree = ref<any>(null); let tree = ref<any>(null);
let list = ref<Array<string>>([]) let list = ref<Array<string>>([])
let keys = ref<Array<string>>([])
let selectArray = ref<Array<SelectParams>>([]) let selectArray = ref<Array<SelectParams>>([])
let hideDialog = () => { let hideDialog = () => {
ctx.emit("update:modelValue", false) ctx.emit("update:modelValue", false)
...@@ -168,8 +169,42 @@ export default { ...@@ -168,8 +169,42 @@ export default {
},100) },100)
} }
let delItem = (i: number) => { let delItemitem=(arr: parmas)=>{
props.defaultArray.splice(i, 1) 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 { ...@@ -181,7 +216,9 @@ export default {
delItem, delItem,
list, list,
getselectArray, 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