| | |
| | | <template> |
| | | <el-container> |
| | | <el-aside> |
| | | <basic-container> |
| | | <basic-container v-loading="treeLoading"> |
| | | <div ref="TreeBox" style="height: calc(100vh - 154px);!important;"> |
| | | <!-- 左侧树 --> |
| | | <div style="height: calc(100vh - 195px);"> |
| | | <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> |
| | | <span slot-scope="{ node, data }" class="el-tree-node__label"> |
| | | <span style="font-size: 15px"> |
| | | <span> |
| | | <i class="el-icon-user-solid"></i> |
| | | {{ (node || {}).label }} |
| | | </span> |
| | |
| | | </el-aside> |
| | | |
| | | <el-main> |
| | | <basic-container v-loading="treeLoading"> |
| | | <basic-container v-loading="mainLoading"> |
| | | <h3 style="margin: 0 0 10px 0">UI权限配置</h3> |
| | | <div> |
| | | <el-button icon="el-icon-place" plain size="small" type="primary" @click="saveHandler">授权</el-button> |
| | | <el-button icon="el-icon-close" plain size="small" style="margin-right: 40px;" type="primary" |
| | | @click="clearValue">重置 |
| | | <el-button v-if="permissionList.rightBtn" class="button-custom-icon" plain size="small" type="primary" @click="saveHandler"> |
| | | <icon-show :name="permissionList.rightBtn.source"></icon-show> |
| | | 授权 |
| | | </el-button> |
| | | <el-button v-if="permissionList.resetBtn" class="button-custom-icon" plain size="small" style="margin-right: 40px;" type="primary" |
| | | @click="clearValue"> |
| | | <icon-show :name="permissionList.resetBtn.source"></icon-show> |
| | | 重置 |
| | | </el-button> |
| | | 业务类型: |
| | | <el-select v-model="type" :clearable="true" placeholder="请选择" size="small" |
| | |
| | | <div style="height: calc(100vh - 232px);margin-top: 10px;"> |
| | | <avue-tree ref="uiTree" :data="uiTreeData" :node-key="oid" :option="uiTreeOption"> |
| | | <span slot-scope="{ node, data }" class="el-tree-node__label"> |
| | | <span style="font-size: 15px"> |
| | | <span> |
| | | <i :class="data.icon"></i> |
| | | {{ (node || {}).label }} |
| | | </span> |
| | |
| | | import {gridRoles, getRightListByRoleId} from "@/api/system/role/api"; |
| | | import {getUIAuthor, authorizedUI} from "@/api/authority/ui/uiAuthor"; |
| | | import {getBizTree, gridUIContextData} from "@/api/UI/uiDefine"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | treeLoading: false, |
| | | mainLoading:false, |
| | | type: '',//业务类型 |
| | | context: '',//UI上下文code |
| | | treeOption: { |
| | |
| | | contextData: [] |
| | | } |
| | | }, |
| | | computed:{ |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | rightBtn: this.vaildData(this.permission[this.$route.query.id].RIGHT, false), |
| | | resetBtn: this.vaildData(this.permission[this.$route.query.id].RESET, false), |
| | | }; |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getTreeList(); |
| | | // this.getUITree(); |
| | |
| | | }, |
| | | methods: { |
| | | getTreeList() { |
| | | const loading = this.$loading({}); |
| | | this.treeLoading = true; |
| | | gridRoles().then(res => { |
| | | this.treeData = res.data.data; |
| | | loading.close(); |
| | | this.treeLoading = false; |
| | | }).catch(error => { |
| | | loading.close(); |
| | | this.treeLoading = false; |
| | | }) |
| | | }, |
| | | |
| | |
| | | nodeClick(row) { |
| | | this.nodeRow = row; |
| | | this.getUITree(); |
| | | // const params = { |
| | | // roleId: row.oid |
| | | // } |
| | | // getRightListByRoleId(params).then(res => { |
| | | // const data = res.data.data.map(item => item.funcId); |
| | | // console.log(data); |
| | | // this.$refs.uiTree.setCheckedKeys(data); |
| | | // }) |
| | | }, |
| | | |
| | | getUITree() { |
| | | this.treeLoading = true; |
| | | this.mainLoading = true; |
| | | const params = { |
| | | 'conditionMap[roleId]': this.nodeRow.oid, |
| | | 'conditionMap[type]': this.type, |
| | |
| | | const checkedData = this.findCheckedOids(res.data.data[0]); |
| | | this.$refs.uiTree.setCheckedKeys(checkedData); |
| | | |
| | | this.treeLoading = false; |
| | | this.mainLoading = false; |
| | | }).catch(error => { |
| | | this.treeLoading = false; |
| | | this.mainLoading = false; |
| | | }) |
| | | }, |
| | | |
| | |
| | | checked: true, |
| | | expanded: true, |
| | | data:item.data, |
| | | parentId:item.parentId, |
| | | level: item.level, |
| | | leaf:item.leaf, |
| | | oid: item.oid, |
| | | text: item.text |
| | | } |
| | | }) |
| | | |
| | | // const parentData = selectParentList.map(item => { |
| | | // return { |
| | | // checked: false, |
| | | // expanded: true, |
| | | // data:item.data, |
| | | // level: item.level, |
| | | // oid: item.oid, |
| | | // text: item.text |
| | | // } |
| | | // }) |
| | | // // 在半选状态中过滤掉顶级节点 oid 为 root |
| | | // const filterSelectTreeData = parentData.filter(item => item.oid !== 'root'); |
| | | const parentData = selectParentList.map(item => { |
| | | return { |
| | | checked: false, |
| | | expanded: true, |
| | | data:item.data, |
| | | parentId:item.parentId, |
| | | level: item.level, |
| | | leaf:item.leaf, |
| | | oid: item.oid, |
| | | text: item.text |
| | | } |
| | | }) |
| | | // 在半选状态中过滤掉顶级节点 oid 为 root |
| | | const filterSelectTreeData = parentData.filter(item => item.oid !== 'root'); |
| | | |
| | | const data = [...selectTreeData]; |
| | | const data = [...selectTreeData,...filterSelectTreeData]; |
| | | const formData = { |
| | | roleId: this.nodeRow.oid, |
| | | type: this.type, |
| | | context: this.context, |
| | | selectTreeList: selectTreeList |
| | | selectTreeList: data |
| | | } |
| | | authorizedUI(formData).then(res => { |
| | | if (res.data.success) { |