|
@@ -75,9 +75,10 @@
|
|
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
|
+
|
|
|
<el-table-column label="功能名称" align="left" prop="name">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-checkbox-group v-model="checkList" style="display:inline-block" @change="handleCheckedCitiesChange">
|
|
|
+ <el-checkbox-group v-model="checkList" style="display:inline-block" @change="handleCheckedCitiesChange(scope.row)">
|
|
|
<el-checkbox :label="scope.row.id" @change="getFunInfo(scope.row.id)"
|
|
|
>
|
|
|
{{scope.row.name}}
|
|
@@ -145,6 +146,10 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'name'
|
|
|
+ },
|
|
|
fun: [],
|
|
|
functionName: '',
|
|
|
functionInfo: [],
|
|
@@ -238,8 +243,67 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleCheckedCitiesChange(value) {
|
|
|
- // console.log(value)
|
|
|
+ // console.log(value,this.checkList.includes(71),this.checkList.includes(value.id))
|
|
|
+
|
|
|
+ if(this.checkList.includes(value.id)){
|
|
|
+ // console.log(value.hasOwnProperty('children'))
|
|
|
+ if(value.hasOwnProperty('children') == true){
|
|
|
+ this.addCheck(value.children)
|
|
|
+ }
|
|
|
+ if(value.path!==0){
|
|
|
+ var aa = value.path.split(",")
|
|
|
+ aa.splice(0,1)
|
|
|
+ // console.log(aa)
|
|
|
+ for(var j=0;j<aa.length;j++){
|
|
|
+ // console.log(Number(aa[j]))
|
|
|
+ // console.log(this.checkList.indexOf(Number(aa[j])))
|
|
|
+ if(this.checkList.indexOf(Number(aa[j]))>-1){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.checkList.push(Number(aa[j]))
|
|
|
+ this.getFunInfo(Number(aa[j]))
|
|
|
+ }
|
|
|
+ // this.checkList.push(Number(aa[j]))
|
|
|
+ // this.getFunInfo(Number(aa[j]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(!this.checkList.includes(value.id)){
|
|
|
+ // console.log(this.checkList.includes(value.id),value.id)
|
|
|
+ if(value.hasOwnProperty('children') == true){
|
|
|
+ this.delCheck(value.children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log(this.checkList,this.permissionData)
|
|
|
+ // this.checkList
|
|
|
+ },
|
|
|
+ delCheck(vals){
|
|
|
+ for(var i = 0 ; i<vals.length ; i++){
|
|
|
+ this.checkList.splice(this.checkList.indexOf(vals[i].id),1)
|
|
|
+ this.getFunInfo(vals[i].id)
|
|
|
+ if(vals[i].hasOwnProperty('children') == true){
|
|
|
+ this.delCheck(vals[i].children)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
+ addCheck(vals){
|
|
|
+ // console.log(vals)
|
|
|
+ for(var i = 0 ; i<vals.length ; i++){
|
|
|
+ // console.log(this.checkList.indexOf(vals[i].id))
|
|
|
+ if(this.checkList.indexOf(vals[i].id)>-1){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.checkList.push(vals[i].id)
|
|
|
+ this.getFunInfo(vals[i].id)
|
|
|
+ }
|
|
|
+
|
|
|
+ if(vals[i].hasOwnProperty('children') == true){
|
|
|
+ this.addCheck(vals[i].children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } ,
|
|
|
handleSelectionChange(val) {
|
|
|
// console.log(val,this.$refs.multipleTable.selection)
|
|
|
this.multipleSelection = val;
|
|
@@ -294,7 +358,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
getFunctionList() {
|
|
|
- this.$api.getFunctionList().then(response => {
|
|
|
+ this.$api.getFuncListByTypeIsShow().then(response => {
|
|
|
this.functionList = response.data
|
|
|
})
|
|
|
},
|
|
@@ -325,7 +389,6 @@ export default {
|
|
|
this.btnLoading = false
|
|
|
})
|
|
|
} else {
|
|
|
-
|
|
|
|
|
|
this.$api.addRole(this.ruleForm).then(response => {
|
|
|
this.$message.success('新增成功')
|