talentAllowance_info_supple.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. //回调
  2. TalentAllowanceInfoDlg.callBack = function (data) {
  3. layer.close(data.obj);
  4. Feng.info(data.msg);
  5. if (data.code == 200) {
  6. $("#fileTable").bootstrapTable("refresh", {});
  7. }
  8. }
  9. //全选
  10. TalentAllowanceInfoDlg.newCheckAll = function (id, obj) {
  11. var checked = $(obj).is(":checked");
  12. if (checked) {
  13. $("#m" + id + " input[name=month]").each(function () {
  14. $(this).prop("checked", "checked");
  15. })
  16. } else {
  17. $("#m" + id + " input[name=month]").each(function () {
  18. $(this).removeAttr("checked");
  19. })
  20. }
  21. }
  22. //全选
  23. TalentAllowanceInfoDlg.checkAll = function (id) {
  24. $("#" + id + " input").each(function () {
  25. $(this).iCheck("check");
  26. })
  27. }
  28. //反选
  29. TalentAllowanceInfoDlg.unCheckAll = function (id) {
  30. $("#" + id + " input").each(function () {
  31. if (this.checked) {
  32. $(this).iCheck("uncheck");
  33. } else {
  34. $(this).iCheck("check");
  35. }
  36. })
  37. }
  38. //初始化工作单位表的列
  39. TalentAllowanceInfoDlg.initContractColumns = function () {
  40. var type = $("#type").val();
  41. var checkState = $("#checkState").val();
  42. var concats = $("#concats").val();
  43. if (type == 1) {
  44. return [
  45. {field: 'selectItem', checkbox: false, visible: false},
  46. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  47. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  48. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  49. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  50. {title: '离职时间(未离职则模拟离职)', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  51. {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  52. {title: '首次来晋行政介绍信时间', field: 'letterTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
  53. {title: '操作', field: 'id', visible: true, align: 'left', valign: 'middle', width: "120px",
  54. formatter: function (value, row, index) {
  55. var html = "";
  56. if (checkState == 1 || (checkState == 10 && concats.indexOf(value) != -1)) {
  57. html = html + "<button type='button' onclick='TalentAllowanceInfoDlg.showEditContractModel(\"" + value + "\")' style='margin-left: 5px' class='btn btn-xs btn-danger'>" +
  58. "<i class=\"fa fa-edit\"></i>修改" +
  59. "</button>";
  60. }
  61. html = html + "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-left: 5px' class='btn btn-xs btn-success'>" +
  62. "<i class=\"fa fa-book\"></i>日志" +
  63. "</button>";
  64. return html;
  65. }
  66. }
  67. ];
  68. }
  69. if (type == 2) {
  70. return [
  71. {field: 'selectItem', checkbox: false, visible: false},
  72. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  73. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
  74. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  75. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  76. {title: '离职时间(未离职则模拟离职)', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  77. {title: '操作', field: 'id', visible: true, align: 'left', valign: 'middle', width: "120px",
  78. formatter: function (value, row, index) {
  79. var html = "";
  80. if (checkState == 1 || (checkState == 10 && concats.indexOf(value) != -1)) {
  81. html = html + "<button type='button' onclick='TalentAllowanceInfoDlg.showEditContractModel(\"" + value + "\")' style='margin-left: 5px' class='btn btn-xs btn-danger'>" +
  82. "<i class=\"fa fa-edit\"></i>修改" +
  83. "</button>";
  84. }
  85. html = html + "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-left: 5px' class='btn btn-xs btn-success'>" +
  86. "<i class=\"fa fa-book\"></i>日志" +
  87. "</button>";
  88. return html;
  89. }
  90. }
  91. ];
  92. }
  93. }
  94. //初始化项目表的列
  95. TalentAllowanceInfoDlg.initProjectColumns = function () {
  96. return [
  97. {field: 'selectItem', checkbox: false, visible: false},
  98. {title: '核查项目名称', field: 'projectName', visible: true, align: 'center', valign: 'middle', width: "15%", 'class': 'uitd_showTip'},
  99. {title: '详情', field: 'months', visible: true, align: 'center', valign: 'middle', width: "45%",
  100. formatter: function (value, row, index) {
  101. var allowanceType = $("#allowanceType").val();
  102. var html = "";
  103. if (row.project == 4 && allowanceType == 2) {
  104. html = TalentAllowanceInfoDlg.createDaySelector(row.id, value);
  105. } else {
  106. html = TalentAllowanceInfoDlg.createMonthSelector(row.id, value);
  107. }
  108. return html;
  109. }
  110. },
  111. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "25%",
  112. formatter: function (value, row, index) {
  113. var html = '<textarea id="d' + row.id + '" class="form-control">' + (value ? value : "") + '</textarea>';
  114. return html;
  115. }
  116. },
  117. {title: '操作', field: 'project', visible: true, align: 'left', valign: 'middle', width: "15%",
  118. formatter: function (value, row, index) {
  119. var allowanceType = $("#allowanceType").val();
  120. var butHtml = "";
  121. if (row.isEdit == 1) {
  122. /*butHtml = butHtml + "<button type='button' data-value='" + (row.description ? row.description : "") + "' onclick=\"TalentAllowanceInfoDlg.showEditProjectModal('" + row.project + "','" + row.id + "','" + row.enterpriseId + "','" + row.months + "','" + row.days + "',this)\" style='margin-left: 5px' class=\"btn btn-xs btn-danger tips\">" +
  123. "<i class=\"fa fa-edit\"></i>修改</button>";*/
  124. butHtml = butHtml + "<button type='button' onclick=\"TalentAllowanceInfoDlg.saveProjectData('" + row.id + "','" + row.project + "','" + allowanceType + "')\" style='margin-left: 5px' class=\"btn btn-xs btn-danger tips\">" +
  125. "<i class=\"fa fa-edit\"></i>保存</button>";
  126. }
  127. butHtml = butHtml + "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-left: 5px' class='btn btn-xs btn-success'><i class=\"fa fa-book\"></i>日志</button>";
  128. return butHtml;
  129. }
  130. }
  131. ];
  132. }
  133. TalentAllowanceInfoDlg.createDaySelector = function (id, selectDays) {
  134. var dayArr = selectDays ? selectDays.split(",") : [];
  135. var tmpKv = {};
  136. for (var d = 0; d < dayArr.length; d++) {
  137. var kv = dayArr[d].split("=");
  138. tmpKv["m" + kv[0]] = kv[1];
  139. }
  140. var html = '<div id="m' + id + '" class="day-selector"><span style="color:red;">*填写对应月份打卡天数,没有填写则记为0天</span><ul>';
  141. var bigMonths = [1, 3, 5, 7, 8, 10, 12];
  142. for (var m = 1; m <= 12; m++) {
  143. var month = m < 10 ? "0" + m : m;
  144. var day = tmpKv["m" + month] ? tmpKv["m" + month] : "";
  145. var maxDay = bigMonths.indexOf(m) > -1 ? 31 : (m != 2 ? 30 : 29);
  146. html += '<li><label>' + m + '月</label><input type="number" name="day" class="form-control" max="' + maxDay + '" min="0" num="' + month + '" value="' + day + '"></li>';
  147. }
  148. html += '</ul></div>'
  149. return html;
  150. }
  151. TalentAllowanceInfoDlg.createMonthSelector = function (id, selectMonths) {
  152. var monthArr = selectMonths ? selectMonths.split(",") : [];
  153. var html = '<div id="m' + id + '" class="month-selector"><ul><li><input type="checkbox" onchange="TalentAllowanceInfoDlg.newCheckAll(' + id + ',this)">全选</li>';
  154. for (var m = 1; m <= 12; m++) {
  155. var month = m < 10 ? "0" + m : m;
  156. var checked = "";
  157. if (monthArr.indexOf(month.toString()) > -1) {
  158. checked = "checked";
  159. }
  160. html += '<li><input type="checkbox" name="month" value="' + month + '" ' + checked + '>' + month + '月</li>';
  161. }
  162. html += '</ul></div>'
  163. return html;
  164. }
  165. /**
  166. * 初始化附件类别表的列
  167. */
  168. TalentAllowanceInfoDlg.initFileTypeColumn = function () {
  169. return [
  170. {field: 'selectItem', checkbox: false, visible: false},
  171. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  172. formatter: function (value, row, index) {
  173. if (row.must == 1) {
  174. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  175. }
  176. if (row.must == 2) {
  177. return '<i class="fa fa-paste"></i>' + value;
  178. }
  179. }
  180. },
  181. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  182. formatter: function (value, row, index) {
  183. if (value == null || value == '' || value == 'null') {
  184. return '无';
  185. }
  186. return "<button type='button' onclick=\"Feng.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  187. "<i class=\"fa fa-download\"></i>下载" +
  188. "</button>";
  189. }
  190. },
  191. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  192. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  193. formatter: function (value, row, index) {
  194. var files = $("#files").val();
  195. var checkState = $("#checkState").val();
  196. if (checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1)) {
  197. return "<button type='button' onclick=\"TalentAllowanceInfoDlg.checkFile(this,'" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  198. "<i class=\"fa fa-upload\"></i>添加" +
  199. "</button>";
  200. } else {
  201. return "";
  202. }
  203. }
  204. }
  205. ]
  206. };
  207. TalentAllowanceInfoDlg.showLog = function (id) {
  208. layer.open({
  209. type: 1,
  210. title: "日志",
  211. fixed: false,
  212. content: '<table id="' + id + '"></table>',
  213. area: ['80%', '80%'],
  214. maxmin: true,
  215. success: function (layero, index) {
  216. $('#' + id).bootstrapTable({
  217. url: Feng.ctxPath + "/common/api/getJbtCheckLog",
  218. method: 'POST',
  219. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  220. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  221. showRefresh: false, // 是否显示刷新按钮
  222. clickToSelect: true, // 是否启用点击选中行
  223. singleSelect: true, // 设置True 将禁止多选
  224. striped: true, // 是否显示行间隔色
  225. pagination: false, // 设置为 true 会在表格底部显示分页条
  226. paginationHAlign: "left",
  227. paginationDetailHAlign: "right",
  228. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  229. showColumns: false,
  230. queryParams: function (params) {
  231. return {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": id, "active": 1}
  232. },
  233. columns:
  234. [
  235. {title: '步骤', field: 'stepName', visible: true, align: 'center', valign: 'middle', width: "10%",
  236. formatter: function (value, row, index) {
  237. return "" + value;
  238. }
  239. },
  240. {title: '操作人', field: 'createUser', visible: true, align: 'center', valign: 'middle', width: "15%"},
  241. {title: '操作时间', field: 'createTime', visible: true, align: 'center', valign: 'middle', width: "20%"},
  242. {title: '描述', field: 'description', visible: true, align: 'center', valign: 'middle', width: "45%",
  243. formatter: function (value, row, index) {
  244. return '<span data-toggle="tooltip" title="' + value + '">"' + value + '"</span>';
  245. }
  246. }
  247. ]
  248. ,
  249. onPostBody: function () {
  250. $('#' + id + "td.uitd_showTip").bind("mouseover", function () {
  251. var htm = $(this).html();
  252. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  253. });
  254. }
  255. });
  256. }
  257. });
  258. }