Sfoglia il codice sorgente

用户权限优化

haha_sir 1 anno fa
parent
commit
12169793ff
2 ha cambiato i file con 188 aggiunte e 157 eliminazioni
  1. 8 5
      src/utils/user.js
  2. 180 152
      src/views/home/Header.vue

+ 8 - 5
src/utils/user.js

@@ -4,7 +4,7 @@ import { GetUserLimit } from "@/apis/user";
 
 // const testData = {
 //     "sysType": "MA==",
-//     "userId": "NTIzMw==",
+//     "userId": "NTMwMw==",
 //     "type": "eXc="
 // }
 
@@ -128,12 +128,15 @@ import { GetUserLimit } from "@/apis/user";
  */
 export function GetUserPrivilege(nameList) {
     let userData = useRoute().query
-    userData.type = userData.digitalTwainType
-    userData.sysType = "MA=="
-    delete userData.digitalTwainType
+    // console.log(userData)
+    if(userData.digitalTwainType){
+        userData.type = userData.digitalTwainType
+        delete userData.digitalTwainType
+    }
+    // userData.sysType = "MA=="
     // console.log(userData)
     GetUserLimit(userData).then((res) => {
-        // console.log(res)
+        console.log(res)
         let parentId = []
         let limitArr = []
         res.data.Rows.forEach((item) => {

+ 180 - 152
src/views/home/Header.vue

@@ -4,13 +4,13 @@
       <div class="title">黄浦江数字孪生系统</div>
       <div class="content">
         <div class="left">
-<!--          <i class="temperature"></i>-->
-<!--          <div class="wsd-title">-->
-<!--            <span>温度</span>-->
-<!--            <span>temperature</span>-->
-<!--          </div>-->
-<!--          <span class="wsd-data">{{temperature}}</span>-->
-<!--          <span class="wsd-unit">℃</span>-->
+          <!--          <i class="temperature"></i>-->
+          <!--          <div class="wsd-title">-->
+          <!--            <span>温度</span>-->
+          <!--            <span>temperature</span>-->
+          <!--          </div>-->
+          <!--          <span class="wsd-data">{{temperature}}</span>-->
+          <!--          <span class="wsd-unit">℃</span>-->
         </div>
         <div class="right">
           <div class="right-btns">
@@ -19,10 +19,10 @@
             <i class="rb-search"></i>
           </div>
           <div class="right-box">
-            <span class="now-time" @click="ueCallGetNowTime">{{time}}</span>
+            <span class="now-time" @click="ueCallGetNowTime">{{ time }}</span>
             <div class="date">
-              <span>{{day}}</span>
-              <span>{{date}}</span>
+              <span>{{ day }}</span>
+              <span>{{ date }}</span>
             </div>
             <i class="weather" :class="weather" @click="toggleScene"></i>
           </div>
@@ -31,13 +31,13 @@
     </div>
     <div class="sub">
       <ul>
-        <li v-for="item,index in subList.data" :class="{'highlight': item.status}">
+        <li v-for="item, index in subList.data" :class="{ 'highlight': item.status }">
           <span @click="handleToggleLayer(index)">{{ item.name }}</span>
         </li>
       </ul>
     </div>
-    <MiForChange v-if="miForChangeShow"/>
-    <water-level v-if="waterDeepShow"/>
+    <MiForChange v-if="miForChangeShow" />
+    <water-level v-if="waterDeepShow" />
   </div>
 </template>
 
@@ -48,154 +48,153 @@ export default {
 </script>
 
 <script setup>
-  import { onMounted, reactive, ref } from 'vue';
-  import { useNow, useDateFormat } from '@vueuse/core'
-  import bus from '@/utils/bus'
-  import { GetWeather } from '@/apis/other'
-  import {
-    ueCallBoatRealtime, ueCallClearBoatTime, ueCallfullExtent,ueCallCloseMi,ueCallShowWarningReturn,
-    ueCallOpenVideoFusion, ueCallCloseVideoFusion, ueCallShowHangdaoLine, ueCallCloseHangdaoLine,ueCallCloseWarningReturn,
-    ueCallOpenRlt, ueCallCloseRlt, ueCallFlyToHD, ueCallFlyToSP, ueCallFlyToZrcb, ueCallShowAllMi,ueCallGetNowTime
-  } from '@/utils/UIInteractions'
-  import WaterLevel from './cpns/WaterLevel.vue'
-  import MiForChange from './cpns/MiForChange.vue'
-  import { asideShow } from '@/store/index'
+import { onMounted, reactive, ref } from 'vue';
+import { useNow, useDateFormat } from '@vueuse/core'
+import bus from '@/utils/bus'
+import { GetWeather } from '@/apis/other'
+import {
+  ueCallBoatRealtime, ueCallClearBoatTime, ueCallfullExtent, ueCallCloseMi, ueCallShowWarningReturn,
+  ueCallOpenVideoFusion, ueCallCloseVideoFusion, ueCallShowHangdaoLine, ueCallCloseHangdaoLine, ueCallCloseWarningReturn,
+  ueCallOpenRlt, ueCallCloseRlt, ueCallFlyToHD, ueCallFlyToSP, ueCallFlyToZrcb, ueCallShowAllMi, ueCallGetNowTime
+} from '@/utils/UIInteractions'
+import WaterLevel from './cpns/WaterLevel.vue'
+import MiForChange from './cpns/MiForChange.vue'
+import { asideShow } from '@/store/index'
 import { GetUserPrivilege } from "@/utils/user";
 
 
-  const global_aside = asideShow()
-  const showVido =ref('false')
+const global_aside = asideShow()
+const showVido = ref('false')
 
-  onMounted(() => [
-    getWeather(),
-    GetUserPrivilege(subList),
+onMounted(() => [
+  getWeather(),
+  GetUserPrivilege(subList),
+])
 
-  ])
+const weather = ref('qing')
 
-  const weather = ref('qing')
+function getWeather() {
+  GetWeather().then(res => {
+    switch (res.data.weather) {
+      case '晴': weather.value = 'qing'; break
+      case '多云': weather.value = 'duoyun'; break
+      case '小雨': weather.value = 'xiaoyu'; break
+      case '中雨': weather.value = 'zhongyu'; break
+      case '大雨': weather.value = 'dayu'; break
+      case '雾': weather.value = 'wu'; break
+      case '小雪': weather.value = 'xiaoxue'; break
+    }
+  })
+}
 
-  function getWeather() {
-    GetWeather().then(res => {
-      switch(res.data.weather) {
-        case '晴': weather.value = 'qing'; break
-        case '多云':weather.value = 'duoyun'; break
-        case '小雨':weather.value = 'xiaoyu'; break
-        case '中雨':weather.value = 'zhongyu'; break
-        case '大雨':weather.value = 'dayu'; break
-        case '雾':weather.value = 'wu'; break
-        case '小雪':weather.value = 'xiaoxue'; break
-      }
-    })
-  }
+const subList = reactive({
+  data: [
+    { name: '航道', status: false },
+    { name: '潮高', status: false },
+    { name: '船舶', status: true },
+    { name: '视频', status: false },
+    { name: '水下地形', status: false },
+    { name: '断面', status: false },
+    { name: '中燃船舶', status: false },
+  ]
+})
 
-  const subList = reactive({
-    data:[
-      { name: '航道', status: false },
-      { name: '潮高', status: false },
-      { name: '船舶', status: true },
-      { name: '视频', status: false },
-      { name: '水下地形', status: false },
-      { name: '断面', status: false },
-      { name: '中燃船舶', status: false },
-    ]
-  }) 
-  
-  function handleToggleLayer(index) {
-    subList.data[index].status = !subList.data[index].status
-    if(subList.data[index].status===true) {
-      switch(index) {
-        case 0:
-          ueCallFlyToHD()
-          setTimeout(() => {
-            ueCallShowHangdaoLine()
-          }, 1000);
-          break
-        case 1:
-          ueCallCloseWarningReturn()
-          waterDeepShow.value = true
-          break
-        case 2:
-          ueCallfullExtent()
-          setTimeout(() => {
-            ueCallBoatRealtime()
-          }, 1000);
-          break
-        case 3:
-          ueCallFlyToSP()
-          bus.on('fly_Action', (data) => {
-            if(data.isOk=='true') {
-              ueCallOpenVideoFusion()
-              bus.off('fly_Action')
-            }
-          })
-          break
-        case 4:
-          bus.emit('toggle_sxdx', true)
-          clickWeeather.value=true
-          break
-        case 5:
-          if (clickWeeather.value) {
-            miForChangeShow.value = true
-            subList.data[index].status = true
-            ueCallShowAllMi()
-          }else {
-            subList.data[index].status = false
+function handleToggleLayer(index) {
+  subList.data[index].status = !subList.data[index].status
+  if (subList.data[index].status === true) {
+    switch (index) {
+      case 0:
+        ueCallFlyToHD()
+        setTimeout(() => {
+          ueCallShowHangdaoLine()
+        }, 1000);
+        break
+      case 1:
+        ueCallCloseWarningReturn()
+        waterDeepShow.value = true
+        break
+      case 2:
+        ueCallfullExtent()
+        setTimeout(() => {
+          ueCallBoatRealtime()
+        }, 1000);
+        break
+      case 3:
+        ueCallFlyToSP()
+        bus.on('fly_Action', (data) => {
+          if (data.isOk == 'true') {
+            ueCallOpenVideoFusion()
+            bus.off('fly_Action')
           }
-          break
-        case 6:
-          ueCallFlyToZrcb()
-          break
-      }
-    } else {
-      switch(index) {
-        case 0:
-          ueCallCloseHangdaoLine()
-          break
-        case 1:
-          ueCallShowWarningReturn()
-          waterDeepShow.value = false
-          break
-        case 2:
-          ueCallClearBoatTime()
-          break
-        case 3:
-          ueCallCloseVideoFusion()
-          break
-        case 4:
-          clickWeeather.value=false
-          miForChangeShow.value = false
-          subList.data[index+1].status = false
-          ueCallCloseMi()
-          bus.emit('toggle_sxdx', false)
-          break
-        case 5:
-          miForChangeShow.value = false
-          ueCallCloseMi()
-          break
-        case 6:
-          ueCallfullExtent()
-          break
-      }
+        })
+        break
+      case 4:
+        bus.emit('toggle_sxdx', true)
+        clickWeeather.value = true
+        break
+      case 5:
+        if (clickWeeather.value) {
+          miForChangeShow.value = true
+          subList.data[index].status = true
+          ueCallShowAllMi()
+        } else {
+          subList.data[index].status = false
+        }
+        break
+      case 6:
+        ueCallFlyToZrcb()
+        break
+    }
+  } else {
+    switch (index) {
+      case 0:
+        ueCallCloseHangdaoLine()
+        break
+      case 1:
+        ueCallShowWarningReturn()
+        waterDeepShow.value = false
+        break
+      case 2:
+        ueCallClearBoatTime()
+        break
+      case 3:
+        ueCallCloseVideoFusion()
+        break
+      case 4:
+        clickWeeather.value = false
+        miForChangeShow.value = false
+        subList.data[index + 1].status = false
+        ueCallCloseMi()
+        bus.emit('toggle_sxdx', false)
+        break
+      case 5:
+        miForChangeShow.value = false
+        ueCallCloseMi()
+        break
+      case 6:
+        ueCallfullExtent()
+        break
     }
   }
-  const clickWeeather = ref(false)
-  const temperature = ref('8')
-  const time = useDateFormat(useNow(), 'HH:mm')
-  const date = useDateFormat(useNow(), 'YYYY.MM.DD')
-  const day = useDateFormat(useNow(), 'ddd', { locales: 'en-US' })
+}
+const clickWeeather = ref(false)
+const temperature = ref('8')
+const time = useDateFormat(useNow(), 'HH:mm')
+const date = useDateFormat(useNow(), 'YYYY.MM.DD')
+const day = useDateFormat(useNow(), 'ddd', { locales: 'en-US' })
 
-  const waterDeepShow = ref(false)
+const waterDeepShow = ref(false)
 
-  const miForChangeShow = ref(false)
+const miForChangeShow = ref(false)
 
-  function toggleScene() {
-    bus.emit('toggleSceneBox')
-  }
+function toggleScene() {
+  bus.emit('toggleSceneBox')
+}
+
+function togglePageAside() {
+  global_aside.toggleAside()
+}
 
-  function togglePageAside() {
-    global_aside.toggleAside()
-  }
-  
 </script>
 
 <style lang="scss" scoped>
@@ -232,6 +231,7 @@ import { GetUserPrivilege } from "@/utils/user";
       left: 0;
       width: 100%;
       text-align: center;
+
       li {
         display: inline-block;
         // width: 110px;
@@ -239,6 +239,7 @@ import { GetUserPrivilege } from "@/utils/user";
         height: 72px;
         margin: 0 5px;
         text-align: center;
+
         span {
           display: inline-block;
           margin-top: 40px;
@@ -249,15 +250,18 @@ import { GetUserPrivilege } from "@/utils/user";
           color: #CCE6FF;
           opacity: 0.65;
           cursor: pointer;
+
           &:hover {
             transform: scale(1.1);
           }
         }
-        
+
       }
+
       .highlight {
         background: url('@/assets/imgs/header/bg-sub-highl.png') no-repeat;
         background-size: 100% 100%;
+
         span {
           color: #EDF3FF;
           opacity: 1;
@@ -282,7 +286,9 @@ import { GetUserPrivilege } from "@/utils/user";
     display: flex;
     justify-content: space-between;
     width: 100%;
-    .left, .right {
+
+    .left,
+    .right {
       display: flex;
       align-items: center;
       justify-content: flex-start;
@@ -291,19 +297,25 @@ import { GetUserPrivilege } from "@/utils/user";
 
   .left {
     margin-left: 30px;
-    .humidity, .temperature {
+
+    .humidity,
+    .temperature {
       display: inline-block;
       width: 36px;
       height: 36px;
       margin-right: 6px;
     }
+
     .humidity {
       background: url('@/assets/imgs/header/humidity.png') no-repeat;
     }
+
     .temperature {
       background: url('@/assets/imgs/header/temperature.png') no-repeat;
     }
-    .humidity, .temperature {
+
+    .humidity,
+    .temperature {
       background-size: contain;
     }
 
@@ -311,15 +323,18 @@ import { GetUserPrivilege } from "@/utils/user";
       text-align: left;
       margin-right: 9px;
       font-family: PFlight;
+
       span {
         display: block;
         color: #F6F6F6;
       }
+
       span:first-child {
         font-size: 16px;
         line-height: 16px;
         margin-bottom: 3px;
       }
+
       span:last-child {
         font-size: 8px;
         line-height: 8px;
@@ -345,23 +360,27 @@ import { GetUserPrivilege } from "@/utils/user";
     .right-btns {
       display: flex;
       align-items: center;
+
       &>i {
         display: inline-block;
         margin-right: 10px;
         cursor: pointer;
       }
+
       .rb-search {
         width: 30px;
         height: 30px;
         background: url('@/assets/imgs/header/search.png') no-repeat;
         background-size: contain;
       }
+
       .rb-fulls {
         width: 35px;
         height: 35px;
         background: url('@/assets/imgs/header/fulls.png') no-repeat;
         background-size: contain;
       }
+
       .rb-aside {
         width: 40px;
         height: 40px;
@@ -376,7 +395,7 @@ import { GetUserPrivilege } from "@/utils/user";
       justify-content: flex-start;
       align-items: center;
       // cursor: pointer;
-      
+
     }
 
     .now-time {
@@ -384,6 +403,7 @@ import { GetUserPrivilege } from "@/utils/user";
       font-size: 30px;
       margin-right: 16px;
       cursor: pointer;
+
       &:hover {
         filter: brightness(1.2);
       }
@@ -393,12 +413,14 @@ import { GetUserPrivilege } from "@/utils/user";
       position: relative;
       text-align: left;
       margin-right: 28px;
+
       span {
         color: #ccc;
         display: block;
         font-size: 12px;
         line-height: 14px;
       }
+
       &::after {
         content: '';
         position: absolute;
@@ -410,7 +432,7 @@ import { GetUserPrivilege } from "@/utils/user";
         background-color: #fff;
       }
     }
-    
+
     .weather {
       display: inline-block;
       width: 32px;
@@ -424,26 +446,32 @@ import { GetUserPrivilege } from "@/utils/user";
         background: url('@/assets/imgs/scene/w-qing.png') no-repeat;
         background-size: contain;
       }
+
       &.duoyun {
         background: url('@/assets/imgs/scene/w-duoyun.png') no-repeat;
         background-size: contain;
       }
+
       &.xiaoyu {
         background: url('@/assets/imgs/scene/w-xiaoyu.png') no-repeat;
         background-size: contain;
       }
+
       &.zhongyu {
         background: url('@/assets/imgs/scene/w-zhongyu.png') no-repeat;
         background-size: contain;
       }
+
       &.dayu {
         background: url('@/assets/imgs/scene/w-dayu.png') no-repeat;
         background-size: contain;
       }
+
       &.wu {
         background: url('@/assets/imgs/scene/w-wu.png') no-repeat;
         background-size: contain;
       }
+
       &.xiaoxue {
         background: url('@/assets/imgs/scene/w-xiaoxue.png') no-repeat;
         background-size: contain;