首页 > 代码库 > 判断人员js

判断人员js


var allchooseEmpID = "";
var allchooseEmpName = "";
//自选经办人
function getJbrWinForMy() {

    top.MainFrameJS.openWindow({
        width: 800,
        height: 600,
        modal: true,
        collapsible: false,
        minimizable: false,
        // initData: { values: $("#txt_hideJBJSRY").val(), texts: $("#txt_JBJSRY").val() },
        title: "选择经办人",
        onBeforeClose: function () {

 

 

            var count = params.NodeData.length;
            var data = http://www.mamicode.com/eval(top.MainFrameJS.getWinData());
            if (data != null && data.length > 0) {
                var faburenid = "";
                var faburenname = "";
                for (var i = 0; i < data.length; i++) {
                    faburenid += data[i].UserId + ‘,‘;
                    faburenname += data[i].RealName + ‘,‘;

                    //拼接字符
                    if (count > 0) {
                        var FLOWNUMBER = getQueryString("flowNumber");
                        var StrNodeArry = {
                            "ID": "", "SEQUENCE": $("#txt_SEQUENCEMAXID").text(), "FLOWNUMBER": FLOWNUMBER, "NODENUM": params.NodeData[0].NODENUM, "NODENAME": params.NodeData[0].NAME,
                            "JBROBJECTID": data[i].UserId, "JBROBJECTNAME": data[i].RealName, "DOTYPE": 0,
                            "ENTRUSTID": "", "ENTRUSTNAME": "", "NODENUMBER": params.NodeData[0].NODENUMBER, "NODEID": params.NodeData[0].NODEID
                        };
                        params.param.NodeArry.push(StrNodeArry);
                    }
                }

                var allfaburenid = "";
                var allfaburenname = "";
                allfaburenid += faburenid;
                allfaburenname += faburenname;
             
                faburenid = faburenid.substr(0, faburenid.length - 1);
                faburenname = faburenname.substr(0, faburenname.length - 1);
                IndexCountJBR(faburenname, allfaburenid, allfaburenname);  //判断包含

                params.param.jsonflow = { "Nodes": params.param.NodeArry };

 


            }

        }
    }, "../SearchEmp/SearchEmpList?choose=M");


}
//选择部门
function unitNameChoose() {

    top.MainFrameJS.openWindow({
        width: 800,
        height: 550,
        modal: true,
        collapsible: false,
        minimizable: false,
        //   initData: { values: $("#txt_hideJBBMObjectName").val(), texts: $("#JBBMObjectName").val() },
        appointData: { type: ‘org‘, rows: params.untinNameRows },

        title: "部门选择",
        onBeforeClose: function () {
            var data = http://www.mamicode.com/eval(top.MainFrameJS.getWinData());
            if (data != null && data.length > 0) {
                var faburenid = "";
                var faburenname = "";
                for (var i = 0; i < data.length; i++) {
                    faburenid += data[i].UserId + ‘,‘;
                    faburenname += data[i].RealName + ‘,‘;

                }

                var allfaburenid = "";
                var allfaburenname = "";
                allfaburenid += faburenid;
                allfaburenname += faburenname;

                faburenid = faburenid.substr(0, faburenid.length - 1);
                faburenname = faburenname.substr(0, faburenname.length - 1);
                IndexCountJBR(faburenname, allfaburenid, allfaburenname);  //判断包含

            }
        }
    }, "../SearchEmp/SearchEmpList?choose=M");

}
//待选经办人
function jbrWinOpen() { //弹出窗口
    top.MainFrameJS.openWindow({
        width: 600,
        height: 400,
        modal: true,
        collapsible: false,
        minimizable: false,
        initData: { values: $("#txt_hideJBRY").val(), texts: $("#txt_JBRY").val() },
        title: "待选人员",
        onBeforeClose: function () {
            var data = http://www.mamicode.com/eval(top.MainFrameJS.getWinData());
            if (data != null) {
                var faburenid = "";
                var faburenname = "";
                for (var i = 0; i < data.length; i++) {
                    faburenid += data[i].UserId + ‘,‘;
                    faburenname += data[i].RealName + ‘,‘;
                }

                var allfaburenid = "";
                var allfaburenname = "";
                allfaburenid += faburenid;
                allfaburenname += faburenname;

                faburenid = faburenid.substr(0, faburenid.length - 1);
                faburenname = faburenname.substr(0, faburenname.length - 1);
                IndexCountJBR(faburenname, allfaburenid, allfaburenname);  //判断包含


            }


        }
    }, "../AddWorkFlow/JbrWinList");

}


//经办岗位
function getJbGwWin() {
    top.MainFrameJS.openWindow({
        width: 800,
        height: 550,
        modal: true,
        collapsible: false,
        minimizable: false,
        // initData: { values: $("#txt_hideJBZWObjectName").val(), texts: $("#JBZWObjectName").val() },
        appointData: { type: ‘role‘, rows: params.gwNameRows },
        title: "选择岗位人员",
        onBeforeClose: function () {
            var data = http://www.mamicode.com/eval(top.MainFrameJS.getWinData());

 

            if (data != null && data.length > 0) {
                var faburenid = "";
                var faburenname = "";
                for (var i = 0; i < data.length; i++) {
                    faburenid += data[i].UserId + ‘,‘;
                    faburenname += data[i].RealName + ‘,‘;
                }

                var allfaburenid = "";
                var allfaburenname = "";
                allfaburenid += faburenid;
                allfaburenname += faburenname;

                faburenid = faburenid.substr(0, faburenid.length - 1);
                faburenname = faburenname.substr(0, faburenname.length - 1);
                IndexCountJBR(faburenname, allfaburenid, allfaburenname);  //判断包含

 

            }

        }
    }, "../SearchEmp/SearchEmpList?choose=M"); // "../SearchRole/SearchRoleList?choose=M");

}
function getJQJbrWin() {
    top.MainFrameJS.openWindow({
        width: 800,
        height: 550,
        modal: true,
        collapsible: false,
        minimizable: false,
        title: "选择加签人",
        onBeforeClose: function () {
            var count = params.NodeData.length;
            var data = http://www.mamicode.com/eval(top.MainFrameJS.getWinData());
            if (data != null && data.length > 0) {
                var faburenid = "";
                var faburenname = "";
                for (var i = 0; i < data.length; i++) {
                    faburenid += data[i].UserId + ‘,‘;
                    faburenname += data[i].RealName + ‘,‘;
                }
                faburenid = faburenid.substr(0, faburenid.length - 1);
                faburenname = faburenname.substr(0, faburenname.length - 1);

                $("#txt_JQR").val(faburenname);
                $("#txt_hidetxt_JQR").val(faburenid);


            }

        }
    }, "../SearchEmp/SearchEmpList?choose=S");


}
//判断是否包含人员为真代表有
function IndexCountJBR(readName, allfaburenid, allfaburenname) {

    var name = "";
    var jbryCount = $("#txt_JBJSRY").val(); //经办接收人
    var strs = new Array(); //定义一数组
    strs = jbryCount.split(","); //分隔经办接收人text里面的经办人

    var strsChoose = new Array(); //定义一数组
    strsChoose = readName.split(","); //分隔选择人员的js

 


    if (strs.length > 0 && strsChoose.length > 0) {
        for (var i = 0; i < strs.length; i++) {
            for (var j = 0; j < strsChoose.length; j++) {
                if (strs[i] == strsChoose[j]) {
                    name += strs[i] + ",";

                }

            }
        }

        name = name.substr(0, name.length - 1);

    }

    if (name.length > 0) {
        alert(‘已存在‘ + name);
        return false;

    } else {

        allchooseEmpID += allfaburenid;
        allchooseEmpName += allfaburenname;
        $("#txt_JBJSRY").val(allchooseEmpName.substr(0, allchooseEmpName.length - 1));
        $("#txt_hideJBJSRY").val(allchooseEmpID.substr(0, allchooseEmpID.length - 1));

    }

}