From 0f2aed761379a10c0de5ee6490a6fb712401a9d4 Mon Sep 17 00:00:00 2001 From: liuye Date: Tue, 27 Jun 2023 14:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E5=90=8C=E5=AE=A3=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectDeptUser.vue | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/project/qianxinan/AppCooperationPropaganda/selectDeptUser.vue b/src/project/qianxinan/AppCooperationPropaganda/selectDeptUser.vue index e7374da1..2ca26295 100644 --- a/src/project/qianxinan/AppCooperationPropaganda/selectDeptUser.vue +++ b/src/project/qianxinan/AppCooperationPropaganda/selectDeptUser.vue @@ -60,13 +60,27 @@ export default { }, onLoad(o) { this.selected = uni.getStorageSync('selectDeptUser') || [] - this.getAllDepts() this.type = o.selectTtype.split('?')[0] + + if(this.type == 1) { //选择发送范围部门 + this.getAllDepts() + }else { //选择审批人 + this.getListAll() + } }, methods: { isSelected(id, corpId) { return !!this.selected.find(e => e.id == id && e.corpId == corpId) }, + getListAll() { + 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, e.corpId)})) + this.deptInit() + } + }) + }, getAllDepts() { // this.$http.post('/app/wxcp/wxdepartment/listAllByCorp').then((res) => { // if (res?.data) { @@ -85,8 +99,11 @@ export default { }) }, deptInit() { - // this.treeList = this.allData.filter(e => !e.parentid) - this.treeList = this.allData + if(this.type == 1) { //选择发送范围部门 + this.treeList = this.allData.filter(e => e.id == this.user.wxMainDepartmentId) + }else { //选择审批人 + this.treeList = this.allData.filter(e => !e.parentid) + } this.selectDeptPath = [{name: "可选范围", id: ''}] }, itemClick({id, name, corpId}) {