Преглед изворни кода

Merge remote-tracking branch 'origin/independentTag' into dev

zhouna пре 6 година
родитељ
комит
6b41a18eed

+ 5 - 2
src/api/utils.js

@@ -153,7 +153,8 @@ export default {
    * 单选数据转换提交
    * **/
   simpleOptionData(data){
-    let arr = data.map((it,i)=>{
+    let arr = [];
+    data.map((it,i)=>{
       let code = '';
       let abnormal = 0
       if(it.isError){
@@ -165,7 +166,9 @@ export default {
       if(it.isBan){
         code = '1';
       }
-      return {name:it.name,defaultSelect:it.defaultSelect?'1':'0',code,abnormal,remark:'单选项-'+it.name}
+      if(it.name){
+        arr.push({name:it.name,defaultSelect:it.defaultSelect?'1':'0',code,abnormal,remark:'单选项-'+it.name});
+      }
     });
     return arr;
   },

+ 25 - 18
src/components/admin/Console.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <crumbs title="控制台"></crumbs>
-        <div class="console">
+        <div class="console" v-if="hasConcole">
             <h2>平台数据</h2>
             <el-row :gutter="20">
                 <el-col :span="6">
@@ -36,31 +36,38 @@
 
   export default {
     name: 'admin-console',
+    props:['hasConcole'],
     data: function () {
       return {
         orderCount: '...',
         authCount: '...'
       }
     },
-    created() {
-      api.getOrderNum().then((res) => {
-        const result = res.data;
-        if (result.code == '0') {
-          this.orderCount = result.data.count;
+    beforeRouteEnter(to,form,next){
+      next(vm=>{
+        if(!vm.hasConcole){
+          vm.$emit('redirect-page');
+          return;
         }
-      }).catch((error) => {
-        console.log(error)
+        //获取控制台默认显示数字
+        api.getOrderNum().then((res) => {
+          const result = res.data;
+          if (result.code == '0') {
+            vm.orderCount = result.data.count;
+          }
+        }).catch((error) => {
+          console.log(error)
+        });
+        api.getAuthNum().then((res) => {
+          const result = res.data;
+          if (result.code == '0') {
+            vm.authCount = result.data.count;
+          }
+        }).catch((error) => {
+          console.log(error)
+        });
       });
-      api.getAuthNum().then((res) => {
-        const result = res.data;
-        if (result.code == '0') {
-          this.authCount = result.data.count;
-        }
-      }).catch((error) => {
-        console.log(error)
-      });
-
-    }
+    },
   }
 </script>
 

+ 15 - 5
src/components/common/HomePage.vue

@@ -23,7 +23,7 @@
                 </div>
             </el-header>
             <el-main>
-              <router-view v-on:status-change="changeStatus"></router-view>
+              <router-view v-if="ok" v-on:status-change="changeStatus" v-on:redirect-page="redirectPage" :hasConcole="hasConcole"></router-view>
             </el-main>
         </el-container>
     </el-container>
@@ -41,7 +41,7 @@
     components: {
       'lt-badge': LtBadge,
       'lt-menu': LtMenu,
-			'console': Console
+      'console': Console
     },
     data: function () {
       return {
@@ -49,7 +49,9 @@
         organization: null,
         userLoginDTO: null,
         authStatus: null,
-        authStatusName:''
+        authStatusName:'',
+        ok:false,           //是否已获取到菜单
+        hasConcole:true         //是否有控制台权限,登录后跳转用
       }
     },
     computed: {
@@ -57,11 +59,16 @@
         return this.userLoginDTO && this.userLoginDTO.type == '0' ? 'user' : 'admin';
       }
     },
-    created() {
+    created () {
       //获取菜单
       api.getAccessdMenu().then((res) => {
         if (res.data.code == '0') {
           const data = res.data.data;
+            this.ok = true;
+            const hasConcole=data.menuWrappers.findIndex((it)=>{
+              return it.code == 'LT-KZT'
+            });
+          this.hasConcole = hasConcole!=-1;
           this.menuWrappers = data.menuWrappers;
           this.organization = data.organization;
           this.userLoginDTO = data.userLoginDTO;
@@ -70,9 +77,12 @@
       }).catch((error) => {
         console.log(error);
       });
-
     },
     methods: {
+      redirectPage(){
+        const url = this.getRole=='user'?'/user':'/admin';
+        this.$router.push({path:url});
+      },
       changeStatus(text){       //账号信息中提交认证后修改状态
         this.authStatus = 2;
         this.authStatusName = text;

+ 4 - 4
src/components/icss/SingleSelect.vue

@@ -3,16 +3,16 @@
         <el-form>
             <div class="operation-row">
                 <el-checkbox-group size="small" v-for="(it,i) in rows" v-if="type!=2&&(focusOn==i||(focusOn==-1&&i==0))" :key="1+i" v-model="rows[i].defaultSelect" @change="emitValues(i,'hasDefault',rows[i].defaultSelect)">
-                    <el-checkbox-button  v-if=" !(ascription == 5 && type == 1 || type == 2)" :label="i" :disabled="hasNone==i||hasBan==i|| hasError==i || (hasDefault!=-1&&hasDefault!=i)">默认选中</el-checkbox-button>
+                    <el-checkbox-button  v-if=" !(ascription == 5 && type == 1 || type == 2)" :label="i" :disabled="hasNone==i||hasBan==i|| hasError==i || (hasDefault!=-1&&hasDefault!=i)||focusOn==-1">默认选中</el-checkbox-button>
                 </el-checkbox-group>
                 <el-checkbox-group size="small" v-for="(it,i) in rows" v-if="type!=1&&(focusOn==i||(focusOn==-1&&i==0))" :key="2+i" v-model="rows[i].isNone" @change="emitValues(i,'hasNone',rows[i].isNone)">
-                    <el-checkbox-button  v-if=" !(ascription == 5 && type == 1)" :label="i" :disabled="hasDefault==i||hasBan==i || hasError==i ||(hasNone!=-1&&hasNone!=i)">同“无”类型</el-checkbox-button>
+                    <el-checkbox-button  v-if=" !(ascription == 5 && type == 1)" :label="i" :disabled="hasBan==i || hasError==i ||focusOn==-1">同“无”类型</el-checkbox-button>
                 </el-checkbox-group>
                 <el-checkbox-group size="small" v-for="(it,i) in rows" v-if="type!=1&&(focusOn==i||(focusOn==-1&&i==0))" :key="3+i" v-model="rows[i].isBan" @change="emitValues(i,'hasBan',rows[i].isBan)">
-                    <el-checkbox-button v-if=" !(ascription == 5 && type == 1)" :label="i" :disabled="hasDefault==i||hasNone==i || hasError==i||(hasBan!=-1&&hasBan!=i)">同“伴”类型</el-checkbox-button>
+                    <el-checkbox-button v-if=" !(ascription == 5 && type == 1)" :label="i" :disabled="hasNone==i || hasError==i||focusOn==-1">同“伴”类型</el-checkbox-button>
                 </el-checkbox-group>
                 <el-checkbox-group size="small" v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :key="4+i" v-model="rows[i].isError" @change="emitValues(i,'hasError',rows[i].isError)">
-                    <el-checkbox-button v-if="ascription==5  && type == 1" :label="i" :disabled="hasDefault==i||hasBan==i ||hasNone==i ||(hasError!=-1&&hasError==i)">标记异常选项</el-checkbox-button>
+                    <el-checkbox-button v-if="ascription==5  && type == 1" :label="i" :disabled="hasDefault==i||hasBan==i ||hasNone==i ||(hasError!=-1&&hasError==i)||focusOn==-1">标记异常选项</el-checkbox-button>
                 </el-checkbox-group>
                 <el-button type="danger" size="small" class="del" @click="delRow">删除</el-button>
             </div>