Selaa lähdekoodia

颜色json文件引入,修改echarts legend配置, 第一个路由重定向写活

ming 3 vuotta sitten
vanhempi
commit
3e1ecb2ad7

+ 5 - 0
src/layout/vab-tabs/index.vue

@@ -88,12 +88,17 @@ export default {
   methods: {
     loadChange() {
       this.breadListLast = []
+      //  console.log('this.$route')
+      // console.log(this.$route)
 
       this.$route.matched.map((val) => {
+        // console.log('val')
+        // console.log(val)
         this.breadListLast.push({
           path:val.path,
           title:val.meta.title
         })
+
       })
     },
 

+ 8 - 8
src/router/index.js

@@ -56,14 +56,14 @@ export const asyncRoutes = [
     // },
 
 
-    {
-        path: 'external-link',
-        component: Layout,
-        children: [{
-            path: '/home',
-            meta: { title: '首页', icon: 'home', }
-        }]
-    },
+    // {
+    //     path: 'external-link',
+    //     component: Layout,
+    //     children: [{
+    //         path: '/home',
+    //         meta: { title: '首页', icon: 'home', }
+    //     }]
+    // },
 
     {
         path: '/',

+ 1 - 30
src/store/modules/routes.js

@@ -44,34 +44,6 @@ const actions = {
     async setAllRoutes({ commit }) {
         let { data } = await getRouterList()
 
-        // let data = [
-        //     {
-        //         path: 'external-link',
-        //         component: "Layout",
-        //         children: [{
-        //             path: '/home',
-        //             meta: { title: '首页', icon: 'home', }
-        //         }]
-        //     },
-        //     {
-        //         path: '/',
-        //         redirect: '/alarmManage/index',
-        //         meta: {
-        //             title: '告警管理',
-        //             icon: 'alarmManage',
-        //             affix: true,
-        //         },
-        //         component: "Layout",
-        //         children: [{
-        //             meta: {
-        //                 title: '告警管理',
-        //                 icon: 'alarmManage',
-        //             },
-        //             path: '/alarmManage/index',
-        //             component: '@/views/alarmManage/index',
-        //         },]
-        //     }
-        // ]
         data.unshift({
             path: 'external-link',
             component: 'Layout',
@@ -83,8 +55,7 @@ const actions = {
 
         // if (data[data.length - 1].path !== '*')
         //     data.push({ path: '/*', redirect: '/404', hidden: true })
-        console.log('data')
-        console.log(data)
+
         const asyncRoutes = convertRouter(data)
         const finallyRoutes = filterRoutes([...constantRoutes, ...asyncRoutes])
         commit('setRoutes', finallyRoutes)

+ 24 - 6
src/vab/plugins/permissions.js

@@ -13,12 +13,11 @@ import {
 } from '@/config'
 
 router.beforeEach(async(to, from, next) => {
-    // console.log('to.matched')
-    // console.log(to.matched)
+
     let hasToken = store.getters['user/accessToken']
 
     if (!loginInterception) hasToken = true
-    console.log(11111111111111111)
+    console.log(localStorage.getItem('accessToken'))
     console.log(localStorage.getItem('accessToken'))
     if (hasToken) {
         if (to.path === '/login') {
@@ -30,7 +29,10 @@ router.beforeEach(async(to, from, next) => {
                 store.getters['acl/role'].length > 0 ||
                 store.getters['acl/ability'].length > 0
             if (hasRoles) {
+                // console.log('to.matched')
+                // console.log(to.matched)
                 if (to.matched.length === 0) {
+                    alert('没有匹配')
                     next('/404') // 判断此跳转路由的来源路由是否存在,存在的情况跳转到来源路由,否则跳转到404页面
                 }
                 next()
@@ -51,9 +53,25 @@ router.beforeEach(async(to, from, next) => {
                     }
 
                     accessRoutes.forEach((item) => {
-                        router.addRoute(item)
-                    })
-                    next({...to, replace: true })
+                            console.log('item')
+                            console.log(item)
+                            router.addRoute(item)
+                        })
+                        // alert(accessRoutes[accessRoutes.length - 1].redirect)
+                        // accessRoutes[accessRoutes.length - 1].redirect = "systemManage/userManage"
+                        // alert(accessRoutes[accessRoutes.length - 1].redirect)
+                    if (accessRoutes[1].path != '/') {
+                        // alert(2)
+                        next(accessRoutes[1].path)
+
+                    } else {
+                        console.log('accessRoutes')
+                        console.log(accessRoutes)
+
+                        next({...to, replace: true })
+
+                    }
+
                 } catch {
                     await store.dispatch('user/resetAll')
                     if (recordRoute)

+ 7 - 8
src/views/dataManage/sameAnalysis/ehcarts/index.vue

@@ -8,6 +8,7 @@
 import { computed, defineComponent, onMounted, ref, watch } from 'vue'
 import { useStore } from 'vuex'
 import * as echarts from 'echarts'
+import json from './json.js'
 // import { ChartDataType } from "../../data";
 
 // const dataAll = [
@@ -119,18 +120,14 @@ export default defineComponent({
       }
     }
 
+
     function ecahrts() {
+      console.log('json.color')
+      console.log(json.color)
       let myChart = echarts.init(sumeChartRef.value)
       myChart.setOption(
         {
-          color: [
-            '#FEB70D',
-            '#50F335',
-            '#0DC8FE',
-            '#e4ff40',
-            '#ff409a',
-            '#ff4040',
-          ],
+          color: json.color,
           title: {
             text: '同比分析',
             left: 'center',
@@ -145,9 +142,11 @@ export default defineComponent({
           },
           // 图列组件
           legend: {
+             type:'scroll',//就这一个属性 设置legend滚动轴的出现
             itemHeight: 10, //改变圆圈大小
             itemWidth: 26, //改变圆圈大小
             itemGap: 30,
+            width: '80%',
             textStyle: {
               color: 'black',
             },

+ 12 - 0
src/views/dataManage/sameAnalysis/ehcarts/json.js

@@ -0,0 +1,12 @@
+let color = ['#FEB70D', "#FFB6C1",
+    '#50F335',
+    '#0DC8FE',
+    '#e4ff40',
+    '#ff409a',
+    '#ff4040',
+    '#B0C4DE', '#778899', '#708090', '#4682B4', '#87CEFA', '#87CEEB', '#00BFFF', '#ADD8E6', '#B0E0E6', '#5F9EA0', '#00FFFF', '#00CED1', '#2F4F4F', '#008B8B', '#40E0D0', '#7FFFAA', '#00FA9A', '#3CB371', '#98FB98', '#00FF00', '#228B22', '#008000', '#006400', '#7FFF00', '#7CFC00', '#ADFF2F', '#556B2F', '#FFFFE0',
+];
+// 定义数据出口
+module.exports = {
+    color: color
+}

+ 10 - 7
src/views/powerQuality/asseReport/loopReport.vue

@@ -102,7 +102,7 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrUa ? getData.qrUa : '-' }}%
+                        {{ getData.qrUa==null ? '-' :getData.qrUa  }}%
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>
@@ -185,7 +185,8 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrUb ? getData.qrUb : '-' }}%
+                        {{ getData.qrUb==null ? '-' :getData.qrUb  }}%
+                       
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>
@@ -268,7 +269,8 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrUc ? getData.qrUc : '-' }}%
+                        {{ getData.qrUc==null ? '-' :getData.qrUc  }}%
+                      
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>
@@ -363,7 +365,8 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrF ? getData.qrF : '-' }}%
+                        <!-- {{ getData.qrF ? getData.qrF : '-' }}% -->
+                        {{ getData.qrF==null ? '-' :getData.qrF  }}%
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>
@@ -475,7 +478,7 @@
                       ? '合格'
                       : getData.cosStatus == false
                       ? '不合格'
-                      : '暂无数据'
+                      : '暂无结论'
                   }}
                 </el-button>
               </div>
@@ -627,7 +630,7 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrElBalun ? getData.qrElBalun : '-' }}%
+                        {{ getData.qrElBalun==null ? '-' :getData.qrElBalun  }}%
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>
@@ -727,7 +730,7 @@
                   <el-col :span="12">
                     <div class="grid-content bg-purple assSmallbox">
                       <div class="assNum greenRate">
-                        {{ getData.qrVtBalun ? getData.qrVtBalun : '-' }}%
+                        {{ getData.qrVtBalun==null ? '-' :getData.qrVtBalun  }}%
                       </div>
                       <div class="assTxt">合格率</div>
                     </div>