管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-02-08 6c33f9c50792c03e55549f82c17405552ecff540
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!--入库质检--->
<template>
  <div class="wareBox">
    <iframe
      id="ifream"
      style="border:none"
      width="100%"
      height="100%"
      v-bind:src="reportUrl"
    ></iframe>
  </div>
</template>
 
<script>
import { getToken } from "@/utils/auth";
export default {
  data() {
    return {
      reportUrl: '',
      url: '',
    }
  },
  computed: {
    Obj() {
      return this.$store.state.themeflag
    },
    lang() {
      return this.$store.state.language
    }
  },
  watch: {
    Obj(newVal, oldVal) {
      //可以对数据执行相应的操作
      this.refreash(newVal)
    },
    lang(newVal, oldVal) {
      this.langreash(newVal)
    }
  },
  methods: {
    langreash(res) {
      if (this.url == '') return
      this.reportUrl = ''
      if (res == true) {
        if (this.url.indexOf('theme=white') != -1) {
          this.url = this.url.replace('theme=white', 'theme=dark');
        }
      } else if (res == false) {
        if (this.url.indexOf('theme=dark') != -1) {
          this.url = this.url.replace('theme=dark', 'theme=white');
        }
      }
      this.reportUrl = this.url;
      this.$store.state.reporturl = this.url;
      this.$router.push('/QualityInspection')
    },
    refreash(res) {
      if (this.url == '') return
      this.reportUrl = ''
      if (res == true) {
        if (this.url.indexOf('lang=en') != -1) {
          this.url = this.url.replace('lang=en', 'lang=zh');
        }
      } else if (res == false) {
        if (this.url.indexOf('lang=zh') != -1) {
          this.url = this.url.replace('lang=zh', 'lang=en');
        }
      }
      this.reportUrl = this.url;
      this.$store.state.reporturl = this.url;
      this.$router.push('/QualityInspection')
    },
    showChangeIfream(res) {
      if (this.$store.state.themeflag == true) {
        if (res.indexOf('theme=white') != -1) {
          res = res.replace('theme=white', 'theme=dark');
        }
      } else if (this.$store.state.themeflag == false) {
        if (res.indexOf('theme=dark') != -1) {
          res = res.replace('theme=dark', 'theme=white');
        }
      }
 
      if (this.$store.state.language == true) {
        if (res.indexOf('lang=en') != -1) {
          res = res.replace('lang=en', 'lang=zh');
        }
      } else if (this.$store.state.language == false) {
        if (res.indexOf('lang=zh') != -1) {
          res = res.replace('lang=zh', 'lang=en');
        }
      }
      if (res.indexOf('{fmeHost}') != -1) {
 
        res = res.replace('{fmeHost}', fmeHost)
      }
 
      if (res.indexOf('token=') != -1) {
        res = res + getToken();
      }
 
      this.$store.state.reporturl = res;
      this.reportUrl = res;
      this.url = res
      // console.log("2", this.reportUrl)
    }
  },
  mounted() {
    this.showChangeIfream(this.$store.reporturl)
 
    this.$bus.$on('changeNaveUrl', (res) => {
      this.showChangeIfream(res)
    });
  }
 
}
</script>
 
<style lang="less" scoped>
.wareBox {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #303030;
}
</style>