diff --git a/src/apps/AppMessageNotification/AppMessageNotification.vue b/src/apps/AppMessageNotification/AppMessageNotification.vue index 70fa6a56..2b606618 100644 --- a/src/apps/AppMessageNotification/AppMessageNotification.vue +++ b/src/apps/AppMessageNotification/AppMessageNotification.vue @@ -214,6 +214,7 @@ export default { this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => { if (res?.code == 0) { this.$u.toast('发送成功') + uni.setStorageSync('selectDeptUser', []) setTimeout(() => { uni.navigateBack() }, 500) diff --git a/src/apps/AppMessageNotification/selectDeptUser.vue b/src/apps/AppMessageNotification/selectDeptUser.vue index 78f66e23..c64ce229 100644 --- a/src/apps/AppMessageNotification/selectDeptUser.vue +++ b/src/apps/AppMessageNotification/selectDeptUser.vue @@ -54,19 +54,21 @@ export default { } }, onLoad() { - console.log(this.$route.query.selected) + // console.log(this.$route.query.selected) // this.selected = [this.$route.query.selected].flat().filter(e => !!e)?.map(id => ({id, kind: /^\d{1,5}}$/.test(id) ? 'dept' : 'user'})) || [] + this.selected = uni.getStorageSync('selectDeptUser') || [] + console.log(this.selected) this.getAllDepts() }, methods: { - isSelected(id) { - return !!this.selected.find(e => e.id == id) + isSelected(id, corpId) { + return !!this.selected.find(e => e.id == id && e.corpId == corpId) }, getAllDepts() { this.$http.post('/app/wxcp/wxdepartment/listAllByCorp').then((res) => { if (res?.data) { let parents = res.data.map(e => e.parentid) - this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id), isChecked: this.isSelected(e.id)})) + this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id), isChecked: this.isSelected(e.id, e.corpId)})) this.deptInit() } }) @@ -114,16 +116,11 @@ export default { this.$forceUpdate() }, submit() { - // uni.navigateBack({ - // success: () => { - // uni.$emit("pagePicker:custom", [this.selected].flat()) - // } - // }) - // uni.$emit("selectDept", [this.selected].flat()) console.log([this.selected].flat()) if(![this.selected].flat().length) { return this.$u.toast('请选择部门或人员') } + uni.$emit("pagePicker:custom", [this.selected].flat()) uni.setStorageSync('selectDeptUser', [this.selected].flat()) uni.navigateTo({url: `./selectTag`}) diff --git a/src/apps/AppMessageNotification/selectTag.vue b/src/apps/AppMessageNotification/selectTag.vue index 6a0ca9bc..57799cbf 100644 --- a/src/apps/AppMessageNotification/selectTag.vue +++ b/src/apps/AppMessageNotification/selectTag.vue @@ -1,17 +1,21 @@