talentInfo.js 12 KB

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