/**
* 初始化人才认定申报详情对话框
*/
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.initFileTable = function (){
Feng.showMiniFileModal(CONFIG.project_rcrd,$("#type").val(),$("#id").val());
var queryData = {};
queryData['project'] = CONFIG.project_rcrd;
queryData['type'] = $("#type").val();
$("#fileTable").bootstrapTable({
url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
method: 'POST',
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
showRefresh: false, // 是否显示刷新按钮
clickToSelect: true, // 是否启用点击选中行
singleSelect: true, // 设置True 将禁止多选
striped: true, // 是否显示行间隔色
escape: true,
pagination: false, // 设置为 true 会在表格底部显示分页条
paginationHAlign: "left",
paginationDetailHAlign: "right",
sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
showColumns: false,
detailView: true, //是否显示父子表
pageList: [10, 30, 50],
queryParams: function (params) {
return $.extend(queryData,params)
},
rowStyle: function (row, index) {
return {classes:"info"};
},
columns: TalentInfoInfoDlg.initFileTypeColumn(),
onPostBody: function () {
$("td.uitd_showTip").bind("mouseover", function () {
var htm = $(this).html();
$(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
});
},
onLoadSuccess: function (data) {
$("#fileTable").bootstrapTable('expandAllRows');
},
onExpandRow: function (index, row, $detail) {
var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/listTalentFile", function (data) {
if(data==null||data.length==0){
return;
}
var html = '
- 附件原名
- 预览
- 操作
';
for(var key in data){
var sn = data[key].url.lastIndexOf(".");
var suffix = data[key].url.substring(sn+1,data[key].url.length);
var imgStr = "";
if(suffix=="pdf"||suffix=="PDF"){
imgStr = "";
}else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
imgStr = "";
}else{
imgStr = '
';
}
html = html + '- '+data[key].id+'
\n'+
'- '+data[key].orignName+'
\n'+
'- '+imgStr+'
\n'+
"";
}
html = html + '
';
$detail.html(html);
$(".imgs").viewer({
// toolbar:false,
fullscreen:false
});
}, function (data) {
Feng.error("查询失败!" + data.responseJSON.message + "!");
});
var queryData = {};
queryData["mainId"] = $("#id").val();
queryData["fileTypeId"] = row.id;
ajax.set(queryData);
ajax.start();
}
});
}
TalentInfoInfoDlg.callback = function(data){
Feng.info(data.msg);
}
/**
* 下载附件
* @param value
*/
TalentInfoInfoDlg.downloadFile = function (id,type){
window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type="+type;
}
TalentInfoInfoDlg.expandRows = function(){
$("#fileTable").bootstrapTable('expandAllRows')
}
/**
* 初始化表格的列
*/
TalentInfoInfoDlg.initFileTypeColumn = function () {
return [
{field: 'selectItem', checkbox:false,visible:false},
{title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"20%",'class': 'uitd_showTip',
formatter : function(value,row,index){
if(row.must==1){
return ' * '+ value;
}if(row.must==2){
return ''+value;
}
}
},
{title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"68%",'class': 'uitd_showTip'},
{title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"10%",
formatter : function(value,row,index){
if(value==null||value==''||value=='null'){
return '无';
}
return "";
}
}
]
};
/**
* 显示审核模态框
*/
TalentInfoInfoDlg.showCommonCheckModal = function (){
var ajax = new $ax(Feng.ctxPath + "/talentInfo/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==2){
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 process = $("#process").val();
var ajax = new $ax(Feng.ctxPath + "/talentInfo/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 fileList = data.obj.fileList;
var html = '';
for(var key in fileList){
html = html + '';
}
$("#field_file").empty().append(html);
var optionHtml = "";
if(process == 1){
optionHtml = '\n' +
' \n' +
' \n' ;
}if(process == 3){
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 () {
var arr = obj.fields.split(",");
for(var key in arr){
if($(this).val()==arr[key]){
this.checked = true;
}
}
});
}
if(obj.files!=null && obj.files!=''){
$("#field_file input").each(function () {
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(),"process":process,"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 process = $("#process").val();
var source = $("#source").val();
var checkMsgFirst = $("#checkMsgFirst").val();
if(checkState==2){
$("#field").show();
$("#checkMsgFirst").val("");
}else if(checkState == 3){
$("#field").hide();
$("#field").find("input[type=checkbox]").removeAttr("checked");
if(checkMsgFirst == null || checkMsgFirst == ''){
if(source==1||source==2){
$("#checkMsgFirst").val((process==1)?"初审通过,待复核。":"复核通过,待核查征信。");
}else if(source==3){
$("#checkMsgFirst").val((process==1)?"初审通过,待部门审核。":"复核通过,待核查征信。");
}
}
}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 + "/talentInfo/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 = '';
$("#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() + ",";
}
});
if(checkState==2 && fields=='' && files==''){
Feng.info("请选择可修改的字段或附件!");
return ;
}
if(locked)return;
locked =true;
var ajax = new $ax(Feng.ctxPath + "/talentInfo/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})
ajax.start();
}
TalentInfoInfoDlg.submitCheck = function(){
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/talentInfo/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(Feng.ctxPath + "/api/commonDownload/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").each(function () {
$(this).val($(this).attr("value")).trigger("change");
});
$("select:not(#checkStateModal,#checkStateFirstModal)").each(function () {
$(this).attr("disabled","disabled");
});
$("input,textarea").not("#checkMsg,#checkMsgFirst").each(function () {
$(this).attr("readonly","readonly");
});
// TalentInfoInfoDlg.initFileTable();
TalentInfoInfoDlg.typeChange();
TalentInfoInfoDlg.sourceChange();
$("#photoImg").viewer();
$('[data-toggle="tooltip"]').tooltip();
TalentInfoInfoDlg.initFileTable();
Feng.getCheckLog("logTable",{"type":CONFIG.project_rcrd,"mainId":$("#id").val(),"typeFileId":"","active":1})
});