|
|
|
@ -55,6 +55,9 @@
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-checkbox v-model="isEdit" @change="handleChangeEdit" style="margin-left: 20px;" v-show="SelectMenu">
|
|
|
|
|
是否编辑
|
|
|
|
|
</a-checkbox>
|
|
|
|
|
<div v-show="SelectMenu && orgTreeShow">
|
|
|
|
|
<a-form-item label="选择机构" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
|
|
<a-tree
|
|
|
|
@ -111,6 +114,7 @@ export default {
|
|
|
|
|
formLoading: true,
|
|
|
|
|
autoExpandParent: true,
|
|
|
|
|
autoExpandParentMenu: true,
|
|
|
|
|
isEdit: false,
|
|
|
|
|
selectedKeys: [],
|
|
|
|
|
userEntity: [],
|
|
|
|
|
replaceFields: {
|
|
|
|
@ -194,6 +198,19 @@ export default {
|
|
|
|
|
this.checkedKeys = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleChangeEdit() {
|
|
|
|
|
let Type = false
|
|
|
|
|
this.GrantData.forEach(item => {
|
|
|
|
|
console.log(item,this.SelectMenuId)
|
|
|
|
|
if (item.sysMenuId == this.SelectMenuId) {
|
|
|
|
|
item.isEdit = this.isEdit
|
|
|
|
|
Type = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (!Type) {
|
|
|
|
|
this.GrantData.push({ isEdit: this.isEdit, sysMenuId: this.SelectMenuId, RightData: [] })
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取机构树
|
|
|
|
|
*/
|
|
|
|
@ -236,7 +253,7 @@ export default {
|
|
|
|
|
appChange(value) {
|
|
|
|
|
this.SelectMenu = false
|
|
|
|
|
this.selectValue = value
|
|
|
|
|
let menuList = this.menuList.filter(f => f.appCode == value)
|
|
|
|
|
const menuList = this.menuList.filter(f => f.appCode == value)
|
|
|
|
|
this.menuTreeData = menuList
|
|
|
|
|
},
|
|
|
|
|
onExpand(expandedKeys) {
|
|
|
|
@ -257,31 +274,34 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSelectMenu(selectedKeys) {
|
|
|
|
|
console.log(selectedKeys)
|
|
|
|
|
this.checkedKeys = []
|
|
|
|
|
this.SelectMenu = true
|
|
|
|
|
this.SelectMenuId = selectedKeys[0]
|
|
|
|
|
let type = ''
|
|
|
|
|
const arr = []
|
|
|
|
|
this.GrantData.forEach(item => {
|
|
|
|
|
if (item.sysMenuId == selectedKeys[0]) {
|
|
|
|
|
item.RightData.forEach(item2 => {
|
|
|
|
|
this.checkedKeys.push(item2.orgId)
|
|
|
|
|
})
|
|
|
|
|
type = `${item.dataScopeType}`
|
|
|
|
|
arr.push(item.isEdit)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (arr.length > 0) {
|
|
|
|
|
this.isEdit = arr[0]
|
|
|
|
|
} else {
|
|
|
|
|
this.isEdit = false
|
|
|
|
|
}
|
|
|
|
|
this.handleChange(type)
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
dataScopeType: type
|
|
|
|
|
})
|
|
|
|
|
console.log(this.GrantData)
|
|
|
|
|
console.log('选择菜单', this.checkedKeys)
|
|
|
|
|
},
|
|
|
|
|
onCheckMenu(checkedKeys, e) {
|
|
|
|
|
let Select = []
|
|
|
|
|
for (let key in checkedKeys.checked) {
|
|
|
|
|
const Select = []
|
|
|
|
|
for (const 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]
|
|
|
|
@ -293,7 +313,6 @@ export default {
|
|
|
|
|
Select.push(stra)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(Select)
|
|
|
|
|
if (Select.length) {
|
|
|
|
|
this.onSelectMenu(Select)
|
|
|
|
|
} else {
|
|
|
|
@ -309,21 +328,17 @@ export default {
|
|
|
|
|
this.confirmLoading = true
|
|
|
|
|
// validateFields((errors, values) => {
|
|
|
|
|
// if (!errors) {
|
|
|
|
|
let childrens = []
|
|
|
|
|
console.log(this.MeuncheckedKeys)
|
|
|
|
|
const childrens = []
|
|
|
|
|
this.MeuncheckedKeys.forEach(item => {
|
|
|
|
|
this.GrantData.forEach(item2 => {
|
|
|
|
|
if (item == item2.sysMenuId) {
|
|
|
|
|
console.log(item2)
|
|
|
|
|
if (!item2.dataScopeType) {
|
|
|
|
|
item2.dataScopeType = this.dataScopeTypeData[0].code
|
|
|
|
|
console.log('这条没有', item2)
|
|
|
|
|
}
|
|
|
|
|
childrens.push({ ...item2, menuId: item2.sysMenuId })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
SysDataUserMenuGrantData({ userId: this.userEntity.id, childrens })
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.success) {
|
|
|
|
@ -353,10 +368,6 @@ export default {
|
|
|
|
|
.finally(res => {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
})
|
|
|
|
|
// } else {
|
|
|
|
|
// this.confirmLoading = false
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
},
|
|
|
|
|
handleCancel() {
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|