talentInfo_library.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /**
  2. * 人才认定申报管理初始化
  3. */
  4. var TalentInfo = {
  5. id: "TalentInfoTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. TalentInfo.initColumn = function () {
  14. var type = $("#type").val();
  15. var isShow = true;
  16. if (type == 2) {
  17. isShow = false;
  18. }
  19. return [
  20. {field: 'selectItem', radio: true},
  21. {title: '申报年度', field: 'apply_year', visible: true, align: 'center', valign: 'middle', width: '80px'},
  22. {title: '离职状态', field: 'active', visible: true, align: 'center', valign: 'middle', width: '80px',
  23. formatter: function (value, row, index) {
  24. if (value == 1) {
  25. return '<span style="color:#6495ED">在职</span>';
  26. }
  27. if (value == 2) {
  28. return '<span style="color:#FF82AB">离职</span>';
  29. }
  30. }
  31. },
  32. {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', width: "100px",
  33. formatter: function (value, row, index) {
  34. if (row.sex == 1) {
  35. return value + '<span style="color:#6495ED">【男】</span>';
  36. }
  37. if (row.sex == 2) {
  38. return value + '<span style="color:#FF82AB">【女】</span>';
  39. }
  40. }
  41. },
  42. {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle', width: "100px",
  43. formatter: function (value, row, index) {
  44. if (value == 1) {
  45. return '晋江市现代产业体系人才';
  46. }
  47. if (value == 2) {
  48. return '集成电路优秀人才';
  49. }
  50. }
  51. },
  52. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
  53. {title: '人才标签', field: 'talentTypeName', visible: isShow, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
  54. {title: '证件号码', field: 'card_number', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  55. {title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  56. {title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  57. {title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  58. {title: '人才证书有效期', field: 'identifyGetTime', visible: isShow, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '150px',
  59. formatter: function (value, row, index) {
  60. return row.certificateGetTime + "至" + row.certificateExpireTime;
  61. }
  62. },
  63. {title: '公布入选月份', field: 'identifyMonth', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
  64. {title: '人才编号', field: 'certificateNo', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
  65. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  66. formatter: function (value, row, index) {
  67. return "<span class='label label-success' onclick=\"TalentInfo.showLog('" + value + "')\" >" +
  68. "<i class=\"fa fa-book\"></i>日志" +
  69. "</span>";
  70. }
  71. }
  72. ];
  73. };
  74. /**
  75. * 检查是否选中
  76. */
  77. TalentInfo.check = function () {
  78. var selected = $('#' + this.id).bootstrapTable('getSelections');
  79. if (selected.length == 0) {
  80. Feng.info("请先选中表格中的某一记录!");
  81. return false;
  82. } else {
  83. TalentInfo.seItem = selected[0];
  84. return true;
  85. }
  86. };
  87. /**
  88. * 显示审核日志
  89. */
  90. TalentInfo.showLog = function (id) {
  91. layer.open({
  92. type: 1,
  93. title: "日志",
  94. fixed: false,
  95. content: '<table id="' + id + '"></table>',
  96. area: ['80%', '80%'],
  97. maxmin: true,
  98. success: function (layero, index) {
  99. Feng.getCheckLog(id, {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  100. }
  101. });
  102. }
  103. /**
  104. * 打开查看人才认定申报详情
  105. */
  106. TalentInfo.openTalentInfoDetail = function () {
  107. if (this.check()) {
  108. var index = layer.open({
  109. type: 2,
  110. title: '人才认定申报详情',
  111. fix: false, //不固定
  112. maxmin: true,
  113. content: '/enterprise/talent/view/id/' + TalentInfo.seItem.id
  114. });
  115. layer.full(index);
  116. TalentInfo.layerIndex = index;
  117. }
  118. };
  119. /**
  120. * 查询表单提交参数对象
  121. * @returns {{}}
  122. */
  123. TalentInfo.formParams = function () {
  124. var queryData = {};
  125. queryData['name'] = $("#name").val();
  126. queryData['card_number'] = $("#card_number").val();
  127. queryData['sex'] = $("#sex").val();
  128. queryData['nation'] = $("#nation").val();
  129. queryData['nationality'] = $("#nationality").val();
  130. queryData['talent_type'] = $("#talent_type").val();
  131. queryData['talent_arrange'] = $("#talent_arrange").val();
  132. return queryData;
  133. }
  134. /**
  135. * 查询人才认定申报列表
  136. */
  137. TalentInfo.search = function () {
  138. TalentInfo.table.refresh({query: TalentInfo.formParams()});
  139. };
  140. /**
  141. * 重置
  142. */
  143. TalentInfo.reset = function () {
  144. $("#name").val("");
  145. $("#card_number").val("");
  146. $("#sex").val("");
  147. $("#nation").val("");
  148. $("#nationality").val("");
  149. $("#talent_type").val("");
  150. $("#talent_arrange").val("");
  151. }
  152. //显示修改手机号码模态框
  153. TalentInfo.updatePhoneModal = function () {
  154. if (this.check()) {
  155. $("#phoneForm")[0].reset();
  156. $("#updateModal").modal("show");
  157. }
  158. }
  159. //修改手机号码提交
  160. TalentInfo.updatePhone = function () {
  161. var oldPhone = $("#oldPhone").val();
  162. var newPhone = $("#newPhone").val();
  163. if ($.trim(oldPhone) != TalentInfo.seItem.phone) {
  164. Feng.info("原手机号码不正确");
  165. return;
  166. }
  167. if (newPhone == null || newPhone == '') {
  168. Feng.info("新手机号码不能为空");
  169. return;
  170. }
  171. var operation = function () {
  172. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent_library/updatePhone", function (data) {
  173. if (data.code == 200) {
  174. Feng.success(data.msg);
  175. TalentInfo.table.refresh();
  176. $("#updateModal").modal("hide");
  177. } else {
  178. Feng.error(data.msg);
  179. }
  180. }, function (data) {
  181. Feng.error("修改手机号码失败!" + data.responseJSON.message + "!");
  182. });
  183. ajax.set("id", TalentInfo.seItem.id);
  184. ajax.set("oldPhone", oldPhone);
  185. ajax.set("newPhone", newPhone);
  186. ajax.start();
  187. };
  188. Feng.confirm("确定修改手机号码吗?", operation);
  189. }
  190. TalentInfo.updatePhoto = function () {
  191. if (this.check()) {
  192. if (TalentInfo.seItem.isCertification == 2) {
  193. Feng.info("已制证,无法修改");
  194. return;
  195. }
  196. var index = layer.open({
  197. type: 1,
  198. title: '修改头像',
  199. area: ['800px', '420px'], //宽高
  200. fix: false, //不固定
  201. maxmin: true,
  202. content: "<form id=\"commonFileForm\" action=\"" + Feng.ctxPath + "/api/talentInfo/updatePhoto\" method=\"post\" enctype=\"multipart/form-data\" target=\"hiddenIframe\">\n" +
  203. " <div class=\"panel panel-default\">\n" +
  204. " <div class=\"panel-heading\" style=\"font-weight: bold\">头像</div>\n" +
  205. " <div class=\"panel-body\">\n" +
  206. " <input type=\"text\" style=\"display: none\" id=\"libId\" name=\"libId\" >\n" +
  207. " <input type=\"text\" style=\"display: none\" id=\"index\" name=\"index\" >\n" +
  208. " <input type=\"file\" style=\"display: none\" id=\"fileUrl\" name=\"fileUrl\" onchange=\"TalentInfo.fileChange(this)\">\n" +
  209. " <input class=\"form-control\" placeholder=\"请上传头像\" id=\"fileInput\" onclick=\"$('#fileUrl').click()\">\n" +
  210. " </div>\n" +
  211. " </div>\n" +
  212. " </form>",
  213. btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  214. btnAlign: 'c',
  215. yes: function (index, layero) {
  216. $("#index").val(index);
  217. $("#libId").val(TalentInfo.seItem.id);
  218. $("#commonFileForm")[0].submit();
  219. }
  220. });
  221. }
  222. }
  223. TalentInfo.fileChange = function (context) {
  224. var file = $(context).val();
  225. var pos = file.lastIndexOf("\\");
  226. $("#fileInput").val(file.substring(pos + 1));
  227. }
  228. TalentInfo.callback = function (data) {
  229. if (data.code == 200) {
  230. Feng.success(data.msg);
  231. layer.close(data.obj);
  232. } else {
  233. Feng.info(data.msg);
  234. }
  235. }
  236. //显示导出模态框
  237. TalentInfo.showExportModal = function () {
  238. $("#exportForm")[0].reset();
  239. $("#select_contract").val(0);
  240. $("#exportModal").modal("show");
  241. }
  242. TalentInfo.showExportModal = function () {
  243. $("#exportForm")[0].reset();
  244. $("#select_contract").val(1);
  245. $("#exportModal").modal("show");
  246. }
  247. //导出
  248. TalentInfo.export = function () {
  249. var operation = function () {
  250. var queryData = TalentInfo.formParams();
  251. var params = $("#exportForm").serialize();
  252. var url = "/enterprise/talent_library/export?" + params;
  253. Object.keys(queryData).forEach(function (key, index) {
  254. if (typeof queryData[key] != "undefined" && queryData[key]) {
  255. url += "&" + key + "=" + queryData[key];
  256. }
  257. })
  258. window.location.href = url;
  259. };
  260. Feng.confirm("确定要导出数据吗?", operation);
  261. }
  262. /**
  263. * 全选
  264. */
  265. TalentInfo.checkAll = function () {
  266. $("#field_info input").each(function () {
  267. this.checked = true;
  268. })
  269. }
  270. /**
  271. * 反选
  272. */
  273. TalentInfo.unCheckAll = function () {
  274. $("#field_info input").each(function () {
  275. if (this.checked) {
  276. this.checked = false;
  277. } else {
  278. this.checked = true;
  279. }
  280. })
  281. }
  282. $(function () {
  283. var defaultColunms = TalentInfo.initColumn();
  284. var table = new BSTable(TalentInfo.id, "/enterprise/talent_library/list", defaultColunms);
  285. table.setPaginationType("server");
  286. table.setOnDblClickRow(function () {
  287. TalentInfo.openTalentInfoDetail();
  288. });
  289. TalentInfo.table = table.init();
  290. //批量加载字典表数据
  291. var arr = [
  292. {"name": "nation", "code": "nation"},
  293. {"name": "nationality", "code": "nationality"},
  294. {"name": "talent_type", "code": "talent_type"},
  295. {"name": "talent_arrange", "code": "talent_arrange"}];
  296. Feng.findChildDictBatch(JSON.stringify(arr));
  297. });