| | |
| | | <template> |
| | | <div style="width: 100%;height: 100%;display: flex;overflow: hidden;"> |
| | | <div class="role-tree-left flex-col"> |
| | | <div |
| | | style=" |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | flex-direction: row; |
| | | overflow: hidden; |
| | | " |
| | | > |
| | | <!-- <div class="role-tree-left flex-col"> |
| | | <div class="title"><i class="el-icon-user"></i>è§è²å表</div> |
| | | <el-scrollbar class="el-role-list"> |
| | | <el-tree :data="tree" @node-click="nodeClick" node-key="id" :default-expanded-keys="openKeys" |
| | |
| | | </template> |
| | | </el-tree> |
| | | </el-scrollbar> |
| | | </div> |
| | | <div style="height: calc(100vh - 6.5rem);flex: 1;overflow: hidden;background-color: white;" class="role-tree-right flex-col"> |
| | | </div> --> |
| | | |
| | | <div |
| | | style=" |
| | | height: calc(100vh - 6.5rem); |
| | | flex: 1; |
| | | overflow: hidden; |
| | | background-color: white; |
| | | " |
| | | class="role-tree-right flex-col" |
| | | > |
| | | <div class="title" style="display: flex; justify-content: space-between"> |
| | | <div> |
| | | è§è²æé管çï¼{{ |
| | | userInfo.userName ? userInfo.userName : "è¶
级管çå" |
| | | }}ï¼ |
| | | </div> |
| | | <el-icon @click="goBack" size="25"><CloseBold /></el-icon> |
| | | </div> |
| | | <div class="title"> |
| | | <div><i class="el-icon-folder-opened"></i>èåæé</div> |
| | | <el-button type="primary" @click="save">ä¿å</el-button> |
| | | </div> |
| | | <el-scrollbar class="el-role-list" style="height: 100%;"> |
| | | <el-tree @check-change="leftCheckChange" @check="nodeCheck" :data="roleTree" :show-checkbox="false" |
| | | style="padding: 15px" node-key="id" default-expand-all :expand-on-click-node="false"> |
| | | <el-scrollbar class="el-role-list" style="height: 100%"> |
| | | <el-tree |
| | | @check-change="leftCheckChange" |
| | | @check="nodeCheck" |
| | | :data="roleTree" |
| | | :show-checkbox="false" |
| | | style="padding: 15px" |
| | | node-key="id" |
| | | default-expand-all |
| | | :expand-on-click-node="false" |
| | | > |
| | | <template #default="{ data }"> |
| | | <div class="action-group"> |
| | | <div class="action-text" :style="{ width: (4 - data.lv) * 18 + 150 + 'px' }"> |
| | | <div |
| | | class="action-text" |
| | | :style="{ width: (4 - data.lv) * 18 + 150 + 'px' }" |
| | | > |
| | | <el-checkbox v-model="data.leftCk" @change="allChange(data)">{{ |
| | | // data.text + (data.isApp ? "(app)" : "") |
| | | data.text |
| | | }}</el-checkbox> |
| | | </div> |
| | | <div class="action-item"> |
| | | <el-checkbox v-for="(item, index) in data.actions" :key="index" v-model="item.checked" |
| | | @change="actionChange(data, item.checked)">{{ item.text }}</el-checkbox> |
| | | <el-checkbox |
| | | v-for="(item, index) in data.actions" |
| | | :key="index" |
| | | v-model="item.checked" |
| | | @change="actionChange(data, item.checked)" |
| | | >{{ item.text }}</el-checkbox |
| | | > |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | </el-scrollbar> |
| | | </div> |
| | | </div> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import { defineComponent, ref, reactive, getCurrentInstance } from "vue"; |
| | | import { |
| | | defineComponent, |
| | | ref, |
| | | reactive, |
| | | getCurrentInstance, |
| | | onActivated, |
| | | } from "vue"; |
| | | import http from "@/../src/api/http.js"; |
| | | import { useRoute, useRouter } from "vue-router"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const selectId = ref(-1); |
| | |
| | | const roleList = reactive([]); |
| | | const roleTree = reactive([]); |
| | | const openKeys = reactive([]); |
| | | |
| | | const route = useRoute(); |
| | | const router = useRouter(); |
| | | const userInfo = reactive({}); |
| | | const leftCheckChange = (node, selected) => { |
| | | node.actions.forEach((x, index) => { |
| | | x.checked = selected; |
| | |
| | | const load = () => { |
| | | const url = "api/Sys_Role/getUserChildRoles"; |
| | | http.post(url, {}, true).then((result) => { |
| | | |
| | | if (!result.status) return; |
| | | list.splice(0); |
| | | list.push(...result.data); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const goBack = () => { |
| | | router.push("/Usermanagement"); |
| | | }; |
| | | const getRoleTree = (id, data, isRootId) => { |
| | | roleList.forEach((x) => { |
| | | if (x.pid == id) { |
| | |
| | | |
| | | load(); |
| | | getCurrentTreePermission(); |
| | | |
| | | onActivated(() => { |
| | | let detail = history.state.info; |
| | | userInfo.value = JSON.parse(detail || {}); |
| | | }); |
| | | console.log(userInfo.value); |
| | | |
| | | return { |
| | | list, |
| | | nodeClick, |
| | |
| | | allChange, |
| | | actionChange, |
| | | save, |
| | | route, |
| | | goBack, |
| | | router, |
| | | userInfo, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style lang="less" scoped> |
| | | |
| | | .flex-col { |
| | | display: flex; |
| | | flex-direction: column; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | .title { |
| | | display: flex; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | .title { |
| | | padding: 10px; |
| | | background: rgb(246 250 255); |
| | |
| | | height: 0; |
| | | overflow-x: hidden; |
| | | } |
| | | |
| | | |
| | | .role-tree-left ::v-deep(.el-tree-node__content) { |
| | | cursor: pointer; |