| | |
| | | |
| | | <div |
| | | ref="scrollCenter" |
| | | style="border-right: 1px solid rgba(0,0,0,0.2);width: 600px;padding-left: 10px;overflow-y: auto" |
| | | style="border-right: 1px solid rgba(0,0,0,0.2);width: 660px;padding-left: 10px;overflow-y: auto" |
| | | :style="{height:(tableHeight-40)+'px'}" |
| | | @scroll="scrollCenterScroll()" |
| | | @mouseover="isScroll='center'" |
| | |
| | | v-if="item.expanded" |
| | | :key="it.menucode" |
| | | v-model="it.buttonChecked" |
| | | style="margin-left: 40px;height:26px;display: flex" |
| | | style="margin-left: 40px;height:26px;display: flex;" |
| | | @change="val=>handleCheckedButtonChange(val,it.menucode)" |
| | | > |
| | | |
| | |
| | | v-for="i in it.buttoncodelist" |
| | | :key="i" |
| | | :label="i" |
| | | style="display:flex;align-items: center" |
| | | style="display:flex;align-items: center;" |
| | | /> |
| | | </el-checkbox-group> |
| | | |
| | |
| | | }, |
| | | |
| | | created() { |
| | | this.getRolePermissionSearchRole() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | |
| | | this.getRolePermissionSearchRole() |
| | | }, |
| | | methods: { |
| | | |
| | |
| | | |
| | | let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : [] |
| | | temp = temp.length > 0 ? temp.split(',') : [] |
| | | console.log(temp, 7) |
| | | |
| | | it.buttonChecked = [] // 数据回显 |
| | | it.buttoncodelist.forEach(j => { |
| | |
| | | }, |
| | | // 单个按钮改变 |
| | | handleCheckedButtonChange(value, code, flag) { |
| | | // console.log(value, code, flag, 1) |
| | | |
| | | // console.log(JSON.parse(JSON.stringify(this.treeCenter[0])), 2) |
| | | |
| | | // 判断是否包含在内 |
| | | if (!flag) { |
| | | if (!this.menuCheckedCodeArr.includes(code) && value.length === 1) { // 否 |
| | |
| | | if (it.buttoncodelist.length) { |
| | | childrenLength++ |
| | | } |
| | | console.log(count, childrenLength) |
| | | }) |
| | | } |
| | | }) |
| | |
| | | }, |
| | | // 获取树形节点node |
| | | getLeftTreeNode(data, Node, VueComponent) { |
| | | // console.log(data, Node, VueComponent, 2221) |
| | | // console.log(Node.expanded) |
| | | this.treeCenter[0].children.forEach(item => { |
| | | if (item.menucode === data.menucode) { |
| | | item.expanded = Node.expanded |
| | |
| | | // 处理中间树形选中值改变 |
| | | handleTreeCenterCheckChange(obj, selfChecked, selfChildrenTreeCheck) { |
| | | // console.log(obj, selfChecked, selfChildrenTreeCheck, '王老吉') |
| | | obj.flag = selfChecked ? 'Y' : 'N' |
| | | if (!selfChildrenTreeCheck) { |
| | | if (!selfChecked) { |
| | | this.treeCenter[0].children.forEach(item => { |
| | |
| | | this.treeCenter[0].children.forEach(item => { |
| | | if (item.children && item.children.length) { |
| | | item.children.forEach(it => { |
| | | if (it.dataChecked.length > 0) { |
| | | if (it.dataChecked.length > 0 && it.datacodelist.length > 0) { |
| | | count++ |
| | | } |
| | | // console.log(it.dataChecked, 234) |
| | | if (it.datacodelist.length > 0) { |
| | | childrenLength++ |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | // console.log(count, childrenLength, 9) |
| | | // console.log(count, childrenLength, 123) |
| | | this.dataIsChecked = count === childrenLength |
| | | this.$forceUpdate() |
| | | }, |
| | |
| | | |
| | | // 页面勾选好保存事件 |
| | | async saveClick() { |
| | | // [{"menucode":"1010","buttoncode":"Add,Update","datacode":"ALL"},] |
| | | const menuKeyArr = this.$refs.treeCenterRef.getCheckedKeys() |
| | | const arr = [] |
| | | this.treeCenter[0].children.forEach(item => { |
| | | if (item.children && item.children.length) { |
| | | item.children.forEach(it => { |
| | | if (it.dataChecked && it.dataChecked.toString().length > 0) { // 数据权限已勾选 |
| | | it.dataChecked = this.dataKeyValue.find(i => i.dataname === it.dataChecked).datacode |
| | | } |
| | | if (menuKeyArr.includes(it.menucode)) { |
| | | if (it.dataChecked && it.dataChecked.toString().length > 0) { // 数据权限已勾选 |
| | | it.dataChecked = this.dataKeyValue.find(i => i.dataname === it.dataChecked).datacode |
| | | } |
| | | |
| | | if (it.buttonChecked && it.buttonChecked.length > 0) { // 已选菜单 |
| | | it.buttonChecked = this.$ButtonData.filter(i => |
| | | it.buttonChecked.includes(i.buttonname) |
| | | ).map(i => i.buttoncode) |
| | | if (it.buttonChecked && it.buttonChecked.length > 0) { // 已选菜单 |
| | | it.buttonChecked = this.$ButtonData.filter(i => |
| | | it.buttonChecked.includes(i.buttonname) |
| | | ).map(i => i.buttoncode) |
| | | } |
| | | arr.push({ |
| | | menucode: it.menucode, |
| | | datacode: it.dataChecked, |
| | | buttoncode: it.buttonChecked ? it.buttonChecked.join(',') : '' |
| | | }) |
| | | } |
| | | arr.push({ |
| | | menucode: it.menucode, |
| | | datacode: it.dataChecked, |
| | | buttoncode: it.buttonChecked ? it.buttonChecked.join(',') : '' |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // console.log(this.$refs.treeCenterRef.getCheckedKeys(), 7) |
| | | console.log(arr, 'arr') |
| | | const rolecode = this.$refs.treeLeftRef.getCurrentKey() |
| | | // console.log(JSON.stringify(arr).toString()) |
| | | const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName) |
| | | if (res.code === '200') { |
| | | const rolename = this.treeLeft[0].roles.find(i => i.code === rolecode).name |
| | |
| | | await this.getRolePermissionSearchRoleMenuButton(rolecode) |
| | | await this.getRolePermissionSearchRoleMenu(rolecode) |
| | | } |
| | | this.$forceUpdate() |
| | | // this.$forceUpdate() |
| | | }, |
| | | // 获取页面高度 |
| | | getHeight() { |
| | |
| | | font-size: 14px; |
| | | padding-right: 8px; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__label { |
| | | width: 55px; |
| | | } |
| | | |
| | | .el-icon-plus:hover,.el-icon-edit:hover,.el-icon-delete:hover{ |
| | | color: #000 !important; |
| | | } |
| | | </style> |