Sfoglia il codice sorgente

2022-08-25 角色优化

zhuliu 3 anni fa
parent
commit
f15122d934
2 ha cambiato i file con 46 aggiunte e 34 eliminazioni
  1. 13 16
      src/views/dataPermission/index.vue
  2. 33 18
      src/views/role/index.vue

+ 13 - 16
src/views/dataPermission/index.vue

@@ -129,9 +129,9 @@ export default {
     TreeItem
   },
   props: [
-    'functionId',
-    'functionName',
-    'functionInfo'
+    'fun',
+    // 'functionName',
+    // 'functionInfo'
   ],
   data() {
     name: 'DataPermission'
@@ -146,9 +146,9 @@ export default {
       show:false,
       disabled:false,
       lastName: '',
-      funId: this.functionId,
-      funName: this.functionName,
-      funInfo: this.functionInfo,
+      func: this.fun,
+      // funName: this.functionName,
+      // funInfo: this.functionInfo,
       functionLis: [],
       multipleSelection: [],
       queryParams: {
@@ -173,7 +173,7 @@ export default {
   mounted() {
     this.getList()
     this.getFunctionList()
-    this.funId = 6
+    // this.funId = 6
     // this.$emit('getPremissData', this.funId)
   },
   computed: {
@@ -186,19 +186,16 @@ export default {
     }
   },
   methods: {
-        handleSelectionChange(val) {
-      this.multipleSelection = val;
-      if (val.length > 0) {
-        this.$emit('getPremissData', this.funId, this.funName, val[0])
-      }
-      // console.log(val[0])
-    },
-       changeData(selection,row){
+
+    changeData(selection,row){
+      console.log(this.func)
       if (selection.length > 1) {
           const del_row = selection.shift()
           this.$refs.dataTable.toggleRowSelection(del_row, false)
         }
-        // this.checkList = selection[0]
+        this.multipleSelection = selection[0]
+        this.$emit('getPremissData', this.func.id, this.func.name,this.multipleSelection )
+        console.log(this.multipleSelection)
 
     },
     addList() {

+ 33 - 18
src/views/role/index.vue

@@ -87,8 +87,8 @@
                       </el-table-column>
                       <el-table-column label="操作" align="center">
                         <template slot-scope="scope">
-                        <!-- <span v-if="multipleSelection">{{multipleSelection}}</span> -->
-                          <i v-if="checkList.filter(item=>item==scope.row.id)[0]" class="el-icon-plus" @click="premissVisibale">添加</i>
+                        <span v-if="scope.row.pdata">{{scope.row.pdata}}</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>
                     </el-table>
@@ -116,9 +116,8 @@
     <el-dialog :title="permissTitle" :visible.sync="permissVisible" width="1100px" :before-close="premissClose" custom-class="permiss">
     <div style="height: 500px;">
       <DataPermission 
-      :functionId="functionId"
-      :functionName="functionName"
-      :functionInfo="functionInfo"
+      :fun="fun"
+
       @getPremissData="getPremissData"
       >
       </DataPermission>
@@ -142,7 +141,7 @@ export default {
   },
   data() {
     return {
-      functionId: '',
+      fun: '',
       functionName: '',
       functionInfo: [],
       checkList:[],
@@ -160,6 +159,7 @@ export default {
       dataList: [],
       multipleSelection: [],
       expands:[],
+      pdata:'',
       queryParams: {
         size: 10,
         current: 1,
@@ -188,20 +188,33 @@ export default {
   },
   methods: {
     getPremissData(id, name, 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)
+      console.log(id, name, data)
+      // for(var i = 0; i<this.functionList.length;i++){
+      //   for(var j=0;j<this.functionList[i].children.length;j++){
+      //     if(this.functionList[i].children[j].id==id){
+      //       this.functionList[i].children[j].pdata = data.name
+      //     }else{
+      //       if(this.functionList[i].children[j].hasOwnProperty('children')){
+              
+      //       }
+      //     }
+      //   }
+      // }
+      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)
     },
     getFunInfo(val) {
-      this.functionId = val.id
+      this.fun = val
       this.functionName = val.name
     },
     handleCheckedCitiesChange(value) {
@@ -239,6 +252,8 @@ export default {
       this.visible = false
     },
     premissSubmit() {
+      this.fun.pdata = this.pdata.name
+      
       console.log('')
     },
     premissClose() {