/**
* 硕博人才生活补贴申报管理初始化
*/
var LivingAllowanceInfo = {
id: "LivingAllowanceInfoTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
LivingAllowanceInfo.initColumn = function () {
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) {
return row.sex == 1 ? value + '【男】' : value + '【女】';
}
},
// {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',width:"100px",
// formatter : function (value,row,index){
// return value == 1?"晋江市现代产业体系人才":"集成电路优秀人才";
// }
// },
{
title: '人才标签',
field: 'talentTypeName',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '证件号码',
field: 'idCard',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "150px"
},
{
title: '企业名称',
field: 'enterpriseName',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '最高学历',
field: 'highEducation',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '毕业学校',
field: 'graduateSchool',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '手机号码',
field: 'phone',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '本单位入职时间',
field: 'entryTime',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '首次来晋工作时间',
field: 'firstInJJTime',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '申请次数',
field: 'applyCount',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '审核状态',
field: 'checkStateName',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
{
title: '公示状态',
field: 'isPublicName',
visible: true,
align: 'center',
valign: 'middle',
'class': 'uitd_showTip',
width: "100px"
},
];
};
/**
* 检查是否选中
*/
LivingAllowanceInfo.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
LivingAllowanceInfo.seItem = selected[0];
return true;
}
};
/**
* 点击添加硕博人才生活补贴申报
*/
LivingAllowanceInfo.openAddLivingAllowanceInfo = 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/livingAllowanceInfo/livingAllowanceInfo_add?year=' + data.obj,
btn: [' 保存未提交', ' 提交审核', ' 取消'],
btnAlign: 'c',
btn1: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.LivingAllowanceInfoInfoDlg.addSubmit();
}, btn2: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.LivingAllowanceInfoInfoDlg.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);
LivingAllowanceInfo.layerIndex = index;
} else {
Feng.info(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.set("type", CONFIG.project_master_living_allowance);
ajax.start();
};
/**
* 打开查看硕博人才生活补贴申报详情
*/
LivingAllowanceInfo.openLivingAllowanceInfoDetail = 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/livingAllowanceInfo/livingAllowanceInfo_update/' + LivingAllowanceInfo.seItem.id + "/update",
btn: [' 保存未提交', ' 提交审核', ' 取消'],
btnAlign: 'c',
btn1: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.LivingAllowanceInfoInfoDlg.addSubmit();
}, btn2: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.LivingAllowanceInfoInfoDlg.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);
LivingAllowanceInfo.layerIndex = index;
} else {
Feng.info(data.msg);
}
}, function (data) {
Feng.error("校验失败!" + data.responseJSON.message + "!");
});
ajax.set("type", CONFIG.project_master_living_allowance);
ajax.set("year", LivingAllowanceInfo.seItem.year);
ajax.start();
}
};
/**
* 打开查看窗口
*/
LivingAllowanceInfo.openLivingAllowanceInfoSelect = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '硕博人才生活补贴详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/api/livingAllowanceInfo/livingAllowanceInfo_update/' + LivingAllowanceInfo.seItem.id + "/select",
btn: [' 取消'],
btnAlign: 'c',
});
layer.full(index);
LivingAllowanceInfo.layerIndex = index;
}
}
/**
* 删除硕博人才生活补贴申报
*/
LivingAllowanceInfo.delete = function () {
if (this.check()) {
if (LivingAllowanceInfo.seItem.checkState != 0) {
Feng.error("该申报已提交审核,无法删除");
return;
}
var operation = function () {
var ajax = new $ax(Feng.ctxPath + "/api/livingAllowanceInfo/delete", function (data) {
Feng.success("删除成功!");
LivingAllowanceInfo.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("livingAllowanceInfoId", LivingAllowanceInfo.seItem.id);
ajax.start();
}
Feng.confirm("删除后无法恢复,确认删除吗?", operation);
}
};
/**
* 查询硕博人才生活补贴申报列表
*/
LivingAllowanceInfo.search = function () {
var queryData = {};
queryData['name'] = $("#name").val();
queryData['idCard'] = $("#idCard").val();
LivingAllowanceInfo.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = LivingAllowanceInfo.initColumn();
var table = new BSTable(LivingAllowanceInfo.id, "/api/livingAllowanceInfo/list", defaultColunms);
table.setOnDblClickRow(function () {
LivingAllowanceInfo.openLivingAllowanceInfoSelect();
});
table.setPaginationType("server");
LivingAllowanceInfo.table = table.init();
});