talentAllowance_info.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var TalentAllowanceInfoDlg = {
  5. talentAllowanceData: {},
  6. validateFields: {
  7. talentId: {validators: {notEmpty: {message: '申报对象不能为空'}}},
  8. allowanceType: {validators: {notEmpty: {message: '津补贴类型不能为空'}}},
  9. postType: {
  10. validators: {
  11. callback: {
  12. message: "请选择岗位类型",
  13. callback: function (value, validator) {
  14. if ($("#postType option").length > 0 && ($("#postType").val() == null || $("#postType").val() == "")) {
  15. return false;
  16. }
  17. return true;
  18. }
  19. }
  20. }
  21. },
  22. institution: {
  23. validators: {
  24. callback: {
  25. message: "请选择所属编制",
  26. callback: function (value, validator) {
  27. if ($("#institution option").length > 0 && ($("#institution").val() == null || $("#institution").val() == "")) {
  28. return false;
  29. }
  30. return true;
  31. }
  32. }
  33. }
  34. },
  35. wage: {
  36. validators: {
  37. callback: {
  38. message: "请填写上一年度年薪",
  39. callback: function (value, validator) {
  40. if ($("#allowanceType").val() == 1 && $("#wage").val().trim().length == 0) {
  41. //return false;
  42. }
  43. return true;
  44. }
  45. }
  46. }
  47. },
  48. backWork: {
  49. validators: {
  50. callback: {
  51. message: "请选择是否退休返聘",
  52. callback: function (value, validator) {
  53. if ($("#backWork option").length > 0 && ($("#backWork").val() == null || $("#backWork").val() == "")) {
  54. return false;
  55. }
  56. return true;
  57. }
  58. }
  59. }
  60. },
  61. }
  62. };
  63. /**
  64. * 清除数据
  65. */
  66. TalentAllowanceInfoDlg.clearData = function () {
  67. this.talentAllowanceData = {};
  68. }
  69. /**
  70. * 设置对话框中的数据
  71. *
  72. * @param key 数据的名称
  73. * @param val 数据的具体值
  74. */
  75. TalentAllowanceInfoDlg.set = function (key, val) {
  76. this.talentAllowanceData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  77. return this;
  78. }
  79. /**
  80. * 设置对话框中的数据
  81. *
  82. * @param key 数据的名称
  83. * @param val 数据的具体值
  84. */
  85. TalentAllowanceInfoDlg.get = function (key) {
  86. return $("#" + key).val();
  87. }
  88. /**
  89. * 关闭此对话框
  90. */
  91. TalentAllowanceInfoDlg.close = function () {
  92. parent.layer.close(window.parent.TalentAllowanceInfo.layerIndex);
  93. }
  94. /**
  95. * 收集数据
  96. */
  97. TalentAllowanceInfoDlg.collectData = function () {
  98. this.set('id')
  99. .set('talentId')
  100. .set('year')
  101. .set('allowanceType')
  102. .set('postType')
  103. .set('institution')
  104. .set('wage');
  105. }
  106. /**
  107. * 验证数据
  108. */
  109. TalentAllowanceInfoDlg.validate = function () {
  110. $('#talentAllowanceForm').data("bootstrapValidator").resetForm();
  111. $('#talentAllowanceForm').bootstrapValidator('validate');
  112. return $("#talentAllowanceForm").data('bootstrapValidator').isValid();
  113. }
  114. TalentAllowanceInfoDlg.onAllowanceTypeChange = function (allowanceType) {
  115. $("#wageDiv").val("");
  116. if (allowanceType == 1) {
  117. //$("#wageDiv").css("display", "block");
  118. } else {
  119. $("#wageDiv").css("display", "none");
  120. }
  121. }
  122. TalentAllowanceInfoDlg.calculator = function () {
  123. var id = $("#id").val();
  124. if (!id) {
  125. Feng.error("请先保存再进行计算");
  126. return;
  127. }
  128. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/calculator/id/" + id, function (data) {
  129. var message = data.recommendAllowanceMsg.join("<br>");
  130. if (data.recommendAllowanceType != 3) {
  131. message += "<br>试算补贴金额:<span style='color:red;font-weight:bold;'>" + data.finnalMoney + "</span>";
  132. }
  133. Feng.confirm(message, function () {});
  134. }, function (data) {
  135. Feng.error("查询失败!" + data.responseJSON.message + "!");
  136. });
  137. ajax.start();
  138. }
  139. /**
  140. * 选择申报对象初始化
  141. */
  142. TalentAllowanceInfoDlg.init = function () {
  143. var talentId = $("#name").val();
  144. var year = $("#year").val();
  145. if (Feng.isNotEmptyStr(talentId)) {
  146. //var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/getInfoById/id/" + talentId, function (data) {
  147. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/getInfoByIdAndYear/id/" + talentId + "/year/" + year, function (data) {
  148. if (data.code == 200) {
  149. var info = data.obj;
  150. $("#active").val(info.active);
  151. $("#talentId").val(talentId);
  152. $("#talentTypeName").val(info.talentTypeName);
  153. $("#enterpriseName").val(info.enterpriseName);
  154. $("#sex").val(info.sex == 1 ? "男" : "女");
  155. $("#idCard").val(info.card_number);
  156. //$("#introductionModeName").val(info.introductionModeName);
  157. $("#firstInJJTime").val(info.fst_work_time);
  158. $("#entryTime").val(info.cur_entry_time);
  159. $("#post").val(info.position);
  160. $("#phone").val(info.phone);
  161. $("#bank").val(info.bank);
  162. $("#bankNumber").val(info.bank_number);
  163. $("#bankNetwork").val(info.bank_branch_name).attr("title", info.bank_branch_name);
  164. $("#bankAccount").val(info.bank_account);
  165. $("#talentArrangeName").val(info.talentArrangeName);
  166. $("#identifyConditionText").val(info.talentConditionName).attr("title", info.talentConditionName);
  167. $("#identifyConditionName").val(info.identifyConditionName).attr("title", info.identifyConditionName);
  168. $("#identifyGetTime").val(info.identifyGetTime);
  169. $("#provinceCode").val(info.provinceName + info.cityName + (info.countyName ? info.countyName : ""));
  170. } else {
  171. $("#active").val("");
  172. $("#talentId").val("");
  173. $("#talentTypeName").val("");
  174. $("#enterpriseName").val("");
  175. $("#sex").val("");
  176. $("#idCard").val("");
  177. //$("#introductionModeName").val(info.introductionModeName);
  178. $("#firstInJJTime").val("");
  179. $("#entryTime").val("");
  180. $("#post").val("");
  181. $("#phone").val("");
  182. $("#bank").val("");
  183. $("#bankNumber").val("");
  184. $("#bankNetwork").val("").attr("title", "");
  185. $("#bankAccount").val("");
  186. $("#talentArrangeName").val("");
  187. $("#identifyConditionText").val("").attr("title", "");
  188. $("#identifyConditionName").val("").attr("title", "");
  189. $("#identifyGetTime").val("");
  190. $("#provinceCode").val("");
  191. Feng.error(data.msg);
  192. }
  193. }, function (data) {
  194. Feng.error("查询失败!" + data.responseJSON.message + "!");
  195. });
  196. ajax.start();
  197. }
  198. }
  199. /**
  200. * 提交添加
  201. */
  202. TalentAllowanceInfoDlg.addSubmit = function () {
  203. this.clearData();
  204. this.collectData();
  205. if (!TalentAllowanceInfoDlg.validate()) {
  206. return;
  207. }
  208. var id = $('#id').val();
  209. if (Feng.isNotEmptyStr(id)) {
  210. TalentAllowanceInfoDlg.editSubmit();
  211. return;
  212. }
  213. /*var allowanceType = $("#allowanceType").val();
  214. if (allowanceType == 1) {
  215. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  216. Feng.info("请填写上一年度年薪");
  217. return;
  218. }
  219. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  220. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  221. return;
  222. }
  223. }*/
  224. var operation = function () {
  225. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/apply", function (data) {
  226. if (data.code == 200) {
  227. Feng.success(data.msg);
  228. $("#id").val(data.obj.id);
  229. $("#name").prop("disabled", true).trigger("chosen:updated");
  230. $("#fileLi").removeAttr("style");
  231. $("#checkState").val(data.obj.checkState);
  232. } else {
  233. Feng.info(data.msg);
  234. }
  235. }, function (data) {
  236. Feng.error("提交失败!" + data.responseJSON.message + "!");
  237. });
  238. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData);
  239. ajax.start();
  240. }
  241. Feng.confirm("请确认当前申报人是否已完成所有的离职变更、工作单位变更、人才层次变更以及银行账号变更且已审核通过,一旦保存无法追加,确认保存吗?", operation);
  242. }
  243. TalentAllowanceInfoDlg.editSubmit = function () {
  244. this.clearData();
  245. this.collectData();
  246. if (!TalentAllowanceInfoDlg.validate()) {
  247. return;
  248. }
  249. if (!TalentAllowanceInfoDlg.validateIsEdit())
  250. return;
  251. /*var active = $("#active").val();
  252. if (active == 2) {
  253. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  254. Feng.info("请填写上一年度年薪");
  255. return;
  256. }
  257. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  258. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  259. return;
  260. }
  261. }*/
  262. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/apply", function (data) {
  263. if (data.code == 200) {
  264. Feng.success(data.msg);
  265. } else {
  266. Feng.info(data.msg);
  267. }
  268. }, function (data) {
  269. Feng.error("提交失败!" + data.responseJSON.message + "!");
  270. });
  271. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData);
  272. ajax.start();
  273. }
  274. /**
  275. * 初始化工作单位及核查项目情况表
  276. */
  277. TalentAllowanceInfoDlg.initContract = function () {
  278. $("#projectTable").bootstrapTable("destroy", {});
  279. $("#projectTable").bootstrapTable({
  280. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceContractDetail",
  281. method: 'POST',
  282. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  283. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  284. showRefresh: false, // 是否显示刷新按钮
  285. clickToSelect: true, // 是否启用点击选中行
  286. singleSelect: true, // 设置True 将禁止多选
  287. striped: true, // 是否显示行间隔色
  288. escape: true,
  289. pagination: false, // 设置为 true 会在表格底部显示分页条
  290. paginationHAlign: "left",
  291. paginationDetailHAlign: "right",
  292. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  293. showColumns: false,
  294. detailView: true, //父子表
  295. queryParams: function (params) {
  296. return $.extend({"mainId": $("#id").val()}, params)
  297. },
  298. columns: TalentAllowanceInfoDlg.initContractColumns(),
  299. onPostBody: function () {
  300. $("td.uitd_showTip").bind("mouseover", function () {
  301. var htm = $(this).html();
  302. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  303. });
  304. },
  305. onLoadSuccess: function (data) {
  306. $("#projectTable").bootstrapTable('expandAllRows');
  307. },
  308. onExpandRow: function (index, row, $detail) {
  309. var enterpriseId = row.enterpriseId;
  310. var cur_table = $detail.html('<table id="' + enterpriseId + '" class="mytable-hover"></table>').find('table');
  311. $(cur_table).bootstrapTable("destroy", {});
  312. $(cur_table).bootstrapTable({
  313. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceProject",
  314. method: 'POST',
  315. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  316. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  317. showRefresh: false, // 是否显示刷新按钮
  318. clickToSelect: true, // 是否启用点击选中行
  319. singleSelect: true, // 设置True 将禁止多选
  320. escape: true,
  321. pagination: false, // 设置为 true 会在表格底部显示分页条
  322. paginationHAlign: "left",
  323. paginationDetailHAlign: "right",
  324. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  325. showColumns: false,
  326. queryParams: function (params) {
  327. return $.extend({"mainId": $("#id").val(), "baseId": row.id}, params)
  328. },
  329. columns: TalentAllowanceInfoDlg.initProjectColumns(),
  330. onLoadSuccess: function (data) {
  331. //TalentAllowanceInfoDlg.initICheck();
  332. //layer.tips('请勾选个税缴纳情况', '.tips', {tips: [1, "#1ab394"], time: 0, closeBtn: 2});
  333. },
  334. });
  335. }
  336. });
  337. }
  338. //显示修改工作单位合同情况模态框
  339. TalentAllowanceInfoDlg.showEditContractModel = function (id) {
  340. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/validateIsEdit", function (data) {
  341. if (data.code == 200) {
  342. $("#contractForm")[0].reset();
  343. $("#contractId").val(id);
  344. $("#contractModal").modal("show");
  345. } else {
  346. 1
  347. Feng.info(data.msg);
  348. }
  349. }, function (data) {
  350. Feng.error("校验失败!" + data.responseJSON.message + "!");
  351. });
  352. ajax.set("id", id);
  353. ajax.set("type", 1);
  354. ajax.start();
  355. }
  356. //修改合同起止时间提交
  357. TalentAllowanceInfoDlg.editContract = function () {
  358. var id = $("#contractId").val();
  359. var startTime = $("#startTime").val();
  360. var endTime = $("#endTime").val();
  361. if (startTime == null || startTime == '') {
  362. Feng.info("请选择合同起始时间");
  363. return;
  364. }
  365. if (endTime == null || endTime == '') {
  366. Feng.info("请选择合同截止时间");
  367. return;
  368. }
  369. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editContract", function (data) {
  370. if (data.code == 200) {
  371. Feng.success(data.msg);
  372. $("#projectTable").bootstrapTable("refresh", {});
  373. $("#contractModal").modal("hide");
  374. } else {
  375. Feng.info(data.msg);
  376. }
  377. }, function (data) {
  378. Feng.error("提交失败!" + data.responseJSON.message + "!");
  379. });
  380. ajax.set({"id": id, "startTime": startTime, "endTime": endTime});
  381. ajax.start();
  382. }
  383. TalentAllowanceInfoDlg.saveProjectData = function (id, project, allowanceType) {
  384. var description = $("#d" + id).val();
  385. var months = [];
  386. var error = "";
  387. if (project == 4 && allowanceType == 2) {
  388. $("#m" + id + " input[name=day]").each(function () {
  389. var days = $(this).val();
  390. var max = $(this).attr("max");
  391. var num = $(this).attr("num");
  392. if (isNaN(days)) {
  393. error = error + num + "月的考勤天数不是数字;";
  394. } else {
  395. days = parseInt(days);
  396. if (days < 0 || days > max) {
  397. error = error + num + "月的考勤天数不在范围内(1-" + max + ");";
  398. }
  399. }
  400. if (days == null || days == '' || isNaN(days)) {
  401. days = 0;
  402. }
  403. months.push(num + "=" + days);
  404. })
  405. } else {
  406. $("#m" + id + " input[name=month]").each(function () {
  407. if (this.checked) {
  408. months.push($(this).val());
  409. }
  410. })
  411. }
  412. if (error != "") {
  413. Feng.error(error);
  414. return;
  415. }
  416. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  417. if (data.code == 200) {
  418. Feng.success(data.msg);
  419. } else {
  420. Feng.info(data.msg);
  421. }
  422. }, function (data) {
  423. Feng.error("提交失败!" + data.responseJSON.message + "!");
  424. });
  425. ajax.set({"id": id, "months": months.join(","), "description": description});
  426. ajax.start();
  427. }
  428. //显示
  429. // 项目模态框
  430. TalentAllowanceInfoDlg.showEditProjectModal = function (project, id, enterpriseId, months, days, content) {
  431. var desc = $(content).attr("data-value");
  432. var type = $("#type").val();
  433. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/validateIsEdit", function (data) {
  434. if (data.code == 200) {
  435. TalentAllowanceInfoDlg.initICheck();
  436. $("#description").val(desc);
  437. if (project == 4 || project == 15 || project == 16) {
  438. if (type == 2) {
  439. if (project == 4) {
  440. $("#attendanceModalLabel").html("考勤");
  441. $("#heading").html("请填写每月考勤天数<span style=\"color: red\">(不填写或填写0则代表无考勤记录)</span>");
  442. }
  443. if (project == 15) {
  444. $("#attendanceModalLabel").html("在境时间");
  445. $("#heading").html("请填写每月在境内天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  446. }
  447. if (project == 16) {
  448. $("#attendanceModalLabel").html("境内工作日时间");
  449. $("#heading").html("请填写每月境内工作日天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  450. }
  451. $("#attendanceForm")[0].reset();
  452. $("#attendanceId").val(id);
  453. $("#attendanceEnterpriseId").val(enterpriseId);
  454. if (months != null && months != '') {
  455. var arr = months.split(",");
  456. for (var key in arr) {
  457. var num = arr[key].split("=")[0];
  458. var day = arr[key].split("=")[1];
  459. $("#attendMonths input").each(function () {
  460. if ($(this).attr('num') == num)
  461. $(this).val(day);
  462. });
  463. }
  464. }
  465. $("#attendanceModal").modal("show");
  466. } else if (type == 1) {
  467. $('#jjAttendanceModal').on('show.bs.modal', function () {
  468. $("#jjmonths input").each(function () {
  469. $(this).iCheck("uncheck");
  470. });
  471. $("#jjAttendanceId").val(id);
  472. $("#jjAttendanceEnterpriseId").val(enterpriseId);
  473. if (Feng.isNotEmptyStr(months) && months.indexOf(",") != -1) {
  474. var arr = months.split(",");
  475. for (var key in arr) {
  476. $("#jjmonths input").each(function () {
  477. if ($(this).val() == arr[key])
  478. $(this).iCheck("check");
  479. });
  480. }
  481. }
  482. });
  483. if (days != null && days != '')
  484. $("#days").val(days);
  485. $("#jjAttendanceModal").modal("show");
  486. }
  487. } else {
  488. $('#projectModal').on('show.bs.modal', function () {
  489. $("#months input").each(function () {
  490. $(this).iCheck("uncheck");
  491. });
  492. $("#projectId").val(id);
  493. $("#enterpriseId").val(enterpriseId);
  494. if (Feng.isNotEmptyStr(months)) {
  495. var arr = months.split(",");
  496. for (var key in arr) {
  497. $("#months input").each(function () {
  498. if ($(this).val() == arr[key])
  499. $(this).iCheck("check");
  500. });
  501. }
  502. }
  503. });
  504. $("#projectModal").modal("show");
  505. }
  506. } else {
  507. Feng.info(data.msg);
  508. }
  509. }, function (data) {
  510. Feng.error("校验失败!" + data.responseJSON.message + "!");
  511. });
  512. ajax.set("id", id);
  513. ajax.set("type", 2);
  514. ajax.start();
  515. }
  516. //编辑项目提交
  517. TalentAllowanceInfoDlg.editProject = function () {
  518. var id = $("#projectId").val();
  519. var enterpriseId = $("#enterpriseId").val();
  520. var description = $("#description").val();
  521. var months = "";
  522. $("#months input").each(function () {
  523. if (this.checked) {
  524. months = months + $(this).val() + ",";
  525. }
  526. })
  527. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  528. if (data.code == 200) {
  529. Feng.success(data.msg);
  530. $("#" + enterpriseId).bootstrapTable("refresh", {});
  531. $("#projectModal").modal("hide");
  532. } else {
  533. Feng.info(data.msg);
  534. }
  535. }, function (data) {
  536. Feng.error("提交失败!" + data.responseJSON.message + "!");
  537. });
  538. ajax.set({"id": id, "months": months, "description": description});
  539. ajax.start();
  540. }
  541. TalentAllowanceInfoDlg.editJJAttendance = function () {
  542. var id = $("#jjAttendanceId").val();
  543. var enterpriseId = $("#jjAttendanceEnterpriseId").val();
  544. var description = $("#jjDescription").val();
  545. var days = $("#days").val();
  546. var months = "";
  547. $("#jjmonths input").each(function () {
  548. if (this.checked) {
  549. months = months + $(this).val() + ",";
  550. }
  551. })
  552. if (months == "" && (days == null || days == "")) {
  553. Feng.info("请填写考勤信息");
  554. return;
  555. }
  556. if (months != null && months != '' && days != null && days != '') {
  557. Feng.info("考勤天数和考勤月份只能选择一个填写");
  558. return;
  559. }
  560. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  561. if (data.code == 200) {
  562. Feng.success(data.msg);
  563. $("#" + enterpriseId).bootstrapTable("refresh", {});
  564. $("#projectModal").modal("hide");
  565. } else {
  566. Feng.info(data.msg);
  567. }
  568. }, function (data) {
  569. Feng.error("提交失败!" + data.responseJSON.message + "!");
  570. });
  571. ajax.set({"id": id, "months": months, "days": days, "description": description});
  572. ajax.start();
  573. }
  574. TalentAllowanceInfoDlg.editAttendanceProject = function () {
  575. var id = $("#attendanceId").val();
  576. var enterpriseId = $("#attendanceEnterpriseId").val();
  577. var description = $("#attendanceDescription").val();
  578. var months = "";
  579. var error = "";
  580. var name = $("#attendanceModalLabel").html();
  581. $("#attendMonths input").each(function () {
  582. var days = $(this).val();
  583. var num = $(this).attr("num");
  584. if (isNaN(days)) {
  585. error = error + num + "月的" + name + "天数不是数字;";
  586. } else {
  587. if (days < 0 || days > 31) {
  588. error = error + num + "月的" + name + "天数不在范围内(1-31);";
  589. }
  590. }
  591. if (days == null || days == '') {
  592. days = 0;
  593. }
  594. months = months + num + "=" + days + ",";
  595. });
  596. if (error != "") {
  597. Feng.error(error);
  598. return;
  599. }
  600. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  601. if (data.code == 200) {
  602. Feng.success(data.msg);
  603. $("#" + enterpriseId).bootstrapTable("refresh", {});
  604. $("#attendanceModal").modal("hide");
  605. } else {
  606. Feng.info(data.msg);
  607. }
  608. }, function (data) {
  609. Feng.error("提交失败!" + data.responseJSON.message + "!");
  610. });
  611. ajax.set({"id": id, "months": months, "description": description});
  612. ajax.start();
  613. }
  614. //初始化附件类别表单
  615. TalentAllowanceInfoDlg.initFileTable = function () {
  616. TalentAllowanceInfoDlg.initContract();
  617. // Feng.showMiniFileModal(CONFIG.project_jbt,$("#type").val(),$("#id").val());
  618. var queryData = {};
  619. queryData["mainId"] = $("#id").val();
  620. queryData['project'] = CONFIG.project_jbt;
  621. queryData['type'] = $("#type").val();
  622. queryData['allowanceType'] = $("#allowanceType").val();
  623. $("#fileTable").bootstrapTable({
  624. url: Feng.ctxPath + "/common/api/findCommonFileType",
  625. method: 'POST',
  626. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  627. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  628. showRefresh: false, // 是否显示刷新按钮
  629. clickToSelect: true, // 是否启用点击选中行
  630. singleSelect: true, // 设置True 将禁止多选
  631. striped: true, // 是否显示行间隔色
  632. escape: true,
  633. pagination: false, // 设置为 true 会在表格底部显示分页条
  634. paginationHAlign: "left",
  635. paginationDetailHAlign: "right",
  636. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  637. showColumns: false,
  638. detailView: true, //是否显示父子表
  639. pageList: [10, 30, 50],
  640. queryParams: function (params) {
  641. return $.extend(queryData, params)
  642. },
  643. rowStyle: function (row, index) {
  644. return {classes: "info"};
  645. },
  646. columns: TalentAllowanceInfoDlg.initFileTypeColumn(),
  647. onPostBody: function () {
  648. $("td.uitd_showTip").bind("mouseover", function () {
  649. var htm = $(this).html();
  650. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  651. });
  652. },
  653. onLoadSuccess: function (data) {
  654. $("#fileTable").bootstrapTable('expandAllRows');
  655. },
  656. onExpandRow: function (index, row, $detail) {
  657. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  658. if (data == null || data.length == 0) {
  659. return;
  660. }
  661. 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>';
  662. var files = $("#files").val();
  663. var checkState = $("#checkState").val();
  664. var type = $("#type").val();
  665. for (var key in data) {
  666. var btn = "";
  667. if (checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1) || (type == 5 && checkState == 8 && files.indexOf(row.id) != -1)) {
  668. btn = "<button type=\'button\' onclick=\"TalentAllowanceInfoDlg.checkFile(this,'" + row.id + "','" + data[key].id + "')\" style=\'margin-left: 5px\' class=\"btn btn-xs btn-success\">" +
  669. "<i class=\"fa fa-paste\"></i>修改" +
  670. "</button>" +
  671. "<button type='button' onclick=\"TalentAllowanceInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  672. "<i class=\"fa fa-times\"></i>删除" +
  673. "</button>";
  674. } else {
  675. btn = "";
  676. }
  677. var sn = data[key].url.lastIndexOf(".");
  678. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  679. var imgStr = "";
  680. if (suffix == "pdf" || suffix == "PDF") {
  681. 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>";
  682. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  683. 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>";
  684. } else {
  685. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  686. }
  687. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  688. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  689. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  690. '<li style="width: 10%;padding-top: 2px;">' + btn + '</li>';
  691. }
  692. html = html + '</ul>';
  693. $detail.html(html);
  694. $(".imgs").viewer({
  695. // toolbar:false,
  696. fullscreen: false
  697. });
  698. }, function (data) {
  699. Feng.error("查询失败!" + data.responseJSON.message + "!");
  700. });
  701. var queryData = {};
  702. queryData["mainId"] = $("#id").val();
  703. queryData["fileTypeId"] = row.id;
  704. ajax.set(queryData);
  705. ajax.start();
  706. }
  707. });
  708. TalentAllowanceInfoDlg.initCommonFileTable();
  709. }
  710. //初始化通用附件
  711. TalentAllowanceInfoDlg.initCommonFileTable = function () {
  712. var queryData = {};
  713. queryData.id = $("#id").val();
  714. $("#commonFileTable").bootstrapTable({
  715. url: Feng.ctxPath + "/common/api/listTalentAllowanceCommonFile",
  716. method: 'POST',
  717. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  718. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  719. showRefresh: false, // 是否显示刷新按钮
  720. clickToSelect: true, // 是否启用点击选中行
  721. singleSelect: true, // 设置True 将禁止多选
  722. striped: true, // 是否显示行间隔色
  723. pagination: false, // 设置为 true 会在表格底部显示分页条
  724. paginationHAlign: "left",
  725. paginationDetailHAlign: "right",
  726. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  727. showColumns: false,
  728. queryParams: function (params) {
  729. return $.extend(queryData, params)
  730. },
  731. rowStyle: function (row, index) {
  732. return {css: {"word-break": "break-word", "white-space": "inherit"}}
  733. },
  734. columns: [
  735. {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '60%', formatter: function (value, row, index) {
  736. return value;
  737. }},
  738. {title: '附件类型', field: 'fileTypeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '20%', formatter: function (value, row, index) {
  739. return value;
  740. }},
  741. {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle', width: "20%",
  742. formatter: function (value, row, index) {
  743. var sn = value.lastIndexOf(".");
  744. var suffix = value.substring(sn + 1, value.length);
  745. var imgStr = "";
  746. if (suffix == "pdf" || suffix == "PDF") {
  747. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  748. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  749. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  750. } else {
  751. imgStr = '<img class=\"cImgUrl\" src=\"' + value + '\" style=\"width:25px;height:25px;\">';
  752. }
  753. return imgStr;
  754. }
  755. }
  756. ],
  757. onPostBody: function () {
  758. $("td.uitd_showTip").bind("mouseover", function () {
  759. var htm = $(this).html();
  760. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  761. });
  762. $(".cImgUrl").viewer({fullscreen: false});
  763. }
  764. });
  765. }
  766. //校验是否保存基础信息
  767. TalentAllowanceInfoDlg.validId = function () {
  768. var id = $("#id").val();
  769. if (id != null && id != '') {
  770. $("#fileLi").removeAttr("style");
  771. } else {
  772. $("#fileLi").attr("style", "pointer-events: none");
  773. $("#name").on('chosen:ready', function (e, params) {
  774. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  775. });
  776. $("#name").chosen({
  777. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  778. disable_search: false,
  779. width: "100%",
  780. enable_split_word_search: true
  781. });
  782. }
  783. }
  784. //选择附件并显示附件名
  785. TalentAllowanceInfoDlg.checkFile = function (content, fileTypeId, fileId) {
  786. if (!TalentAllowanceInfoDlg.validateIsEdit())
  787. return;
  788. $("#upload_file ").unbind("change");
  789. $("#upload_file ").change(function () {
  790. TalentAllowanceInfoDlg.upload(fileTypeId, fileId);
  791. });
  792. $('#upload_file').val("");
  793. $('#upload_file').click()
  794. }
  795. //上传附件
  796. TalentAllowanceInfoDlg.upload = function (fileTypeId, fileId) {
  797. var id = $("#id").val();
  798. if (!TalentAllowanceInfoDlg.validateIsEdit())
  799. return;
  800. if (fileId != null && fileId != 'null') {
  801. $("#fileId").val(fileId)
  802. } else {
  803. $("#fileId").val("");
  804. }
  805. $("#mainId").val(id);
  806. $("#fileTypeId").val(fileTypeId);
  807. var index = layer.load(0, {shade: false, time: 0});
  808. $("#index").val(index);
  809. $("#uploadForm").submit();
  810. }
  811. //删除附件
  812. TalentAllowanceInfoDlg.deleteFile = function (id) {
  813. if (!TalentAllowanceInfoDlg.validateIsEdit())
  814. return;
  815. var operation = function () {
  816. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  817. if (data.code = 200) {
  818. Feng.success(data.msg);
  819. $("#fileTable").bootstrapTable("refresh", {});
  820. } else {
  821. Feng.error(data.msg);
  822. }
  823. }, function (data) {
  824. Feng.error("删除失败!" + data.responseJSON.message + "!");
  825. });
  826. ajax.set("id", id);
  827. ajax.set("type", CONFIG.project_jbt);
  828. ajax.start();
  829. }
  830. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  831. }
  832. /**
  833. * 提交审核
  834. */
  835. TalentAllowanceInfoDlg.submitToCheck = function () {
  836. var id = $("#id").val();
  837. if (id == null || id == "") {
  838. Feng.info("请先填写基础信息并上传附件");
  839. return;
  840. }
  841. TalentAllowanceInfoDlg.clearData();
  842. TalentAllowanceInfoDlg.collectData();
  843. if (!TalentAllowanceInfoDlg.validateIsEdit())
  844. return;
  845. /*var active = $("#active").val();
  846. if (active == 2) {
  847. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  848. Feng.info("请填写上一年度年薪");
  849. return;
  850. }
  851. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  852. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  853. return;
  854. }
  855. }*/
  856. var operation = function () {
  857. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/submitToCheck", function (data) {
  858. if (data.code == 200) {
  859. Feng.success(data.msg);
  860. window.parent.TalentAllowanceInfo.table.refresh();
  861. TalentAllowanceInfoDlg.close();
  862. } else {
  863. Feng.error(data.msg);
  864. }
  865. }, function (data) {
  866. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  867. });
  868. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData)
  869. // ajax.set("id", id);
  870. ajax.start();
  871. }
  872. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  873. }
  874. /**
  875. * 校验是否可以修改/提交审核
  876. */
  877. TalentAllowanceInfoDlg.validateIsEdit = function () {
  878. var id = $("#id").val();
  879. if (id == null || id == '') {
  880. Feng.info("请先添加基本信息并保存后再试");
  881. return false;
  882. }
  883. var checkState = $("#checkState").val();
  884. var type = $("#type").val();
  885. if (checkState != 1 && !(checkState == 10) && !(type == 5 && checkState == 8)) {
  886. if (checkState == -1) {
  887. Feng.error("您的申报审核不通过,无法再修改");
  888. return false;
  889. } else if (checkState == 30) {
  890. Feng.error("您的申报已审核通过,无法再修改");
  891. return false;
  892. } else {
  893. Feng.error("您的申报正在审核中,请耐心等待");
  894. return false;
  895. }
  896. }
  897. return true;
  898. }
  899. TalentAllowanceInfoDlg.initICheck = function () {
  900. $('input[type=checkbox]').iCheck({
  901. labelHover: false,
  902. cursor: true,
  903. checkboxClass: 'icheckbox_square-green',
  904. radioClass: 'iradio_square-greene',
  905. increaseArea: '20%'
  906. });
  907. }
  908. TalentAllowanceInfoDlg.showAllLog = function () {
  909. var id = $("#id").val();
  910. if (Feng.isNotEmptyStr(id)) {
  911. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  912. }
  913. }
  914. $(function () {
  915. Feng.initValidatorTip("talentAllowanceForm", TalentAllowanceInfoDlg.validateFields);
  916. Feng.addAjaxSelect({
  917. "id": 'name',
  918. "displayCode": "id",
  919. "displayName": "name",
  920. "type": "GET",
  921. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year=" + $("#year").val()
  922. });
  923. TalentAllowanceInfoDlg.validId();
  924. var type = $("#type").val();
  925. if (type == 2) {
  926. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  927. }
  928. //批量加载时间控件
  929. $(".date").each(function () {
  930. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  931. });
  932. $("select").each(function () {
  933. $(this).val($(this).attr("value"));
  934. });
  935. if ($("#allowanceType").val() == 1) {
  936. //$("#wageDiv").css("display", "block");
  937. }
  938. //设置禁止字段
  939. var checkState = $("#checkState").val();
  940. if ($("#id").val() != "" && checkState != 1) {
  941. $("#allowanceType").attr("style", "pointer-events: none;background-color: #eee;");
  942. $("#wage").prop("readonly", true);
  943. }
  944. if ((checkState == 10) || (type == 5 && checkState == 8)) {
  945. var fields = $("#fields").val().split(",");
  946. if (fields.indexOf("wage") > -1) {
  947. $("#wage").removeAttr("readonly");
  948. }
  949. if (fields.indexOf("allowanceType") > -1) {
  950. $("#allowanceType").removeAttr("style");
  951. }
  952. }
  953. TalentAllowanceInfoDlg.showAllLog();
  954. toastr.options = {
  955. "closeButton": true,
  956. "debug": false,
  957. "positionClass": "toast-bottom-right",
  958. "onclick": null,
  959. "showDuration": "300",
  960. "hideDuration": "1000",
  961. "timeOut": "600000",
  962. "extendedTimeOut": "1000",
  963. "showEasing": "swing",
  964. "hideEasing": "linear",
  965. "showMethod": "fadeIn",
  966. "hideMethod": "fadeOut",
  967. "tapToDismiss": true
  968. };
  969. toastr.success("请确保申报对象在申报津补贴之前已完成离职变更、工作单位变更、人才层次变更、银行账号变更且审核通过,否则可能带来不必要的损失,请在申报之前再次确认!!!");
  970. });