talentAllowance_info.js 41 KB

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