talentQuit.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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: 'year', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  22. {title: '姓名', field: 'talentName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  23. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', width: "150px", 'class': 'uitd_showTip'},
  24. {title: '离职企业', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  25. {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  26. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  27. {title: '认定时间', field: 'identifyTime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  28. {title: '合同开始时间', field: 'starttime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  29. {title: '合同结束时间', field: 'endtime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  30. {title: '离职时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  31. {title: '离职申报原因', field: 'quitReason', visible: isShow, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  32. {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "80px",
  33. formatter: function (value, row, index) {
  34. if (value == -1) {
  35. return '<span class=\'label\'>待提交</span>';
  36. }
  37. if (value == 1) {
  38. return '<span class=\'label label-success\'>待审核</span>';
  39. }
  40. if (value == 2) {
  41. return '<span class=\'label label-danger\'>已驳回</span>';
  42. }
  43. if (value == 3) {
  44. return '<span class=\'label label-primary\'>已通过</span>';
  45. }
  46. if (value == 9) {
  47. return '<span class=\'label label-success\'>重新提交</span>';
  48. }
  49. }
  50. },
  51. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  52. formatter: function (value, row, index) {
  53. return "<span class='label label-success' onclick=\"TalentQuit.showLog('" + value + "')\" >" +
  54. "<i class=\"fa fa-book\"></i>日志" +
  55. "</span>";
  56. }
  57. },
  58. ];
  59. };
  60. /**
  61. * 检查是否选中
  62. */
  63. TalentQuit.check = function () {
  64. var selected = $('#' + this.id).bootstrapTable('getSelections');
  65. if (selected.length == 0) {
  66. Feng.info("请先选中表格中的某一记录!");
  67. return false;
  68. } else {
  69. TalentQuit.seItem = selected[0];
  70. return true;
  71. }
  72. };
  73. /**
  74. * 打开查看离职管理审核页面
  75. */
  76. TalentQuit.openTalentQuitCheck = function () {
  77. if (this.check()) {
  78. if (TalentQuit.seItem.checkState != 1 && TalentQuit.seItem.checkState != 9) {
  79. Feng.info("不在审核范围内");
  80. return;
  81. }
  82. var index = layer.open({
  83. type: 2,
  84. title: '离职管理审核',
  85. fix: false, //不固定
  86. maxmin: true,
  87. content: Feng.ctxPath + '/admin/talent_quit/detail/' + TalentQuit.seItem.id,
  88. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  89. btnAlign: 'c',
  90. yes: function (index, layero) {
  91. var obj = layero.find("iframe")[0].contentWindow;
  92. obj.TalentQuitInfoDlg.submitCheck();
  93. }
  94. });
  95. TalentQuit.layerIndex = index;
  96. layer.full(index);
  97. }
  98. };
  99. /**
  100. * 打开查看离职管理页面
  101. */
  102. TalentQuit.openTalentQuitDetail = function () {
  103. if (this.check()) {
  104. var index = layer.open({
  105. type: 2,
  106. title: '离职管理详情',
  107. fix: false, //不固定
  108. maxmin: true,
  109. content: Feng.ctxPath + '/admin/talent_quit/detail/id/' + TalentQuit.seItem.id
  110. });
  111. TalentQuit.layerIndex = index;
  112. layer.full(index);
  113. }
  114. };
  115. /**
  116. * 查询表单提交参数对象
  117. * @returns {{}}
  118. */
  119. TalentQuit.formParams = function () {
  120. var queryData = {};
  121. queryData['talentName'] = $("#talentName").val();
  122. queryData['idCard'] = $("#idCard").val();
  123. queryData['enterpriseName'] = $("#enterpriseName").val();
  124. queryData['talentArrange'] = $("#talentArrange").val();
  125. queryData['checkState'] = $("#checkState").val();
  126. return queryData;
  127. }
  128. /**
  129. * 重置
  130. */
  131. TalentQuit.reset = function () {
  132. $("#talentName").val("");
  133. $("#idCard").val("");
  134. $("#enterpriseName").val("");
  135. $("#talentArrange").val("");
  136. $("#checkState").val("");
  137. }
  138. /**
  139. * 查询离职管理列表
  140. */
  141. TalentQuit.search = function () {
  142. TalentQuit.table.refresh({query: TalentQuit.formParams()});
  143. };
  144. /**
  145. * 导出
  146. */
  147. TalentQuit.export = function () {
  148. var queryData = TalentQuit.formParams();
  149. var url = Feng.ctxPath + "/admin/talent_quit/export?" +
  150. "&talentName=" + queryData.talentName +
  151. "&idCard=" + queryData.idCard +
  152. "&enterpriseName=" + queryData.enterpriseName +
  153. "&talentArrange=" + queryData.talentArrange +
  154. "&checkState=" + queryData.checkState;
  155. window.location.href = encodeURI(encodeURI(url));
  156. }
  157. /**
  158. * 打包下载附件
  159. */
  160. TalentQuit.download = function () {
  161. if (this.check()) {
  162. window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/common/api/downloadZip?type=3&id=" + TalentQuit.seItem.id));
  163. }
  164. }
  165. /**
  166. * 显示审核日志
  167. */
  168. TalentQuit.showLog = function (id) {
  169. layer.open({
  170. type: 1,
  171. title: "日志",
  172. fixed: false,
  173. content: '<table id="' + id + '"></table>',
  174. area: ['80%', '80%'],
  175. maxmin: true,
  176. success: function (layero, index) {
  177. Feng.getCheckLog(id, {"type": CONFIG.project_quit, "mainId": id, "typeFileId": "", "active": 1})
  178. }
  179. });
  180. }
  181. $(function () {
  182. var defaultColunms = TalentQuit.initColumn();
  183. var table = new BSTable(TalentQuit.id, "/admin/talent_quit/list", defaultColunms);
  184. table.setPaginationType("server");
  185. TalentQuit.table = table.init();
  186. Feng.addAjaxSelect({
  187. "id": 'talentArrange',
  188. "displayCode": "code",
  189. "displayName": "name",
  190. "type": "GET",
  191. "url": Feng.ctxPath + "/common/tool/findChildDictByCode?code=talent_arrange"
  192. });
  193. });