|
@@ -108,7 +108,7 @@
|
|
|
<el-table-column label="描述" prop="remark" width="231" />
|
|
|
<el-table-column label="权限" prop="createTime" width="55" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span><input type="checkbox" v-if="findChildrenIds(scope.row).length" :checked="isChecked(scope.row)" @change="handleCheckedTreeConnect($event, 'menu', scope.row)" /></span>
|
|
|
+ <span><input type="checkbox" :checked="isChecked(scope.row)" @change="handleCheckedTreeConnect($event, 'menu', scope.row)" /></span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" class-name="small-padding fixed-width">
|
|
@@ -119,7 +119,7 @@
|
|
|
:style="{ color: checkedKeys.includes(item.menuId) ? '#409EFF' : '#909399' }"
|
|
|
v-for="(item, index) in btnListss(scope.row.menuId)"
|
|
|
:key="index"
|
|
|
- @click="updateBtn(item)"
|
|
|
+ @click="updateBtn(item, scope.row)"
|
|
|
><span>{{ item.menuName }}</span>
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -426,6 +426,8 @@ export default {
|
|
|
// 双击角色表格某一行
|
|
|
roleLineDbclick(row) {
|
|
|
this.roleId = ''
|
|
|
+ this.functionList = []
|
|
|
+ this.checkedKeys = []
|
|
|
this.btnList = []
|
|
|
this.FuncList = []
|
|
|
this.FuncListTree = []
|
|
@@ -450,16 +452,17 @@ export default {
|
|
|
},
|
|
|
// 双击功能权限表格某一行
|
|
|
functionalLineDbclick(row, event, column) {
|
|
|
+ this.disabled = this.isChecked(row) ? false : true
|
|
|
+ this.headList = []
|
|
|
this.functionalShow = false
|
|
|
this.headShow = true
|
|
|
this.over = 3
|
|
|
this.listName = row.menuName
|
|
|
this.menuId = row.menuId
|
|
|
this.checkStatus = this.isChecked(row) ? 0 : 1
|
|
|
- this.disabled = this.isChecked(row) ? false : true
|
|
|
getTableHeadList(this.roleId, row.menuId, this.checkStatus).then((res) => {
|
|
|
+ console.log(res)
|
|
|
this.headList = res.data
|
|
|
- console.log(this.headList)
|
|
|
})
|
|
|
},
|
|
|
// 单击表头权限表格某一行
|
|
@@ -527,32 +530,48 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 修改功能操作权限
|
|
|
- updateBtn(e) {
|
|
|
+ updateBtn(e, obj1) {
|
|
|
let obj = {
|
|
|
menuId: e.menuId,
|
|
|
roleId: this.roleId
|
|
|
}
|
|
|
let arr = []
|
|
|
arr.push(obj)
|
|
|
+ // let parent = this.functionList.find((item) => item.menuId == e.parentId)
|
|
|
+ // let parents = []
|
|
|
+ // while (parent) {
|
|
|
+ // parents.push(parent)
|
|
|
+ // parent = this.functionList.find((item) => item.menuId == parent.parentId)
|
|
|
+ // }
|
|
|
if (this.checkedKeys.includes(e.menuId)) {
|
|
|
authUserCancelAll(arr).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
this.checkedKeys = this.checkedKeys.filter((item) => item != e.menuId)
|
|
|
+ this.$msg({ message: '修改成功' })
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
+ // let arrs = []
|
|
|
+ // arrs.push(obj)
|
|
|
+ // parents.forEach(element => {
|
|
|
+ // let e = {
|
|
|
+ // menuId: element.menuId,
|
|
|
+ // roleId: this.roleId
|
|
|
+ // }
|
|
|
+ // arrs.push(e)
|
|
|
+ // });
|
|
|
saveRoleMenu(arr).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
this.checkedKeys.push(e.menuId)
|
|
|
+ this.$msg({ message: '修改成功' })
|
|
|
+ // this.checkedKeys.push(obj1.menuId)
|
|
|
+ // parents.forEach(element => {
|
|
|
+ // this.checkedKeys.push(element.menuId)
|
|
|
+ // });
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- // let parent = this.functionList.find((item) => item.menuId == e.parentId)
|
|
|
- // let parents = []
|
|
|
- // while (parent) {
|
|
|
- // parents.push(parent)
|
|
|
- // parent = this.functionList.find((item) => item.menuId == parent.parentId)
|
|
|
- // }
|
|
|
+
|
|
|
// let checked = !this.checkedKeys.includes(e.menuId)
|
|
|
// let obj = {
|
|
|
// menuId: e.menuId,
|
|
@@ -605,6 +624,7 @@ export default {
|
|
|
setSysTableCfgIsShow(row.id, iss, this.menuId, this.roleId).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
row.isShow = row.isShow == '1' || row.isShow == null ? '0' : '1'
|
|
|
+ this.$msg({ message: '修改成功' })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -677,31 +697,52 @@ export default {
|
|
|
// 树权限(父子联动)
|
|
|
handleCheckedTreeConnect(e, type, item) {
|
|
|
let value = e.target.checked
|
|
|
- let ids = this.findChildrenIds(item)
|
|
|
- let objs = ids.map((m) => {
|
|
|
- return {
|
|
|
- menuId: m,
|
|
|
- roleId: this.roleId
|
|
|
- }
|
|
|
- })
|
|
|
- objs.push({
|
|
|
- menuId: item.menuId,
|
|
|
- roleId: this.roleId
|
|
|
- })
|
|
|
+ // if (item.parentId) {
|
|
|
+
|
|
|
+ // }
|
|
|
+ // let ms = this.functionList.filter((item, index, c) => item.menuType == 'M')
|
|
|
+ // let mss = this.functionList.filter((it, index, c) => it.parentId == item.parentId)
|
|
|
+ // let m = ms.filter(i => i.menuId == item.parentId)
|
|
|
+ // console.log(mss)
|
|
|
+ // let ids = this.findChildrenIds(item)
|
|
|
+ // let objs = ids.map((m) => {
|
|
|
+ // return {
|
|
|
+ // menuId: m,
|
|
|
+ // roleId: this.roleId
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // objs.push({
|
|
|
+ // menuId: item.menuId,
|
|
|
+ // roleId: this.roleId
|
|
|
+ // })
|
|
|
if (value) {
|
|
|
this.checkStatus = 0
|
|
|
this.disabled = false
|
|
|
- saveRoleMenu(objs).then((res) => {
|
|
|
+ this.checkedKeys.push(item.menuId)
|
|
|
+ let obj = {
|
|
|
+ menuId: item.menuId,
|
|
|
+ roleId: this.roleId
|
|
|
+ }
|
|
|
+ let arr = []
|
|
|
+ arr.push(obj)
|
|
|
+ saveRoleMenu(arr).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- this.checkedKeys = [...new Set(this.checkedKeys.concat(ids))]
|
|
|
+ this.$msg({ message: '修改成功' })
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
+ this.checkedKeys = this.checkedKeys.filter((f) => f != item.menuId)
|
|
|
this.checkStatus = 1
|
|
|
this.disabled = true
|
|
|
- authUserCancelAll(objs).then((res) => {
|
|
|
+ let obj = {
|
|
|
+ menuId: item.menuId,
|
|
|
+ roleId: this.roleId
|
|
|
+ }
|
|
|
+ let arr = []
|
|
|
+ arr.push(obj)
|
|
|
+ authUserCancelAll(arr).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- this.checkedKeys = this.checkedKeys.filter((f) => !ids.includes(f))
|
|
|
+ this.$msg({ message: '修改成功' })
|
|
|
}
|
|
|
})
|
|
|
}
|