dev
张同海 2 years ago
parent 262694285d
commit e067bb6666

@ -11,6 +11,13 @@
<a-form :form="form">
<a-row>
<a-col :span="12">
<a-form-item label="应用名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select @change="appChange" v-model="selectValue">
<a-select-option v-for="(item, index) in appList" :key="index" :value="item.appCode">{{
item.appName
}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择菜单" :labelCol="labelCol" :wrapperCol="wrapperCol" class="grantOrgScrollbar">
<a-tree
v-model="checkedMenuKeys"
@ -80,6 +87,7 @@ import {
SysDataUserMenuGetGrantData
} from '@/api/modular/system/userManage'
import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
import { SysMenuTreeForGrant } from '@/api/modular/system/menuManage'
export default {
data() {
return {
@ -111,7 +119,7 @@ export default {
},
replaceMenuFields: {
key: 'id',
title: 'name'
title: 'title'
},
form: this.$form.createForm(this),
dataScopeTypeData: [],
@ -119,7 +127,10 @@ export default {
GrantData: [],
SelectMenu: false,
SelectMenuId: '',
MeuncheckedKeys: []
MeuncheckedKeys: [],
appList: [],
selectValue: null,
menuList: []
}
},
@ -144,6 +155,7 @@ export default {
res.data.forEach(item => {
this.checkedMenuKeys.push(item.sysMenuId)
})
this.MeuncheckedKeys = this.checkedMenuKeys
//
SysDataUserMenuGetGrantRightData({ userid: record.id }).then(res => {
this.GrantData.forEach(item => {
@ -164,14 +176,6 @@ export default {
let Type = false
this.GrantData.forEach(item => {
if (item.sysMenuId == this.SelectMenuId) {
// if (value == '5') {
// this.checkedKeys = []
// item.RightData.forEach(item => {
// this.checkedKeys.push(item.orgId)
// })
// } else {
// item.RightData = []
// }
item.dataScopeType = value
Type = true
}
@ -219,13 +223,21 @@ export default {
*/
getMenuList() {
this.formLoading = true
getMenuList().then(res => {
SysMenuTreeForGrant().then(res => {
if (res.success) {
this.menuTreeData = res.data
this.appList = res.data.appList
this.menuList = res.data.menuTree
this.selectValue = this.appList[0].appCode
this.appChange(this.selectValue)
}
})
},
appChange(value) {
this.SelectMenu = false
this.selectValue = value
let menuList = this.menuList.filter(f => f.appCode == value)
this.menuTreeData = menuList
},
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
@ -244,6 +256,7 @@ export default {
},
onSelectMenu(selectedKeys) {
console.log(selectedKeys)
this.checkedKeys = []
this.SelectMenu = true
this.SelectMenuId = selectedKeys[0]
@ -264,16 +277,39 @@ export default {
console.log('选择菜单', this.checkedKeys)
},
onCheckMenu(checkedKeys, e) {
let Select = []
for (let key in checkedKeys.checked) {
var stra = checkedKeys.checked[key]
console.log(stra)
var count = 0
for (var j = 0; j < this.MeuncheckedKeys.length; j++) {
var strb = this.MeuncheckedKeys[j]
if (stra == strb) {
count++
}
}
if (count === 0) {
Select.push(stra)
}
}
console.log(Select)
if (Select.length) {
this.onSelectMenu(Select)
} else {
this.SelectMenu = false
}
this.MeuncheckedKeys = checkedKeys.checked
},
handleSubmit() {
const {
form: { validateFields }
} = this
// const {
// form: { validateFields }
// } = this
this.confirmLoading = true
// validateFields((errors, values) => {
// if (!errors) {
let childrens = []
console.log(this.MeuncheckedKeys)
this.MeuncheckedKeys.forEach(item => {
this.GrantData.forEach(item2 => {
if (item == item2.sysMenuId) {

Loading…
Cancel
Save