talentInfo_library.js 11 KB

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