存数据到本地

This commit is contained in:
shijingjing
2022-09-08 10:38:13 +08:00
parent 0b3523418c
commit f9584df365
4 changed files with 38 additions and 29 deletions

View File

@@ -125,6 +125,8 @@ export default {
uni.$on("pagePicker:custom", res => {
this.selectedUser = res
})
this.selectedUser = uni.getStorageSync('girdList')
this.deptListArr = uni.getStorageSync('deptList')
},
}

View File

@@ -48,7 +48,7 @@ export default {
onLoad() {
this.selected.id = this.$route.query.id
this.getAllGrids()
this.selected = uni.getStorageSync('userSelect') || []
this.selected = uni.getStorageSync('girdSelect') || []
},
onShow() {
document.title = '选择人员'
@@ -73,7 +73,8 @@ export default {
},
getGridsAndUsersByParent(id) {
this.treeList = this.allData.filter(e => (e.parentGirdId == 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()
},
girdNameClick(row, index) {
@@ -94,6 +95,7 @@ export default {
let index=this.selected.findIndex(item=>row.id===item.id)
index >= 0 && this.selected.splice(index, 1)
}
uni.setStorageSync('girdSelect', this.selected)
this.$forceUpdate()
},

View File

@@ -7,9 +7,9 @@
<icon type="circle" size="18" v-else />
<div class="title">{{ item.name }}</div>
</div>
<div class="right" v-if="item.name != '全部居民群'">
<div v-if="item.name == '按部门选择' && deptSelect.length">已选择{{ 1 }}名成员</div>
<div v-if="item.name == '按网格选择' && girdSelect.length">已选择{{ 2 }}名成员</div>
<div class="right" v-if="item.vlaue != '0'">
<div v-if="item.value == '1' && deptSelect.length">已选择{{ deptSelect.length }}个部门</div>
<div v-if="item.value == '2' && girdSelect.length">已选择{{ girdSelect.length }}个网格</div>
<u-icon name="arrow-right" color="#CCD0D3"></u-icon>
</div>
</div>
@@ -30,7 +30,7 @@ export default {
return {
value: '',
checkList: [
{ name: '全部居民群', checked: false, value: '0'},
{ name: '全部居民群', checked: true, value: '0'},
{ name: '按部门选择', checked: false, value: '1'},
{ name: '按网格选择', checked: false, value: '2' }
],
@@ -58,43 +58,49 @@ export default {
this.getWxGroups()
uni.setStorageSync('sendScope', this.sendScope)
uni.navigateBack({
success: () => {
uni.$emit("checkedScope",{ sendScope: this.sendScope });
}
// success: () => {
// uni.$emit("checkedScope",{ sendScope: this.sendScope });
// }
})
},
getWxGroups() {
this.$http.post(`/app/appmasssendingtask/queryWxGroups?sendScope=${this.sendScope}`,
// null,
// {
// data: {
// filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
// },
// headers: {'Content-Type': 'application/json;charset=utf-8'},
// transformRequest: [function(data) {
// console.log(data);
// return data.filterCriteria
// }]
// }).then(res => {
// if (res.code === 0) {
// this.wxGroups = res.data
// }
// })
null,
{
filterCriteria: ''
data: {
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
},
headers: {'Content-Type': 'application'},
transformRequest: [function(data) {
return data.filterCriteria
}]
}).then(res => {
if (res.code === 0) {
this.wxGroups = res.data
}
})
// {
// filterCriteria: ''
// }).then(res => {
// if (res.code === 0) {
// this.wxGroups = res.data
// }
// })
},
},
onLoad(o) {
this.sendType = o.type;
document.title = "选择发送范围"
this.sendScope = uni.getStorageSync('sendScope')
// this.checkList.map(i=> i.value ==this.sendScope)
this.sendScope = uni.getStorageSync('sendScope') || ''
this.checkList.forEach(i=> {
return {
name: i.name,
value: i.value,
// checked: this.sendScope.find(v=>(i.value==v))
}
})
},
onShow() {

View File

@@ -3,7 +3,6 @@
<div class="tags-group">
<div class="tags-list" v-for="items in subTags" :key="items.id">
<div class="tag_title">{{ items.name }}</div>
<!-- -->
<div class="item"
v-for="(item, index) in items.tagList"
:class="[checked.includes(item.id) ? 'active' : '']"