wssq.js 3.48 KB
layui.use('element', function () {
    let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
});
$(function () {
    addTabs('#wssq');
    //config的设置是全局的
    layui.config({
        base: '../../staticJs/'
    }).extend({ //设定模块别名
        common: 'cityCommon'
    });

    $(document).on("click", ".area_list li", function (e) {
        $(".area_list li").removeClass("active2")
        $(this).addClass("active2");
        _businessList($(this).attr("data-id"))
    })

    layui.use(['form', 'common'], function () {
        var common = layui.common,
            form = layui.form;
        //三级地址联动
        common.showCity('province', 'city');
        //区域选择
        form.on('select(selectCity)', function (data) {
            return false;
        });
    });
    _initData()
    // 网上申请
    $(document).on("click", ".handleBus", function (e) {
        if (isLogin()) {
            getInitiateFLow($(this).attr("ywid"),$(this).attr("businessNo"));
        }
    })
})

// 初始化数据
function _initData() {
    var area_list = $(".area_list");
    area_list.empty();
    var li
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/cms/district/queryAllDistrict",//路径  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                let data = result.data[0].children[0].children
                for (var i = 0; i < data.length; i++) {
                    if(i==0) {
                        li = '<li data-id="' + data[i].id + '" class="active2">' + data[i].name + '</li>';
                    }else {
                        li = '<li data-id="' + data[i].id + '">' + data[i].name + '</li>';
                    }
                    area_list.append(li);
                }
                regionId = data[0].id
                _businessList(regionId)
            }
        }
    });
}

// 获取申请业务列表
function _businessList(districtId) {
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/ApplyBusinessService/getApplyBusiness",//路径  
        dataType: "json",
        data: {
            "districtId": districtId,
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                // 即时办结
                data.immediateList = result.data.forthwith
                data.settlementList = result.data.onlineAudit
            }
            layui.use('laytpl', function () {
                laytpl = layui.laytpl;
                var getTpl = document.getElementById('immediatelist').innerHTML
                    , view = document.getElementById('immediate');
                laytpl(getTpl).render(data, function (html) {
                    view.innerHTML = html;
                });

                // 网上预审
                var getTpl = document.getElementById('settlementlist').innerHTML
                    , view = document.getElementById('settlement');
                laytpl(getTpl).render(data, function (html) {
                    view.innerHTML = html;
                });
            });
        }
    });
}


var data = { //数据
    "immediateList": [],
    "settlementList": []
};