123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- /**
- * 人才认定申报管理初始化
- */
- 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 '<span style="color:#6495ED">在职</span>';
- }
- if (value == 2) {
- return '<span style="color:#FF82AB">离职</span>';
- }
- }
- },
- {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', width: "100px",
- formatter: function (value, row, index) {
- if (row.sex == 1) {
- return value + '<span style="color:#6495ED">【男】</span>';
- }
- if (row.sex == 2) {
- return value + '<span style="color:#FF82AB">【女】</span>';
- }
- }
- },
- {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 "<span class='label label-success' onclick=\"TalentInfo.showLog('" + value + "')\" >" +
- "<i class=\"fa fa-book\"></i>日志" +
- "</span>";
- }
- }
- ];
- };
- /**
- * 检查是否选中
- */
- 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: '<table id="' + id + '"></table>',
- 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: "<form id=\"commonFileForm\" action=\"" + Feng.ctxPath + "/api/talentInfo/updatePhoto\" method=\"post\" enctype=\"multipart/form-data\" target=\"hiddenIframe\">\n" +
- " <div class=\"panel panel-default\">\n" +
- " <div class=\"panel-heading\" style=\"font-weight: bold\">头像</div>\n" +
- " <div class=\"panel-body\">\n" +
- " <input type=\"text\" style=\"display: none\" id=\"libId\" name=\"libId\" >\n" +
- " <input type=\"text\" style=\"display: none\" id=\"index\" name=\"index\" >\n" +
- " <input type=\"file\" style=\"display: none\" id=\"fileUrl\" name=\"fileUrl\" onchange=\"TalentInfo.fileChange(this)\">\n" +
- " <input class=\"form-control\" placeholder=\"请上传头像\" id=\"fileInput\" onclick=\"$('#fileUrl').click()\">\n" +
- " </div>\n" +
- " </div>\n" +
- " </form>",
- btn: ['<i class="fa fa-eye"></i> 提交', '<i class="fa fa-eraser"></i> 关闭'],
- 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();
- $("#select_contract").val(0);
- $("#exportModal").modal("show");
- }
- TalentInfo.showExportModal = function () {
- $("#exportForm")[0].reset();
- $("#select_contract").val(1);
- $("#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));
- });
|