Browse Source

完善功能授权

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

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

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

Loading…
Cancel
Save