瀏覽代碼

大屏-航站下拉权限

zhongxiaoyu 1 年之前
父節點
當前提交
b0fc369024
共有 1 個文件被更改,包括 23 次插入7 次删除
  1. 23 7
      src/views/dashboard/index.vue

+ 23 - 7
src/views/dashboard/index.vue

@@ -150,6 +150,7 @@ import MapCharts from '@/layout/components/Echarts/commonChartsChinaMap.vue'
 import VueSeamlessScroll from 'vue-seamless-scroll'
 import { Query } from '@/api/webApi'
 import { parseTime } from '@/utils'
+import { getAuthData } from '@/utils/validate'
 
 const defaultDate = parseTime(new Date(), '{y}-{m}-{d}')
 const barOption = {
@@ -326,6 +327,8 @@ export default {
       inHourDataOption: this._.cloneDeep(barOption),
       outHourDataOption: this._.cloneDeep(barOption),
       transHourDataOption: this._.cloneDeep(barOption),
+      authId: null,
+      queryId: null,
     }
   },
   computed: {
@@ -354,7 +357,16 @@ export default {
     this.outHourDataOption.series[0].color = '#527CF5'
     this.transHourDataOption.series[0].color = '#F5C871'
   },
-  async mounted() {
+  mounted() {
+    const { auth_id } = this.$route.meta
+    if (auth_id) {
+      const { arrs } = getAuthData(auth_id)
+      if (arrs && arrs.length) {
+        const obj = arrs[0]
+        this.authId = obj.auth_id
+        this.queryId = obj.queryTemplateID
+      }
+    }
     this.getAiportList()
   },
   methods: {
@@ -362,15 +374,19 @@ export default {
     async getAiportList() {
       this.loading = true
       try {
-        const {
-          code,
-          returnData: { listValues },
-          message,
-        } = await Query({
+        let params = {
           serviceId: SERVICE_ID.AirportIds,
           dataContent: [],
           pageSize: 9999,
-        })
+        }
+        if (this.queryId) {
+          params = {
+            ...params,
+            authId: this.authId,
+            serviceId: this.queryId,
+          }
+        }
+        const { code, returnData: listValues, message } = await Query(params)
         if (String(code) !== '0') {
           throw new Error(message || '失败')
         }