';
if (major1Array) {
for (var i = 0; i < major1Array.length; i++) {
if (QS_major[major1Array[i]]) {
if (QS_major[major1Array[i]].split('`')) {
var major11Array = QS_major[major1Array[i]].split('`');
htmlMajor += '
';
for (var j = 0; j < major11Array.length; j++) {
if (major11Array[j].split(',')) {
var jArray = major11Array[j].split(',');
htmlMajor += ['
', '', '
'].join('');
}
}
htmlMajor += '
';
}
}
}
}
htmlMajor += '
';
htmlMajor += '';
htmlMajor += '
';
}
prepareModal(titleValue, multipleValue, maxNumValue);
$('.J_modal_content').html(htmlMajor);
$('.J_btnyes').attr('id', 'J_btnyes_major');
$('.J_modal_content .right_box .list_nav').eq(0).show();
$('.J_list_major_parent').eq(0).addClass('current');
$('.modal_dialog').css({
width: widthValue + 'px',
left: ($(window).width() - widthValue) / 2,
top: ($(window).height() - $('.modal_dialog').outerHeight()) / 2 + $(document).scrollTop()
});
$('.modal_backdrop').addClass('in');
// 恢复选中
var recoverValue = $('#J_showmodal_major .J_resultcode_major').val();
if (recoverValue.length) {
if (multipleValue) {
var recoverValueArray = recoverValue.split(',');
for (var i = 0; i < recoverValueArray.length; i++) {
$('.J_list_major').each(function(index, el) {
if ($(this).data('code') == recoverValueArray[i]) {
$(this).addClass('seledted');
}
});
}
copyMajorSelected();
} else {
$('.J_list_major').each(function(index, el) {
if ($(this).data('code') == recoverValue) {
$(this).addClass('seledted');
}
});
}
$('.J_list_major_parent').removeClass('seledted current');
$('.J_list_major.seledted').each(function(index, el) {
var thisGroup = $(this).closest('.J_list_major_group');
var subscriptValue = $('.J_list_major_group').index(thisGroup);
$('.J_list_major_parent').eq(subscriptValue).addClass('seledted');
});
$('.J_list_major_parent.seledted').first().click();
}
$('.J_list_major_parent').on('click', function() {
$(this).addClass('current').siblings('.J_list_major_parent').removeClass('current');
var subscriptValue = $('.J_list_major_parent').index(this);
$('.J_list_major_group').eq(subscriptValue).show().siblings('.J_list_major_group').hide();
});
$('.J_list_major').off().on('click', function() {
if ($(this).hasClass('seledted')) {
$(this).removeClass('seledted');
if (multipleValue) {
copyMajorSelected();
}
var thisGroup = $(this).closest('.J_list_major_group');
var subscriptValue = $('.J_list_major_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_major_parent').eq(subscriptValue).removeClass('seledted').addClass('current');
}
} else {
$(this).addClass('seledted');
if (multipleValue) {
if ($('.J_list_major.seledted').length > maxNumValue) {
$(this).removeClass('seledted');
disapperTooltip("remind", '最多选择' + maxNumValue + '个');
return false;
} else {
copyMajorSelected();
}
var thisGroup = $(this).closest('.J_list_major_group');
var subscriptValue = $('.J_list_major_group').index(thisGroup);
$('.J_list_major_parent').eq(subscriptValue).addClass('seledted');
} else {
var code = $(this).data('code');
var title = $(this).data('title');
$('#J_showmodal_major .J_resultcode_major').val(code);
$('#J_showmodal_major .J_resuletitle_major').text(title);
$('#J_showmodal_major .J_resuletitle_major').attr('title', title);
$('.modal_backdrop').remove();
$('.modal').remove();
}
}
});
// 同步(关键)
function copyMajorSelected() {
var htmlListed = '';
$('.J_list_major.seledted').each(function(index, el) {
var listedCode = $(this).data('code');
var listedTitle = $(this).data('title');
htmlListed += ['
'].join('');
});
$('#J_listed_content').html(htmlListed);
if ($('.J_listed_major').length) {
$('#J_listed_group').addClass('nmb');
} else {
$('#J_listed_group').removeClass('nmb');
}
$('#J_listed_group').show();
}
// 已选分类点击
$('.J_listed_major').off().on('click', function() {
var listedValue = $(this).data('code');
$('.J_list_major').each(function(index, el) {
if ($(this).data('code') == listedValue) {
$(this).removeClass('seledted');
var thisGroup = $(this).closest('.J_list_major_group');
var subscriptValue = $('.J_list_major_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_major_parent').eq(subscriptValue).removeClass('seledted');
}
}
});
copyMajorSelected();
});
// 清空
$('#J_listed_clear').on('click', function() {
$('.J_list_major.seledted').each(function(index, el) {
$(this).removeClass('seledted');
});
$('.J_list_major_parent').removeClass('seledted');
copyMajorSelected();
});
// 确定
$('#J_btnyes_major').off().on('click', function() {
var checkedArray = $('.J_list_major.seledted');
var codeArray = new Array();
var titleArray = new Array();
$.each(checkedArray, function(index, val) {
codeArray[index] = $(this).data('code');
titleArray[index] = $(this).data('title');
});
$('#J_showmodal_major .J_resultcode_major').val(codeArray.join(','));
;$('#J_showmodal_major .J_resuletitle_major').text(titleArray.length ? titleArray.join('+') : '请选择');
$('#J_showmodal_major .J_resuletitle_major').attr('title', titleArray.length ? titleArray.join('+') : '请选择');
removeModal();
});
});
// 点击显示地区分类
$('#J_showmodal_city').on('click', function() {
var titleValue = $(this).data('title');// 标题
var multipleValue = eval($(this).data('multiple')); // 是否多选
var maxNumValue = eval($(this).data('maxnum')); // 最多选择的数量
var widthValue = eval($(this).data('width')); // 内容的宽度
var htmlCity = '';
var categoryValue = eval($(this).data('category')); // 几级分类的标识
var addJob = eval($(this).data('addjob')); // 是否是发布职位
// 发职位标识
var classifyModel = 0;
// 标记二级还是三级分类
categoryValue > 2 ? classifyModel = 0 : classifyModel = 1;
if (classifyModel) {
// 二级分类
if (QS_city_parent) {
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
// 生成一级分类
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var iArray = QS_city_parent[i].split(',');
htmlCity += ['
', '', '
'].join('');
}
}
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_parent) {// 生成二级分类
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {// 一级分类是否存在
var city1Array = QS_city_parent[i].split(',');
if (QS_city[city1Array[0]]) {// 是否存在该一级分类对应的子分类
if (QS_city[city1Array[0]].split('`')) {// 子分类是否为空
var city11Array = QS_city[city1Array[0]].split('`');
htmlCity += '
';
if (!addJob) {// 发布职位不出现不限
htmlCity += ['
', '', '
'].join('');
}
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += ['
', '', '
'].join('');
}
}
htmlCity += '
';
}
} else {// 子分类为空
htmlCity += '
';
if (addJob) {// 发布职位时给出提示,不出现不限
// 发布职位
htmlCity += ['
', '', '
'].join('');
} else {// 无子分类显示不限
htmlCity += ['
', '', '
'].join('');
}
htmlCity += '
';
}
}
}
}
htmlCity += '
';
htmlCity += '';
htmlCity += '
';
}
prepareModal(titleValue, multipleValue, maxNumValue); // 初始化二级地区弹出框
$('.J_modal_content').html(htmlCity);// 弹出框写入内容(根据缓存转换来的html)
$('.J_btnyes').attr('id', 'J_btnyes_city');// 确定按钮绑定ID
$('.J_modal_content .right_box .list_nav').eq(0).show();
// 二级分类列表的第一个为显示状态,后面会根据是否需要恢复来重置
$('.J_list_city_parent').eq(0).addClass('current');
// 一级分类的第一个添加选中状态,后面会根据是否需要恢复来重置
$('.modal_dialog').css({// 弹出框位置在屏幕正中
width: widthValue + 'px',
left: ($(window).width() - widthValue) / 2,
top: ($(window).height() - $('.modal_dialog').outerHeight()) / 2 + $(document).scrollTop()
});
$('.modal_backdrop').addClass('in');// 半透明遮罩层添加动画的效果
// 一级分类绑定事件
$('.J_list_city_parent').on('click', function() {
$(this).addClass('current').siblings('.J_list_city_parent').removeClass('current');
var subscriptValue = $('.J_list_city_parent').index(this);
$('.J_list_city_group').eq(subscriptValue).show().siblings('.J_list_city_group').hide();
});
// 恢复选中
var recoverValue = $('#J_showmodal_city .J_resultcode_city').val();
if (recoverValue.length) {// 隐藏表单中有值就进行复原
// 原理->将隐藏表单中已选的值分割分别与弹出框二级列表的data-code比对,如果相同就添加选中(这里如果是三级数据会导致匹配不上,出现弹出框中复原不了选中,需要重新选择保存)。
if (multipleValue) {// 多选
var recoverValueArray = recoverValue.split(',');
for (var i = 0; i < recoverValueArray.length; i++) {
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == recoverValueArray[i]) {
$(this).addClass('seledted');
}
});
}
copyCitySelectedSecond();// 调用选择同步的方法给复原选中的项目绑定相应的事件。
} else {// 单选
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == recoverValue) {
$(this).addClass('seledted');
}
});
}
// 重置一级分类的选中情况
$('.J_list_city_parent').removeClass('seledted current');
$('.J_list_city.seledted').each(function(index, el) {
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
$('.J_list_city_parent').eq(subscriptValue).addClass('seledted');
});
$('.J_list_city_parent.seledted').first().click();// 选中列表的第一个显示
}
// 不限绑定事件
$('.J_list_city_nolimit').off().on('click', function() {
var thisGroup = $(this).closest('.J_list_city_group');
thisGroup.find('.J_list_city').not('.J_list_city_nolimit').removeClass('seledted');
});
// 二级分类绑定事件
$('.J_list_city').off().on('click', function() {
if ($(this).hasClass('seledted')) { // 已经是选中状态
$(this).removeClass('seledted');
if (multipleValue) { // 多选情况下需要同步已选列表
copyCitySelectedSecond();
}
// 判断当前分类下是否还有选中的项目,如果没有其他选中项目则将对应的一级分类已选状态去掉
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_city_parent').eq(subscriptValue).removeClass('seledted').addClass('current');
}
} else { // 未选中状态
$(this).addClass('seledted');
if (multipleValue) {
if (!$(this).is('.J_list_city_nolimit')) {// 判断是否点击的是不限
var thisGroup = $(this).closest('.J_list_city_group');
thisGroup.find('.J_list_city_nolimit').removeClass('seledted');
}
// 是否超出最大选择数量
if ($('.J_list_city.seledted').length > maxNumValue) {
$(this).removeClass('seledted');
disapperTooltip("remind", '最多选择' + maxNumValue + '个');
return false;
} else {
copyCitySelectedSecond();
}
// 将对应的一级分类添加已选状态
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
$('.J_list_city_parent').eq(subscriptValue).addClass('seledted');
} else {// 单选直接赋值然后关闭弹出框
var code = $(this).data('code');
var title = $(this).data('title');
$('#J_showmodal_city .J_resultcode_city').val(code);
$('#J_showmodal_city .J_resuletitle_city').text(title);
$('#J_showmodal_city .J_resuletitle_city').attr('title', title);
$('.modal_backdrop').remove();
$('.modal').remove();
}
}
});
// 同步选择与已选列表
function copyCitySelectedSecond() {
var htmlListed = '';
$('.J_list_city.seledted').each(function(index, el) {
var listedCode = $(this).data('code');
var listedTitle = $(this).data('title');
htmlListed += ['
'].join('');
});
$('#J_listed_content').html(htmlListed);
if ($('.J_listed_city').length) {
$('#J_listed_group').addClass('nmb');
} else {
$('#J_listed_group').removeClass('nmb');
}
$('#J_listed_group').show();
}
// 已选列表绑定时间
$('.J_listed_city').off().on('click', function() {
var listedValue = $(this).data('code');
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == listedValue) {
$(this).removeClass('seledted');
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_city_parent').eq(subscriptValue).removeClass('seledted');
}
}
});
copyCitySelectedSecond();
});
// 清空已选
$('#J_listed_clear').on('click', function() {
$('.J_list_city.seledted').each(function(index, el) {
$(this).removeClass('seledted');
});
$('.J_list_city_parent').removeClass('seledted');
copyCitySelectedSecond();
});
// 二级地区确定按钮绑定事件
$('#J_btnyes_city').off().on('click', function() {
var checkedArray = $('.J_list_city.seledted');
var codeArray = new Array();
var titleArray = new Array();
$.each(checkedArray, function(index, val) {
codeArray[index] = $(this).data('code');
titleArray[index] = $(this).data('title');
});
$('#J_showmodal_city .J_resultcode_city').val(codeArray.join(','));
$('#J_showmodal_city .J_resuletitle_city').text(titleArray.length ? titleArray.join('+') : '请选择');
$('#J_showmodal_city .J_resuletitle_city').attr('title', titleArray.length ? titleArray.join('+') : '请选择');
removeModal();
});
} else {
// 三级分类
if (QS_city_parent) {
var city2Array = new Array();// 创建数组用来存放生成三级分类的依照
var htmlCity = '
';
htmlCity += '
';
htmlCity += '
';
// 生成一级分类
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var iArray = QS_city_parent[i].split(',');
htmlCity += ['
', '', '
'].join('');
}
}
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_parent) {
// 生成二级分类
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {// 是否存在一级分类
var city1Array = QS_city_parent[i].split(',');
if (QS_city[city1Array[0]]) {// 该分类下对应的子分类是否存在
if (QS_city[city1Array[0]].split('`')) {// 子分类是否为空
var city11Array = QS_city[city1Array[0]].split('`');
htmlCity += '
';
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += ['
';
if (city2Array) {
if (multipleValue) { // 多选
for (var i = 0; i < city2Array.length; i++) {
if (city2Array[i].split('.')) { // 二级分类是否存在
var combinationArray = city2Array[i].split('.');
if (QS_city[combinationArray[1]]) { // 三级分类是否存在
if (QS_city[combinationArray[1]].split('`')) {// 三级分类是否为空
var city22Array = QS_city[combinationArray[1]].split('`');
htmlCity += '
';
if (!addJob) {// 发职位时需要选择最后一级,不出现不限。
htmlCity += ['
', '', '
'].join('');
}
for (var j = 0; j < city22Array.length; j++) {
if (city22Array[j].split(',')) {
var jArray = city22Array[j].split(',');
htmlCity += ['
', '', '
'].join('');
}
}
htmlCity += '
';
}
} else {// 三级分类不存在
htmlCity += '
';
if (addJob) {
// 发布职位时最后一级不存在则给出提示
htmlCity += ['
'].join('');
});
$('#J_listed_content').html(htmlListed);
if ($('.J_listed_city').length) {
$('#J_listed_group').addClass('nmb');
} else {
$('#J_listed_group').removeClass('nmb');
}
$('#J_listed_group').show();
}
// 已选项目绑定事件
$('.J_listed_city').off().on('click', function() {
var listedValue = $(this).data('code');
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == listedValue) {
$(this).closest('li').removeClass('seledted');
$(this).prop('checked', 0);
var thisGroup = $(this).closest('.J_list_city_group2');
var subscriptValue = $('.J_list_city_group2').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_city_parent1').eq(subscriptValue).removeClass('seledted current');
var thisGroup2 = $('.J_list_city_parent1').eq(subscriptValue).closest('.J_list_city_group1');
var subscriptValue1 = $('.J_list_city_group1').index(thisGroup2);
if (!thisGroup2.find('.seledted').length) {
$('.J_list_city_parent').eq(subscriptValue1).removeClass('seledted');
}
}
}
});
copyCitySelected();
});
// 清空选择
$('#J_listed_clear').on('click', function() {
$('.J_list_city:checked').each(function(index, el) {
$(this).closest('li').removeClass('seledted');
$(this).prop('checked', 0);
});
$('.J_list_city_parent1').removeClass('seledted');
$('.J_list_city_parent').removeClass('seledted');
copyCitySelected();
});
// 三级地区确定按钮绑定事件
$('#J_btnyes_city').off().on('click', function() {
var checkedArray = $('.J_list_city:checked');
var codeArray = new Array();
var titleArray = new Array();
$.each(checkedArray, function(index, val) {
codeArray[index] = $(this).data('code');
titleArray[index] = $(this).data('title');
});
$('#J_showmodal_city .J_resultcode_city').val(codeArray.join(','));
$('#J_showmodal_city .J_resuletitle_city').text(titleArray.length ? titleArray.join('+') : '请选择');
$('#J_showmodal_city .J_resuletitle_city').attr('title', titleArray.length ? titleArray.join('+') : '请选择');
removeModal();
});
}
});
// 点击显示职位分类
$('#J_showmodal_jobs').on('click', function() {
var titleValue = $(this).data('title');
var multipleValue = eval($(this).data('multiple'));
var maxNumValue = eval($(this).data('maxnum'));
var widthValue = eval($(this).data('width'));
var htmlJobs = '';
var categoryValue = eval($(this).data('category'));
var addJob = eval($(this).data('addjob'));
// 发职位标识
var classifyModel = 0;
// 标记二级还是三级分类
categoryValue > 2 ? classifyModel = 0 : classifyModel = 1;
if (classifyModel) {
// 二级分类
if (QS_jobs_parent) {
htmlJobs += '
';
htmlJobs += '
';
htmlJobs += '
';
for (var i = 0; i < QS_jobs_parent.length; i++) {
if (QS_jobs_parent[i].split(',')) {
var iArray = QS_jobs_parent[i].split(',');
htmlJobs += ['
', '', '
'].join('');
}
}
htmlJobs += '
';
htmlJobs += '
';
htmlJobs += '
';
if (QS_jobs_parent) {
for (var i = 0; i < QS_jobs_parent.length; i++) {
if (QS_jobs_parent[i].split(',')) {
var jobs1Array = QS_jobs_parent[i].split(',');
if (QS_jobs[jobs1Array[0]]) {
if (QS_jobs[jobs1Array[0]].split('`')) {
var jobs11Array = QS_jobs[jobs1Array[0]].split('`');
htmlJobs += '
';
if (!addJob) {
htmlJobs += ['
', '', '
'].join('');
}
for (var j = 0; j < jobs11Array.length; j++) {
if (jobs11Array[j].split(',')) {
var jArray = jobs11Array[j].split(',');
htmlJobs += ['
', '', '
'].join('');
}
}
htmlJobs += '
';
}
} else {
htmlJobs += '
';
if (addJob) {
htmlJobs += ['
', '', '
'].join('');
} else {
htmlJobs += ['
', '', '
'].join('');
}
htmlJobs += '
';
}
}
}
}
htmlJobs += '
';
htmlJobs += '';
htmlJobs += '
';
}
prepareModal(titleValue, multipleValue, maxNumValue);
$('.J_modal_content').html(htmlJobs);
$('.J_btnyes').attr('id', 'J_btnyes_jobs');
$('.J_modal_content .right_box .list_nav').eq(0).show();
$('.J_list_jobs_parent').eq(0).addClass('current');
$('.modal_dialog').css({
width: widthValue + 'px',
left: ($(window).width() - widthValue) / 2,
top: ($(window).height() - $('.modal_dialog').outerHeight()) / 2 + $(document).scrollTop()
});
$('.modal_backdrop').addClass('in');
$('.J_list_jobs_parent').on('click', function() {
$(this).addClass('current').siblings('.J_list_jobs_parent').removeClass('current');
var subscriptValue = $('.J_list_jobs_parent').index(this);
$('.J_list_jobs_group').eq(subscriptValue).show().siblings('.J_list_jobs_group').hide();
});
// 恢复选中
var recoverValue = $('#J_showmodal_jobs .J_resultcode_jobs').val();
if (recoverValue.length) {
if (multipleValue) {
var recoverValueArray = recoverValue.split(',');
for (var i = 0; i < recoverValueArray.length; i++) {
$('.J_list_jobs').each(function(index, el) {
if ($(this).data('code') == recoverValueArray[i]) {
$(this).addClass('seledted');
}
});
}
copyJobsSelectedSecond();
} else {
$('.J_list_jobs').each(function(index, el) {
if ($(this).data('code') == recoverValue) {
$(this).addClass('seledted');
}
});
}
$('.J_list_jobs_parent').removeClass('seledted current');
$('.J_list_jobs.seledted').each(function(index, el) {
var thisGroup = $(this).closest('.J_list_jobs_group');
var subscriptValue = $('.J_list_jobs_group').index(thisGroup);
$('.J_list_jobs_parent').eq(subscriptValue).addClass('seledted');
});
$('.J_list_jobs_parent.seledted').first().click();
}
// 不限
$('.J_list_jobs_nolimit').off().on('click', function() {
var thisGroup = $(this).closest('.J_list_jobs_group');
thisGroup.find('.J_list_jobs').not('.J_list_jobs_nolimit').removeClass('seledted');
});
$('.J_list_jobs').off().on('click', function() {
if ($(this).hasClass('seledted')) {
$(this).removeClass('seledted');
if (multipleValue) {
copyJobsSelectedSecond();
}
var thisGroup = $(this).closest('.J_list_jobs_group');
var subscriptValue = $('.J_list_jobs_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_jobs_parent').eq(subscriptValue).removeClass('seledted').addClass('current');
}
} else {
$(this).addClass('seledted');
if (multipleValue) {
if (!$(this).is('.J_list_jobs_nolimit')) {
var thisGroup = $(this).closest('.J_list_jobs_group');
thisGroup.find('.J_list_jobs_nolimit').removeClass('seledted');
}
if ($('.J_list_jobs.seledted').length > maxNumValue) {
$(this).removeClass('seledted');
disapperTooltip("remind", '最多选择' + maxNumValue + '个');
return false;
} else {
copyJobsSelectedSecond();
}
var thisGroup = $(this).closest('.J_list_jobs_group');
var subscriptValue = $('.J_list_jobs_group').index(thisGroup);
$('.J_list_jobs_parent').eq(subscriptValue).addClass('seledted');
} else {
var code = $(this).data('code');
var title = $(this).data('title');
$('#J_showmodal_jobs .J_resultcode_jobs').val(code);
$('#J_showmodal_jobs .J_resuletitle_jobs').text(title);
$('#J_showmodal_jobs .J_resuletitle_jobs').attr('title', title);
// 智能填充职位描述
if (addJob) {
var cId = code.split('.')[1];
$.ajax({
// url: qscms.root + '?m=Home&c=AjaxCompany&a=ajax_get_category_content',
url: ajaxGetCategoryContent,
type: 'GET',
dataType: 'json',
data: {
id: cId
}
}).done(function(data) {
if (parseInt(data.status)) {
if (parseInt(data.data.show_relation)) {
var ddh = '';
for (var dr = 0; dr < data.data.relation_data.length; dr++) {
ddh += '' + data.data.relation_data[dr].name + '';
}
$('#des-item-group').html(ddh);
$('#des-cell-box').show();
} else {
$('#des-item-group').html('');
$('#des-cell-box').hide();
}
// 默认填写选中分类的描述
$('#contents').val(data.data.relation_data[0].desc);
// 相关分类绑定事件
$('.J-rea-desc').on('click', function() {
$('#des-item-group .des-item').removeClass('cur').addClass('J-rea-desc');
$(this).addClass('cur').removeClass('J-rea-desc');
$('#contents').val($(this).data('desc'));
})
} else {
console.log(data.msg);
}
}).fail(function(result) {
console.log(result.msg);
});
}
$('.modal_backdrop').remove();
$('.modal').remove();
}
}
});
function copyJobsSelectedSecond() {
var htmlListed = '';
$('.J_list_jobs.seledted').each(function(index, el) {
var listedCode = $(this).data('code');
var listedTitle = $(this).data('title');
htmlListed += ['
'].join('');
});
$('#J_listed_content').html(htmlListed);
if ($('.J_listed_jobs').length) {
$('#J_listed_group').addClass('nmb');
} else {
$('#J_listed_group').removeClass('nmb');
}
$('#J_listed_group').show();
}
$('.J_listed_jobs').off().on('click', function() {
var listedValue = $(this).data('code');
$('.J_list_jobs').each(function(index, el) {
if ($(this).data('code') == listedValue) {
$(this).removeClass('seledted');
var thisGroup = $(this).closest('.J_list_jobs_group');
var subscriptValue = $('.J_list_jobs_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_jobs_parent').eq(subscriptValue).removeClass('seledted');
}
}
});
copyJobsSelectedSecond();
});
$('#J_listed_clear').on('click', function() {
$('.J_list_jobs.seledted').each(function(index, el) {
$(this).removeClass('seledted');
});
$('.J_list_jobs_parent').removeClass('seledted');
copyJobsSelectedSecond();
});
$('#J_btnyes_jobs').off().on('click', function() {
var checkedArray = $('.J_list_jobs.seledted');
var codeArray = new Array();
var titleArray = new Array();
$.each(checkedArray, function(index, val) {
codeArray[index] = $(this).data('code');
titleArray[index] = $(this).data('title');
});
$('#J_showmodal_jobs .J_resultcode_jobs').val(codeArray.join(','));
;$('#J_showmodal_jobs .J_resuletitle_jobs').text(titleArray.length ? titleArray.join('+') : '请选择');
$('#J_showmodal_jobs .J_resuletitle_jobs').attr('title', titleArray.length ? titleArray.join('+') : '请选择');
removeModal();
});
} else {
// 三级分类
if (QS_jobs_parent) {
var job2Array = new Array();
var htmlJobs = '
';
htmlJobs += '
';
htmlJobs += '
';
for (var i = 0; i < QS_jobs_parent.length; i++) {
if (QS_jobs_parent[i].split(',')) {
var iArray = QS_jobs_parent[i].split(',');
htmlJobs += ['
', '', '
'].join('');
}
}
htmlJobs += '
';
htmlJobs += '
';
htmlJobs += '
';
if (QS_jobs_parent) {
for (var i = 0; i < QS_jobs_parent.length; i++) {
if (QS_jobs_parent[i].split(',')) {
var jobs1Array = QS_jobs_parent[i].split(',');
if (QS_jobs[jobs1Array[0]]) {
if (QS_jobs[jobs1Array[0]].split('`')) {
var job11Array = QS_jobs[jobs1Array[0]].split('`');
htmlJobs += '
';
for (var j = 0; j < job11Array.length; j++) {
if (job11Array[j].split(',')) {
var jArray = job11Array[j].split(',');
htmlJobs += ['
';
if (job2Array) {
if (multipleValue) {
for (var i = 0; i < job2Array.length; i++) {
if (job2Array[i].split('.')) {
var combinationArray = job2Array[i].split('.')
if (QS_jobs[combinationArray[1]]) {
if (QS_jobs[combinationArray[1]].split('`')) {
var job22Array = QS_jobs[combinationArray[1]].split('`');
htmlJobs += '
';
if (!addJob) {
htmlJobs += ['
', '', '
'].join('');
}
for (var j = 0; j < job22Array.length; j++) {
if (job22Array[j].split(',')) {
var jArray = job22Array[j].split(',');
htmlJobs += ['
';
}
}
}
} else {
for (var i = 0; i < job2Array.length; i++) {
if (job2Array[i].split('.')) {
var combinationArray = job2Array[i].split('.')
if (QS_jobs[combinationArray[1]]) {
if (QS_jobs[combinationArray[1]].split('`')) {
var job22Array = QS_jobs[combinationArray[1]].split('`');
htmlJobs += '
';
if (!addJob) {
htmlJobs += ['
', '', '
'].join('');
}
for (var j = 0; j < job22Array.length; j++) {
if (job22Array[j].split(',')) {
var jArray = job22Array[j].split(',');
htmlJobs += ['