talentQuit.js 10 KB

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