workFlow.js 6.22 KB
var business;
//获取业务配置信息
function getBusinessConfig(ywid, businessno) {
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/ApplyBusinessService/getBusinessFlow",//路径  
        dataType: "json",
        async: false,
        data: {
            "ywid": ywid,
            "businessNo": businessno
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                business = result.data;
            }
        }
    });
}

//获取业务配置信息
function loadBusinessConfig(ywid) {
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/ApplyBusinessService/getFQFBusinessFlow",//路径  
        dataType: "json",
        async: false,
        data: {
            "ywid": ywid,
            "businessNo": businessno
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                business = result.data;
            }
        }
    });
}


//获取正在办理的流程业务
function getAcceptFlow(bsm_slsq, businessno) {
    $.ajax({
        type: "get",  //提交方式  
        //contentType: 'application/json',
        url: portal.api_url + "/portal/ApplyBusinessService/getApplyFlow",//路径  
        dataType: "json",
        async: false,
        data: {
            "bsmSlsq": bsm_slsq,
            "businessNo": businessno,
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                business = result.data;
            }
        }
    });

}

//获取申请信息记录
function getApplyRecord(bsm_slsq, businessno) {
    let bdc = null;
    $.ajax({
        type: "get",  //提交方式  
        //contentType: 'application/json',
        url: portal.api_url + "/portal/FillInformation/getDetailBybsmSlsq",//路径  
        dataType: "json",
        async: false,
        data: {
            "bsmSlsq": bsm_slsq,
            "businessNo": businessno,
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200 && result.data != null) {
                bdc = result.data;
            }
        }
    });
    return bdc;
}


//设置步骤条信息
function setArticleSteps() {
    $('.name_title h2').text(business.shortName);
    var ArticleContent = $("#app_progress");
    $.each(business.stepList, function (index, item) {
        switch (item.stepState) {
            case 0:
                ArticleContent.append('<li class="item_proress"><p></p><h5>' + item.stepname + '</h5></li>');
                if ((index + 1) < business.stepList.length) {
                    ArticleContent.append('<li class="layui-progress"><div class="layui-progress-bar" lay-percent="0%"></div></li>');
                }
                break;
            case 1:
                ArticleContent.append('<li class="item_proress"><p class="activeing"></p><h5 class="activeingtext">' + item.stepname + '</h5></li>');
                if ((index + 1) < business.stepList.length) {
                    ArticleContent.append('<li class="layui-progress"><div class="layui-progress-bar" lay-percent="50%"></div></li>');
                }
                break;
            case 2:
                ArticleContent.append('<li class="item_proress"><p class="active"></p><h5>' + item.stepname + '</h5></li>');
                if ((index + 1) < business.stepList.length) {
                    ArticleContent.append('<li class="layui-progress"><div class="layui-progress-bar" lay-percent="100%"></div></li>');
                }
                break;
        }
    });
}

//获取业务发起流程方法
function getInitiateFLow(ywid, businessno) {
    getBusinessConfig(ywid, businessno);
    window.open(portal.rootPath + business.stepList[0].pageurl + "?ywid=" + ywid + "&businessno=" + businessno, "_self")
}

//发起流程方法
function createBusinesseFlow(ywid) {
    loadBusinessConfig(ywid);
    window.open(portal.rootPath + business.stepList[0].pageurl + "?ywid=" + ywid + "&businessno=" + business.businessno, "_self")
}


//工作箱调取流程方法
function getWorkBoxFLow(bsm_slsq, businessno) {
    getAcceptFlow(bsm_slsq, businessno);
    var pageurl;
    $.each(business.stepList, function (index, item) {
        if (item.stepState == 1) {
            pageurl = item.pageurl;
            return;
        }
    });
    window.open(portal.rootPath + pageurl + "?bsm_slsq=" + bsm_slsq + "&businessno=" + businessno, "_self")
}


//设置首环节页面相关内容
function setFristStepPageFLow(ywid, businessno) {
    getBusinessConfig(ywid, businessno);
    setArticleSteps();
}

//设置正在办理页面相关内容
function setAcceptFlow(bsmSlsq, businessNo) {
    getAcceptFlow(bsmSlsq, businessNo);
    setArticleSteps();
}

//跳转下一个环节页面
function skipNextPage(bsm_slsq, businessno) {
    var nextStepIndex;
    $.each(business.stepList, function (index, item) {
        if (item.stepState == 1) {
            nextStepIndex = index + 1;
            return;
        }
    });
    var datajson = {
        "bsmSlsq": bsm_slsq,
        "businessNo": businessno,
        "stepNo": business.stepList[nextStepIndex].stepno
    };
    //更新当前流程所处环节
    $.ajax({
        type: "post",  //提交方式  
        contentType: 'application/json',
        url: portal.api_url + "/portal/FillInformation/updateStepNo",//路径  
        dataType: "json",
        async: false,
        data: JSON.stringify(datajson),
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200) {
                window.location.href = portal.rootPath + business.stepList[nextStepIndex].pageurl + "?bsm_slsq=" + bsm_slsq + "&businessno=" + businessno;
            }
        }
    });
}