{
  template: '${tmpl}',
    data: function() {
      return {
        multipleSelection: [],

        /*1.监控类型*/
        monit_type: [{
          value: -1,
          label: '全部'
        }, {
          value: 1,
          label: '商标监控'
        }, {
          value: 2,
          label: '代理机构监控'
        },],
        value: -1,
        /*2.监控名称*/
        jkmc: "",
        /*全选*/
        isnumIndeterminate: false,

        /*查询得到数据*/
        querydata: [],
        /*当前页*/
        page: 1,
        size: 20,
        total: "",
        /*code*/

        code: "",

        checkAll: "",
        options: [],
        checkAllOptions: false,
      };
    },
  created: function() {
    $("#byctitle").text("标眼查-监控列表");
    /*页面加载时使用*/
    this.getMonitList();
  },
  methods: {
    getMonitList(){
      var that = this;
      var obj = {
        monit_type: that.value,
        name: that.jkmc,
        current_page: that.page,
        page_size: that.size,
      };
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      that.$root.postReq("/web/bytmmonitCtl/getMonitList", obj).then(function (d) {
        loading.close();
        that.querydata = d.data;
        that.total = d.total_count;
        that.code = d.code;
      }).catch(function (e) {
      });
    },
    handleSelectionChange(val){
      this.multipleSelection = val;
    },
    delectselect(){
      if (this.multipleSelection.length == 0) {
        this.$message.warning("请选择要删除的数据");
        return false;
      }
      var list = [];
      for (var i = 0; i < this.multipleSelection.length; i++) {
        list.push(this.multipleSelection[i].code);
      }
      var that = this;
      this.$confirm('确定删除该监控任务吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        that.$root.postReq("/web/bytmmonitCtl/delMonit", { "code_list": list }).then(function (d) {
          console.log(d);
          if (d.code == 1) {
            that.jkcx();
          }
        }).catch(function (e) {
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    bytmmonitck()
    {
      this.$router.push("/bytmmonit?tmmonit");
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    /*监控查询*/
    jkcx(){
      console.log("-----jkcx-----------");
      var that = this;
      var obj = {
        monit_type: that.value,
        name: that.jkmc,
        current_page: that.page,
        page_size: that.size,
      };
      that.$root.postReq("/web/bytmmonitCtl/getMonitList", obj).then(function (d) {
        that.querydata = d.data;
        that.total = d.total_count;
        that.code = d.code;
        console.log(d)
      }).catch(function (e) {
      });
    },
    /**/
    handleCurrentChange(val)
    {
      this.page = val;
      console.log(`当前 ${val} 页`);
    }
    ,
    handleSizeChange(val)
    {
      this.size = val;
      console.log(`每页 ${val} 条`);
    }
    ,

    /* 查看列表*/
    listView(code, monit_type_name, tm_agency){
      console.log(code,"code=====>>>>");
      console.log(tm_agency,"tm_agency=====>>>>");
      var localurl = location.href;
      var base = localurl.split("b#");
      var url = "";
      if (monit_type_name == "商标监控") {
        url = base[0] + "b#/bytmmonitlistdetails?code=" + code;
      } else {
        url = base[0] + "b#/bytmmonitagency?agency_name=" + tm_agency;
      }
      console.log(url,"url>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
      
      window.open(url);
    },
    /*全选*/


    handleCheckAllChange(){
      console.log(this.checkAllOptions);
      if (this.querydata) {
        this.querydata.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      }
    },
    handleChecked(){

    },
    delRow(index, row){
      var that = this;
      console.log("-------delRow-----------");
      console.log(row);
      var list = [];
      list.push(row.code);

      this.$confirm('确定删除该监控任务吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        that.$root.postReq("/web/bytmmonitCtl/delMonit", { "code_list": list }).then(function (d) {
          console.log(d);
          if (d.code == 1) {
            that.jkcx();
          }
        }).catch(function (e) {
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    }
  },
  mounted: function() {

  },
  vname: "gsb-bytmmonitlist"
}
