talentQuit.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /**
  2. * 离职管理管理初始化
  3. */
  4. var TalentQuit = {
  5. id: "TalentQuitTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. TalentQuit.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: 'talentName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  22. {title: '离职企业', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  23. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', width: "150px", 'class': 'uitd_showTip'},
  24. {title: '人才标签', field: 'talentTypeName', visible: isShow, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  25. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  26. {title: '认定时间', field: 'identifyTime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  27. {title: '合同开始时间', field: 'starttime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  28. {title: '合同结束时间', field: 'endtime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  29. {title: '离职时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  30. {title: '离职申报原因', field: 'quitReason', visible: isShow, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  31. {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "80px",
  32. formatter: function (value, row, index) {
  33. if (value == -1) {
  34. return '<span class=\'label\'>待提交</span>';
  35. }
  36. if (value == 1) {
  37. return '<span class=\'label label-success\'>待审核</span>';
  38. }
  39. if (value == 2) {
  40. return '<span class=\'label label-danger\'>已驳回</span>';
  41. }
  42. if (value == 3) {
  43. return '<span class=\'label label-primary\'>已通过</span>';
  44. }
  45. if (value == 9) {
  46. return '<span class=\'label label-success\'>重新提交</span>';
  47. }
  48. }
  49. },
  50. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  51. formatter: function (value, row, index) {
  52. return "<span class='label label-success' onclick=\"TalentQuit.showLog('" + value + "')\" >" +
  53. "<i class=\"fa fa-book\"></i>日志" +
  54. "</span>";
  55. }
  56. }
  57. ];
  58. };
  59. /**
  60. * 检查是否选中
  61. */
  62. TalentQuit.check = function () {
  63. var selected = $('#' + this.id).bootstrapTable('getSelections');
  64. if (selected.length == 0) {
  65. Feng.info("请先选中表格中的某一记录!");
  66. return false;
  67. } else {
  68. TalentQuit.seItem = selected[0];
  69. return true;
  70. }
  71. };
  72. /**
  73. * 点击添加离职管理
  74. */
  75. TalentQuit.openAddTalentQuit = function () {
  76. var ajax = new $ax(Feng.ctxPath + "/common/batch/checkBatchValid", function (data) {
  77. if (data.code == 200) {
  78. var index = layer.open({
  79. type: 2,
  80. title: '添加离职管理',
  81. area: 'auto', //宽高
  82. fix: false, //不固定
  83. maxmin: true,
  84. content: Feng.ctxPath + '/enterprise/talent_quit/apply?year=' + data.obj,
  85. 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;取消'],
  86. btnAlign: 'c',
  87. btn1: function (index, layero) {
  88. var obj = layero.find("iframe")[0].contentWindow;
  89. obj.TalentQuitInfoDlg.addSubmit();
  90. }, btn2: function (index, layero) {
  91. var obj = layero.find("iframe")[0].contentWindow;
  92. obj.TalentQuitInfoDlg.editSubmit(2);
  93. return false;
  94. },
  95. success: function (layero, index) {
  96. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  97. },
  98. end: function () {
  99. layer.closeAll('tips');
  100. }
  101. });
  102. TalentQuit.layerIndex = index;
  103. layer.full(index);
  104. } else {
  105. Feng.info(data.msg);
  106. }
  107. }, function (data) {
  108. Feng.error("校验失败!" + data.responseJSON.message + "!");
  109. });
  110. ajax.set("type", CONFIG.project_quit);
  111. ajax.start();
  112. };
  113. /**
  114. * 打开查看离职管理详情
  115. */
  116. TalentQuit.openTalentQuitDetail = function () {
  117. if (this.check()) {
  118. var ajax = new $ax(Feng.ctxPath + "/common/batch/checkBatchValid", function (data) {
  119. if (data.code == 200) {
  120. if (TalentQuit.seItem.checkState == 1) {
  121. Feng.error("申报正在审核中");
  122. return;
  123. }
  124. if (TalentQuit.seItem.checkState == 3) {
  125. Feng.error("审核通过,无法修改");
  126. return;
  127. }
  128. var index = layer.open({
  129. type: 2,
  130. title: '离职管理详情',
  131. area: ['800px', '420px'], //宽高
  132. fix: false, //不固定
  133. maxmin: true,
  134. content: Feng.ctxPath + '/enterprise/talent_quit/apply/id/' + TalentQuit.seItem.id,
  135. 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;取消'],
  136. btnAlign: 'c',
  137. btn1: function (index, layero) {
  138. var obj = layero.find("iframe")[0].contentWindow;
  139. obj.TalentQuitInfoDlg.addSubmit();
  140. }, btn2: function (index, layero) {
  141. var obj = layero.find("iframe")[0].contentWindow;
  142. obj.TalentQuitInfoDlg.editSubmit(2);
  143. return false;
  144. },
  145. success: function (layero, index) {
  146. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  147. },
  148. end: function () {
  149. layer.closeAll('tips');
  150. }
  151. });
  152. TalentQuit.layerIndex = index;
  153. layer.full(index);
  154. } else {
  155. Feng.info(data.msg);
  156. }
  157. }, function (data) {
  158. Feng.error("校验失败!" + data.responseJSON.message + "!");
  159. });
  160. ajax.set("type", CONFIG.project_quit);
  161. ajax.set("year", TalentQuit.seItem.year);
  162. ajax.start();
  163. }
  164. };
  165. /**
  166. * 打开查看离职管理详情
  167. */
  168. TalentQuit.openTalentQuitSelect = function () {
  169. if (this.check()) {
  170. var index = layer.open({
  171. type: 2,
  172. title: '离职管理详情',
  173. area: ['800px', '420px'], //宽高
  174. fix: false, //不固定
  175. maxmin: true,
  176. content: Feng.ctxPath + '/enterprise/talent_quit/view/id/' + TalentQuit.seItem.id,
  177. });
  178. TalentQuit.layerIndex = index;
  179. layer.full(index);
  180. }
  181. };
  182. /**
  183. * 删除离职管理
  184. */
  185. TalentQuit.delete = function () {
  186. if (this.check()) {
  187. if (TalentQuit.seItem.checkState != -1) {
  188. Feng.error("已提交审核,无法删除");
  189. return;
  190. }
  191. var operation = function () {
  192. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent_quit/delete", function (data) {
  193. if (data.code == 200) {
  194. Feng.success(data.msg);
  195. TalentQuit.table.refresh();
  196. } else {
  197. Feng.error(data.msg);
  198. }
  199. }, function (data) {
  200. Feng.error("删除失败!" + data.responseJSON.message + "!");
  201. });
  202. ajax.set("id", TalentQuit.seItem.id);
  203. ajax.start();
  204. }
  205. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  206. }
  207. };
  208. /**
  209. * 查询表单提交参数对象
  210. * @returns {{}}
  211. */
  212. TalentQuit.formParams = function () {
  213. var queryData = {};
  214. queryData['talentName'] = $("#talentName").val();
  215. queryData['idCard'] = $("#idCard").val();
  216. queryData['enterpriseName'] = $("#companyName").val();
  217. queryData['talentArrange'] = $("#talentArrange").val();
  218. return queryData;
  219. }
  220. /**
  221. * 重置
  222. */
  223. TalentQuit.reset = function () {
  224. $("#talentName").val("");
  225. $("#idCard").val("");
  226. $("#enterpriseName").val("");
  227. $("#talentArrange").val("");
  228. }
  229. /**
  230. * 查询离职管理列表
  231. */
  232. TalentQuit.search = function () {
  233. TalentQuit.table.refresh({query: TalentQuit.formParams()});
  234. };
  235. /**
  236. * 显示审核日志
  237. */
  238. TalentQuit.showLog = function (id) {
  239. layer.open({
  240. type: 1,
  241. title: "日志",
  242. fixed: false,
  243. content: '<table id="' + id + '"></table>',
  244. area: ['80%', '80%'],
  245. maxmin: true,
  246. success: function (layero, index) {
  247. Feng.getCheckLog(id, {"type": CONFIG.project_quit, "mainId": id, "typeFileId": "", "active": 1})
  248. }
  249. });
  250. }
  251. $(function () {
  252. var defaultColunms = TalentQuit.initColumn();
  253. var table = new BSTable(TalentQuit.id, "/enterprise/talent_quit/list", defaultColunms);
  254. table.setPaginationType("server");
  255. TalentQuit.table = table.init();
  256. Feng.addAjaxSelect({
  257. "id": 'talentArrange',
  258. "displayCode": "code",
  259. "displayName": "name",
  260. "type": "GET",
  261. "url": Feng.ctxPath + "/common/tool/findChildDictByCode?code=talent_arrange"
  262. });
  263. });