管道基础大数据平台系统开发-【前端】-新系統界面
surprise
2024-02-05 c215c89ecda16e4d32593f3e942fe871898071e9
src/views/PackageTwo/WareInspection.vue
@@ -1,8 +1,11 @@
<!--入库质检--->
<template>
  <div class="wareBox">
  <div
    class="wareBox"
    id="wareBox"
  >
    <iframe
      id="ifream"
      id="iframeContainer"
      style="border:none"
      width="100%"
      height="100%"
@@ -10,7 +13,8 @@
    ></iframe>
  </div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
@@ -38,37 +42,18 @@
    }
  },
  methods: {
    closeNaveMenu() {
      this.$bus.$emit('closeNaveMenu', true)
    },
    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) {
@@ -90,11 +75,12 @@
          res = res.replace('lang=zh', 'lang=en');
        }
      }
      if (res.indexOf('{fmeHost}') != -1) {
        res = res.replace('{fmeHost}', fmeHost)
      }
      console.log("2", this.reportUrl)
      if (res.indexOf('token=') != -1) {
        res = res + getToken();
      }
@@ -102,15 +88,73 @@
      this.$store.state.reporturl = res;
      this.reportUrl = res;
      this.url = res
      // console.log("2", this.reportUrl)
      // sessionStorage.setItem('routerName', this.reportUrl)
      console.log("2", this.reportUrl)
      // window.addEventListener("message", this.handleMessage, false);
    },
    setLiClick(res, index) {
      var timer = setTimeout(function () {
        if (res.indexOf('http') != -1) {
          this.$store.reporturl = res;
          // sessionStorage.setItem('iframehttpurl', this.$store.reporturl)
          this.$router.push('/QualityInspection');
          // if (location.href.indexOf('/WareInspection') == -1) {
          //   this.$store.reporturl = res.url;
          //   this.$router.push('/WareInspection');
          // } else {
          //   this.$bus.$emit('changeNaveUrl', res.url);
          // }
        }
        this.setShowFalseDiv(false)
      }, 100)
      clearTimeout(timer)
    },
    setShowFalseDiv(bolean) {
      var index = this.showFlag;
      if (index != null) {
        let newItem = this.listMenu[index];
        newItem.show = bolean;
        Vue.set(this.listMenu, index, newItem);
      }
    },
    getFunc() {
      console.log("closeMenuSecond")
      this.$bus.$emit('closeMenuSecond', false)
    }
  },
  mounted() {
    this.showChangeIfream(this.$store.reporturl)
    this.$bus.$on('changeNaveUrl', (res) => {
      this.showChangeIfream(res)
    });
    // const iframe = document.querySelector('#iframeContainer')
    // // 处理兼容行问题
    // if (iframe.attachEvent) {
    //   iframe.attachEvent('onload', () => {
    //     // iframe加载完毕以后执行操作
    //     this.getFunc()
    //   })
    // } else {
    //   iframe.onload = () => {
    //     // iframe加载完毕以后执行操作
    //     this.getFunc()
    //   }
    // }
    if (sessionStorage.getItem('routerName') === '/WareInspection') {
      this.showChangeIfream(sessionStorage.getItem('iframehttpurl'))
      this.setLiClick(sessionStorage.getItem('iframehttpurl'))
      this.$bus.$on('changeNaveUrl', (res) => {
        this.showChangeIfream(res)
      });
    } else {
      this.showChangeIfream(this.$store.reporturl)
      this.$bus.$on('changeNaveUrl', (res) => {
        this.showChangeIfream(res)
      });
    }
  }
}