wdyw.js 9.06 KB
layui.use('element', function () {
    let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function (elem) {
        //console.log(elem)
        layer.msg(elem.text());
    });
});
$(function () {
    _applyBusinessRecord()
    _applyBusinessAJZTCount()
    $('.business_titleList li a').click(function () {
        $('.business_titleList li a').removeClass('itemTitleActive')
        $(this).addClass('itemTitleActive')
        let dataId = ($(this).attr('data-id'))
        if (dataId == '1') {
            _applyBusinessRecord()
            dataRendering(dataList.list)
        } else if (dataId == '2') {
            _applyBusinessWiat()
            dataRendering(dataList.list)
        } else if (dataId == '3') {
            _applyBusinessIn()
            dataRendering(dataList.list)
        } else if (dataId == '6') {
            _applyBusinessEnd()
            dataRendering(dataList.list)
        }
    })

    $(document).on("click", ".appintmentList li .handle", function () {
        let businessNo = $(this).attr('data-businessNo');
        let slsqBsm = $(this).attr('data-slsqBsm');
        getWorkBoxFLow(slsqBsm, businessNo)
    })
    // 业务列表操作

    $(document).on("click", ".delete", function () {
        let slsqBsm = $(this).attr('slsqBsm')
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.confirm('此操作将删除业务是否继续?', {
                scrollbar: false,
                btn: ['是', '否'] //按钮
            }, function () {
                _listDel(slsqBsm)
            }, function () {
                layer.closeAll();
            });
        });
    })
  $('#zjhm').text(getCookie().zjhm)
  $('#username').text(getCookie().username )
})

// 列表操作

function _listDel(slsqBsm) {
    $.ajax({
        type: "delete",  //提交方式  
        url: portal.api_url + "/portal/FillInformation/deleteSlsqBybsmSlsq?bsmSlsq="+slsqBsm,//路径  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            if (result.code == 200) {
                layer.msg('操作成功!');
                _applyBusinessAJZTCount()
                _applyBusinessRecord()
                dataRendering(dataList.list)
            }
        }
    });
}


//网上申请业务待提交
function _applyBusinessWiat(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessWait",//路径  
        dataType: "json",
        data: {
            "userId": getCookie().userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentList').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}
//网上申请业务正在办理
function _applyBusinessIn(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessIn",//路径  
        dataType: "json",
        data: {
            "userId": getCookie().userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentList').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}

//网上申请业务已办结
function _applyBusinessEnd(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessEnd",//路径  
        dataType: "json",
        data: {
            "userId": getCookie().userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentList').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}

//网上申请业务记录
function _applyBusinessRecord(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessRecord",//路径  
        dataType: "json",
        data: {
            "userId": getCookie().userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentList').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total, result.data.current);
        }
    });
}

// 网上申请业务案件状态数量统计
function _applyBusinessAJZTCount() {
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessAJZTCount?userId=" + dataList.userid,//路径  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            $('.applyBusinessRecord span').text(result.data.allBusinessCount)
            $('.to_be_submitted span').text(result.data.businessWaitCount)
            $('.applyBusinessIn span').text(result.data.businessInProcessCount)
            $('.applyBusinessEnd span').text(result.data.businessEndCount)
        }
    });
}


// 分页
function paged(pageCount, curr) {
    layui.use('laypage', function () {
        let laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
            , count: pageCount //数据总数,从服务端得到
            , curr: curr
            , prev: '<'
            , next: '>'
            , theme: '#0091FF'
            , jump: function (obj, first) {
                if (!first) {
                    console.log(obj.curr)
                    _applyBusinessRecord(obj.curr);
                }
            }
        });
    })
}


// 列表数据渲染

function dataRendering() {
    for (var i = 0; i < dataList.list.length; i++) {
        li = '<li data-slsqBsm="' + dataList.list[i].slsqBsm + '" data-businessNo="' + dataList.list[i].businessNo + '">';
        if (dataList.list[i].ajzt == '1') {
            li += '<span class="state tobeSubmit">正在填写</span>'
        } else if (dataList.list[i].ajzt == '2') {
            li += '<span class="state dataReview">资料审核</span>'
        } else if (dataList.list[i].ajzt == '3') {
            li += '<span class="state pay">缴费</span>'
        } else if (dataList.list[i].ajzt == '4') {
            li += '<span class="state return">退回</span>'
        } else if (dataList.list[i].ajzt == '5') {
            li += '<span class="state reject">驳回</span>'
        } else {
            li += '<span class="state success">办理成功</span>'
        }
        li += ' <div class="business_name">'
        li += '<h5>' + dataList.list[i].djywjc + '</h5>'
        li += '<p>权力类型:' + dataList.list[i].qllxmc + '</p>'
        li += '</div>'
        li += '<div>'
        li += '<p>权利人</p>'
        li += '<p>' + dataList.list[i].qlrmc + '</p>'
        li += '</div>'
        li += '<div>'
        li += '<p>义务人</p>'
        li += '<p>' + dataList.list[i].ywrmc + '</p>'
        li += '</div>'
        li += '<div>'
        li += '<p>办理流水</p>'
        li += '<p>' + dataList.list[i].wwsqbh + '</p>'
        li += '</div>'
        li += '<div>'
        li += '<p>办理时间</p>'
        li += '<p>' + dataList.list[i].sqrq + '</p>'
        li += '</div>'
        li += '<a slsqBsm="'+dataList.list[i].slsqBsm+'" class="delete">删除</a>'
        if (dataList.list[i].ajzt == '1') {
            li += '<a class="handle" data-slsqBsm="' + dataList.list[i].slsqBsm + '" data-businessNo="' + dataList.list[i].businessNo + '">继续办理</a>'
        } else if (dataList.list[i].ajzt == '3') {
            li += '<a slsqBsm="'+dataList.list[i].slsqBsm+'" class="handle">缴费</a>'
        }
        $('.appintmentList').append(li)
    }
}

var dataList = {
    "list": [],
    "userid": getCookie().userid
};