|  |  |  | 
|---|
|  |  |  | children: 'children', | 
|---|
|  |  |  | label: 'label' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | visibleDel: false | 
|---|
|  |  |  | visibleDel: false, | 
|---|
|  |  |  | parentIds: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 计算属性 类似于data概念 | 
|---|
|  |  |  | 
|---|
|  |  |  | // console.log('当前组织下的菜单列表') | 
|---|
|  |  |  | // console.log(res) | 
|---|
|  |  |  | this.menuData = res.data.menus | 
|---|
|  |  |  | // 拿到所有的父id | 
|---|
|  |  |  | this.parentIds = [] | 
|---|
|  |  |  | res.data.menus.map(v => { | 
|---|
|  |  |  | this.parentIds.push(v.id) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.parentIds = JSON.parse(JSON.stringify(this.parentIds)) | 
|---|
|  |  |  | }).catch(err => { | 
|---|
|  |  |  | console.log(err) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | // console.log('当前角色的菜单列表') | 
|---|
|  |  |  | // console.log(res) | 
|---|
|  |  |  | this.checkedData = res.data | 
|---|
|  |  |  | console.log(this.checkedData) | 
|---|
|  |  |  | var allIds = res.data | 
|---|
|  |  |  | // 过滤父id | 
|---|
|  |  |  | for (let i = 0; i < allIds.length; i++) { | 
|---|
|  |  |  | for (let j = 0; j < this.parentIds.length; j++) { | 
|---|
|  |  |  | if (allIds[i] === this.parentIds[j]) { | 
|---|
|  |  |  | allIds.splice(i, 1) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.checkedData = allIds | 
|---|
|  |  |  | }).catch(err => { | 
|---|
|  |  |  | console.log(err) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | method: 'post', | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | groupId: this.currentGroupId, | 
|---|
|  |  |  | menuIds:this.$refs.tree.getCheckedKeys() | 
|---|
|  |  |  | menuIds: this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys()) | 
|---|
|  |  |  | // menuIds: this.$refs.tree.getCheckedKeys() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | if (res.code === 0) { | 
|---|
|  |  |  | this.$message({ | 
|---|
|  |  |  | message: '保存成功', | 
|---|