| | |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="角色权限配置" append-to-body :visible.sync="box" width="345px"> |
| | | <el-tabs type="border-card"> |
| | | <el-tabs stretch="true" type="border-card"> |
| | | <el-tab-pane label="菜单权限"> |
| | | <el-tree |
| | | :data="menuGrantList" |
| | |
| | | :props="props" |
| | | ></el-tree> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="数据权限"> |
| | | <el-tab-pane label="系统权限"> |
| | | <el-tree |
| | | :data="systemList" |
| | | show-checkbox |
| | | node-key="dictKey" |
| | | ref="treeSystemScope" |
| | | :default-checked-keys="checkedSystem" |
| | | :props="propSystem" |
| | | ></el-tree> |
| | | </el-tab-pane> |
| | | <!-- <el-tab-pane label="数据权限"> |
| | | <el-tree |
| | | :data="dataScopeGrantList" |
| | | show-checkbox |
| | |
| | | :default-checked-keys="apiScopeTreeObj" |
| | | :props="props" |
| | | ></el-tree> |
| | | </el-tab-pane> |
| | | </el-tab-pane> --> |
| | | </el-tabs> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | |
| | | |
| | | <script> |
| | | import { add, getList, getRole, getRoleTreeById, grant, grantTree, remove, update } from "@/api/system/role" |
| | | import {getDictionary} from "@/api/system/dictbiz" |
| | | import { mapGetters } from "vuex" |
| | | import website from '@/config/website' |
| | | |
| | | export default { |
| | | |
| | | data () { |
| | | return { |
| | | form: {}, |
| | |
| | | props: { |
| | | label: "title", |
| | | value: "key" |
| | | }, |
| | | propSystem:{ |
| | | label:"dictValue", |
| | | value:"dictKey" |
| | | }, |
| | | menuGrantList: [], |
| | | dataScopeGrantList: [], |
| | |
| | | } |
| | | ] |
| | | }, |
| | | data: [] |
| | | data: [], |
| | | checkAll: false, |
| | | checkedSystem: [], |
| | | systemList: [], |
| | | isIndeterminate: true |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | submit () { |
| | | const menuList = this.$refs.treeMenu.getCheckedKeys() |
| | | const dataScopeList = this.$refs.treeDataScope.getCheckedKeys() |
| | | const apiScopeList = this.$refs.treeApiScope.getCheckedKeys() |
| | | grant(this.idsArray, menuList, dataScopeList, apiScopeList).then(() => { |
| | | // const dataScopeList = this.$refs.treeDataScope.getCheckedKeys() |
| | | // const apiScopeList = this.$refs.treeApiScope.getCheckedKeys() |
| | | const dataScopeList = [] |
| | | const apiScopeList = [] |
| | | const systemLists = this.$refs.treeSystemScope.getCheckedKeys() |
| | | const systemIds = systemLists.join(",") |
| | | grant(this.idsArray, menuList, dataScopeList, apiScopeList,systemIds).then(() => { |
| | | this.box = false |
| | | this.$message({ |
| | | type: "success", |
| | |
| | | }) |
| | | this.onLoad(this.page) |
| | | }) |
| | | |
| | | }, |
| | | rowSave (row, done, loading) { |
| | | add(row).then(() => { |
| | |
| | | this.menuGrantList = res.data.data.menu |
| | | this.dataScopeGrantList = res.data.data.dataScope |
| | | this.apiScopeGrantList = res.data.data.apiScope |
| | | getDictionary({code:"system"}).then(res=>{ |
| | | if(res.data.code == 200){ |
| | | this.systemList = res.data.data |
| | | |
| | | } |
| | | }) |
| | | getRole(this.ids).then(res => { |
| | | if(res.data.data.systemIds){ |
| | | this.checkedSystem = res.data.data.systemIds.split(",") |
| | | }else{ |
| | | this.checkedSystem = [] |
| | | } |
| | | |
| | | this.menuTreeObj = res.data.data.menu |
| | | this.dataScopeTreeObj = res.data.data.dataScope |
| | | this.apiScopeTreeObj = res.data.data.apiScope |
| | | this.box = true |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | handleDelete () { |
| | | if (this.selectionList.length === 0) { |
| | |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | }, |
| | | handleCheckAllChange(val) { |
| | | this.checkedSystem = val ? this.systemList : []; |
| | | this.isIndeterminate = false; |
| | | }, |
| | | handleCheckedChange(value) { |
| | | |
| | | }, |
| | | } |
| | | }; |
| | | </script> |