talentInfo.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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: 'name', visible: true, align: 'center', valign: 'middle',width:"100px",
  23. formatter : function(value,row,index){
  24. if(row.sex==1){
  25. return value+'<span style="color:#6495ED">【男】</span>';
  26. }if(row.sex==2){
  27. return value+'<span style="color:#FF82AB">【女】</span>';
  28. }
  29. }
  30. },
  31. {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',width:"100px",
  32. formatter : function (value,row,index){
  33. if(value==1){
  34. return '晋江市优秀人才';
  35. }if(value==2){
  36. return '集成电路优秀人才';
  37. }
  38. }
  39. },
  40. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"80px",},
  41. {title: '人才标签', field: 'talentTypeName', visible: isShow, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"80px"},
  42. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
  43. {title: '认定条件', field: 'identifyConditionText', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
  44. {title: '认定条件名称', field: 'identifyConditionName', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"120px"},
  45. {title: '认定条件证书取得时间', field: 'identifyGetTime', visible: true, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px"},
  46. {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle',width:"100px",
  47. formatter : function (value,row,index) {
  48. if(value==1){
  49. return "<span class='label'>待提交</span>"
  50. }else if(value==10 || value==5){
  51. return "<span class='label label-danger'>已驳回</span>"
  52. }else{
  53. if(row.isPublic>=5){
  54. if(value==-1){
  55. return "<span class='label label-danger'>审核不通过</span>"
  56. }else if(value==35){
  57. return "<span class='label label-primary'>认定通过</span>"
  58. }else{
  59. return "<span class='label label-success'>审核中</span>"
  60. }
  61. }else{
  62. return "<span class='label label-success'>审核中</span>"
  63. }
  64. }
  65. }
  66. },
  67. {title: '审核意见', field: 'checkMsg', visible: false, align: 'center', valign: 'middle','class': 'uitd_showTip',width:"100px",
  68. formatter : function (value,row,index) {
  69. if(value==1){
  70. return ""
  71. }else if(value==10 || value==5){
  72. return value;
  73. }else{
  74. if(row.isPublic>=5){
  75. if(value==-1){
  76. return value
  77. }else if(value==35){
  78. return value;
  79. }else{
  80. return ""
  81. }
  82. }else{
  83. return ""
  84. }
  85. }
  86. }
  87. },
  88. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"80px",
  89. formatter : function (value,row,index){
  90. return "<span class='label label-success' onclick=\"TalentInfo.showLog('"+value+"')\" >" +
  91. "<i class=\"fa fa-book\"></i>日志" +
  92. "</span>";
  93. }
  94. }
  95. ];
  96. };
  97. /**
  98. * 检查是否选中
  99. */
  100. TalentInfo.check = function () {
  101. var selected = $('#' + this.id).bootstrapTable('getSelections');
  102. if(selected.length == 0){
  103. Feng.info("请先选中表格中的某一记录!");
  104. return false;
  105. }else{
  106. TalentInfo.seItem = selected[0];
  107. return true;
  108. }
  109. };
  110. /**
  111. * 显示审核日志
  112. */
  113. TalentInfo.showLog = function (id){
  114. layer.open({
  115. type: 1,
  116. title:"日志",
  117. fixed:false,
  118. content: '<table id="'+id+'"></table>',
  119. area: ['80%', '80%'],
  120. maxmin: true,
  121. success :function (layero, index) {
  122. Feng.getCheckLog(id,{"type":CONFIG.project_rcrd,"mainId":id,"typeFileId":"","active":1})
  123. }
  124. });
  125. }
  126. /**
  127. * 点击添加人才认定申报
  128. */
  129. TalentInfo.openAddTalentInfo = function () {
  130. var ajax = new $ax(Feng.ctxPath + "/api/commonBatch/valiateIsAdd", function (data) {
  131. if(data.code==200){
  132. var index = layer.open({
  133. type: 2,
  134. title: '添加人才认定申报',
  135. fix: false, //不固定
  136. maxmin: true,
  137. content: Feng.ctxPath + '/api/talentInfo/talentInfo_add?year='+data.obj,
  138. btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交','<i class="fa fa-check layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  139. btnAlign: 'c',
  140. btn1: function (index, layero) {
  141. var obj = layero.find("iframe")[0].contentWindow;
  142. obj.TalentInfoInfoDlg.addSubmit();
  143. },btn2: function(index, layero){
  144. var obj = layero.find("iframe")[0].contentWindow;
  145. obj.TalentInfoInfoDlg.submitToCheck();
  146. return false;
  147. },
  148. success :function (layero, index) {
  149. layer.tips('添加基本信息并上传附件后点击','.layui-layer-btn1',{tips:[1,"#78BA32"],time:0,closeBtn :2});
  150. },
  151. end :function () {
  152. layer.closeAll('tips');
  153. }
  154. });
  155. layer.full(index);
  156. TalentInfo.layerIndex = index;
  157. }else{
  158. Feng.info(data.msg);
  159. }
  160. }, function (data) {
  161. Feng.error("校验失败!" + data.responseJSON.message + "!");
  162. });
  163. ajax.set("type",CONFIG.project_rcrd);
  164. ajax.start();
  165. };
  166. /**
  167. * 打开查看人才认定申报详情
  168. */
  169. TalentInfo.openTalentInfoDetail = function () {
  170. if (this.check()) {
  171. var ajax = new $ax(Feng.ctxPath + "/api/commonBatch/valiateIsEditOrSubmit", function (data) {
  172. if (data.code == 200) {
  173. var index = layer.open({
  174. type: 2,
  175. title: '人才认定申报详情',
  176. area: ['800px', '420px'], //宽高
  177. fix: false, //不固定
  178. maxmin: true,
  179. content: Feng.ctxPath + '/api/talentInfo/talentInfo_update/' + TalentInfo.seItem.id+"/update",
  180. btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交','<i class="fa fa-check layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  181. btnAlign: 'c',
  182. btn1: function (index, layero) {
  183. var obj = layero.find("iframe")[0].contentWindow;
  184. obj.TalentInfoInfoDlg.addSubmit();
  185. },btn2: function(index, layero){
  186. var obj = layero.find("iframe")[0].contentWindow;
  187. obj.TalentInfoInfoDlg.submitToCheck();
  188. return false;
  189. },
  190. success :function (layero, index) {
  191. layer.tips('添加基本信息并上传附件后点击','.layui-layer-btn1',{tips:[1,"#78BA32"],time:0,closeBtn :2});
  192. },
  193. end :function () {
  194. layer.closeAll('tips');
  195. }
  196. });
  197. layer.full(index);
  198. TalentInfo.layerIndex = index;
  199. }else{
  200. Feng.info(data.msg);
  201. }
  202. }, function (data) {
  203. Feng.error("校验失败!" + data.responseJSON.message + "!");
  204. });
  205. ajax.set("type",CONFIG.project_rcrd);
  206. ajax.set("year",TalentInfo.seItem.year);
  207. ajax.start();
  208. }
  209. };
  210. /**
  211. * 查看
  212. */
  213. TalentInfo.openTalentInfoSelect = function(){
  214. if (this.check()) {
  215. var index = layer.open({
  216. type: 2,
  217. title: '人才认定申报详情',
  218. area: ['800px', '420px'], //宽高
  219. fix: false, //不固定
  220. maxmin: true,
  221. content: Feng.ctxPath + '/api/talentInfo/talentInfo_select/' + TalentInfo.seItem.id,
  222. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  223. btnAlign: 'c',
  224. });
  225. layer.full(index);
  226. TalentInfo.layerIndex = index;
  227. }
  228. }
  229. /**
  230. * 删除人才认定申报
  231. */
  232. TalentInfo.delete = function () {
  233. if (this.check()) {
  234. if(TalentInfo.seItem.checkState!=1){
  235. Feng.error("该申报已提交审核,无法删除");
  236. return ;
  237. }
  238. var operation = function() {
  239. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/delete", function (data) {
  240. Feng.success("删除成功!");
  241. TalentInfo.table.refresh();
  242. }, function (data) {
  243. Feng.error("删除失败!" + data.responseJSON.message + "!");
  244. });
  245. ajax.set("talentInfoId", TalentInfo.seItem.id);
  246. ajax.start();
  247. }
  248. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  249. }
  250. };
  251. /**
  252. * 查询表单提交参数对象
  253. * @returns {{}}
  254. */
  255. TalentInfo.formParams = function() {
  256. var queryData = {};
  257. queryData['name'] = $("#name").val();
  258. queryData['idCard'] = $("#idCard").val();
  259. queryData['sex'] = $("#sex").val();
  260. queryData['nation'] = $("#nation").val();
  261. queryData['nationality'] = $("#nationality").val();
  262. queryData['talentType'] = $("#talentType").val();
  263. queryData['talentArrange'] = $("#talentArrange").val();
  264. queryData['checkState'] = $("#checkState").val();
  265. return queryData;
  266. }
  267. /**
  268. * 查询人才认定申报列表
  269. */
  270. TalentInfo.search = function () {
  271. TalentInfo.table.refresh({query: TalentInfo.formParams()});
  272. };
  273. /**
  274. * 重置
  275. */
  276. TalentInfo.reset = function (){
  277. $("#name").val("");
  278. $("#idCard").val("");
  279. $("#sex").val("");
  280. $("#nation").val("");
  281. $("#nationality").val("");
  282. $("#talentType").val("");
  283. $("#talentArrange").val("");
  284. $("#checkState").val("");
  285. }
  286. $(function () {
  287. var defaultColunms = TalentInfo.initColumn();
  288. var table = new BSTable(TalentInfo.id, "/enterprise/talent/list/type/1", defaultColunms);
  289. table.setPaginationType("server");
  290. table.setOnDblClickRow(function () {
  291. TalentInfo.openTalentInfoDetail();
  292. });
  293. TalentInfo.table = table.init();
  294. //批量加载字典表数据
  295. var arr = [
  296. {"name":"nation","code":"un_nation"},
  297. {"name":"talentArrange","code":"un_talentLevel"},
  298. {"name":"nationality","code":"un_nationality"},
  299. {"name":"talentType","code":"un_jbt_talentType"}];
  300. Feng.findChildDictBatch(JSON.stringify(arr));
  301. });