let vue_sjcx = new Vue({
    el: '#sjcx',
    data: {
        data_sjlxs: [],
        data_table_wfpz: [],
        data_sjlxs1: [],
        count: '',
        deptId: getCookie("bjpt_deptId"),
        fy_select: 20,
        state_arr: [],
        cllx_select: [],
        clzt_select: 9,
        arr_cllx: [],
        sjlx_select:null
    },
    methods: {
        tss:function () {
            vue_sjcx.state_arr = [];
            $(".div-pub-gt").find('input:checked').each(function () {
                vue_sjcx.state_arr.push($(this).val());
            });
            let a = vue_sjcx.state_arr;
        },
        getChange_tszt:function () {
            setTimeout(function () {
                vue_sjcx.query(1, true);
            }, 200);
        },
        qx_s:function (e) {
            if(e.currentTarget.checked){
                $(".div-pub-gt").find('input').each(function () {
                    $(this).prop("checked", true);
                });
                vue_sjcx.state_arr = [];
                $(".div-pub-gt").find('input:checked').each(function () {
                    vue_sjcx.state_arr.push($(this).val());
                });
            }else{
                $(".div-pub-gt").find('input').each(function () {
                    $(this).removeAttr("checked", false);
                    $(this).prop("checked", false);
                    vue_sjcx.state_arr = [];
                });
            }
        },
        query: function (pages, items) {
            $.ajax({
                url: "/traffic/list/pushrecordsBypage",
                dateType: 'json',
                type: "POST",
                contentType: 'application/json',
                data: {
                    starttime: starttime,
                    endtime: endtime,
                    page: pages,
                    limit: this.fy_select,
                    pushstatus: this.clzt_select,
                    construction: this.sjlx_select,
                },
                success: function (result) {
                    vue_sjcx.data_table_wfpz = [];
                    if (result.code == 0) {
                        let a_sum = result.count;
                        vue_sjcx.count = result.count;
                        vue_sjcx.data_table_wfpz = result.data;
                        if (items) {
                            $("#fy4").bootstrapPaginator({
                                bootstrapMajorVersion: 3, //版本，这里设置为3，大于2即可
                                currentPage: 1,//当前页
                                totalPages: Math.ceil(((a_sum > 0) ? a_sum : 1) / vue_sjcx.fy_select),//总页数
                                // numberofPages: 10,//显示的页数
                                itemTexts: function (type, page, current) { //修改显示文字
                                    switch (type) {
                                        case "first":
                                            return "首页";
                                        case "prev":
                                            return "上一页";
                                        case "next":
                                            return "下一页";
                                        case "last":
                                            return "末页";
                                        case "page":
                                            return page;
                                    }
                                }, onPageClicked: function (event, originalEvent, type, page) { //异步换页
                                    //请求加载数据
                                    vue_sjcx.query(page, false);
                                }
                            });
                        }
                    }
                }
            });
        },
        getChange: function () {
            setTimeout(function () {
                vue_sjcx.query(1, true);
            }, 200);

        },
    },
    mounted(){

        this.query(1, true);
    },

});