{
    template: '${tmpl}',
    data: function () {
        return {
            address: '',
            level: '部委通知',
            checkAll: false,
            checkAll2: false,
            checkedfabus: [],
            checkedhangyes: [],
            isIndeterminate: false,
            levels: [
                '部委通知',
                '省级通知',
                '市级通知',
                '区级通知'
            ],
            proNames: [{
                    name: "北京",
                    flag: false
                },
                {
                    name: "天津",
                    flag: false
                },
                {
                    name: "上海",
                    flag: false
                },
                {
                    name: "重庆",
                    flag: false
                },
                {
                    name: "河北",
                    flag: false
                },
                {
                    name: "河南",
                    flag: false
                },
                {
                    name: "云南",
                    flag: false
                },
                {
                    name: "辽宁",
                    flag: false
                },
                {
                    name: "黑龙江",
                    flag: false
                },
                {
                    name: "湖南",
                    flag: false
                },
                {
                    name: "安徽",
                    flag: false
                },
                {
                    name: "山东",
                    flag: false
                },
                {
                    name: "江苏",
                    flag: false
                },
                {
                    name: "浙江",
                    flag: false
                },
                {
                    name: "江西",
                    flag: false
                },
                {
                    name: "湖北",
                    flag: false
                },
                {
                    name: "新疆",
                    flag: false
                },
                {
                    name: "广西",
                    flag: false
                },
                {
                    name: "甘肃",
                    flag: false
                },
                {
                    name: "山西",
                    flag: false
                },
                {
                    name: "陕西",
                    flag: false
                },
                {
                    name: "内蒙古",
                    flag: false
                },
                {
                    name: "吉林",
                    flag: false
                },
                {
                    name: "福建",
                    flag: false
                },
                {
                    name: "贵州",
                    flag: false
                },
                {
                    name: "广东",
                    flag: false
                },
                {
                    name: "青海",
                    flag: false
                },
                {
                    name: "西藏",
                    flag: false
                },
                {
                    name: "宁夏",
                    flag: false
                },
                {
                    name: "四川",
                    flag: false
                }
            ],
            fabus: ['发改部门', '教育部门', '科学技术部门', '工业和信息化部门', '人社部门', '生态环境部门', '交通运输部门', '农业农村部门', '商务部门', '文化和旅游部门', '知识产权部门', '财政部门', '税务部门', '国防科技部门', '开发区/高新区/自贸区', '市场监督部门'],
            hangyes: ['工业', '建筑业', '金融业', '农、林、牧、渔业', '软件、信息传输和信息技术服务业', '住宿和餐饮业', '批发和零售业', '现代服务业', '租赁和商业服务业', '交通运输、仓储和邮政业', '教育和卫生业', '文化、体育和娱乐业', '房地产和物业管理业', '水利、环境和公共设施管理业', '公共管理、社会保障、社会和国际组织', '电力、热力、燃气及水生产和供应业', '其他'],
            flag: false,
            activeClass: 0,
            checkBoxSeleArr: [],
            activeClass2Arr: [],
            Deparment: '',
            industry: '',
            Email: '',
            address: [],
            dataNew: {}
        }
    },
    created: function () {

    },
    mounted: function () {
        this.selPro(0);
    },
    methods: {
        selPro(index) {
            console.log(this.address, "hhhhhhhhhhhhhhhhhhhhhhhhhh");
            if (this.proNames[index].flag) {
                this.proNames[index].flag = false;
                for (let i = 0; i < this.address.length; i++) {
                    if (this.address[i] && this.address[i].proName == this.proNames[index].name) {
                        console.log(index, "aaaaaaaaaaaaaaaaaaaaaaa");
                        this.address.splice(i, 1);
                    }
                }
            } else {
                if (this.address.length >= 3) {
                    return this.$message({
                        showClose: true,
                        message: "最多选择3个",
                        type: "warning",
                    })
                }
                this.proNames[index].flag = true;
                let dataNew = {};
                this.address.push(dataNew);
                console.log(this.address, "jjjjjjjjjjjjjj");
                axios.post('http://106.13.228.212:8009/gsb/zc/citylist', {
                    "address": this.proNames[index].name,
                }).then(d => {
                    for (let i = 0; i < d.data.length; i++) {
                        console.log("kkklll");
                        for (let key in d.data[i]) {
                            dataNew.proName = key;
                            dataNew.citys = [];
                            if (i == 0) {
                                dataNew.flag = true;
                            } else {
                                dataNew.flag = false;
                            }
                            let _cityArray = d.data[i][key];
                            for (let j = 0; j < _cityArray.length; j++) {
                                let _temp = {};
                                _temp.name = _cityArray[j];
                                if (j == 0) {
                                    _temp.flag = true;
                                } else {
                                    _temp.flag = false;
                                }
                                dataNew.citys.push(_temp);
                                console.log(dataNew, "kkkkkkkkkkk");

                            }
                        }
                    }
                    this.$forceUpdate();
                })
            }
            console.log(this.address.length, "===========length");
        },
        sleCity(index, cityIndex) {
            this.address[index].citys[cityIndex].flag = !this.address[index].citys[cityIndex].flag;
            this.$forceUpdate();
            console.log(this.address[index].citys[cityIndex].flag, "0000000000000000000000");
        },
        format(_arryCitys) {
            for (let i = 0; i < _arryCitys.length; i++) {
                let temp = [];
                for (let element of _arryCitys[i].citys) {
                    if (element.flag) {
                        temp.push(element);
                    }
                }
                _arryCitys[i].citys = temp;
            }
            return _arryCitys;
        },

        getlevel(index, level) {
            console.log(level, '4444444');
            this.activeClass = index;
            this.level = level;
        },

        handleCheckAllChange(val) {
            this.checkedfabus = val ? this.fabus : [];
            this.isIndeterminate = false;
        },

        handleCheckAllChange2(val) {
            this.checkedhangyes = val ? this.hangyes : [];
            this.isIndeterminate = false;
        },

        handleCheckedfabusChange(value) {
            let checkedCount = value.length;
            this.checkAll = checkedCount === this.fabus.length;
            this.isIndeterminate = checkedCount > 0 && checkedCount < this.fabus.length;
        },

        handleCheckedhangyesChange(value) {
            let checkedCount = value.length;
            this.checkAll2 = checkedCount === this.hangyes.length;
            this.isIndeterminate = checkedCount > 0 && checkedCount < this.hangyes.length;
        },
        payMoney() {
            console.log("黄静" + JSON.stringify(this.address));

            let _arryCitys = this.format(this.address);
            console.log(JSON.stringify(_arryCitys) + "黄静");
            this.$root.pushx({
                title: "支付订阅",
                name: "/pay",
                params: {
                    "poliyLevel": this.level,
                    "address": _arryCitys,
                    "Department": this.checkedfabus,
                    "industry": this.checkedhangyes,
                },
            })
        },
        back() {
            this.$root.pushx({
                title: "政策推送",
                name: "/subscription",
            })
        },

    },
    computed: {

    },
    vname: "gsb_policycondition"
}