/**
* 人才认定申报管理初始化
*/
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: 'apply_year', visible: true, align: 'center', valign: 'middle', width: '80px'},
{title: '离职状态', field: 'active', visible: true, align: 'center', valign: 'middle', width: '80px',
formatter: function (value, row, index) {
if (value == 1) {
return '在职';
}
if (value == 2) {
return '离职';
}
}
},
{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: 'card_number', 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: "120px"},
{title: '人才证书有效期', field: 'identifyGetTime', visible: isShow, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '150px',
formatter: function (value, row, index) {
return row.certificateGetTime + "至" + row.certificateExpireTime;
}
},
{title: '公布入选月份', field: 'identifyMonth', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
{title: '人才编号', field: 'certificateNo', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
{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.openTalentInfoDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '人才认定申报详情',
fix: false, //不固定
maxmin: true,
content: '/enterprise/talent/view/id/' + TalentInfo.seItem.id
});
layer.full(index);
TalentInfo.layerIndex = index;
}
};
/**
* 查询表单提交参数对象
* @returns {{}}
*/
TalentInfo.formParams = function () {
var queryData = {};
queryData['name'] = $("#name").val();
queryData['card_number'] = $("#card_number").val();
queryData['sex'] = $("#sex").val();
queryData['nation'] = $("#nation").val();
queryData['nationality'] = $("#nationality").val();
queryData['talent_type'] = $("#talent_type").val();
queryData['talent_arrange'] = $("#talent_arrange").val();
return queryData;
}
/**
* 查询人才认定申报列表
*/
TalentInfo.search = function () {
TalentInfo.table.refresh({query: TalentInfo.formParams()});
};
/**
* 重置
*/
TalentInfo.reset = function () {
$("#name").val("");
$("#card_number").val("");
$("#sex").val("");
$("#nation").val("");
$("#nationality").val("");
$("#talent_type").val("");
$("#talent_arrange").val("");
}
//显示修改手机号码模态框
TalentInfo.updatePhoneModal = function () {
if (this.check()) {
$("#phoneForm")[0].reset();
$("#updateModal").modal("show");
}
}
//修改手机号码提交
TalentInfo.updatePhone = function () {
var oldPhone = $("#oldPhone").val();
var newPhone = $("#newPhone").val();
if ($.trim(oldPhone) != TalentInfo.seItem.phone) {
Feng.info("原手机号码不正确");
return;
}
if (newPhone == null || newPhone == '') {
Feng.info("新手机号码不能为空");
return;
}
var operation = function () {
var ajax = new $ax(Feng.ctxPath + "/enterprise/talent_library/updatePhone", function (data) {
if (data.code == 200) {
Feng.success(data.msg);
TalentInfo.table.refresh();
$("#updateModal").modal("hide");
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("修改手机号码失败!" + data.responseJSON.message + "!");
});
ajax.set("id", TalentInfo.seItem.id);
ajax.set("oldPhone", oldPhone);
ajax.set("newPhone", newPhone);
ajax.start();
};
Feng.confirm("确定修改手机号码吗?", operation);
}
TalentInfo.updatePhoto = function () {
if (this.check()) {
if (TalentInfo.seItem.isCertification == 2) {
Feng.info("已制证,无法修改");
return;
}
var index = layer.open({
type: 1,
title: '修改头像',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: "",
btn: [' 提交', ' 关闭'],
btnAlign: 'c',
yes: function (index, layero) {
$("#index").val(index);
$("#libId").val(TalentInfo.seItem.id);
$("#commonFileForm")[0].submit();
}
});
}
}
TalentInfo.fileChange = function (context) {
var file = $(context).val();
var pos = file.lastIndexOf("\\");
$("#fileInput").val(file.substring(pos + 1));
}
TalentInfo.callback = function (data) {
if (data.code == 200) {
Feng.success(data.msg);
layer.close(data.obj);
} else {
Feng.info(data.msg);
}
}
//显示导出模态框
TalentInfo.showExportModal = function () {
$("#exportForm")[0].reset();
$("#exportModal").modal("show");
}
//导出
TalentInfo.export = function () {
var operation = function () {
var queryData = TalentInfo.formParams();
var params = $("#exportForm").serialize();
var url = "/enterprise/talent_library/export?" + params;
Object.keys(queryData).forEach(function (key, index) {
if (typeof queryData[key] != "undefined" && queryData[key]) {
url += "&" + key + "=" + queryData[key];
}
})
window.location.href = url;
};
Feng.confirm("确定要导出数据吗?", operation);
}
/**
* 全选
*/
TalentInfo.checkAll = function () {
$("#field_info input").each(function () {
this.checked = true;
})
}
/**
* 反选
*/
TalentInfo.unCheckAll = function () {
$("#field_info input").each(function () {
if (this.checked) {
this.checked = false;
} else {
this.checked = true;
}
})
}
$(function () {
var defaultColunms = TalentInfo.initColumn();
var table = new BSTable(TalentInfo.id, "/enterprise/talent_library/list", defaultColunms);
table.setPaginationType("server");
table.setOnDblClickRow(function () {
TalentInfo.openTalentInfoDetail();
});
TalentInfo.table = table.init();
//批量加载字典表数据
var arr = [
{"name": "nation", "code": "nation"},
{"name": "nationality", "code": "nationality"},
{"name": "talent_type", "code": "talent_type"},
{"name": "talent_arrange", "code": "talent_arrange"}];
Feng.findChildDictBatch(JSON.stringify(arr));
});