talentAllowance_info.js 41 KB

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