talentQuit_info.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 + "/common/api/findCommonFileType",
  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. }
  49. if (row.must == 2) {
  50. return '<i class="fa fa-paste"></i>' + value;
  51. }
  52. }
  53. },
  54. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  55. formatter: function (value, row, index) {
  56. if (value == null || value == '' || value == 'null') {
  57. return '无';
  58. }
  59. return "<button type='button' onclick=\"TalentQuitInfoDlg.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  60. "<i class=\"fa fa-download\"></i>下载" +
  61. "</button>";
  62. }
  63. },
  64. ]
  65. ,
  66. onPostBody: function () {
  67. $("td.uitd_showTip").bind("mouseover", function () {
  68. var htm = $(this).html();
  69. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  70. });
  71. },
  72. onLoadSuccess: function (data) {
  73. $("#fileTable").bootstrapTable('expandAllRows');
  74. },
  75. onExpandRow: function (index, row, $detail) {
  76. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentCommonFile", function (data) {
  77. if (data == null || data.length == 0) {
  78. return;
  79. }
  80. 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>';
  81. for (var key in data) {
  82. var sn = data[key].url.lastIndexOf(".");
  83. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  84. var imgStr = "";
  85. if (suffix == "pdf" || suffix == "PDF") {
  86. 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>";
  87. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  88. 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>";
  89. } else {
  90. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  91. }
  92. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  93. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  94. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  95. "<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>";
  96. }
  97. html = html + '</ul>';
  98. $detail.html(html);
  99. $(".imgs").viewer({
  100. // toolbar:false,
  101. fullscreen: false
  102. });
  103. }, function (data) {
  104. Feng.error("查询失败!" + data.responseJSON.message + "!");
  105. });
  106. var queryData = {};
  107. queryData["mainId"] = $("#id").val();
  108. queryData["typeId"] = row.id;
  109. ajax.set(queryData);
  110. ajax.start();
  111. }
  112. });
  113. }
  114. //下载
  115. TalentQuitInfoDlg.downloadFile = function (id, type) {
  116. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type=" + type;
  117. }
  118. //提交审核
  119. TalentQuitInfoDlg.submitCheck = function () {
  120. layer.open({
  121. type: 1,
  122. id: "checkModel",
  123. title: '审核',
  124. area: ['800px', '450px'], //宽高
  125. fix: false, //不固定
  126. shade: 0,
  127. maxmin: true,
  128. content: " <form id=\"checkForm\" style='margin: 5px'>\n" +
  129. " <div class=\"form-group\">\n" +
  130. " <label for=\"checkState\" class=\"control-label\">审核状态</label>\n" +
  131. " <select class=\"form-control\" id=\"checkStateNow\" onchange=\"TalentQuitInfoDlg.toggleField()\">\n" +
  132. " <option value=\"\"></option>\n" +
  133. " <option value=\"3\">审核通过</option>\n" +
  134. " <option value=\"2\">审核驳回</option>\n" +
  135. " </select>\n" +
  136. " </div>\n" +
  137. " <div class=\"form-group\">\n" +
  138. " <label for=\"msg\" class=\"control-label\">审核意见</label>\n" +
  139. " <textarea class=\"form-control\" id=\"msg\" rows='6'></textarea>\n" +
  140. " </div>\n" +
  141. " </form>",
  142. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  143. btnAlign: 'c',
  144. zIndex: layer.zIndex,
  145. success: function () {
  146. $("#checkForm")[0].reset();
  147. },
  148. yes: function (index, layero) {
  149. var id = $("#id").val();
  150. var checkState = $("#checkStateNow").val();
  151. var msg = $("#msg").val();
  152. if (checkState == null || checkState == '') {
  153. Feng.error("请选择审核状态");
  154. return;
  155. }
  156. if (msg == null || msg == '') {
  157. Feng.error("请填写审核意见");
  158. return;
  159. }
  160. var operation = function () {
  161. var ajax = new $ax(Feng.ctxPath + "/admin/talentQuit/submitToCheck", function (data) {
  162. if (data.code == "200") {
  163. Feng.success(data.msg);
  164. window.parent.TalentQuit.table.refresh();
  165. layer.close(index);
  166. TalentQuitInfoDlg.close();
  167. } else {
  168. Feng.error(data.msg);
  169. }
  170. }, function (data) {
  171. Feng.error("提交失败!" + data.responseJSON.message + "!");
  172. });
  173. ajax.setData({"id": id, "checkState": checkState, "checkMsg": msg});
  174. ajax.start();
  175. }
  176. Feng.confirm("一旦提交,无法修改,确认提交审核吗?", operation);
  177. }
  178. });
  179. }
  180. TalentQuitInfoDlg.toggleField = function () {
  181. var checkState = $("#checkStateNow").val();
  182. if (checkState == 3) {
  183. $("#msg").val("离职申报审核通过。");
  184. } else if (checkState == 2) {
  185. $("#msg").val("");
  186. }
  187. }
  188. /**
  189. * 打包下载
  190. */
  191. TalentQuitInfoDlg.download = function () {
  192. window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/common/api/downloadZip?type=3&id=" + $("#id").val()));
  193. }
  194. $(function () {
  195. if (id != null && id != '') {
  196. $("#fileLi").removeAttr("style");
  197. } else {
  198. $("#fileLi").attr("style", "pointer-events: none");
  199. }
  200. Feng.getCheckLog("logTable", {"type": CONFIG.project_quit, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  201. $("select").each(function () {
  202. $(this).val($(this).attr("value"));
  203. });
  204. });