Newer
Older
operation_web / src / components / NFCloudPlatform / VideoSurveillance.vue
<template>
  <div
    id="VideoSurveillance"
    v-loading="loading"
    element-loading-text="正在登陆中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(255, 255, 255, 0.3)"
  >
    <el-tabs v-model="activeName" @tab-click="handleClick" v-if="LoginOn">
      <el-tab-pane label="一楼泵站" name="first">
        <child1 v-if="isChildUpdate1"></child1>
      </el-tab-pane>
      <el-tab-pane label="顶楼泵站" name="second">
        <child2 v-if="!isChildUpdate1"></child2>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import GroundFloor from "@/components/NFCloudPlatform/GroundFloor"; //视频监控-一楼泵站
import Attic from "@/components/NFCloudPlatform/Attic"; //视频监控-顶楼泵站
export default {
  name: "VideoSurveillance",
  components: {
    child1: GroundFloor,
    child2: Attic
  },
  data: function() {
    return {
      activeName: "first",
      isChildUpdate1: true,
      LoginOn: false,
      userName: "工程作业及监控系统",
      loading: true
    };
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name == "first") {
        this.isChildUpdate1 = true;
      } else if (tab.name == "second") {
        this.isChildUpdate1 = false;
      }
    },
    //SN:53231220106     密码:xfgd0987654321  //平台地址   http://132.232.115.20:8103
    login1() {
      let params = {
        GRM: "53231220106",
        PASS: "xfgd0987654321"
      };
      var url = "http://www.yunplc.com:7080/exlog";
      this.$http.post(url, this.qs.stringify(params)).then(res => {
        var Ary = this.formatterData(res.data);
        if (Ary[0] == "OK") {
          var str = JSON.stringify(res.data);
          var index = str.indexOf("SID") + 4;
          var sid = str.substring(index, str.length - 5);
          localStorage.setItem("SID", sid);
          localStorage.setItem("flag", 0);
          localStorage.setItem("flag1", 0);
          this.loading = false;
          this.LoginOn = true;
          // this.record(1);
        } else {
          this.$message.error(Ary[2]);
        }
      });
    },
    formatterData(data) {
      var str = data;
      var strs = new Array();
      strs = str.split("\r\n");
      var Ary = [];
      for (var i = 0; i < strs.length; i++) {
        Ary.push(strs[i]);
      }
      return Ary;
    },
    record(type) {
      // let url = "/dataApi/LogCloudPlatformsController/addPlatformsLog";
      // let params = {
      //   log_user_name: this.userName,
      //   log_type: type
      // };
      // this.$http.post(url, params).then(res => {});
    }
  },
  mounted: function() {
    //   默认登录
    localStorage.setItem("userName", "工程作业及监控系统");
    this.login1();
  }
};
</script>

<style scoped>
#VideoSurveillance {
  width: 100%;
  height: 100%;
}
</style>