/**
* 人才认定申报管理初始化
*/
var TalentInfo = {
id: "TalentInfoTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
TalentInfo.initColumn = function () {
var type = $("#type").val();
var isShow = true;
if(type==2){
isShow = false;
}
return [
{field: 'selectItem', radio: true},
{title: '申报年度', field: 'year', visible: true, align: 'center', valign: 'middle',width:'80px'},
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:"100px",
formatter : function(value,row,index){
if(row.sex==1){
return value+'【男】';
}if(row.sex==2){
return value+'【女】';
}
}
},
{title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',width:"100px",
formatter : function (value,row,index){
if(value==1){
return '晋江市优秀人才';
}if(value==2){
return '集成电路优秀人才';
}
}
},
{title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"80px",},
{title: '人才标签', field: 'talentTypeName', visible: isShow, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"80px"},
{title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
{title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
{title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
{title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px"},
{title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle',width:"100px",
formatter : function (value,row,index) {
if(value==1){
return "待提交"
}else if(value==10 || value==5){
return "已驳回"
}else{
if(row.isPublic>=5){
if(value==-1){
return "审核不通过"
}else if(value==35){
return "认定通过"
}else{
return "审核中"
}
}else{
return "审核中"
}
}
}
},
{title: '审核意见', field: 'checkMsg', visible: false, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px",
formatter : function (value,row,index) {
if(value==1){
return ""
}else if(value==10 || value==5){
return value;
}else{
if(row.isPublic>=5){
if(value==-1){
return value
}else if(value==35){
return value;
}else{
return ""
}
}else{
return ""
}
}
}
},
{title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"80px",
formatter : function (value,row,index){
return "" +
"日志" +
"";
}
}
];
};
/**
* 检查是否选中
*/
TalentInfo.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
TalentInfo.seItem = selected[0];
return true;
}
};
/**
* 显示审核日志
*/
TalentInfo.showLog = function (id){
layer.open({
type: 1,
title:"日志",
fixed:false,
content: '
',
area: ['80%', '80%'],
maxmin: true,
success :function (layero, index) {
Feng.getCheckLog(id,{"type":CONFIG.project_rcrd,"mainId":id,"typeFileId":"","active":1})
}
});
}
/**
* 点击添加人才认定申报
*/
TalentInfo.openAddTalentInfo = function () {
var ajax = new $ax(Feng.ctxPath + "/api/commonBatch/valiateIsAdd", function (data) {
if(data.code==200){
var index = layer.open({
type: 2,
title: '添加人才认定申报',
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/api/talentInfo/talentInfo_add?year='+data.obj,
btn: [' 保存未提交',' 提交审核', ' 取消'],
btnAlign: 'c',
btn1: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.TalentInfoInfoDlg.addSubmit();
},btn2: function(index, layero){
var obj = layero.find("iframe")[0].contentWindow;
obj.TalentInfoInfoDlg.submitToCheck();
return false;
},
success :function (layero, index) {
layer.tips('添加基本信息并上传附件后点击','.layui-layer-btn1',{tips:[1,"#78BA32"],time:0,closeBtn :2});
},
end :function () {
layer.closeAll('tips');
}
});
layer.full(index);
TalentInfo.layerIndex = index;
}else{
Feng.info(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.set("type",CONFIG.project_rcrd);
ajax.start();
};
/**
* 打开查看人才认定申报详情
*/
TalentInfo.openTalentInfoDetail = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/api/commonBatch/valiateIsEditOrSubmit", function (data) {
if (data.code == 200) {
var index = layer.open({
type: 2,
title: '人才认定申报详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/api/talentInfo/talentInfo_update/' + TalentInfo.seItem.id+"/update",
btn: [' 保存未提交',' 提交审核', ' 取消'],
btnAlign: 'c',
btn1: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.TalentInfoInfoDlg.addSubmit();
},btn2: function(index, layero){
var obj = layero.find("iframe")[0].contentWindow;
obj.TalentInfoInfoDlg.submitToCheck();
return false;
},
success :function (layero, index) {
layer.tips('添加基本信息并上传附件后点击','.layui-layer-btn1',{tips:[1,"#78BA32"],time:0,closeBtn :2});
},
end :function () {
layer.closeAll('tips');
}
});
layer.full(index);
TalentInfo.layerIndex = index;
}else{
Feng.info(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.set("type",CONFIG.project_rcrd);
ajax.set("year",TalentInfo.seItem.year);
ajax.start();
}
};
/**
* 查看
*/
TalentInfo.openTalentInfoSelect = function(){
if (this.check()) {
var index = layer.open({
type: 2,
title: '人才认定申报详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/api/talentInfo/talentInfo_select/' + TalentInfo.seItem.id,
btn: [' 取消'],
btnAlign: 'c',
});
layer.full(index);
TalentInfo.layerIndex = index;
}
}
/**
* 删除人才认定申报
*/
TalentInfo.delete = function () {
if (this.check()) {
if(TalentInfo.seItem.checkState!=1){
Feng.error("该申报已提交审核,无法删除");
return ;
}
var operation = function() {
var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/delete", function (data) {
Feng.success("删除成功!");
TalentInfo.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("talentInfoId", TalentInfo.seItem.id);
ajax.start();
}
Feng.confirm("删除后无法恢复,确认删除吗?", operation);
}
};
/**
* 查询表单提交参数对象
* @returns {{}}
*/
TalentInfo.formParams = function() {
var queryData = {};
queryData['name'] = $("#name").val();
queryData['idCard'] = $("#idCard").val();
queryData['sex'] = $("#sex").val();
queryData['nation'] = $("#nation").val();
queryData['nationality'] = $("#nationality").val();
queryData['talentType'] = $("#talentType").val();
queryData['talentArrange'] = $("#talentArrange").val();
queryData['checkState'] = $("#checkState").val();
return queryData;
}
/**
* 查询人才认定申报列表
*/
TalentInfo.search = function () {
TalentInfo.table.refresh({query: TalentInfo.formParams()});
};
/**
* 重置
*/
TalentInfo.reset = function (){
$("#name").val("");
$("#idCard").val("");
$("#sex").val("");
$("#nation").val("");
$("#nationality").val("");
$("#talentType").val("");
$("#talentArrange").val("");
$("#checkState").val("");
}
$(function () {
var defaultColunms = TalentInfo.initColumn();
var table = new BSTable(TalentInfo.id, "/enterprise/talent/list/type/1", defaultColunms);
table.setPaginationType("server");
table.setOnDblClickRow(function () {
TalentInfo.openTalentInfoDetail();
});
TalentInfo.table = table.init();
//批量加载字典表数据
var arr = [
{"name":"nation","code":"un_nation"},
{"name":"talentArrange","code":"un_talentLevel"},
{"name":"nationality","code":"un_nationality"},
{"name":"talentType","code":"un_jbt_talentType"}];
Feng.findChildDictBatch(JSON.stringify(arr));
});