{
  template:'${tmpl}',
  data:function(){
    return {
      dialogFormVisible:false,
      detaildata:{
        filingno:"",
        pubno:"",
        grno:"",
        mainipc:"",
        pubstatusnow:"",
        filingdate:"",
        pubdate:"",
        grdate:"",
        agentname:"",
        pubstatus:"",
        applname:"",
        invname:"",
        appladdress:"",
        agencyname:"",
        otheripc:"",
        filingname:"",
        abstract:"",
        priorinfo:"",
        pctinfo:""
      },
      a:true,
      b:false,
      c:false,
      total: 0,
      size: 10,
      page: 1,
      searchInput:"",
      btnchange:-1,
      form:{
        patentType:[],
        patentStatus:[],
        patentName:"",
        publicNumber:"",
        abstract:"",
        notificationNumber:"",
        priority:"",
        appearance:"",
        applier:"",
        applyDate:"",
        inventor:"",
        applyNumber:"",
        notificationDate:"",
        publicDate:""
      },
      datalist:[],
    };
  },
  methods:{
    intellectsearchClick:function(){
      this.btnchange = 0;
      this.datalist= null;
      if(this.searchInput==""){
        this.$message.warning("请输入查询信息");
      }else{
        var obj =
          {
            selectName: this.searchInput,
            pageSize:this.size,
            currentPage:this.page
          };
          var that=this;
          this.$root.showMask();
          this.$root.postReq("/web/patentqueryCtl/findintellect",obj).then(function(d){
            that.$root.hideMask();
            that.datalist = d.data.rows;
            that.total = d.data.count;
          }).catch(function(e){
            console.log(e);
            that.$message.warning(`操作失败，请刷新页面后重新操作`);
          });
          this.c=true;
      }

    },

    advancedSearch:function(){
      this.a=false;
      this.b=true;
      this.c=false;
    },
    search:function(){
      this.btnchange=1;
      this.datalist=null;
      var term1 = false;
      if (this.form.patentName != "" && this.form.patentName != null){
        term1 = true;
      }
      if (this.form.publicNumber != "" && this.form.publicNumber != null){
        term1 = true;
      }
      if (this.form.abstract != "" && this.form.abstract != null){
        term1 = true;
      }
      if (this.form.notificationNumber != "" && this.form.notificationNumber != null){
        term1 = true;
      }
      if (this.form.priority != "" && this.form.priority != null){
        term1 = true;
      }
      if (this.form.appearance != "" && this.form.appearance != null){
        term1 = true;
      }
      if (this.form.applier != "" && this.form.applier != null){
        term1 = true;
      }
      if (this.form.applyDate != "" && this.form.applyDate != null){
        term1 = true;
      }
      if (this.form.inventor != "" && this.form.inventor != null){
        term1 = true;
      }
      if (this.form.publicDate != "" && this.form.publicDate != null){
        term1 = true;
      }
      if (this.form.applyNumber != "" && this.form.applyNumber != null){
        term1 = true;
      }
      if (this.form.notificationDate != "" && this.form.notificationDate != null){
        term1 = true;
      }

      if (term1 == false){
        this.$message.warning("请输入查询信息");
      }
      else {
        var fmtype = "";
        var xxtype = "";
        var wgtype = "";
        var grtype = "";
        var yxstatus = "";
        var szstatus = "";
        var wxstatus = "";
        this.form.patentType.forEach(function(mm){
          if (mm == "发明专利"){
            fmtype = mm;
          }
          else if (mm == "实用新型"){
            xxtype = mm;
          }
          else if (mm == "外观设计"){
            wgtype = mm;
          }
          else if (mm == "发明授权"){
            grtype = mm;
          }
        });
        this.form.patentStatus.forEach(function(mm){
          if (mm == "有效"){
            yxstatus = mm;
          }
          else if (mm == "在审"){
            szstatus = mm;
          }
          else if (mm == "无效"){
            wxstatus = mm;
          }
        });

        var filingdate1 = "";
        var filingdate2 = "";
        var pubdate1 = "";
        var pubdate2 = "";
        var grdate1 = "";
        var grdate2 = "";
        if (this.form.applyDate != "" && this.form.applyDate != null){
          filingdate1 = this.form.applyDate[0];
          filingdate2 = this.form.applyDate[1];
        }
        if (this.form.publicDate != "" && this.form.publicDate != null){
          pubdate1 = this.form.publicDate[0];
          pubdate2 = this.form.publicDate[1];
        }
        if (this.form.notificationDate != "" && this.form.notificationDate != null){
          grdate1 = this.form.notificationDate[0];
          grdate2 = this.form.notificationDate[1];
        }


        var obj =
          {
            fmtype:fmtype,
            xxtype:xxtype,
            wgtype:wgtype,
            grtype:grtype,
            yxstatus:yxstatus,
            szstatus:szstatus,
            wxstatus:wxstatus,
            filingname: this.form.patentName,
            pubno:this.form.publicNumber,
            abstract:this.form.abstract,
            grno:this.form.notificationNumber,
            priorno:this.form.priority,
            ipcno:this.form.appearance,
            applname:this.form.applier,
            filingdate1:filingdate1,
            filingdate2:filingdate2,
            invname:this.form.inventor,
            pubdate1:pubdate1,
            pubdate2:pubdate2,
            filingno:this.form.applyNumber,
            grdate1:grdate1,
            grdate2:grdate2,
            pageSize:this.size,
            currentPage:this.page
          };
          var that=this;
          this.$root.showMask();
          this.$root.postReq("/web/patentqueryCtl/findsenior",obj).then(function(d){
            that.$root.hideMask();
            console.log("$$$$$$");
            console.log(d.data.count);
            console.log(d.data.rows);
            that.datalist = d.data.rows;
            that.total = d.data.count;
          }).catch(function(e){
            console.log(e);
            that.$message.warning(`操作失败，请刷新页面后重新操作`);
          });

          this.a = false;
          this.b = false;
          this.c = true;
      }

    },
    handleCurrentChange(val) {
      this.page = val;
      console.log(`当前 ${val} 页`);
      if (this.btnchange == 0){
        this.intellectsearchClick();
      } else if (this.btnchange === 1) {
        this.search();
      }

    },
    handleSizeChange(val) {
      this.size = val;
      console.log(`每页 ${val} 条`);
      if (this.btnchange == 0){
        this.intellectsearchClick();
      } else if (this.btnchange === 1) {
        this.search();
      }
    },
    todetail:function(obj){
      this.dialogFormVisible =true;
      this.detaildata.filingno = obj.filingno;
      this.detaildata.pubno = obj.pubno;
      this.detaildata.grno = obj.grno;
      if (obj.mainipc != "" && obj.mainipc != null){
        this.detaildata.mainipc = obj.mainipc;
      }
      else{
        this.detaildata.mainipc = "";
      }
      if (obj.ipcversion !="" && obj.ipcversion != null){
        if (this.detaildata.mainipc != "" && this.detaildata.mainipc != null){
          this.detaildata.mainipc = this.detaildata.mainipc + obj.ipcversion;
        }
      }

      this.detaildata.pubstatusnow = obj.pubstatus;
      this.detaildata.filingdate = obj.filingdate;
      this.detaildata.pubdate = obj.pubdate;
      this.detaildata.grdate = obj.grdate;
      if (obj.agentname1 != "" && obj.agentname1 != null){
        this.detaildata.agentname = obj.agentname1;
      }
      else{
        this.detaildata.agentname = "";
      }
      if (obj.agentname2 != "" && obj.agentname2 != null){
        if (this.detaildata.agentname != "" && this.detaildata.agentname != null){
          this.detaildata.agentname = this.detaildata.agentname + ";" + obj.agentname2;
        }
      }
      this.detaildata.pubstatus = obj.pubstatusnow;

      if (obj.applname != "" && obj.applname != null){
        this.detaildata.applname = obj.applname.join(";");
      }
      else {
        this.detaildata.applname = "";
      }

      if (obj.invname != "" && obj.invname != null){
        this.detaildata.invname = obj.invname.join(";");
      }
      else {
        this.detaildata.invname = "";
      }

      if (obj.appladdress != "" && obj.appladdress != null){
        this.detaildata.appladdress = obj.appladdress;
      }
      else {
        this.detaildata.appladdress = "";
      }
      if (obj.applzip != "" && obj.applzip != null){
        if (this.detaildata.appladdress != "" && this.detaildata.appladdress != null){
          this.detaildata.appladdress = this.detaildata.appladdress + "(" + obj.applzip + ")";
        }
      }

      if (obj.agencycode != "" && obj.agencycode != null){
        this.detaildata.agencyname = "(" + obj.agencycode + ")";
      }
      else {
        this.detaildata.agencyname = "";
      }
      if (obj.agencyname != "" && obj.agencyname != null){
        if (this.detaildata.agencyname != "" && this.detaildata.agencyname != null){
          this.detaildata.agencyname = this.detaildata.agencyname + obj.agencyname;
        }
        else {
          this.detaildata.agencyname = obj.agencyname;
        }
      }

      if (obj.otheripc != "" && obj.otheripc != null){
        this.detaildata.otheripc = obj.otheripc.join(";");
      }
      else {
        this.detaildata.otheripc = "";
      }

      this.detaildata.filingname = obj.filingname;
      this.detaildata.abstract = obj.abstract;

      var priorinfo = "";
      if (obj.priorinfo != "" && obj.priorinfo != null){
        obj.priorinfo.forEach(function(mm){
          var ttinfo = mm.pri_country + mm.pri_no+";";
          priorinfo += ttinfo;
        });
      }
      var reg=/;$/gi;
      this.detaildata.priorinfo = priorinfo.replace(reg,"");

      if (obj.pctinfo != "" && obj.pctinfo != null){
        this.detaildata.pctinfo = obj.pctinfo.pct_filing_no + ";" + obj.pctinfo.pct_pub_no + ";" + obj.pctinfo.pct_pub_lang;
      }

    },

  },
  mounted:function(){
  },
  vname:"gsb-patentquery"
}
