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