/**
* 初始化人才认定申报详情对话框
*/
var locked = false;
var TalentInfoInfoDlg = {
talentInfoInfoData: {},
};
/**
* 关闭此对话框
*/
TalentInfoInfoDlg.close = function () {
parent.layer.close(window.parent.TalentInfo.layerIndex);
}
//人才标签变化
TalentInfoInfoDlg.typeChange = function () {
var talentType = $("#talentType").val();
if (talentType == 'gbwszb' || talentType == 'zzbsh' || talentType == 'sydw') {
$("#letterTime").parent().attr("style", "display:block");
// }else if(talentType=='gyqyl' || talentType=="gyqyh"){
// $("#letterTime").parent().attr("style","display:none");
} else {
$("#letterTime").parent().attr("style", "display:none");
}
}
TalentInfoInfoDlg.sourceChange = function () {
var source = $("#source").val();
if (source == 1) {
$("#fromCityName").parent().attr("style", "display:none");
$("#qzBatch").parent().attr("style", "display:block");
$("#qzgccrcActiveTime").parent().attr("style", "display:block");
$("#certificateStartTime").parent().attr("style", "display:block");
$("#ourCitySource").parent().attr("style", "display:block");
}
if (source == 2) {
$("#certificateStartTime").parent().attr("style", "display:block");
$("#qzgccrcActiveTime").parent().attr("style", "display:block");
$("#fromCityName").parent().attr("style", "display:block");
$("#qzBatch").parent().attr("style", "display:block");
$("#ourCitySource").parent().attr("style", "display:none");
}
if (source == 3 || source == null || source == '') {
$("#certificateStartTime").parent().attr("style", "display:none");
$("#qzgccrcActiveTime").parent().attr("style", "display:none");
$("#fromCityName").parent().attr("style", "display:none");
$("#qzBatch").parent().attr("style", "display:none");
$("#ourCitySource").parent().attr("style", "display:none");
}
}
TalentInfoInfoDlg.callback = function (data) {
Feng.info(data.msg);
}
/**
* 下载附件
* @param value
*/
TalentInfoInfoDlg.downloadFile = function (id, type) {
window.location.href = "/common/api/downloadFile?id=" + id + "&type=" + type;
}
/**
* 显示审核模态框
*/
TalentInfoInfoDlg.showCommonCheckModal = function () {
var ajax = new $ax("/admin/talent/validateIsCheck", function (data) {
if (data.code == 200) {
layer.open({
type: 1,
id: "neewFieldFormModel",
title: '审核',
area: ['800px', '350px'], //宽高
fix: false, //不固定
shade: 0,
maxmin: true,
content: TalentInfoInfoDlg.createNoFieldCheckModal(),
btn: [' 提交', ' 关闭'],
btnAlign: 'c',
zIndex: layer.zIndex,
success: function (layero, index) {
layer.setTop(layero);
$("#commonCheckForm")[0].reset();
var process = $("#process").val();
if (process == 3) {
var html = '\n' +
' \n' +
' ';
$("#checkStateModal").empty().append(html);
}
$("#checkStateModal").val(data.obj.checkState);
$("#checkMsg").val(data.obj.checkMsg);
},
yes: function (index, layero) {
TalentInfoInfoDlg.commonCheck(index);
}
});
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.setData({"id": $("#id").val(), "process": $("#process").val(), "companyId": $("#companyId").val()})
ajax.start();
}
/**
* 显示初审审核模态框
*/
TalentInfoInfoDlg.showFirstCheckModal = function () {
var ajax = new $ax("/admin/talent/validateIsCheck", function (data) {
if (data.code == 200) {
layer.open({
type: 1,
id: "neewFieldFormModel",
title: '审核',
area: ['800px', '450px'], //宽高
fix: false, //不固定
shade: 0,
maxmin: true,
content: TalentInfoInfoDlg.creatFieldCheckModal(),
btn: [' 提交', ' 关闭'],
btnAlign: 'c',
zIndex: layer.zIndex,
success: function (layero, index) {
layer.setTop(layero);
var obj = data.obj.talentInfo;
var companyList = data.obj.companys;
var fileList = data.obj.fileList;
var process = data.obj.process;
if (typeof data.obj.fieldList != "undefined" && data.obj.fieldList.length > 0) {
var fieldList = data.obj.fieldList;
var html1 = '';
for (var key in fieldList) {
html1 = html1 + '
' + fieldList[key]["value"] + '';
}
}
var html2 = '';
for (var key in fileList) {
html2 = html2 + '';
}
var html3 = '';
for (var key in companyList) {
html3 += '' + companyList[key].name + '';
}
$("#field_info ul").css("overflow", "hidden").empty().append(html1);
$("#field_file").css("overflow", "hidden").empty().append(html2);
$("#company_list ul").css("overflow", "hidden").empty().append(html3);
var optionHtml = "";
if (process <= 4 && process != 2) {
optionHtml = '\n' +
(obj.highProcess == 4 && process == 3 ? '\n' : '') +
(obj.highProcess == 4 && process == 3 ? '\n' : "") +
' \n';
}
if (process == 5 || process == 2) {
optionHtml = '\n' +
' \n' +
' \n' +
' ';
}
$("#checkStateFirstModal").empty().append(optionHtml);
$("#firstCheckForm")[0].reset();
//$("#checkStateFirstModal").val(obj.checkState);
$("#checkStateFirstModal").trigger("change");
$("#checkMsgFirst").val(obj.checkMsg);
if (obj.fields != null && obj.fields != '') {
$("#field_info input").each(function () {
for (var key in obj.fields) {
if ($(this).val() == obj.fields[key]) {
this.checked = true;
}
}
});
}
if (obj.files != null && obj.files != '') {
$("#field_file input").each(function () {
for (var key in obj.files) {
if ($(this).val() == obj.files[key]) {
this.checked = true;
}
}
//if (obj.files.indexOf($(this).val()) != -1) {
//this.checked = true;
//}
});
}
},
yes: function (index, layero) {
TalentInfoInfoDlg.firstCheck(index);
}
});
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.setData({"id": $("#id").val(), "companyId": $("#companyId").val()})
ajax.start();
}
TalentInfoInfoDlg.toggledepField = function () {
var checkState = $("#checkStateModal").val();
var checkMsg = $("#checkMsg").val();
if (checkState == 3) {
if (checkMsg == null || checkMsg == '') {
$("#checkMsg").val("部门审核通过,待复核");
}
} else {
$("#checkMsg").val("");
}
}
/**
* 显示字段或者隐藏字段选择
*/
TalentInfoInfoDlg.toggleField = function () {
var checkState = $("#checkStateFirstModal").val();
var checkMsgFirst = $("#checkMsgFirst").val();
$("#company_list").hide();
if (checkState == 2) {
$("#field").show();
$("#checkMsgFirst").val("");
} else if (checkState == 3 || checkState == 4 || checkState == 5) {
$("#field").hide();
$("#field").find("input[type=checkbox]").removeAttr("checked");
if (checkMsgFirst == null || checkMsgFirst == '') {
$("#checkMsgFirst").val("审核通过");
}
if (checkState == 5) {
$("#company_list").show();
}
} else if (checkState == -1) {
$("#field").hide();
$("#checkMsgFirst").val("审核不通过");
}
}
/**
* 全选
*/
TalentInfoInfoDlg.checkAll = function () {
$("#field input").each(function () {
this.checked = true;
})
}
/**
* 反选
*/
TalentInfoInfoDlg.unCheckAll = function () {
$("#field input").each(function () {
if (this.checked) {
this.checked = false;
} else {
this.checked = true;
}
})
}
/**
* 审核提交
*/
TalentInfoInfoDlg.commonCheck = function (i) {
var checkState = $("#checkStateModal").val();
var checkMsg = $("#checkMsg").val();
if (checkState == null || checkState == '') {
Feng.info("请选择审核状态");
return;
}
if (checkMsg == null || checkMsg == '') {
Feng.info("请填写审核意见");
return;
}
if (locked)
return;
locked = true;
var ajax = new $ax(Feng.ctxPath + "/admin/talent/check", function (data) {
if (data.code == 200) {
Feng.success(data.msg);
// $("#commonModal").modal("hide");
layer.close(i);
} else {
Feng.error(data.msg);
}
locked = false;
}, function (data) {
Feng.error("提交审核失败!" + data.responseJSON.message + "!");
locked = false;
});
ajax.setData({"id": $("#id").val(), "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(), "companyId": $("#companyId").val()})
ajax.start();
}
/**
* 初审提交
*/
TalentInfoInfoDlg.firstCheck = function (i) {
var checkState = $("#checkStateFirstModal").val();
var checkMsg = $("#checkMsgFirst").val();
if (checkState == null || checkState == '') {
Feng.info("请选择审核状态");
return;
}
if (checkMsg == null || checkMsg == '') {
Feng.info("请填写审核意见");
return;
}
var fields = '';
var files = '';
var companys = '';
$("#field_info li input").each(function (index) {
if ($(this).is(":checked")) {
fields = fields + $(this).val() + ",";
}
});
$("#field_file li input").each(function (index) {
if ($(this).is(":checked")) {
files = files + $(this).val() + ",";
}
});
$("#company_list li input").each(function (index) {
if ($(this).is(":checked")) {
companys += $(this).val() + ",";
}
});
if (checkState == 2 && fields == '' && files == '') {
Feng.info("请选择可修改的字段!");
return;
}
if(checkState == 5 && companys == ""){
Feng.info("请选择需要再次审核的部门!");
return;
}
if (locked)
return;
locked = true;
var ajax = new $ax("/admin/talent/check", function (data) {
if (data.code == 200) {
// $("#firstModal").modal("hide");
layer.close(i);
Feng.success(data.msg);
} else {
Feng.error(data.msg);
}
locked = false;
}, function (data) {
Feng.error("提交审核失败!" + data.responseJSON.message + "!");
locked = false;
});
ajax.setData({"id": $("#id").val(), "checkState": checkState, "checkMsg": checkMsg,
"process": $("#process").val(), "fields": fields, "files": files, "companys": companys})
ajax.start();
}
TalentInfoInfoDlg.submitCheck = function () {
var operation = function () {
var ajax = new $ax(Feng.ctxPath + "/admin/talent/submitCheck", function (data) {
if (data.code == 200) {
Feng.success(data.msg);
window.parent.TalentInfo.table.refresh();
TalentInfoInfoDlg.close();
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("提交审核失败!" + data.responseJSON.message + "!");
});
ajax.setData({"id": $("#id").val(), "process": $("#process").val(), "companyId": $("#companyId").val()});
ajax.start();
}
Feng.confirm("一旦提交无法修改,是否审核完毕且无误?", operation);
}
TalentInfoInfoDlg.fieldCheckd = function (context) {
if ($(context).get(0).checked) {
$(context).parent().next().children()[0].checked = true;
$(context).parent().next().children().eq(0).trigger("change");
}
}
TalentInfoInfoDlg.sourceCheckd = function (context) {
if ($(context).get(0).checked) {
$("#talentArrangeCheckBox").attr("checked", true);
$("#talentArrangeCheckBox").trigger("change");
}
}
TalentInfoInfoDlg.download = function () {
window.location.href = encodeURI(encodeURI("/common/api/downloadZip?type=1&id=" + $("#id").val()));
}
TalentInfoInfoDlg.creatFieldCheckModal = function () {
var type = $("#type").val();
if (type == 1) {
return '';
} else if (type == 2) {
return '';
}
}
TalentInfoInfoDlg.createNoFieldCheckModal = function () {
return '';
}
$(function () {
$("select:not(#checkStateModal,#checkStateFirstModal)").each(function () {
//$(this).attr("disabled", "disabled");
});
$("input,textarea").not("#checkMsg,#checkMsgFirst").each(function () {
$(this).attr("readonly", "readonly");
});
TalentInfoInfoDlg.typeChange();
TalentInfoInfoDlg.sourceChange();
$('[data-toggle="tooltip"]').tooltip();
//$(".ibox-content").viewer({fullscreen: false});
Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
$(".uitd_showTip").bind("mouseover", function () {
var htm = $(this).html();
$(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
});
});