存数据到本地

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 => { uni.$on("pagePicker:custom", res => {
this.selectedUser = res this.selectedUser = res
}) })
this.selectedUser = uni.getStorageSync('girdList')
this.deptListArr = uni.getStorageSync('deptList')
}, },
} }

View File

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

View File

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

View File

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