This commit is contained in:
shijingjing
2023-03-01 14:15:58 +08:00
parent 72900b596b
commit 31881327de
6 changed files with 12 additions and 46 deletions

View File

@@ -59,7 +59,7 @@ export default {
this.$http.post('/app/appgirdinfo/listByInfo').then((res) => {
if (res?.data) {
let parents = res.data.map(e => e.parentGirdId)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id)}))
this.allData = res.data.map(e => ({...e, isChecked: this.selected.find(i=> i.id == e.id), hasChildren: parents.includes(e.id)}))
this.gridInit()
}
}).then(()=> {
@@ -78,9 +78,7 @@ export default {
},
getGridsAndUsersByParent(id) {
this.treeList = this.allData.filter(e => (e.parentGirdId == id)).map(v=> ({...v,isChecked:this.selected.find(i=>i.id == v.id)}))
this.treeList
this.$forceUpdate()
this.treeList = this.allData.filter(e => (e.parentGirdId == id)).map(v=> ({...v, isChecked: this.selected.find(i=>i.id == v.id)}))
},
girdNameClick(row, index) {
this.userList = []
@@ -97,7 +95,7 @@ export default {
if(row.isChecked) {
this.selected.push(row)
} else {
let index=this.selected.findIndex(item=>row.id===item.id)
let index=this.selected.findIndex(item=>row.id == item.id)
index >= 0 && this.selected.splice(index, 1)
}
uni.setStorageSync('girdSelect', this.selected)