Browse Source

完善功能授权

master
yunuo970428 2 years ago
parent
commit
18b9d5baf2
  1. 135
      anrui-system-ui/src/views/RoleAdminister/RoleAdminister.vue

135
anrui-system-ui/src/views/RoleAdminister/RoleAdminister.vue

@ -224,7 +224,7 @@
<td>岗位</td>
<td>
<el-select v-model="roleForm.postSid" filterable style="width:300px" @change="changePost">
<el-option v-for="(item, i) in postSidData" :key="i" :label="item.name" :value="item.sid"></el-option>
<el-option v-for="item in postSidData" :key="item.sid" :label="item.name" :value="item.sid"></el-option>
</el-select>
</td>
</tr>
@ -244,10 +244,8 @@
<td>组织层级</td>
<td>
<el-select v-model="roleForm.roleTypeValue" style="width:300px" @change="changeOrgName">
<el-option v-for="(item, i) in roleTypeValue_list" :key="i" :label="item.dictValue"
:value="item.dictValue"></el-option>
<el-option v-for="item in roleTypeValue_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"></el-option>
</el-select>
<!-- <el-input v-model="roleForm.roleTypeValue" style="width:300px"></el-input>-->
</td>
</tr>
<tr>
@ -303,8 +301,8 @@ export default {
type: '2',
postSid: '',
remarks: '',
roleType:'',
roleTypeValue:''
roleType: '',
roleTypeValue: ''
},
formBackup: {},
search: {
@ -341,7 +339,7 @@ export default {
funDialog: false,
//
mobileDialog: false
};
}
},
mounted() {
this.formBackup = Object.assign({}, this.roleForm)
@ -357,16 +355,14 @@ export default {
},
getPostList() {
postList().then((res) => {
if (res.code === '200') {
if (res.success) {
this.postSidData = res.data
}
})
},
getType() {
typeValues({
type: 'roleType'
}).then((res) => {
if (res.code === '200') {
typeValues({ type: 'roleType' }).then((res) => {
if (res.success) {
this.roleTypeValue_list = res.data
console.log('下拉框请求组织层级', res.data)
}
@ -394,7 +390,7 @@ export default {
changeOrgName(value) {
const choosetItem = this.roleTypeValue_list.filter((item) => item.dictValue === value)
this.roleForm.roleType = choosetItem[0].dictKey
console.log('组织层级',this.roleForm.roleType,this.roleForm.roleTypeValue)
console.log('组织层级', this.roleForm.roleType, this.roleForm.roleTypeValue)
},
changePost(value) {
const choosetItem = this.postSidData.filter((item) => item.sid === value)
@ -419,38 +415,29 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delOrgroles({
sid: row.sid
}).then(res => {
this.getroleOrgList()
this.$message({
type: 'success',
message: '删除成功!'
});
delOrgroles({ sid: row.sid }).then((res) => {
if (res.success) {
this.getroleOrgList()
this.$message({ showClose: true, type: 'success', message: '删除成功!' })
}
})
})
},
//
save() {
if (this.roleForm.sid) {
putOrgroles(this.roleForm).then(res => {
if (res.code == '200') {
putOrgroles(this.roleForm).then((res) => {
if (res.success) {
this.getroleOrgList()
this.editDialog = false
this.$message({
message: res.msg,
type: 'success'
})
this.$message({ showClose: true, message: res.msg, type: 'success' })
}
})
} else {
saveOrgroles(this.roleForm).then(res => {
if (res.code == '200') {
this.$message({
message: res.msg,
type: 'success'
})
this.activeName = "roleList"
saveOrgroles(this.roleForm).then((res) => {
if (res.success) {
this.$message({ showClose: true, message: res.msg, type: 'success' })
this.activeName = 'roleList'
this.getroleOrgList()
}
})
@ -461,11 +448,10 @@ export default {
setRoleEnable({
sid: row.sid,
isEnable: value
}).then(res => {
this.$message({
type: 'success',
message: res.msg
});
}).then((res) => {
if (res.success) {
this.$message({ showClose: true, type: 'success', message: res.msg })
}
})
},
sourceMenus(row) {
@ -499,23 +485,56 @@ export default {
}
funMenuTree(params).then(res => {
let data1 = res.data
//
for (let i = 0; i < data1.length; i++) {
if (data1[i].checked == 0) {
this.checkedId.push(data1[i].sid)
}
for (let j = 0; j < data1[i].children.length; j++) {
if (data1[i].children) {
// data2
let data2 = data1[i].children
if (data2[j].checked == 0) {
this.checkedId.push(data2[j].sid)
}
for (let k = 0; k < data2[j].children.length; k++) {
let data3 = data2[j].children
if (data3[k].checked == 0) {
this.checkedId.push(data3[k].sid)
for (let j = 0; j < data2.length; j++) {
//
if (data2[j].children) {
// data3
const data3 = data2[j].children
for (let k = 0; k < data3.length; k++) {
//
if (data3[k].children) {
const data4 = data3[k].children
for (let l = 0; l < data4.length; l++) {
if (data4[l].checked == 0) {
this.checkedId.push(data4[l].sid)
}
}
}
//
if (data3[k].children.length == 0 && data3[k].checked == 0) {
this.checkedId.push(data3[k].sid)
}
}
}
//
if (data2[j].children.length == 0 && data2[j].checked == 0) {
this.checkedId.push(data2[j].sid)
}
}
}
}
// for (let i = 0; i < data1.length; i++) {
// if (data1[i].checked == 0) {
// this.checkedId.push(data1[i].sid)
// }
// for (let j = 0; j < data1[i].children.length; j++) {
// let data2 = data1[i].children
// if (data2[j].checked == 0) {
// this.checkedId.push(data2[j].sid)
// }
// for (let k = 0; k < data2[j].children.length; k++) {
// let data3 = data2[j].children
// if (data3[k].checked == 0) {
// this.checkedId.push(data3[k].sid)
// }
// }
// }
// }
this.treedata = res.data
this.loading = false
})
@ -746,11 +765,10 @@ export default {
},
//
sourceSave() {
let _this = this
let sourceMenus = this.$refs.sourceTree.getCheckedKeys()
let params = {
sorceSid: sourceMenus.toString(),
roleSid: _this.Thisrow.sid
roleSid: this.Thisrow.sid
}
saveSource(params).then(res => {
this.sourceDialog = false
@ -762,11 +780,10 @@ export default {
},
//
funSave() {
let _this = this
let funMenus = this.$refs.funTree.getCheckedKeys()
let params = {
functionSid: funMenus.toString(),
roleSid: _this.Thisrow.sid
roleSid: this.Thisrow.sid
}
savefunMenu(params).then(res => {
this.funDialog = false
@ -778,7 +795,6 @@ export default {
},
//
getCheckedKeys() {
let _this = this
let roleMenus = []
roleMenus = this.$refs.Tree.getCheckedNodes(false, true)
// roleMenus = this.$refs.Tree.getCheckedKeys()
@ -798,7 +814,7 @@ export default {
// }
let params = {
menuSid: roleMenus_sid.toString(),
roleSid: _this.Thisrow.sid
roleSid: this.Thisrow.sid
}
saveorgrolemenus(params).then(res => {
this.roleDialog = false
@ -809,7 +825,6 @@ export default {
})
},
getCheckedMobile() {
let _this = this
let roleMenus = []
roleMenus = this.$refs.mobileTree.getCheckedNodes(false, true)
// roleMenus = this.$refs.Tree.getCheckedKeys()
@ -829,7 +844,7 @@ export default {
// }
let params = {
menuSid: roleMenus_sid.toString(),
roleSid: _this.Thisrow.sid
roleSid: this.Thisrow.sid
}
saveRoleMenuList(params).then((res) => {
if (res.success) {
@ -842,10 +857,10 @@ export default {
}
}
};
}
</script>
<style scoped="scoped">
<style scoped>
.my-tabs {
margin-top: 10px;
}

Loading…
Cancel
Save