zhuliu 3 gadi atpakaļ
vecāks
revīzija
bf8bbb6551
2 mainītis faili ar 25 papildinājumiem un 25 dzēšanām
  1. 10 6
      src/views/dataPermission/index.vue
  2. 15 19
      src/views/role/index.vue

+ 10 - 6
src/views/dataPermission/index.vue

@@ -146,7 +146,7 @@ export default {
       show:false,
       disabled:false,
       lastName: '',
-      func: this.fun,
+      // func: this.fun,
       // funName: this.functionName,
       // funInfo: this.functionInfo,
       functionLis: [],
@@ -185,16 +185,23 @@ export default {
       return this.$store.state.admin.userinfo
     }
   },
+  watch:{
+    fun(val,oldval){
+      if(val!=oldval){
+        this.$refs.dataTable.clearSelection()
+      }
+    }
+  },
   methods: {
 
     changeData(selection,row){
-      console.log(this.func)
+      console.log(this.fun)
       if (selection.length > 1) {
           const del_row = selection.shift()
           this.$refs.dataTable.toggleRowSelection(del_row, false)
         }
         this.multipleSelection = selection[0]
-        this.$emit('getPremissData', this.func.id, this.func.name,this.multipleSelection )
+        this.$emit('getPremissData', this.fun.id, this.fun.name,this.multipleSelection )
         console.log(this.multipleSelection)
 
     },
@@ -320,9 +327,6 @@ export default {
       this.$api.getFunctionList().then(response => {
         this.functionList = response.data
       })
-      console.log(this.funId)
-      console.log(this.functionName)
-      console.log(this.functionInfo)
     },
     submit() {
       this.$refs.ruleForm.validate((valid) => {

+ 15 - 19
src/views/role/index.vue

@@ -87,7 +87,7 @@
                       </el-table-column>
                       <el-table-column label="操作" align="center">
                         <template slot-scope="scope">
-                        <span v-if="scope.row.pdata">{{scope.row.pdata}}</span>
+                        <span v-if="(permissionData.filter(item=>item.functionId == scope.row.id))[0]">{{(permissionData.filter(item=>item.functionId == scope.row.id))[0].permissionData.name}}</span>
                           <i v-if="checkList.filter(item=>item==scope.row.id)[0]" class="el-icon-plus" @click="premissVisibale(scope.row)">添加</i>
                         </template>
                       </el-table-column>
@@ -144,6 +144,8 @@ export default {
       fun: '',
       functionName: '',
       functionInfo: [],
+      pdata:'',
+      permissionData:[],
       checkList:[],
       checked: true,
       visible: false,
@@ -159,7 +161,7 @@ export default {
       dataList: [],
       multipleSelection: [],
       expands:[],
-      pdata:'',
+      
       queryParams: {
         size: 10,
         current: 1,
@@ -200,18 +202,16 @@ export default {
       //     }
       //   }
       // }
-      this.pdata=data
-      // if (this.functionInfo.length === 0) {
-      //   this.functionInfo.push({
-      //     'functionId': id,
-      //     'functionName': name,
-      //     'dataPremiss': data
-      //   })
-      // } 
-      // else if (this.functionInfo.length > 0) {
-      //   console.log(this.functionInfo.some(item => item.dataPremiss === data))
-      // }
-      // console.log(this.functionInfo)
+      this.pdata={
+        functionId:id,
+        permissionData:data
+      }
+    
+    },
+      premissSubmit() {
+      this.permissionData.push(this.pdata)
+      this.permissVisible=false
+      // console.log('')
     },
     getFunInfo(val) {
       this.fun = val
@@ -251,11 +251,7 @@ export default {
     close() {
       this.visible = false
     },
-    premissSubmit() {
-      this.fun.pdata = this.pdata.name
-      
-      console.log('')
-    },
+  
     premissClose() {
       this.permissVisible = false
       console.log(this.functionId)