{
    template:'${tmpl}',
    data:function(){
      return {
        a:true,
        b:false,
        checkAll:true,
        isIndeterminate:false,
        cities1:["中国大陆","香港","澳门","台湾"],
        cities2:["EPO","WIPO","美国","日本","韩国","英国","法国","德国","俄罗斯","瑞士"],
        cities3:["奥地利","澳大利亚","西班牙","意大利","加拿大","瑞典"],
        isIndeterminate1: false,
        checkAll1:true,
        isIndeterminate2: false,
        checkAll2:true,
        isIndeterminate3: false,
        checkAll3:true,
        checked:["中国大陆","香港","澳门","台湾"],
        checkedmain:["EPO","WIPO","美国","日本","韩国","英国","法国","德国","俄罗斯","瑞士"],
        checkedother:["奥地利","澳大利亚","西班牙","意大利","加拿大","瑞典"],
        activeName: "patentname",
        active:{patentname:"专利名称",applynum:"申请号",publishnum:"公开号",applier:"申请人",inventor:"发明人"},
        input:"",
        checkedoptions:[],
        patenttype:"",
        status:"",
        applydate:"",
        publishdate:"",
        pagesize:20,
        currentpage:1,
        datalist1:{
          patenttype:[
            {code:"fmsq",lable:"发明申请",num:0},
            {code:"syxx",lable:"实用新型",num:0},
            {code:"wgsj",lable:"外观设计",num:0}
          ],
          status:[
            {code:"yx",lable:"有效",num:0},
            {code:"zs",lable:"在审",num:0},
            {code:"wx",lable:"无效",num:0}
          ],
          applydate:[
            {code:"2001",lable:"2001年",num:0},{code:"2002",lable:"2002年",num:0},
            {code:"2003",lable:"2003年",num:0},{code:"2004",lable:"2004年",num:0},
            {code:"2005",lable:"2005年",num:0},{code:"2006",lable:"2006年",num:0},
            {code:"2007",lable:"2007年",num:0},{code:"2008",lable:"2008年",num:0}
          ],
          publishdate:[
            {code:"2001",lable:"2001年",num:0},{code:"2002",lable:"2002年",num:0},
            {code:"2003",lable:"2003年",num:0},{code:"2004",lable:"2004年",num:0},
            {code:"2005",lable:"2005年",num:0},{code:"2006",lable:"2006年",num:0},
            {code:"2007",lable:"2007年",num:0},{code:"2008",lable:"2008年",num:0}
          ]
        },
        isShow:true,
        isShow2:true,
        total:20,
        datalist2:[],

        isIndeterminateAnalysis: false,
        checkAllAnalysis:false,
        multipleSelection:[],
        checkListAnalysis:[],
        row01Height: '',
        patenObj: null
      };
    },
    created:function(){
      console.log(this.$router.history.current.query,'((((((((((((((((((((((((((((((((((((');
      let patenObj = this.$router.history.current.query.patenObj;
      if (patenObj) {
        this.patenObj = JSON.parse(patenObj);
        this.input = this.patenObj.content; 
        this.search()
      };
      var taht = this;
      taht.row01Height = 'height:' + document.documentElement.clientHeight + 'px';  
      window.addEventListener("resize",function(){
        taht.row01Height = 'height:' + document.documentElement.clientHeight + 'px';  
      });

    },
    methods:{
      checkClick(){
        this.b=!this.b;
      },
      search(){
        if(!this.input){
          this.$message.warning("输入的搜索关键字不能为空");
          return false;
        };
        console.log(this.patenObj);
        var obj= this.patenObj ? this.patenObj : {
          lable:this.activeName,
          content:this.input,
          range:{
            china:this.checked,
            main:this.checkedmain,
            other:this.checkedother
          },
          patenttype:this.patenttype,
          status:this.status,
          applydate:this.applydate,
          publishdate:this.publishdate,
          pagesize:this.pagesize,
          currentpage:this.currentpage,
        };
        var that=this;
        console.log(obj);
        let loadingbyc = this.$loading({
            lock: true,
            text: 'Loading',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
        });
        this.$root.postReq("/web/patentycCtl/simplesearch",obj).then(function (d) {
          console.log("--------/web/patentycCtl/simplesearch----------");
          console.log(d);
          loadingbyc.close();
          if(d.status==0){
            
            that.total=d.data.total;
            if(d.data.dataList1.patenttype.length==0){
              d.data.dataList1.patenttype=[
                {code:"发明",lable:"发明申请",num:0},
                {code:"实用新型",lable:"实用新型",num:0},
                {code:"外观设计",lable:"外观设计",num:0}
              ]
            }
            if(d.data.dataList1.status==0){
              d.data.dataList1.status=[
                {code:"有效",lable:"有效",num:0},
                {code:"在审",lable:"在审",num:0},
                {code:"无效",lable:"无效",num:0}
              ]
            }
            that.datalist1=d.data.dataList1;
            that.datalist2=d.data.dataList2;
            if(that.checkAllAnalysis){
              that.$nextTick(function(){
                that.datalist2.forEach(d=>{
                  that.$refs.multipleTable.toggleRowSelection(d,true);
                })
              })
            }else{
              that.$nextTick(function(){
                for(var i=0;i<that.checkListAnalysis.length;i++){
                  if(that.currentpage==that.checkListAnalysis[i].pageNo){
                    for (var j=0;j<that.checkListAnalysis[i].data.length;j++){
                      that.datalist2.forEach(d=>{
                        if(d.applynum==that.checkListAnalysis[i].data[j].applynum){
                          console.log("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");
                          that.$refs.multipleTable.toggleRowSelection(d,true);
                        }
                      })
                    }
                  }
                }
              })
            }

          }
          that.a=false;that.b=false;
          $('#wave-container').css('display','none');
        })

      },
      search1(val){
        console.log(typeof val,'sssssssssssssssssssssssssssssssssss');
        if (typeof val == 'string') {
          this.input = val;
        };
        this.total=0;
        this.currentpage=1;
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      search2(){
        this.total=0;
        this.currentpage=1;
        this.checkedoptions=[];
        this.patenttype="";
        this.status="";
        this.applydate="";
        this.publishdate="";
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      onclick(){
        this.isShow=!this.isShow;
      },
      onclick2(){
        this.isShow2=!this.isShow2;
      },
      handleSizeChange(val){
        console.log("------------handleSizeChange--------------");
        console.log(val);
        this.pagesize=val;
        this.currentpage=1;
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      handleCurrentChange(val){
        console.log("------------handleCurrentChange--------------");
        if(!this.checkAllAnalysis){
          var bool=true;
          for(var i=0;i< this.checkListAnalysis.length;i++){
            if(this.checkListAnalysis[i].pageNo==this.currentpage){
              bool=false;
              this.checkListAnalysis[i].data=this.multipleSelection;
              break;
            }
          }
          if(bool){
            var item={pageNo:this.currentpage,data:this.multipleSelection};
            this.checkListAnalysis.push(item);
          }
        }

        this.currentpage=val;
        this.search();
      },
      patentdetail(row){
        console.log(row);
        var localurl = location.href;
        var base = localurl.split("#");
        /*var url = base[0] + "p#/patentdetail?applynum=" + row.applynum + "&publishnum=" + row.publishnum+"&activeIndex=1";
        window.open(url);*/
        var url = base[0] + "#/patentdetail";
        this.$root.windowOpen({
          url:url,
          title:"专利详情",
          params:[
            {name:"applynum",value:row.applynum},
            {name:"publishnum",value:row.publishnum},
            {name:"activeIndex",value:1}
          ]
        })
        /*window.open(url);*/
      },
      handleClick(){
        this.total=0;
        this.currentpage=1;
        this.checkedoptions=[];
        this.patenttype="";
        this.status="";
        this.applydate="";
        this.publishdate="";
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      patenttypeclick(o){
        this.total=0;
        this.currentpage=1;
        this.patenttype=o.code;
        var bool=true;
        for(var i=0;i<this.checkedoptions.length;i++){
          if(this.checkedoptions[i].name=="patenttype"){
            bool=false;
            break;
          }
        }
        if(bool){
          this.checkedoptions.push({name:"patenttype",code:o.code,lable:o.lable});
        }
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      handleClose(tag){
        if(tag.name=="patenttype"){
          this.patenttype="";
        }
        if(tag.name=="status"){
          this.status="";
        }
        if(tag.name=="applydate"){
          this.applydate="";
        }
        if(tag.name=="publishdate"){
          this.publishdate="";
        }
        this.total=0;
        this.currentpage=1;
        this.checkedoptions.splice(this.checkedoptions.indexOf(tag), 1);
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      statusclick(o){
        this.total=0;
        this.currentpage=1;
        this.status=o.code;
        var bool=true;
        for(var i=0;i<this.checkedoptions.length;i++){
          if(this.checkedoptions[i].name=="status"){
            bool=false;
            break;
          }
        }
        if(bool){
          this.checkedoptions.push({name:"status",code:o.code,lable:o.lable});
        }
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      applydateclick(o){
        this.total=0;
        this.currentpage=1;
        this.applydate=o.code;
        var bool=true;
        for(var i=0;i<this.checkedoptions.length;i++){
          if(this.checkedoptions[i].name=="applydate"){
            bool=false;
            break;
          }
        }
        if(bool){
          this.checkedoptions.push({name:"applydate",code:o.code,lable:o.lable});
        }
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      publishdateclick(o){
        this.total=0;
        this.currentpage=1;
        this.publishdate=o.code;
        var bool=true;
        for(var i=0;i<this.checkedoptions.length;i++){
          if(this.checkedoptions[i].name=="publishdate"){
            bool=false;
            break;
          }
        }
        if(bool){
          this.checkedoptions.push({name:"publishdate",code:o.code,lable:o.lable});
        }
        /*清楚勾选的痕迹*/
        this.checkAllAnalysis=false;
        this.checkListAnalysis=[];
        this.multipleSelection=[];
        this.search();
      },
      tableHeaderColor({row, column, rowIndex, columnIndex}){
        if (rowIndex === 0) {
          return 'background: #F5F5F5;color:#333333;text-align:center'
        }
      },
      tableRowStyle({ row, rowIndex }) {
        return 'height:50px;text-align:center'
      },
      logoclick(){
        this.a=true;this.b=false;
      },
      handleCheckAllChange(val) {
        this.checked =val ? this.cities1:[];
        this.checkAll1=this.checked===this.cities1;
        this.isIndeterminate1=this.checked.length > 0 && this.checked.length < this.cities1.length;
        this.checkedmain=val ? this.cities2:[];
        this.checkAll2=this.checkedmain===this.cities2;
        this.isIndeterminate2=this.checkedmain.length > 0 && this.checkedmain.length < this.cities2.length;
        this.checkedother=val ? this.cities3:[];
        this.checkAll3=this.checkedother===this.cities3;
        this.isIndeterminate3=this.checkedother.length > 0 && this.checkedother.length < this.cities3.length;
      },
      check(){
        if(this.checkAll1&&this.checkAll2&&this.checkAll3){
          this.checkAll=true;
          this.isIndeterminate=false;
        }else{
          this.checkAll=false;
          this.isIndeterminate=true;
        }
      },
      handleCheckAllChange1(val) {
        this.checked =val ? this.cities1:[];
        this.isIndeterminate1=false;
        this.check();
      },
      handleCheckedCitiesChange1(value) {
        let checkedCount = value.length;
        this.checkAll1 = checkedCount === this.cities1.length;
        this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.cities1.length;
        this.check();
      },
      handleCheckAllChange2(val) {
        this.checkedmain =val ? this.cities2:[];
        this.isIndeterminate2=false;
        this.check();
      },
      handleCheckedCitiesChange2(value) {
        let checkedCount = value.length;
        this.checkAll2 = checkedCount === this.cities2.length;
        this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.cities2.length;
        this.check();
      },
      handleCheckAllChange3(val) {
        this.checkedother =val ? this.cities3:[];
        this.isIndeterminate3=false;
        this.check();
      },
      handleCheckedCitiesChange3(value) {
        let checkedCount = value.length;
        this.checkAll3 = checkedCount === this.cities3.length;
        this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length;
        this.check();
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      handleCheckAllChangeAnalysis(val){
        this.multipleSelection =val ? this.datalist2:[];
        console.log(this.multipleSelection);
        this.toggleSelection(this.multipleSelection);
        this.isIndeterminateAnalysis=false;
      },
      toggleSelection(rows){
        if (rows.length!=0) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        }else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      patentAnalysis(){
        var localurl = location.href;
        var base = localurl.split("#");
        if((this.checkAllAnalysis)||(!this.checkAllAnalysis && this.multipleSelection.length==0)){
          /*url=base[0] + "p#/patentanalysis?search=simpleall";*/
          url=base[0] + "#/patentanalysis";
          var obj={
            total:this.total,
            lable:this.activeName,
            content:this.input,
            patenttype:this.patenttype,
            range:{
              china:this.checked,
              main:this.checkedmain,
              other:this.checkedother
            },
            status:this.status,
            applydate:this.applydate,
            publishdate:this.publishdate,
          };
          localStorage.setItem("patentyc_patentanalysis",JSON.stringify(obj));
          this.$root.windowOpen({
            url:url,
            title:"专利分析",
            params:[
              {name:"search",value:"simpleall"}
            ]
          })
          /*window.open(url);*/
        }else{
          url=base[0] + "#/patentanalysis";
          if(!this.checkAllAnalysis){
            var bool=true;
            for(var i=0;i< this.checkListAnalysis.length;i++){
              if(this.checkListAnalysis[i].pageNo==this.currentpage){
                bool=false;
                this.checkListAnalysis[i].data=this.multipleSelection;
                break;
              }
            }
            if(bool){
              var item={pageNo:this.currentpage,data:this.multipleSelection};
              this.checkListAnalysis.push(item);
            }
          }
          var list="";
          for(var i=0;i<this.checkListAnalysis.length;i++){
            for(var j=0;j<this.checkListAnalysis[i].data.length;j++){
              if(list.length>0){
                list=list+","+this.checkListAnalysis[i].data[j].applynum;
              }else{
                list=this.checkListAnalysis[i].data[j].applynum;
              }
            }
          }
          var num=list.split(",").length;
          var obj={
            total:num,
            applynumList:list.split(",")
          };
          localStorage.setItem("patentyc_patentanalysis",JSON.stringify(obj));
          this.$root.windowOpen({
            url:url,
            title:"专利分析",
            params:[
              {name:"search",value:"simpleother"}
            ]
          })
          /*window.open(url);*/
        }

      }
    },
    mounted:function(){
      $('#wave-container').hover(function(){
          $("#wave-container").addClass("animate-wave-container-hover");
      },function(){
          $("#wave-container").removeClass("animate-wave-container-hover");
      });
      $("#patentyc").text("专眼查-常规检索");

    },
    vname:"gsb-patentsimplesearch"
}
