function getProAddress(form,proId) {
    tree.render({
        elem: '#proId',
        data: cityData,
        showLine: false  // 是否开启连接线
    });
};

function reloadTip(tip,message,type,layNotify){
    layNotify.notice({
        title: tip+"提示",
        type: type,
        message: message
    });
}

/**
 * 获取分公司数据
 * @param id 工种id
 */
function getOrgName(from,id) {
    $("#orgId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getBranchName',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择分公司</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#orgId").html(html);
            layui.form.render("select");
        },
        error: function (err) {
            console.log("获取分公司数据失败：", err);
        }
    });
}
/**
 * 获取分公司数据
 * @param id 工种id
 */
function getAnnouncementType(from,id) {
    $("#type").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getAnnouncementType',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择公告类型</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#type").html(html);
            layui.form.render("select");
        },
        error: function (err) {
            console.log("获取分公司数据失败：", err);
        }
    });
}

/**
 * 获取项目部数据
 * @param id 工种id
 */
function getProjectName(from,id) {
    $("#projectIds").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getProjectName',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择项目部</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#projectIds").html(html);
            layui.form.render("select");
        },
        error: function (err) {
            console.log("获取分公司数据失败：", err);
        }
    });
}

/**
 * 获取电压等级
 * @param id 工种id
 */
function getVoltageLevel(from,id) {
    $("#volLevelIds").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getVoltageLevel',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择电压等级</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id || id == res[i].name){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#volLevelIds").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取电压等级数据失败：", err);
        }
    });
}

/**
 * 获取工程名称
 * @param id 工种id
 */
function getEngineerLevel(from,id) {
    console.log("id:"+id)
    console.log("from:"+from)
    $("#engineerIds").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getEngineerLevel',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择工程</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id || id == res[i].name){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#engineerIds").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取电压等级数据失败：", err);
        }
    });
}

/**
 * 获取承包商
 * @param from
 * @param id
 */
function getSub(from,id) {
    $("#subId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getSub',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择分包商</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#subId").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取分包商数据失败：", err);
        }
    });
}
/**
 * 获取自由班组标准班组
 * @param from
 * @param id
 */
function getstrandTeamType(from,id,teamTypeId) {
    $("#standardTeamTypeId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getStrandTeamType',
        data:{
            id:teamTypeId
        },
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择标准班组</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#standardTeamTypeId").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取分包商数据失败：", err);
        }
    });
}
/**
 * 根据班组类别获取标准班组类型
 * @param from
 * @param id
 */
function getStandardTeamTypeForSubTeamId(from,subTeamId) {
    $("#teamTypeId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getStandardTeamTypeForSubTeamId',
        async: false,
        data:{
            id : subTeamId
        },
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择标准班组类型</option>';
            for(var i=0;i<res.length;i++){
                html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
            }
            $("#teamTypeId").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取标准班组类型数据失败：", err);
        }
    });
}
function getStandardTeamType(from,id) {
    $("#teamTypeId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getStandardTeamType',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择标准班组类型</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#teamTypeId").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取标准班组类型数据失败：", err);
        }
    });
}
/**
 * 获取团队类型
 * @param id 工种id
 */
function getTeamType(from,id,volId) {
    $("#teamTypeId").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getTeamType',
        async: false,
        data: {
            id : volId
        },
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">请选择团队类型</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#teamTypeId").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取电压等级数据失败：", err);
        }
    });
}

/**
 * 获取团队类型
 * @param id 工种id
 */
function getTowerType(from,id) {
    $("#teamType").empty();
    let res = [];
    let child1 ={'id':"1",'dictKey':'基础'};
    let child2 ={'id':"2",'dictKey':'组塔'};
    let child3 ={'id':"3",'dictKey':'架线'};
    res.push(child1);
    res.push(child2);
    res.push(child3);
    var html = '';
    html  += '<option value="">请选择团队类型</option>';
    for(var i=0;i<res.length;i++){
        if(id == res[i].id){
            html += '<option selected value=\'' + res[i].id + '\'>' + res[i].dictKey + '</option>';
        }else{
            html += '<option value=\'' + res[i].id + '\'>' + res[i].dictKey + '</option>';
        }
    }
    $("#teamType").html(html);
    form.render("select");
}
/**
 *
 * 获取角色下拉框
 * @param form          //form对象
 * @param roleId      //下拉框选中id
 */
function getRole(form,roleId) {
    $("#roleId").html("");
    $.ajax({
        type: 'post',
        url: ctxPath + '/users/getRole',
        data: {
        },
        async: false,
        success: function (data) {
            var html = '<option value="">--请选择人员角色--</option>';
            for (var i = 0; i < data.length; i++) {
                if (roleId == data[i].key) {
                    html += '<option selected="selected" value=\'' + data[i].key + '\'>' + data[i].value + '</option>';
                } else {
                    html += '<option value=\'' + data[i].key + '\'>' + data[i].value + '</option>';
                }
            }
            $("#roleId").html(html);
            layui.form.render('select');  //这里就是我们要渲染的地方了
            // form.render('select' ,'combinType');
        },
        error: function (err) {
            console.log("获取人员角色下拉列表出错：", err);
        }
    });
}

/**
 * 获取设备工序
 * @param id 工种id
 */
function getProcessEquipment(from,id) {
    $("#dictKey").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getProcessEquipment',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            html  += '<option value="">设备类型</option>';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id || id == res[i].name){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#dictKey").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取设备工序数据失败：", err);
        }
    });
}

/**
 * 获取预释放日期
 * @param id
 */
function getReleaseData(from,id) {
    $("#releaseData").empty();
    $.ajax({
        type: 'post',
        url: ctxPath + '/selectUtil/getReleaseData',
        async: false,
        success: function (data) {
            var res = data;
            var html = '';
            for(var i=0;i<res.length;i++){
                if(id == res[i].id || id == res[i].name){
                    html += '<option selected value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }else{
                    html += '<option value=\'' + res[i].id + '\'>' + res[i].name + '</option>';
                }
            }
            $("#releaseData").html(html);
            form.render("select");
        },
        error: function (err) {
            console.log("获取电压等级数据失败：", err);
        }
    });
}