{

    template: '${tmpl}',
        data
:

    function () {
        return {
            /*1.监控类型*/
            monit_type: '1',
            tabPosition: 'top',
            a: "",
            b: "",
            /*2.商标名称*/
            sbname: "",
            /*3.商标类型*/
            radio: '',
            /*4.申请号*/
            tm_regist_num: "",
            /*5.申请人*/
            applicant_cn: "",
            /*多选框*/
            checkAll: false,
            isIndeterminate: true,
            checkAllCategoryNum: false,
            categoryOptionNumbers: [
                "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24",
                "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"
            ],
            checkedCategoryNum: [
                "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24",
                "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"
            ],
            /*4.类别ncl_type*/
            ncl_type: [
                "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24",
                "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"
            ],
            isnumIndeterminate: true,

            missOption: false,
            /*动态绑定class*/
            isActive: false,
            generateButton: "",
            tm_agency: "",
            /*弹出框*/
            showMask: false,
            /*监控数量*/
            dynamicsCount: 0,
            nofityQrcodeUrl: "",
            scansStyle: "display:black",
        };
    }

,
    watch: {
        /*监控按钮可用吗*/
        isActive: {
            handler: function (nowVal, oldVal) {
                if (this.sbname != "" && this.radio != "" && this.checkedCategoryNum.length != 0 && this.tm_regist_num != "" && this.applicant_cn != "") {
                    this.isActive = true
                } else {
                    this.isActive = false
                }
            }
        ,
            deep: true
        },

    }
,
    created: function() {
        $("#byctitle").text("标眼查-标眼监测");
        /*页面加载时使用*/
    },
    methods: {
        bytmmonitlistck()
        {
            console.log("lllllllllllllllllllllllllllllllllllllllllllllllllddddd");
            var localurl = location.href;
            console.log(localurl);
            var base = localurl.split("b#");
            var url = base[0] + "b#/bytmmonitlist?tmmonitlist";
            console.log(base);
            console.log(url);
            window.open(url);
        },
        bytmmonitdynamics()
        {

            var localurl = location.href;
            var base = localurl.split("b#");
            var url = base[0] + "b#/bytmmonitdynamics?tmmonitdynamics";
            window.open(url);
        },
        /*tab切换*/
        handleClick(tab, event)
        {
            console.log(tab, event);
            console.log('----------------------------------');
            console.log(this.monit_type);
            if (this.monit_type == "1") {
                this.a = true;
                this.b = false;
            }
            if (this.monit_type == "2") {
                this.a = false;
                this.b = true;
            }
        }
    ,

        /*多选框*/
        handleCheckAllCategoryNumChange(val){
            this.checkedCategoryNum = val ? [] : this.categoryOptionNumbers;
            this.isnumIndeterminate = !this.isnumIndeterminate;
        }
    ,
        handleCheckedCategoryNumChange(value)
        {
            let checkedCountCategory = value.length;
            this.checkAllCategoryNum = checkedCountCategory === this.ncl_type.length;
            this.isnumIndeterminate = checkedCountCategory > 0 && checkedCountCategory < this.ncl_type.length;
        }
    ,
        /*生成监控*/
        addMonit()
        {
            console.log("monit_type....................>>>>>>>>>>>>>>>>>");
            console.log(this.monit_type);
            if (this.monit_type == 2) {
                if (!this.tm_agency || !this.tm_agency.trim()) {
                    this.$message.warning("代理机构不能为空");
                    return false;
                }
            } else {
                if ((!this.sbname || !this.sbname.trim()) && (!this.tm_regist_num || !this.tm_regist_num.trim()) && (!this.applicant_cn || !this.applicant_cn.trim())) {
                    this.$message.warning("请至少输入一个条件生成监控任务");
                    return false;
                }
                if (this.sbname && !this.radio) {
                    this.$message.warning("查询的类型（相同、近似、相同+近似），必须选择一个！");
                    return false;
                }
            }
            var that = this;
            var obj = {
                monit_type: this.monit_type,
                name: this.sbname,
                name_type: this.radio,
                ncl_type: this.checkedCategoryNum,
                tm_regist_num: this.tm_regist_num,
                applicant_cn: this.applicant_cn,
                tm_agency: this.tm_agency
            };
            that.$root.postReq("/web/bytmmonitCtl/addMonit", obj).then(function (d) {
                if (d.code == 1) {
                    that.$router.push("/bytmmonitlist?tmmonitlist");
                } else if (d.code == -100) {
                    that.$message.warning("该监控任务已存在，请到我的监控列表中查看！");
                } else {
                    that.$message.warning("该监控任务已存在，请到我的监控列表中查看");
                }
            }).catch(function (e) {
                that.$message.warning("保存失败!!!");
                console.log(e);
            });
        }
        ,
        checkGenerate()
        {

        },
        mask(){
            this.showMask = !this.showMask;
        },
        getNofityQrcodeUrl() {
            var self = this;
            this.$root.postReq("/web/bytmmonitCtl/notifyQrcode", {}).then(function (d) {
                if (d.code == 1) {
                    self.nofityQrcodeUrl = d.data || "";
                }
            }).catch(function (e) {
                console.log(e);
            });
        },
    }
,
    mounted: function () {
        this.a = true;
        var that = this;
        that.$root.postReq("/web/bytmmonitCtl/getDynamicsCount", "").then(function (d) {
            that.dynamicsCount = d.data.count
        }).catch(function (e) {
            that.$message.warning(`操作失败，请刷新页面后重新操作`);
        });

        this.getNofityQrcodeUrl();
    }
,
    vname: "gsb-bytmmonit"
}
