<template>
  <div id="app">
    <router-view v-if="toggleFlag" />
  </div>
</template>
<script>
export default {
  name: "App",
  provide() {
    // 在app组件这提供一个方法
    return {
      reload: this.reload,
      inittip: this.inittip,
    };
  },
  data() {
    return {
      toggleFlag: true,
    };
  },
  mounted() {
    // 将inittip方法绑定到window下面，提供给外部调用
    let me = this;
    window["inittip"] = (data) => {
      me.inittip(data); // 这个也就是我定义的方法
    };
    window["window_warning"] = (data) => {
      me.window_warning(data); // 这个也就是我定义的方法
    };
    window["spa_refresh"] = () => {
      me.reload();
    };
  },
  methods: {
    reload() {
      this.toggleFlag = false;
      // 等v-if重载渲染后再把值赋值回来重新再渲染【关了界面再开。大家如果有更好的方法欢迎留言讨论】
      this.$nextTick(function () {
        this.toggleFlag = true;
      });
      let app = this.inittip();
    },
    inittip(data) {
      if (typeof data !== "string") {
        return;
      }
      var message = data.toString();
      var msg = "";
      if (message.indexOf(",") != -1) {
        var errs = data.split(";");
        errs.forEach((item) => {
          var inf = item.split(",");
          msg +=
            this.$t("1077") + inf[0] + this.$t("1083") + this.$t(inf[1]) + ",";
        });
        msg = msg.slice(0, -1);
        this.window_warning(msg);
      } else {
        this.$Message.error(message);
      }
    },
    window_warning(msg) {
      // 自定义警告模态框
      this.$Modal.warning({
        title: this.$t("600013"), // 提示
        content: "<p>" + msg + "</p>",
      });
    },
  },
};
</script>
<style lang="less">
  .size {
    width: 100%;
    height: 100%;
  }

  html,
  body {
    .size;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  #app {
    .size;
  }
  .Manual_inspection_table>.ivu-table{ //人工检验table特殊需求table
    font-size: 16px;
  }
  .ivu-table th {
    height: 40px;
    white-space: nowrap;
    overflow: hidden;
    background-color: #2D8CF0 !important;
    color: #fff
  }

  .ivu-table-row-highlight td,
  tr.ivu-table-row-highlight.ivu-table-row-hover td {
    background-color: #78C5FF !important;
    color: #fff;
  }

  .ivu-table-cell {
    padding-left: 1px;
    padding-right: 1px;
  }

  .ivu-table th,
  .ivu-table td {
    min-width: 0;
    height: 36px !important;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    text-align: left;
    text-overflow: ellipsis;
    vertical-align: middle;
    border-bottom: 1px solid #e8eaec;
  }

  .filter {
    display: inline-block;
    height: 42px;
    font-size: 15px;
    margin-right: 15px;
    margin-top: 0px;

    select {
      border-radius: 3px;
      height: 32px;
      color: #999;
      padding: 5px;
      box-shadow: 0px 0px 1px 1px #eee;
      width:140px;
    }

    ;

    label {
      font-size: 12px;
      display: inline-block;
      margin-right: 5px;
      width: 100px;
      text-align: end;
    }
  }

  .publicinput {
    display: inline-block;
    width: 100%;
    height: 32px;
    line-height: 1.5;
    padding: 4px 0px;
    font-size: 12px;
    border: 1px solid #dcdee2;
    border-radius: 3px;
    color: #515a6e;
    // background-color: #fff;
    background-image: none;
    position: relative;
    cursor: text;
    width: 160px;
  }

  .ivu-date-picker{
    padding: 0;
    border: 0px;
  }
  // 查询条件或者table的外边框样式
  .divborder {
    margin-top: 10px;
    padding: 10px 5px;
    // border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
    //padding-top: 15px;
    background-color: #fff;
    box-shadow: 0px 0px 2px 1px rgba(216, 216, 216, 0.5);
  }

  //按钮整体样式
  .buttonall {
    // margin: 5px;
    margin-left:25px;

    button {
      // margin: 0px 10px;
      margin-right:10px;
    }
    .twoWord{
      padding: 5px 7.5px 6px;
      border-radius: 3px;
    }
  }

  .file {
    width: 80px;
    height: 32px;
    position: relative;
    color: #fff;
    display: inline-block;
    margin-bottom: 0;
    font-weight: normal;
    text-align: center;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    background-image: none;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.5;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 5px 15px 6px;
    font-size: 12px;
    border-radius: 4px;
    background-color: #2d8cf0;
    margin-right: 15px;
    // border-color: #2d8cf0;
    -webkit-appearance: button // border-color: #57a3f3;
  }

  .file input {
    position: absolute;
    // font-size: 100px;
    left: 0;
    top: 0;
    opacity: 0;
    width: 80px;
    height: 30px;
  }

  input {
    text-indent: 5px;
  }

  .mt5 {
    margin-top: 5px;
  }

  .mt10 {
    margin-top: 10px;
  }

  .mt15 {
    margin-top: 15px;
  }

  .mt20 {
    margin-top: 20px;
  }

  .mb5 {
    margin-bottom: 5px;
  }

  .mb10 {
    margin-bottom: 10px;
  }

  .mb15 {
    margin-bottom: 15px;
  }

  .mb20 {
    margin-bottom: 20px;
  }

  .ml5 {
    margin-left: 5px;
  }

  .ml10 {
    margin-left: 10px;
  }

  .ml15 {
    margin-left: 15px;
  }

  .ml20 {
    margin-left: 20px;
  }

  .m5 {
    margin: 5px;
  }

  .m10 {
    margin: 10px;
  }

  .m15 {
    margin: 15px;
  }

  .m20 {
    margin: 20px;
  }

  .pt5 {
    padding-top: 5px;
  }

  .pt10 {
    padding-top: 10px;
  }

  .pt15 {
    padding-top: 15px;
  }

  .pt20 {
    padding-top: 20px;
  }

  .pl5 {
    padding-left: 5px;
  }

  .pl10 {
    padding-left: 10px;
  }

  .pl15 {
    padding-left: 15px;
  }

  .pl20 {
    padding-left: 20px;
  }

  .p5 {
    padding: 5px;
  }

  .p10 {
    padding: 10px;
  }

  .p15 {
    padding: 15px;
  }

  .p20 {
    padding: 20px;
  }

  .fs10 {
    font-size: 10px;
  }

  .fs12 {
    font-size: 12px;
  }

  .fs14 {
    font-size: 14px;
  }

  .fs16 {
    font-size: 16px;
  }

  .fs18 {
    font-size: 18px;
  }

  .fs20 {
    font-size: 20px;
  }

  .fs24 {
    font-size: 24px;
  }

  .fs32 {
    font-size: 32px;
  }

  .fs36 {
    font-size: 36px;
  }

  .clear {
    clear: both;
  }

  .fl {
    float: left;
  }

  .fr {
    float: right;
  }

  .block {
    display: block;
  }

  .inline-block {
    display: inline-block;
  }

  .pr {
    position: relative;
  }

  .pa {
    position: absolute;
  }

  .red {
    color: red;
  }

  ul {
    list-style-type: none;
    padding: 0px;
    margin: 0px;
  }

  .center {
    text-align: center;
  }

  .bold {
    font-weight: bold;
  }

  .hide{
    display: none;
  }
  .table_min_height .ivu-table-tip{
      min-height:360px;
  }
  .table_min_height .ivu-table-body{
      min-height:360px;
  }
  /*************  web UI 菜单  start *******************/
  @width_1: 140px;
  @height_1: 29px;
  @fontSize_1: 12px;
  @backgroundColor: #2b85e4; //蓝色背景色
  @backgroundColorTr: #F5F6F7; //table 隔行换色

  //下拉菜单组件
  .dropDownClass{
    .ivu-dropdown-item{
      font-size: @fontSize_1!important;
    }
  }

  //左右分割页面
  .leftDiv{
    width:22%;
    float:left;
    height:87vh;
    overflow:auto;
    margin:0px;
  }
  .rightDiv{
    width:78%;
    float:left;
    padding-left:10px;
  }

  //树菜单
  .treeDiv{
    .ivu-tree ul{
      font-size: @fontSize_1!important;
    }
    .ivu-tree-children{
      font-size: @fontSize_1!important;
    }
  }
  /*************  web UI 菜单  end *******************/

  /*************  web UI 搜索部分 start**************/
  .treeItemdiv{
      margin:0px!important;
      height:89vh;
  }

  .newSearchDiv,.newModalClass{
    padding: 15px 5px 5px;
    margin: 0px;
    .filter{
      display: inline-block;
      height: 39px;
      font-size: @fontSize_1;
      margin-right: 5px;
      margin-top: 0px;
      span{
        font-size: @fontSize_1;
      }
    }
    label{
      width: 100px;
      display: inline-block;
      text-align: right;
      font-size: @fontSize_1;
      i{
        color:red;
        margin-right: 5px!important;
      }
    }
    .ivu-radio-wrapper,.ivu-checkbox-default{
      width: 65px!important;
      display: inline-block;
      text-align: left;
    }

    //禁止换行
    .nowropStyle{
      overflow: hidden;
      white-space: nowrap;
    }

    // input
    .searchInput{
      width: @width_1;
      height: @height_1;
      font-size: @fontSize_1;
      display:inline-block;
      line-height: @height_1;
      .ivu-input,.ivu-input-number-input,.ivu-input-number,.ivu-input-number-input-wrap{
        width: 100%;
        height: @height_1;
        border-radius: 3px;
        font-size: @fontSize_1;
        line-height: @height_1;
      }
      .ivu-input-prefix i, .ivu-input-suffix i {
        height: @height_1;
        line-height: @height_1;
      }
    }
    // select
    .searchSelect{
      width: @width_1;
      height: @height_1;
      font-size: @fontSize_1;
      display:inline-block;
      .ivu-select-selection,.ivu-input{
        width: 100%;
        height: @height_1;
        line-height: @height_1;
        border-radius: 3px;
        font-size: @fontSize_1;
        min-height: @height_1!important;
        overflow:hidden;
        .ivu-select-placeholder,.ivu-select-selected-value{
          height: @height_1;
          font-size: @fontSize_1;
          line-height: @height_1;
          min-height: @height_1;
        }
        .ivu-select-input,.ivu-input{
          height: @height_1;
          font-size: @fontSize_1;
          line-height: @height_1;
          min-height: @height_1;
        }
        div{
          overflow:hidden;
        }
      }
      .ivu-select-item{
        padding: 6px 16px;
        font-size: @fontSize_1!important;
      }
      .ivu-select-item:hover{
        background: #E2F1FB;
      }
      .ivu-select-item-focus{
        background: #E2F1FB;
      }
      .ivu-cascader .ivu-cascader-menu-item{
        font-size: @fontSize_1!important;
      }
    }
    //button
    .searchBtn{
      margin-left: 25px;
      button {
        // margin: 0px 10px;
        margin-right:15px;
        margin-bottom:10px;
      }
      .intervalRight{
        margin-right:50px;
      }
      .twoWord{
        padding: 5px 7.5px 6px;
        border-radius: 3px;
      }
      .fourWord{
        padding: 5px 6.5px 6px;
        border-radius: 3px;
      }
      .sixWord{
        padding: 5px 11px 6px;
        border-radius: 3px;
      }
      .ivu-btn{
        font-size: @fontSize_1;
      }
    }

    //宽度设置
    .minWidth{
      width:100px;
    }
    .middleWidth{
      width:200px;
    }
    .MaxWidth{
      width:300px;
    }

    //右边距
    .marginR_o{
      margin-right:10px;
    }
  }
  /*************  web UI 搜索部分 end**************/

  /*************  web UI table部分 start**************/
  //隔行换色
  .ivu-table-wrapper .ivu-table-body tr:nth-child(2n) td, .ivu-table-wrapper .ivu-table-fixed-body tr:nth-child(2n) td {
    background-color: @backgroundColorTr;
  }

  .newTableDiv{
    padding:0px;
    font-size: @fontSize_1!important;
    //隔行换色
    .ivu-table-wrapper .ivu-table-body tr:nth-child(2n) td, .ivu-table-wrapper .ivu-table-fixed-body tr:nth-child(2n) td {
      background-color: @backgroundColorTr;
    }
    .tableClass{
      min-width:600px;
      overflow-x: auto;
      .ivu-table{
        font-size: @fontSize_1!important;
      }

      //滚动条样式
      // ::-webkit-scrollbar{
      //   height:15px;
      // }
      //轨道条里的小方块
      // ::-webkit-scrollbar-thumb{
      //   background-color:#fff;
      //   border-radius: 5.5px;
      // }
      //轨道条里的轨道
      // ::-webkit-scrollbar-track{
      //   background-color:#ddd;
      // }
    }
    .pageDiv{
      margin: 20px;
      overflow: hidden;
      .pageDirection{
        float: right;
      }
    }
  }

  /*************  web UI table部分 end**************/

  /*************  web UI Modal弹窗部分 start**************/
  .newModalClass{

      //隔行换色
      .ivu-table-wrapper .ivu-table-body tr:nth-child(2n) td, .ivu-table-wrapper .ivu-table-fixed-body tr:nth-child(2n) td {
        background-color: @backgroundColorTr;
      }

      .tableClass{
        min-width:600px;
        overflow-x: auto;
        .ivu-table{
          font-size: @fontSize_1!important;
        }
      }

      .ivu-modal{
        margin-top: -20px;
        //宽度自适应
        // width: -moz-min-content;
        // width: -webkit-min-content;
        // width: min-content;

        // width:800px!important;
        .ivu-modal-header{
          height:53px;
          padding:16px 25px;
          background-color:@backgroundColor;
          border-top-left-radius: 5px;
          border-top-right-radius: 5px;
          .ivu-modal-header-inner,span{
            color:#fff;
          }
        }
        .ivu-modal-close{
          right: 16px;
          top: 11px;
          .ivu-icon-ios-close{
            color:#fff;
          }
        }
        .ivu-modal-body{
          padding:30px 0px 30px 40px;
        }
        .ivu-modal-footer{
          padding:17px 20px;
        }
        //上传图片 上传文件
        .uploadMax{
          width:155px;
          height:155px;
          border: 3px dashed #ddd;
          border-radius: 5px;
          display:block;
          overflow:hidden;
          position: relative;
          cursor: pointer;
          img{
            width:100%;
            height:100%;
            cursor: pointer;
          }
          input{
            position:absolute;
            top:0px;
            left:0px;
            opacity: 0;
            width:155px;
            height:155px;
            cursor: pointer;
          }
        }
      }

  }
  .newModalClass1{

      
      .ivu-modal{
        // margin-top: -20px;
        //宽度自适应
        // width: -moz-min-content;
        // width: -webkit-min-content;
        // width: min-content;

        // width:800px!important;
        .ivu-modal-header{
          height:53px;
          padding:16px 25px;
          background-color:@backgroundColor;
          border-top-left-radius: 5px;
          border-top-right-radius: 5px;
          .ivu-modal-header-inner,span{
            color:#fff;
          }
        }
        .ivu-modal-close{
          right: 16px;
          top: 11px;
          .ivu-icon-ios-close{
            color:#fff;
          }
        }
        .ivu-modal-body{
          padding:30px;
          .filter{
              label{
                  min-width: 100px;
              }
          }
        }
        .ivu-modal-footer{
          padding:17px 20px;
        }
        
      }
  }

  //confirm  弹窗确认样式
  .v-transfer-dom{
    .ivu-modal{
      .ivu-modal-content{
        .ivu-modal-confirm-head{
          // text-align: center;
          text-align: left;
          margin-top: 33px;
          margin-bottom: -10px;
        }
      }
    }
  }

  /*************  web UI Modal弹窗部分 end**************/

  /*************  web UI echart部分 start**************/
  .newEchartStyle{
    .echartsId{
      height:400px!important;
    }

    //隔行换色
    .ivu-table-wrapper .ivu-table-body tr:nth-child(2n) td, .ivu-table-wrapper .ivu-table-fixed-body tr:nth-child(2n) td {
      background-color: @backgroundColorTr;
    }
    .echartsTable{
      margin:20px 60px;
      .ivu-table{
        font-size: @fontSize_1!important;
      }
    }
  }

  /*************  web UI echart部分 end**************/
.ivu-btn-icon-only{
  width: auto !important;
}
.deviceStatusScreenClass .ivu-modal .ivu-modal-body{
  padding: 16px !important;
}
.vertical-center-modal{
  display: flex;
  align-items: center;
  justify-content: center;

  .ivu-modal{
    top: 0;
    margin-top: 0;
  }
}
.echo_tooltip .ivu-tooltip-rel{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deviceStatusScreenClass .groupList6 label{
  width: auto !important;
  margin-left: 16px;
}

.deviceStatusScreenClass .ivu-modal .ivu-modal-footer{
  padding: 12px 18px 12px 18px;
}

.versionModal .ivu-table-cell{
  display: flex;
}

// 新加指令 v-field 默认样式，勿动
.v-field {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 32px;
    margin-top: -16px;
    line-height: 1.5;
    padding: 4px 7px;
    font-size: 12px;
    border: 1px solid #dcdee2;
    border-radius: 4px;
    color: #515a6e;
    background-color: #fff;
    background-image: none;
    cursor: text;
    -webkit-transition: border 0.2s ease-in-out, background 0.2s ease-in-out, -webkit-box-shadow 0.2s ease-in-out;
    transition: border 0.2s ease-in-out, background 0.2s ease-in-out, -webkit-box-shadow 0.2s ease-in-out;
    transition: border 0.2s ease-in-out, background 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    transition: border 0.2s ease-in-out, background 0.2s ease-in-out, box-shadow 0.2s ease-in-out, -webkit-box-shadow 0.2s ease-in-out;
    display: inline-block;
    outline: 0;
    vertical-align: middle;
}

.v-field:focus {
    border-color:#57A3F3 !important;
}

.echo_wrap .ivu-modal .ivu-modal-body{
  padding: 30px 40px !important;
}
.d2h-code-side-linenumber{
  position: static !important;
  display: table-cell !important;
  width: auto !important;
  color: #515a6e !important;
  text-align: center !important;
  cursor: auto !important;
}
.d2h-code-side-line{
  padding: 0 !important;
}
.echo_upload_btn .ivu-upload{
  width: 100%;
}
.echo_upload_btn .ivu-btn{
  width: 100%;
}
</style>
