talentQuit_info.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /**
  2. * 初始化离职管理详情对话框
  3. */
  4. var TalentQuitInfoDlg = {
  5. talentQuitInfoData : {}
  6. };
  7. /**
  8. * 关闭此对话框
  9. */
  10. TalentQuitInfoDlg.close = function() {
  11. parent.layer.close(window.parent.TalentQuit.layerIndex);
  12. }
  13. //附件初始化
  14. TalentQuitInfoDlg.initFileTable = function(){
  15. var queryData = {};
  16. queryData['project'] = CONFIG.project_quit;
  17. queryData['type'] = $("#type").val();
  18. $("#fileTable").bootstrapTable({
  19. url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
  20. method: 'POST',
  21. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  22. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  23. showRefresh: false, // 是否显示刷新按钮
  24. clickToSelect: true, // 是否启用点击选中行
  25. singleSelect: true, // 设置True 将禁止多选
  26. striped: true, // 是否显示行间隔色
  27. escape: true,
  28. pagination: false, // 设置为 true 会在表格底部显示分页条
  29. paginationHAlign: "left",
  30. paginationDetailHAlign: "right",
  31. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  32. showColumns: false,
  33. detailView: true, //是否显示父子表
  34. pageList: [10, 30, 50],
  35. queryParams: function (params) {
  36. return $.extend(queryData,params)
  37. },
  38. rowStyle: function (row, index) {
  39. return {classes:"info"};
  40. },
  41. columns:
  42. [
  43. {field: 'selectItem', checkbox:false,visible:false},
  44. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"30%",'class': 'uitd_showTip',
  45. formatter : function(value,row,index){
  46. if(row.must==1){
  47. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> '+ value;
  48. }if(row.must==2){
  49. return '<i class="fa fa-paste"></i>'+value;
  50. }
  51. }
  52. },
  53. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"8%",
  54. formatter : function(value,row,index){
  55. if(value==null||value==''||value=='null'){
  56. return '无';
  57. }
  58. return "<button type='button' onclick=\"TalentQuitInfoDlg.downloadFile('"+row.id+"',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  59. "<i class=\"fa fa-download\"></i>下载" +
  60. "</button>";
  61. }
  62. },
  63. ]
  64. ,
  65. onPostBody: function () {
  66. $("td.uitd_showTip").bind("mouseover", function () {
  67. var htm = $(this).html();
  68. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  69. });
  70. },
  71. onLoadSuccess: function (data) {
  72. $("#fileTable").bootstrapTable('expandAllRows');
  73. },
  74. onExpandRow: function (index, row, $detail) {
  75. var ajax = new $ax(Feng.ctxPath + "/api/talentCommonFile/listTalentCommonFile", function (data) {
  76. if(data==null||data.length==0){
  77. return;
  78. }
  79. var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
  80. for(var key in data){
  81. var sn = data[key].url.lastIndexOf(".");
  82. var suffix = data[key].url.substring(sn+1,data[key].url.length);
  83. var imgStr = "";
  84. if(suffix=="pdf"||suffix=="PDF"){
  85. imgStr = "<button type='button' onclick=\"Feng.showPdf('"+data[key].url+"','"+data[key].id+"','"+data[key].orignName+"')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  86. }else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
  87. imgStr = "<button type='button' onclick=\"Feng.showExcel('"+data[key].url+"','"+data[key].id+"','"+data[key].orignName+"')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  88. }else{
  89. imgStr = '<img class=\"imgUrl\" src=\"'+data[key].url+'\" style=\"width:25px;height:25px;\">';
  90. }
  91. html = html + '<li style="display: none">'+data[key].id+'</li>\n'+
  92. '<li style="width: 80%;padding-top: 5px;">'+data[key].orignName+'</li>\n'+
  93. '<li style="width: 10%;">'+imgStr+'</li>\n'+
  94. "<li style='width: 10%;padding-top: 2px;'><button type='button' onclick=\"TalentQuitInfoDlg.downloadFile('"+data[key].id+"',2)\" class=\"btn btn-xs btn-success\"><i class=\"fa fa-download\" aria-hidden=\"true\"></i>下载</button></li>";
  95. }
  96. html = html + '</ul>';
  97. $detail.html(html);
  98. $(".imgs").viewer({
  99. // toolbar:false,
  100. fullscreen:false
  101. });
  102. }, function (data) {
  103. Feng.error("查询失败!" + data.responseJSON.message + "!");
  104. });
  105. var queryData = {};
  106. queryData["mainId"] = $("#id").val();
  107. queryData["typeId"] = row.id;
  108. ajax.set(queryData);
  109. ajax.start();
  110. }
  111. });
  112. }
  113. //下载
  114. TalentQuitInfoDlg.downloadFile = function (id,type){
  115. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id+ "&type="+type;
  116. }
  117. //提交审核
  118. TalentQuitInfoDlg.submitCheck = function(){
  119. layer.open({
  120. type: 1,
  121. id: "checkModel",
  122. title: '审核',
  123. area: ['800px', '450px'], //宽高
  124. fix: false, //不固定
  125. shade: 0,
  126. maxmin: true,
  127. content: " <form id=\"checkForm\" style='margin: 5px'>\n" +
  128. " <div class=\"form-group\">\n" +
  129. " <label for=\"checkState\" class=\"control-label\">审核状态</label>\n" +
  130. " <select class=\"form-control\" id=\"checkStateNow\" onchange=\"TalentQuitInfoDlg.toggleField()\">\n" +
  131. " <option value=\"\"></option>\n" +
  132. " <option value=\"3\">审核通过</option>\n" +
  133. " <option value=\"2\">审核驳回</option>\n" +
  134. " </select>\n" +
  135. " </div>\n" +
  136. " <div class=\"form-group\">\n" +
  137. " <label for=\"msg\" class=\"control-label\">审核意见</label>\n" +
  138. " <textarea class=\"form-control\" id=\"msg\" rows='6'></textarea>\n" +
  139. " </div>\n" +
  140. " </form>",
  141. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  142. btnAlign: 'c',
  143. zIndex: layer.zIndex,
  144. success:function(){
  145. $("#checkForm")[0].reset();
  146. },
  147. yes: function (index, layero) {
  148. var id = $("#id").val();
  149. var checkState = $("#checkStateNow").val();
  150. var msg = $("#msg").val();
  151. if(checkState==null || checkState==''){
  152. Feng.error("请选择审核状态");
  153. return ;
  154. }
  155. if(msg==null || msg==''){
  156. Feng.error("请填写审核意见");
  157. return ;
  158. }
  159. var operation = function(){
  160. var ajax = new $ax(Feng.ctxPath + "/talentQuit/submitCheck", function(data){
  161. if(data.code=="200"){
  162. Feng.success(data.msg);
  163. window.parent.TalentQuit.table.refresh();
  164. layer.close(index);
  165. TalentQuitInfoDlg.close();
  166. }else{
  167. Feng.error(data.msg);
  168. }
  169. },function(data){
  170. Feng.error("提交失败!" + data.responseJSON.message + "!");
  171. });
  172. ajax.setData({"id":id,"checkState":checkState,"checkMsg":msg});
  173. ajax.start();
  174. }
  175. Feng.confirm("一旦提交,无法修改,确认提交审核吗?", operation);
  176. }
  177. });
  178. }
  179. TalentQuitInfoDlg.toggleField = function(){
  180. var checkState = $("#checkStateNow").val();
  181. if(checkState==3){
  182. $("#msg").val("离职申报审核通过。");
  183. }else if(checkState==2){
  184. $("#msg").val("");
  185. }
  186. }
  187. /**
  188. * 打包下载
  189. */
  190. TalentQuitInfoDlg.download = function(){
  191. window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/api/commonDownload/downloadZip?type=3&id="+$("#id").val()));
  192. }
  193. $(function() {
  194. if(id!=null && id!=''){
  195. $("#fileLi").removeAttr("style");
  196. }else{
  197. $("#fileLi").attr("style","pointer-events: none");
  198. }
  199. Feng.getCheckLog("logTable",{"type":CONFIG.project_quit,"mainId":$("#id").val(),"typeFileId":"","active":1})
  200. $("select").each(function () {
  201. $(this).val($(this).attr("value"));
  202. });
  203. });