2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!--
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-07-18 16:06:37
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-07-18 16:54:18
 * @FilePath: \cim-xian\src\views\system\secure\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <iframe
    :src="url"
    style="width: 100%;height: 100%"></iframe>
  <!--  http://103.85.165.99:9014/d/bdb2f738-e136-4b09-b896-8c12556ed7b7/5pyN5Yqh55uR5o6n?orgId=1&refresh=30s&kiosk-->
  <!--  http://103.85.165.99:9014/d/bdb2f738-e136-4b09-b896-8c12556ed7b7/5pyN5Yqh55uR5o6n?orgId=1&refresh=30s-->
  <!--  http://103.85.165.99:9014/d/e567c585-41e8-4c41-b309-58b17675320d/5pyN5Yqh55uR5o6n?orgId=1&refresh=30s&kiosk-->
</template>
 
<script>
import { GetDashInfo, GetDashList } from "../../../api/systemJK";
 
export default {
  name: "Grafanaframe",
  data() {
    return {
      url: ""
    };
  },
  watch: {
    $route(to, from) {
      if (to.params && to.params.id) {
        let obj = this.$store.state.systemJKOBJ.filter(item => item.id == to.params.id);
        this.setFrameUrl(obj);
        // this.url = SYSTEMURL + obj[0].url.substr(1, obj[0].url.length - 1) + "?orgId=1&refresh=30s&kiosk";
        // console.log(this.url);
      }
    }
  },
  created() {
    this.getDashList();
    let obj = this.$store.state.systemJKOBJ.filter(item => item.id == 4);
    this.setFrameUrl(obj);
  },
  methods: {
    async setFrameUrl(obj) {
      if (obj.length>0) {
        let res = await GetDashInfo(obj[0].uid);
        this.url = SYSTEMURL + obj[0].url.substr(1, obj[0].url.length - 1) + "?orgId=1&refresh=" + res.data.dashboard.refresh + "&kiosk";
      } else {
        let res = await GetDashList();
        let obj = res.data.filter(item=>item.id == this.$route.params.id);
        res = await GetDashInfo(obj[0].uid);
        this.url = SYSTEMURL + obj[0].url.substr(1, obj[0].url.length - 1) + "?orgId=1&refresh=" + res.data.dashboard.refresh + "&kiosk";
      }
    },
    async getDashinfod(id) {
      let res = await GetDashInfo(id);
      return res;
    },
    async getDashList() {
      let res = await GetDashList();
      debugger;
      this.jkObjArr = res.data;
      this.$store.state.systemJKOBJ = res.data;
    }
  }
};
</script>
 
<style scoped>
 
</style>