|
@@ -21,7 +21,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="功能权限" align="center" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-for="item in scope.row.functionList" :key="item.id">{{item.name}}
|
|
|
+ <span v-for="item in scope.row.permissionData" :key="item.id">{{item.functionName}}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -88,8 +88,8 @@
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="checkList.filter(item=>item==scope.row.id)[0]">
|
|
|
- <span v-if="(permissionData.filter(item=>item.functionId == scope.row.id))[0]">{{(permissionData.filter(item=>item.functionId == scope.row.id))[0].permissionData.name}}</span>
|
|
|
- <el-link style="margin-left: 10px" :underline="false" v-if="(permissionData.filter(item=>item.functionId == scope.row.id))[0]" @click="editpremissVisibale(scope.row,(permissionData.filter(item=>item.functionId == scope.row.id))[0].permissionData)">修改</el-link>
|
|
|
+ <span v-if="(permissionData.filter(item=>item.functionId == scope.row.id))[0]">{{(permissionData.filter(item=>item.functionId == scope.row.id))[0].data.name}}</span>
|
|
|
+ <el-link style="margin-left: 10px" :underline="false" v-if="(permissionData.filter(item=>item.functionId == scope.row.id))[0]" @click="editpremissVisibale(scope.row,(permissionData.filter(item=>item.functionId == scope.row.id))[0].data)">修改</el-link>
|
|
|
<el-link style="margin-left:10px" :underline="false" v-else-if="checkList.filter(item=>item==scope.row.id)[0]" @click="addpremissVisibale(scope.row)">添加</el-link>
|
|
|
</span>
|
|
|
|
|
@@ -183,29 +183,29 @@ export default {
|
|
|
this.getList()
|
|
|
this.getFunctionList()
|
|
|
},
|
|
|
- watch:{
|
|
|
- "ruleForm.function"(val){
|
|
|
- if(val.length!=0){
|
|
|
- this.showDataList=true
|
|
|
- }else{
|
|
|
- this.showDataList=false
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ // watch:{
|
|
|
+ // "ruleForm.function"(val){
|
|
|
+ // if(val.length!=0){
|
|
|
+ // this.showDataList=true
|
|
|
+ // }else{
|
|
|
+ // this.showDataList=false
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
methods: {
|
|
|
getPremissData(id, name, data) {
|
|
|
// console.log(id, name, data)
|
|
|
this.pdata={
|
|
|
functionId:id,
|
|
|
- permissionData:data
|
|
|
+ data:data
|
|
|
}
|
|
|
- console.log(this.pdata)
|
|
|
+ // console.log(this.pdata)
|
|
|
},
|
|
|
premissSubmit() {
|
|
|
if(this.permissionData.filter(item=>item.functionId == this.pdata.functionId)[0]){
|
|
|
- if(this.pdata.permissionData){
|
|
|
+ if(this.pdata.data){
|
|
|
// console.log(11)
|
|
|
- this.permissionData.filter(item=>item.functionId == this.pdata.functionId)[0].permissionData = this.pdata.permissionData
|
|
|
+ this.permissionData.filter(item=>item.functionId == this.pdata.functionId)[0].permissionData = this.pdata.data
|
|
|
}else{
|
|
|
// console.log(this.permissionData)
|
|
|
var index = this.permissionData.findIndex((item) => {
|
|
@@ -215,7 +215,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
- if (this.pdata.permissionData) {
|
|
|
+ if (this.pdata.data) {
|
|
|
this.permissionData.push(this.pdata)
|
|
|
}
|
|
|
// else {
|
|
@@ -223,7 +223,7 @@ export default {
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- // console.log(this.permissionData)
|
|
|
+ console.log(this.permissionData)
|
|
|
this.permissVisible=false
|
|
|
},
|
|
|
getFunInfo(val) {
|
|
@@ -234,7 +234,7 @@ export default {
|
|
|
});
|
|
|
if (!index) {
|
|
|
this.permissionData.splice(index,1)
|
|
|
- }
|
|
|
+ }
|
|
|
// console.log(this.permissionData)
|
|
|
}
|
|
|
},
|
|
@@ -264,6 +264,11 @@ export default {
|
|
|
this.title = '编辑角色'
|
|
|
this.visible = true
|
|
|
this.ruleForm = { ...row }
|
|
|
+ for (let i = 0; i < row.permissionData.length; i++) {
|
|
|
+ this.checkList.push(row.permissionData[i].functionId)
|
|
|
+ }
|
|
|
+ this.permissionData = row.permissionData
|
|
|
+ console.log(row)
|
|
|
},
|
|
|
addpremissVisibale(val) {
|
|
|
this.permissTitle = '添加数据权限管理'
|
|
@@ -277,6 +282,8 @@ export default {
|
|
|
},
|
|
|
close() {
|
|
|
this.visible = false
|
|
|
+ this.permissionData = []
|
|
|
+ this.checkList = []
|
|
|
},
|
|
|
|
|
|
premissClose() {
|
|
@@ -298,7 +305,7 @@ export default {
|
|
|
this.$api.getRoleList(this.queryParams).then(response => {
|
|
|
this.tableData = response.data
|
|
|
// console.log(response.data)
|
|
|
- this.total=response.pageColumn.total
|
|
|
+ this.total = response.pageColumn.total
|
|
|
this.loading = false
|
|
|
}).catch(error => {
|
|
|
this.loading = false
|
|
@@ -307,11 +314,12 @@ export default {
|
|
|
submit() {
|
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.ruleForm.functions=[]
|
|
|
- for(var i =0;i<this.ruleForm.function.length;i++){
|
|
|
- var a =this.ruleForm.function[i].join(',')
|
|
|
- this.ruleForm.functions.push(a)
|
|
|
- }
|
|
|
+ // this.ruleForm.functions=[]
|
|
|
+ this.ruleForm.permissionData = this.permissionData
|
|
|
+ // for(var i =0;i<this.ruleForm.function.length;i++){
|
|
|
+ // var a =this.ruleForm.function[i].join(',')
|
|
|
+ // this.ruleForm.functions.push(a)
|
|
|
+ // }
|
|
|
this.btnLoading = true
|
|
|
if (this.ruleForm.id) {
|
|
|
this.$api.editRole(this.ruleForm).then(response => {
|