Просмотр исходного кода

个人中心团队角色显示调整

qymljy 2 недель назад
Родитель
Сommit
0a4dc28208

+ 45 - 26
src/HManagement/roleManage/modules/auth_list.vue

@@ -115,7 +115,7 @@
 
 <script>
 export default {
-  props:['data'],
+  props:['data','new_set','roleid'],
   data () {
     return {
       dialogTableVisible:false,
@@ -149,13 +149,19 @@ export default {
   },
   methods:{
     onShow () {
-      console.log(this.$route.query)
-      if (!this.$route.query.id) return this.$message({
-        message:this.$t('请先保存角色信息'),
-        type:'error'
-      })
-      this.dialogTableVisible = true
-      this.query_all_auth()
+      if (this.new_set){
+        this.dialogTableVisible = true
+        this.query_all_auth()
+      }else {
+        console.log(this.$route.query)
+        if (!this.$route.query.id) return this.$message({
+          message:this.$t('请先保存角色信息'),
+          type:'error'
+        })
+        this.dialogTableVisible = true
+        this.query_all_auth()
+      }
+
     },
     handleClick(val) {
       this.func_selection.length > 0 ? this.$refs.multipleTable.clearSelection():''
@@ -164,7 +170,7 @@ export default {
     query_all_auth() {
       // this.param.content.roleid = this.data.roleid
       this.$api.requested(this.param).then(res=>{
-        this.list = res.data        
+        this.list = res.data
         this.total = res.total
         this.currentPage = res.pageNumber
       })
@@ -196,7 +202,7 @@ export default {
       }).then(res=>{
         this.fun_list = res.data
         console.log(this.fun_list);
-        
+
       })
     },
     query_field_list (row) {
@@ -230,7 +236,7 @@ export default {
       this.$api.requested({"classname": "webmanage.role.role",
         "method": "add_appauth",
         "content": {
-          "roleid":this.$route.query.id,
+          "roleid":this.new_set?this.roleid:this.$route.query.id,
           "systemapps": [
             {
               "systemappid": this.systemappid,
@@ -240,20 +246,33 @@ export default {
           ]
         }
       }).then(res=>{
-        if (res.code === 1) {
-          this.$notify({
-            title: this.$t('成功'),
-            message: this.activeName === 'first'?this.$t('功能授权成功'):this.$t('设置成功'),
-            type: 'success'
-          });
-          this.query_function_list(this.row)
-          this.$emit('onSuccess')
-        } else {
-          this.$notify({
-            title: this.$t('失败'),
-            message: res.data,
-            type: 'error'
-          });
+        if (this.new_set){
+          if (res.code == 0){
+            this.tool.showMessage(res,()=>{})
+          }else {
+            this.$notify({
+              title: this.$t('成功'),
+              message: this.$t('功能授权成功'),
+              type: 'success'
+            });
+            this.$emit('setAuth')
+          }
+        }else {
+          if (res.code === 1) {
+            this.$notify({
+              title: this.$t('成功'),
+              message: this.activeName === 'first'?this.$t('功能授权成功'):this.$t('设置成功'),
+              type: 'success'
+            });
+            this.query_function_list(this.row)
+            this.$emit('onSuccess')
+          } else {
+            this.$notify({
+              title: this.$t('失败'),
+              message: res.data,
+              type: 'error'
+            });
+          }
         }
       })
     }
@@ -268,4 +287,4 @@ export default {
 .auth-container .el-tabs--border-card>.el-tabs__content{
   padding: 0;
 }
-</style>
+</style>

+ 33 - 23
src/SManagement/user/role-edit/components/RolePowerSelect.vue

@@ -7,9 +7,10 @@
       <el-col :span="11" style="margin-right:16px">
         <div class="handle">
           <search @searchActive="searchActive" @clearData="clearData"></search>
-          <el-select size="small" clearable @clear="clearCategory" v-model="power.content.where.systemclientname" :placeholder="$t(`筛选端口`)" @change="categoryChange()">
+          <el-select class="inline-16" size="small" clearable @clear="clearCategory" v-model="power.content.where.systemclientname" :placeholder="$t(`筛选端口`)" @change="categoryChange()">
             <el-option v-for="(item,index) in selectList" :label="$t(item)" :value="item" :key="index"></el-option>
           </el-select>
+<!--          <auth :new_set="true" :roleid="power.content.roleid" @setAuth="searchActive"></auth>-->
         </div>
         <table-layout :layout="tablecols" :data="powerList" @rowClick="rowClick"></table-layout>
         <div class="page">
@@ -20,7 +21,7 @@
       </el-col>
       <el-col :span="12">
         <el-row>
-          <el-col :span="8">
+          <el-col :span="12">
             <div class="power-block">
               <div class="title" @click="aaa = true">{{$t(`功能`)}}</div>
               <el-checkbox-group v-model="checkList" @change="groupChange" class="padd">
@@ -36,16 +37,16 @@
               </div>
             </div>
           </el-col>
-          <el-col :span="8">
+          <el-col :span="12">
             <div class="power-block">
               <p class="title">{{$t(`隐藏字段`)}}</p>
             </div>
           </el-col>
-          <el-col :span="8">
-            <div class="power-block">
-              <p class="title">{{$t('基础数据')}}</p>
-            </div>
-          </el-col>
+<!--          <el-col :span="8">-->
+<!--            <div class="power-block">-->
+<!--              <p class="title">{{$t('基础数据')}}</p>-->
+<!--            </div>-->
+<!--          </el-col>-->
         </el-row>
       </el-col>
     </el-row>
@@ -56,6 +57,7 @@
 import search from '@/components/search/index'
 import pagination from '@/components/pagination/Pagination'
 import tableLayout from '@/components/dynamic-table/index'
+import auth from '@/HManagement/roleManage/modules/auth_list'
 import { log } from '@antv/g2plot/lib/utils';
 export default {
   name: 'RolePowerSelect',
@@ -68,7 +70,7 @@ export default {
         "method": "query_appselect_web",
         "content": {
           "pageNumber": 1,
-          "pageSize": 10,
+          "pageSize": 50,
           "roleid": parseInt(window.sessionStorage.getItem('currentEditRole')) == 0 ? 0 : JSON.parse(window.sessionStorage.getItem('currentEditRole')).roleid,
           "where": {
             "condition": "",
@@ -77,8 +79,8 @@ export default {
         }
       },
       //当前选中的row
-      currentItem: 0,
-      total: 2,
+      // currentItem: 0,
+      total: 0,
       //应用表数据
       powerList: [],
       //端口分类列表
@@ -96,7 +98,7 @@ export default {
     };
   },
   props: [],
-  components: { search, pagination, tableLayout },
+  components: { search, pagination, tableLayout, auth },
   computed: {
     //是否选中
     isCheck () {
@@ -117,11 +119,11 @@ export default {
   watch: {
   },
   created () {
-    this.getAllHavePower()
+    // this.getAllHavePower()
   },
   mounted () {
     this.tablecols = this.tool.tabelCol('roleManagent').roleTable.tablecols
-
+    this.getAllHavePower()
   },
   methods: {
     //当编辑逻辑时 拉取所有数据 储存所有已授权数据
@@ -137,7 +139,8 @@ export default {
             }
           }
         })
-        let data = res.data.filter(item => item.optionids.length > 0)
+        console.log(res.data,'数据1111')
+        let data = res.data && res.data.length > 0 ? res.data.filter(item => item.optionids.length > 0):[]
         let result
         this.tempPowerList.forEach((item, index) => {
           result = data.find(item2 => item2.systemappid == item.systemappid)
@@ -151,14 +154,21 @@ export default {
     //获取授权列表
     async getPowerList () {
       let res = await this.$api.requested(this.power)
-      this.selectList = res.tips.client
-      this.powerList = res.data
-      this.handleHavePower()
-      this.calcHavePower(this.powerList)
-      this.currentItem = this.powerList[0]
-      this.allCheck = this.currentItem.optionids.length == this.currentItem.options.length
-      this.refreshItem(this)
-      this.total = res.total
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }else {
+        if (res.data && res.data.length > 0){
+          this.selectList = res.tips.client
+          this.powerList = res.data
+          this.handleHavePower()
+          this.calcHavePower(this.powerList)
+          this.currentItem = this.powerList[0]
+          this.allCheck = this.currentItem.optionids.length == this.currentItem.options.length
+          this.refreshItem(this)
+          this.total = res.total
+        }
+      }
+      console.log(this.powerList,'输出数据powerList')
     },
     //抓取所有操作过的数据
     handleHavePower () {