talentAllowanceInfo_info.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var TalentAllowanceInfoDlg = {
  5. talentAllowanceData: {}
  6. };
  7. /**
  8. * 关闭此对话框
  9. */
  10. TalentAllowanceInfoDlg.close = function () {
  11. parent.layer.close(window.parent.TalentAllowanceInfo.layerIndex);
  12. }
  13. /**
  14. * 初始化工作单位及核查项目情况表
  15. */
  16. TalentAllowanceInfoDlg.initContract = function () {
  17. $("#projectTable").bootstrapTable({
  18. url: Feng.ctxPath + "/admin/talentAllowance/findAllowanceContractDetail",
  19. method: 'POST',
  20. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  21. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  22. showRefresh: false, // 是否显示刷新按钮
  23. clickToSelect: true, // 是否启用点击选中行
  24. singleSelect: true, // 设置True 将禁止多选
  25. striped: true, // 是否显示行间隔色
  26. escape: true,
  27. pagination: false, // 设置为 true 会在表格底部显示分页条
  28. paginationHAlign: "left",
  29. paginationDetailHAlign: "right",
  30. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  31. showColumns: false,
  32. detailView: true, //父子表
  33. queryParams: function (params) {
  34. return $.extend({"mainId": $("#id").val()}, params)
  35. },
  36. columns: TalentAllowanceInfoDlg.initContractColumns(),
  37. onPostBody: function () {
  38. $("td.uitd_showTip").bind("mouseover", function () {
  39. var htm = $(this).html();
  40. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  41. });
  42. },
  43. onLoadSuccess: function (data) {
  44. $("#projectTable").bootstrapTable('expandAllRows');
  45. },
  46. onExpandRow: function (index, row, $detail) {
  47. var enterpriseId = row.enterpriseId + index;
  48. var cur_table = $detail.html('<table id="' + enterpriseId + '"></table>').find('table');
  49. $(cur_table).bootstrapTable({
  50. url: Feng.ctxPath + "/admin/talentAllowance/findAllowanceProject",
  51. method: 'POST',
  52. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  53. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  54. showRefresh: false, // 是否显示刷新按钮
  55. clickToSelect: true, // 是否启用点击选中行
  56. singleSelect: true, // 设置True 将禁止多选
  57. striped: true, // 是否显示行间隔色
  58. escape: true,
  59. pagination: false, // 设置为 true 会在表格底部显示分页条
  60. paginationHAlign: "left",
  61. paginationDetailHAlign: "right",
  62. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  63. showColumns: false,
  64. queryParams: function (params) {
  65. var companyCode = "";
  66. if ($("#process").val() == 1) {
  67. companyCode = $("#companyCode").val();
  68. }
  69. return $.extend({"mainId": $("#id").val(), "baseId": row.id, "companyCode": companyCode}, params)
  70. },
  71. onPostBody: function () {
  72. $("td.uitd_showTip").bind("mouseover", function () {
  73. var htm = $(this).html();
  74. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  75. });
  76. },
  77. onLoadSuccess: function (data) {
  78. $(".imgs").viewer({
  79. // toolbar:false,
  80. fullscreen: false
  81. });
  82. },
  83. columns: TalentAllowanceInfoDlg.initProjectColumns(enterpriseId),
  84. });
  85. }
  86. });
  87. TalentAllowanceInfoDlg.initArrange();
  88. }
  89. /**
  90. * 初始化人才层次
  91. */
  92. TalentAllowanceInfoDlg.initArrange = function () {
  93. $("#arrangeTable").bootstrapTable({
  94. url: Feng.ctxPath + "/admin/talentAllowance/findAllowanceArrange",
  95. method: 'POST',
  96. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  97. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  98. showRefresh: false, // 是否显示刷新按钮
  99. clickToSelect: true, // 是否启用点击选中行
  100. singleSelect: true, // 设置True 将禁止多选
  101. striped: true, // 是否显示行间隔色
  102. escape: true,
  103. pagination: false, // 设置为 true 会在表格底部显示分页条
  104. paginationHAlign: "left",
  105. paginationDetailHAlign: "right",
  106. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  107. showColumns: false,
  108. pageList: [10, 30, 50],
  109. queryParams: function (params) {
  110. return $.extend({"mainId": $("#id").val()}, params)
  111. },
  112. columns: TalentAllowanceInfoDlg.initArrangeColumn(),
  113. onPostBody: function () {
  114. $("td.uitd_showTip").bind("mouseover", function () {
  115. var htm = $(this).html();
  116. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  117. });
  118. }
  119. });
  120. }
  121. //显示修改工作单位合同情况模态框
  122. TalentAllowanceInfoDlg.showEditContractModel = function (id) {
  123. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  124. if (data.code == 200) {
  125. $("#contractForm")[0].reset();
  126. $("#contractId").val(id);
  127. $(".date").each(function () {
  128. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  129. });
  130. $("#contractModal").modal("show");
  131. } else {
  132. Feng.info(data.msg);
  133. }
  134. }, function (data) {
  135. Feng.error("校验失败!" + data.responseJSON.message + "!");
  136. });
  137. ajax.set("id", id);
  138. ajax.set("type", 1);
  139. ajax.set("process", $("#process").val())
  140. ajax.set("companyId", $("#companyId").val())
  141. ajax.start();
  142. }
  143. //修改合同起止时间提交
  144. TalentAllowanceInfoDlg.editContract = function () {
  145. var id = $("#contractId").val();
  146. var startTime = $("#startTime").val();
  147. var endTime = $("#endTime").val();
  148. if (startTime == null || startTime == '') {
  149. Feng.info("请选择合同起始时间");
  150. return;
  151. }
  152. if (endTime == null || endTime == '') {
  153. Feng.info("请选择合同截止时间");
  154. return;
  155. }
  156. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editContract", function (data) {
  157. if (data.code == 200) {
  158. Feng.success(data.msg);
  159. $("#projectTable").bootstrapTable("refresh", {});
  160. $("#contractModal").modal("hide");
  161. } else {
  162. Feng.info(data.msg);
  163. }
  164. }, function (data) {
  165. Feng.error("提交失败!" + data.responseJSON.message + "!");
  166. });
  167. ajax.set({"id": id, "startTime": startTime, "endTime": endTime, "process": $("#process").val()});
  168. ajax.start();
  169. }
  170. //显示编辑项目模态框
  171. TalentAllowanceInfoDlg.showEditProjectModal = function (project, id, enterpriseId, months, days, content) {
  172. var desc = $(content).attr("data-value");
  173. var type = $("#type").val();
  174. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  175. if (data.code == 200) {
  176. $("#description").val(desc);
  177. TalentAllowanceInfoDlg.initICheck();
  178. switch (project) {
  179. case "1":
  180. $("#contractCheckForm")[0].reset();
  181. $("#contractCheckId").val(id);
  182. $("#contractEnterpriseId").val(enterpriseId);
  183. $("#contractCheckModal").modal("show");
  184. break;
  185. case "4":
  186. if (type == 1) {
  187. $('#jjAttendanceModal').on('show.bs.modal', function () {
  188. $("#jjAttendanceForm")[0].reset();
  189. $("#jjmonths input").each(function () {
  190. $(this).iCheck("uncheck");
  191. });
  192. $("#jjAttendanceId").val(id);
  193. $("#jjAttendanceEnterpriseId").val(enterpriseId);
  194. if (Feng.isNotEmptyStr(months)) {
  195. if (months.indexOf(",") != -1) {
  196. var arr = months.split(",");
  197. for (var key in arr) {
  198. $("#jjmonths input").each(function () {
  199. if ($(this).val() == arr[key])
  200. $(this).iCheck("check");
  201. });
  202. }
  203. }
  204. }
  205. });
  206. if (days != null && days != '')
  207. $("#days").val(days);
  208. $("#jjAttendanceModal").modal("show");
  209. } else {
  210. $("#attendanceModalLabel").html("考勤");
  211. $("#heading").html("请填写每月考勤天数<span style=\"color: red\">(不填写或填写0则代表无考勤记录)</span>");
  212. $("#attendanceForm")[0].reset();
  213. $("#attendanceId").val(id);
  214. $("#attendanceEnterpriseId").val(enterpriseId);
  215. if (months != null && months != '') {
  216. var arr = months.split(",");
  217. for (var key in arr) {
  218. var num = arr[key].split("=")[0];
  219. var day = arr[key].split("=")[1];
  220. $("#attendMonths input").each(function () {
  221. if ($(this).attr('num') == num)
  222. $(this).val(day);
  223. });
  224. }
  225. }
  226. $("#attendanceModal").modal("show");
  227. }
  228. break;
  229. case "15":
  230. $("#attendanceModalLabel").html("在境时间");
  231. $("#heading").html("请填写每月在境内天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  232. $("#attendanceForm")[0].reset();
  233. $("#attendanceId").val(id);
  234. $("#attendanceEnterpriseId").val(enterpriseId);
  235. if (months != null && months != '') {
  236. var arr = months.split(",");
  237. for (var key in arr) {
  238. var num = arr[key].split("=")[0];
  239. var day = arr[key].split("=")[1];
  240. $("#attendMonths input").each(function () {
  241. if ($(this).attr('num') == num)
  242. $(this).val(day);
  243. });
  244. }
  245. }
  246. $("#attendanceModal").modal("show");
  247. break;
  248. case "16":
  249. $("#attendanceModalLabel").html("境内工作日时间");
  250. $("#heading").html("请填写每月境内工作日天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  251. $("#attendanceForm")[0].reset();
  252. $("#attendanceId").val(id);
  253. $("#attendanceEnterpriseId").val(enterpriseId);
  254. if (months != null && months != '') {
  255. var arr = months.split(",");
  256. for (var key in arr) {
  257. var num = arr[key].split("=")[0];
  258. var day = arr[key].split("=")[1];
  259. $("#attendMonths input").each(function () {
  260. if ($(this).attr('num') == num)
  261. $(this).val(day);
  262. });
  263. }
  264. }
  265. $("#attendanceModal").modal("show");
  266. break;
  267. default:
  268. $('#projectModal').on('show.bs.modal', function () {
  269. $("#months input").each(function () {
  270. $(this).iCheck("uncheck");
  271. });
  272. $("#projectId").val(id);
  273. $("#enterpriseId").val(enterpriseId);
  274. TalentAllowanceInfoDlg.initICheck();
  275. if (Feng.isNotEmptyStr(months)) {
  276. var arr = months.split(",");
  277. for (var key in arr) {
  278. $("#months input").each(function () {
  279. if ($(this).val() == arr[key])
  280. $(this).iCheck("check");
  281. });
  282. }
  283. }
  284. });
  285. $("#projectModal").modal("show");
  286. break;
  287. }
  288. } else {
  289. Feng.info(data.msg);
  290. }
  291. }, function (data) {
  292. Feng.error("校验失败!" + data.responseJSON.message + "!");
  293. });
  294. ajax.set("id", id);
  295. ajax.set("type", 2);
  296. ajax.set("process", $("#process").val())
  297. ajax.set("companyId", $("#companyId").val())
  298. ajax.start();
  299. }
  300. //审核合同满两年提交
  301. TalentAllowanceInfoDlg.contractCheckSubmit = function () {
  302. var id = $("#contractCheckId").val();
  303. var enterpriseId = $("#contractEnterpriseId").val();
  304. var description = $("#msg").val();
  305. var months = $("#state").val();
  306. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  307. if (data.code == 200) {
  308. Feng.success(data.msg);
  309. $("#" + enterpriseId).bootstrapTable("refresh", {});
  310. $("#contractCheckModal").modal("hide");
  311. } else {
  312. Feng.info(data.msg);
  313. }
  314. }, function (data) {
  315. Feng.error("提交失败!" + data.responseJSON.message + "!");
  316. });
  317. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  318. ajax.start();
  319. }
  320. //编辑项目提交
  321. TalentAllowanceInfoDlg.editProject = function () {
  322. var id = $("#projectId").val();
  323. var enterpriseId = $("#enterpriseId").val();
  324. var description = $("#description").val();
  325. var months = "";
  326. $("#months input").each(function () {
  327. if (this.checked) {
  328. months = months + $(this).val() + ",";
  329. }
  330. })
  331. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  332. if (data.code == 200) {
  333. Feng.success(data.msg);
  334. $("#" + enterpriseId).bootstrapTable("refresh", {});
  335. $("#projectModal").modal("hide");
  336. } else {
  337. Feng.info(data.msg);
  338. }
  339. }, function (data) {
  340. Feng.error("提交失败!" + data.responseJSON.message + "!");
  341. });
  342. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  343. ajax.start();
  344. }
  345. /**
  346. * 提交晋江市现代产业体系人才的考勤
  347. */
  348. TalentAllowanceInfoDlg.editJJAttendance = function () {
  349. var id = $("#jjAttendanceId").val();
  350. var enterpriseId = $("#jjAttendanceEnterpriseId").val();
  351. var description = $("#jjDescription").val();
  352. var days = $("#days").val();
  353. var months = "";
  354. $("#jjmonths input").each(function () {
  355. if (this.checked) {
  356. months = months + $(this).val() + ",";
  357. }
  358. })
  359. if (months == "" && (days == null || days == "")) {
  360. Feng.info("请填写考勤信息");
  361. return;
  362. }
  363. if (months != null && months != '' && days != null && days != '') {
  364. Feng.info("考勤天数和考勤月份只能选择一个填写");
  365. return;
  366. }
  367. $("#attendanceMonths").val(months);
  368. $("#jjAttendanceForm")[0].submit();
  369. // var ajax = new $ax(Feng.ctxPath + "/talentAllowanceInfo/editProject", function(data){
  370. // if(data.code==200){
  371. // Feng.success(data.msg);
  372. // $("#"+enterpriseId).bootstrapTable("refresh", {});
  373. // $("#jjAttendanceModal").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,"months":months,"days":days,"description":description,"process":$("#process").val()});
  381. // ajax.start();
  382. }
  383. TalentAllowanceInfoDlg.editAttendanceProject = function () {
  384. var id = $("#attendanceId").val();
  385. var enterpriseId = $("#attendanceEnterpriseId").val();
  386. var description = $("#attendanceDescription").val();
  387. var months = "";
  388. var error = "";
  389. $("#attendMonths input").each(function () {
  390. var days = $(this).val();
  391. var num = $(this).attr("num");
  392. if (isNaN(days)) {
  393. error = error + num + "月的考勤天数不是数字;";
  394. } else {
  395. if (days < 0 || days > 31) {
  396. error = error + num + "月的考勤天数不在范围内(1-31);";
  397. }
  398. }
  399. if (days == null || days == '') {
  400. days = 0;
  401. }
  402. months = months + num + "=" + days + ",";
  403. });
  404. if (error != "") {
  405. Feng.error(error);
  406. return;
  407. }
  408. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  409. if (data.code == 200) {
  410. Feng.success(data.msg);
  411. $("#" + enterpriseId).bootstrapTable("refresh", {});
  412. $("#attendanceModal").modal("hide");
  413. } else {
  414. Feng.info(data.msg);
  415. }
  416. }, function (data) {
  417. Feng.error("提交失败!" + data.responseJSON.message + "!");
  418. });
  419. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  420. ajax.start();
  421. }
  422. /**
  423. * 锁定工作单位合同
  424. * @param id
  425. */
  426. TalentAllowanceInfoDlg.lockContract = function (id) {
  427. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  428. if (data.code == 200) {
  429. var operation = function () {
  430. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/lockContract", function (data) {
  431. if (data.code == 200) {
  432. Feng.success(data.msg);
  433. $("#projectTable").bootstrapTable("refresh", {});
  434. } else {
  435. Feng.info(data.msg);
  436. }
  437. }, function (data) {
  438. Feng.error("删除失败!" + data.responseJSON.message + "!");
  439. });
  440. ajax.set("id", id);
  441. ajax.set("process", $("#process").val())
  442. ajax.start();
  443. }
  444. Feng.confirm("一旦锁定无法修改,确认锁定吗?", operation);
  445. } else {
  446. Feng.info(data.msg);
  447. }
  448. }, function (data) {
  449. Feng.error("校验失败!" + data.responseJSON.message + "!");
  450. });
  451. ajax.set("id", id);
  452. ajax.set("type", 1);
  453. ajax.set("process", $("#process").val())
  454. ajax.set("companyId", $("#companyId").val())
  455. ajax.start();
  456. }
  457. /**
  458. * 锁定项目
  459. * @param id
  460. */
  461. TalentAllowanceInfoDlg.lockProject = function (id, enterpriseId) {
  462. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  463. if (data.code == 200) {
  464. var operation = function () {
  465. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/lockProject", function (data) {
  466. if (data.code == 200) {
  467. Feng.success(data.msg);
  468. $("#" + enterpriseId).bootstrapTable("refresh", {});
  469. } else {
  470. Feng.info(data.msg);
  471. }
  472. }, function (data) {
  473. Feng.error("删除失败!" + data.responseJSON.message + "!");
  474. });
  475. ajax.set("id", id);
  476. ajax.set("process", $("#process").val())
  477. ajax.start();
  478. }
  479. Feng.confirm("一旦锁定无法修改,确认锁定吗?", operation);
  480. } else {
  481. Feng.info(data.msg);
  482. }
  483. }, function (data) {
  484. Feng.error("校验失败!" + data.responseJSON.message + "!");
  485. });
  486. ajax.set("id", id);
  487. ajax.set("type", 2);
  488. ajax.set("process", $("#process").val())
  489. ajax.set("companyId", $("#companyId").val())
  490. ajax.start();
  491. }
  492. /**
  493. * 显示审核模态框
  494. */
  495. TalentAllowanceInfoDlg.showCheckModal = function () {
  496. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  497. if (data.code == 200) {
  498. layer.open({
  499. type: 1,
  500. id: "neewFieldFormModel",
  501. title: '审核',
  502. area: ['800px', '450px'], //宽高
  503. fix: false, //不固定
  504. shade: 0,
  505. maxmin: true,
  506. content: TalentAllowanceInfoDlg.createCheckHtml(),
  507. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  508. btnAlign: 'c',
  509. zIndex: layer.zIndex,
  510. success: function (layero, index) {
  511. var projectList = data.obj.projects;
  512. var fileList = data.obj.files;
  513. var concatList = data.obj.concats;
  514. var files = data.obj.info.files;
  515. var projects = data.obj.info.projects;
  516. var concats = data.obj.info.concats;
  517. var fields = data.obj.info.fields;
  518. var info = data.obj.info;
  519. var calResult = typeof data.obj.calResult != "undefined" ? data.obj.calResult : {};
  520. //初始化附件、核查项目、合同
  521. if (projectList != null && projectList.length != 0) {
  522. var html = '<ul>';
  523. for (var key in projectList) {
  524. html = html + '<li style="width: 100%"><input type="checkbox" value="' + projectList[key].id + '"><span>' + projectList[key].projectName + '</span></li>';
  525. }
  526. html = html + "</ul>";
  527. $("#field_project").empty().append(html);
  528. }
  529. if (fileList != null && fileList.length != 0) {
  530. var html = '';
  531. for (var key in fileList) {
  532. html = html + '<ul><li style="width: 100%"><input type="checkbox" data-type="' + fileList[key].isConditionFile + '" value="' + fileList[key].id + '"><span>' + fileList[key].name + '</span></li></ul>';
  533. }
  534. $("#field_file").empty().append(html);
  535. }
  536. if (concatList != null && concatList.length != 0) {
  537. var html = '';
  538. for (var key in concatList) {
  539. html = html + '<ul><li style="width: 100%"><input type="checkbox" value="' + concatList[key].id + '"><span>' + concatList[key].enterpriseName + '</span></li></ul>';
  540. }
  541. $("#field_concat").empty().append(html);
  542. }
  543. if (calResult) {
  544. $("#otherEnjoyedMoney").data("money", calResult.recommendMoney);
  545. $("#finalMoney").val(calResult.recommendMoney);
  546. if (calResult.recommendAllowanceType == 1) {
  547. var text = "补贴类型:工作津贴\n满足条件的月份:" + calResult.recommendMonths;
  548. text += "\n可享受补贴(元):" + calResult.recommendMoney;
  549. $("#calResult").text(text);
  550. } else if (calResult.recommendAllowanceType == 2) {
  551. var text = "补贴类型:一次性交通补贴";
  552. text += "\n可享受补贴(元):" + calResult.recommendMoney;
  553. $("#calResult").text(text);
  554. } else {
  555. $("#calResult").text(calResult.recommendAllowanceMsg);
  556. }
  557. }
  558. TalentAllowanceInfoDlg.initICheck();
  559. //回显数据
  560. $("#checkStateModal").val(info.checkState).trigger("change");
  561. $("#toProcess").val(info.toProcess).trigger("change");
  562. if (Feng.isNotEmptyStr(info.toDep))
  563. $("#toDep").val(info.toDep.split(",")).trigger("chosen:updated");
  564. $("#checkMsg").val(info.checkMsg);
  565. if (Feng.isNotEmptyStr(projects)) {
  566. $("#field_project input").each(function () {
  567. if (projects.indexOf($(this).val()) != -1) {
  568. $(this).iCheck("check");
  569. }
  570. });
  571. }
  572. if (files != null && files != '') {
  573. $("#field_file input").each(function () {
  574. if (files.indexOf($(this).val()) != -1) {
  575. $(this).iCheck("check");
  576. }
  577. });
  578. }
  579. if (concats != null && concats != '') {
  580. $("#field_concat input").each(function () {
  581. if (concats.indexOf($(this).val()) != -1) {
  582. $(this).iCheck("check");
  583. }
  584. });
  585. }
  586. if (Feng.isNotEmptyStr(fields)) {
  587. $("#field_field input").each(function () {
  588. if (fields.indexOf($(this).val()) != -1) {
  589. $(this).iCheck("check");
  590. }
  591. });
  592. }
  593. $("input[type=checkbox][value=allowanceType]").on("ifChanged", function (e) {
  594. var isChecked = $(this).is(":checked") ? "check" : "uncheck";
  595. $("#field_file input").each(function () {
  596. $(this).iCheck(isChecked);
  597. })
  598. $("#field_project input").each(function () {
  599. $(this).iCheck(isChecked);
  600. })
  601. })
  602. if (calResult) {
  603. $("#otherEnjoyedMoney").val(info.otherEnjoyedMoney);
  604. $("#otherEnjoyedDescription").val(info.otherEnjoyedDescription);
  605. TalentAllowanceInfoDlg.cal();
  606. }
  607. },
  608. yes: function (index, layero) {
  609. TalentAllowanceInfoDlg.checkSubmit(index);
  610. }
  611. });
  612. } else {
  613. Feng.info(data.msg);
  614. }
  615. }, function (data) {
  616. Feng.error("校验失败!" + data.responseJSON.message + "!");
  617. });
  618. ajax.set("id", $("#id").val());
  619. ajax.set("type", 3);
  620. ajax.set("process", $("#process").val())
  621. ajax.set("companyId", $("#companyId").val())
  622. ajax.start();
  623. }
  624. TalentAllowanceInfoDlg.cal = function () {
  625. var value = $("#otherEnjoyedMoney").val();
  626. var totalMoney = $("#otherEnjoyedMoney").data("money");
  627. var result = totalMoney - value;
  628. $("#finalMoney").val(result);
  629. }
  630. /**
  631. * 显示/隐藏设置津补贴类型
  632. */
  633. TalentAllowanceInfoDlg.toggleSetAllowance = function () {
  634. var checkState = $("#reviewState").val();
  635. if (checkState == 2) {
  636. $("#setAllowanceHeading,#setAllowanceBody").css("display", "none");
  637. $("#processLable,#processDiv").css("display", "block");
  638. $("#checkMsg").val("审核通过");
  639. } else if (checkState == 3) {
  640. $("#setAllowanceHeading,#setAllowanceBody").css("display", "block");
  641. $("#processLable,#processDiv").css("display", "none");
  642. }
  643. }
  644. /**
  645. * 保存复核审核结果
  646. */
  647. TalentAllowanceInfoDlg.saveReviewCheck = function () {
  648. var id = $("#id").val();
  649. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  650. if (data.code == 200) {
  651. var checkState = $("#reviewState").val();
  652. var checkMsg = $("#allowanceCheckMsg").val();
  653. if (checkState == null || checkState == '') {
  654. Feng.info("请选择审核状态");
  655. return;
  656. }
  657. var toPorcess = $("#toProcess").val();
  658. var allowanceType = null, months = "", allowanceMsg = null;
  659. if (checkState == 3) {
  660. allowanceType = $("#newAllowanceType").val();
  661. $("#allowanceMonths input[type=checkbox]").each(function () {
  662. if (this.checked) {
  663. months = months + $(this).val() + ",";
  664. }
  665. });
  666. allowanceMsg = $("#newAllowanceMsg").val();
  667. }
  668. var param = {"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(),
  669. "toPorcess": toPorcess, "allowanceType": allowanceType, "allowanceMsg": allowanceMsg, "months": months, "source": $("#source").val(), "resAllowanceType": $("#resAllowanceType").val(), resAllowanceMsg: $("#resAllowanceMsg").val()};
  670. var checkAjax = new $ax(Feng.ctxPath + "/admin/talentAllowance/reviewCheck", function (res) {
  671. if (res.code == 200) {
  672. Feng.success(res.msg)
  673. } else {
  674. Feng.error(res.msg);
  675. }
  676. }, function (data) {
  677. Feng.error("提交失败!" + data.responseJSON.message + "!");
  678. });
  679. checkAjax.setData(param);
  680. checkAjax.start();
  681. } else {
  682. Feng.error(data.msg);
  683. }
  684. }, function (data) {
  685. Feng.error("校验失败!" + data.responseJSON.message + "!");
  686. });
  687. ajax.set("id", id);
  688. ajax.set("type", 3);
  689. ajax.set("process", $("#process").val())
  690. ajax.set("companyId", $("#companyId").val())
  691. ajax.start();
  692. }
  693. /**
  694. * 显示字段或者隐藏字段选择
  695. */
  696. TalentAllowanceInfoDlg.toggleField = function () {
  697. var checkState = $("#checkStateModal").val();
  698. var process = $("#process").val();
  699. var type = $("#type").val();
  700. $("#otherEnjoyedMoney").val(0);
  701. TalentAllowanceInfoDlg.cal();
  702. $("#otherEnjoyed").css("display", "none");
  703. if (checkState == 2 || checkState == -2) {
  704. $("#toProcessDiv").css("display", process == 3 ? "block" : "none");
  705. $("#field").show();
  706. } else {
  707. if (checkState == 3) {
  708. // if (type == 6) {
  709. // $("#otherEnjoyed").css("display", "block");
  710. // }
  711. $("#checkMsg").val(process == 3 ? "复核通过,待核查征信" : "初审通过");
  712. }
  713. $("#field").hide();
  714. $("#field").find("input[type=checkbox]").each(function () {
  715. $(this).iCheck("uncheck");
  716. });
  717. $("#toProcessDiv").css("display", "none");
  718. }
  719. }
  720. TalentAllowanceInfoDlg.save = function () {
  721. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  722. if (data.code == 200) {
  723. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/save", function (data) {
  724. if (data.code == 200) {
  725. Feng.success(data.msg);
  726. } else {
  727. Feng.error(data.msg);
  728. }
  729. }, function (data) {
  730. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  731. });
  732. var id = $("#id").val();
  733. var allowanceType = $("#allowanceType").val();
  734. ajax.setData({"id": id, "allowanceType": allowanceType});
  735. ajax.start();
  736. } else {
  737. Feng.info(data.msg);
  738. }
  739. }, function (data) {
  740. Feng.error("校验失败!" + data.responseJSON.message + "!");
  741. });
  742. ajax.set("id", $("#id").val());
  743. ajax.set("type", 3);
  744. ajax.set("process", $("#process").val())
  745. ajax.set("companyId", $("#companyId").val())
  746. ajax.start();
  747. }
  748. /**
  749. * 审核信息提交
  750. */
  751. TalentAllowanceInfoDlg.checkSubmit = function (index) {
  752. var id = $("#id").val();
  753. var type = $("#type").val();
  754. var checkState = $("#checkStateModal").val();
  755. var checkMsg = $("#checkMsg").val();
  756. var process = $("#process").val();
  757. var companyCode = $("#companyCode").val();
  758. var companyCodes = "";
  759. var otherEnjoyedMoney = $("#otherEnjoyedMoney").val();
  760. var otherEnjoyedDescription = $("#otherEnjoyedDescription").val();
  761. // var absolute_control = $("input[name='absolute_control']").val()
  762. var crontol_money = $("#crontol_money").val();
  763. if (Feng.isEmptyStr(checkState)) {
  764. Feng.info("请选择审核状态");
  765. return;
  766. }
  767. if (Feng.isEmptyStr(checkMsg)) {
  768. Feng.info("请填写审核意见");
  769. return;
  770. }
  771. if (type == 6 && process == 3 && checkState == 3 && otherEnjoyedMoney != 0 && Feng.isEmptyStr(otherEnjoyedDescription)) {
  772. Feng.info("其它补贴金额不为0时需要填写其它补贴金额说明");
  773. return;
  774. }
  775. /*if (process == 3 && checkState == 2) {
  776. var toProcess = $("#toProcess").val();
  777. if (Feng.isEmptyStr(toProcess)) {
  778. Feng.info("请选择驳回至流程");
  779. return;
  780. }
  781. if (toProcess == 1) {
  782. var toDep = $("#toDep").val();
  783. for (var key in toDep) {
  784. companyCodes = companyCodes + toDep[key] + ",";
  785. }
  786. if (Feng.isEmptyStr(companyCodes)) {
  787. Feng.info("请选择驳回单位");
  788. return;
  789. }
  790. }
  791. }*/
  792. var projects = '', files = '', concats = '', fields = "";
  793. if (process == 1) {
  794. $("#field_project li input").each(function (index) {
  795. if ($(this).is(":checked")) {
  796. projects = projects + $(this).val() + ",";
  797. }
  798. });
  799. $("#field_file li input").each(function (index) {
  800. if ($(this).is(":checked")) {
  801. files = files + $(this).val() + ",";
  802. }
  803. });
  804. //if(companyCode == CONFIG.COM_RSJ || companyCode == CONFIG.COM_IC){
  805. $("#field_concat li input").each(function (index) {
  806. if ($(this).is(":checked")) {
  807. concats = concats + $(this).val() + ",";
  808. }
  809. });
  810. $("#field_field li input").each(function (index) {
  811. if ($(this).is(":checked")) {
  812. fields = fields + $(this).val() + ",";
  813. }
  814. });
  815. fields = fields.substring(0, fields.length - 1);
  816. //}
  817. }
  818. // if(process ==1 && checkState==2 && projects=='' && files==''){
  819. // Feng.info("请选择可修改的项目或附件!");
  820. // return ;
  821. // }
  822. if (Feng.isNotEmptyStr(companyCodes)) {
  823. companyCodes = companyCodes.substring(0, companyCodes.length - 1);
  824. }
  825. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/check", function (data) {
  826. if (data.code == 200) {
  827. layer.close(index);
  828. Feng.success(data.msg);
  829. } else {
  830. Feng.error(data.msg);
  831. }
  832. }, function (data) {
  833. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  834. });
  835. ajax.setData({"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(), "projects": projects, "files": files, "concats": concats, "fields": fields, "companyId": $("#companyId").val(), "toProcess": $("#toProcess").val(), "toDep": companyCodes, otherEnjoyedMoney: otherEnjoyedMoney, otherEnjoyedDescription: otherEnjoyedDescription, source: $("#source").val(), resAllowanceType: $("#resAllowanceType").val(), resAllowanceMsg: $("#resAllowanceMsg").val()});
  836. ajax.start();
  837. }
  838. /**
  839. * 提交审核
  840. */
  841. TalentAllowanceInfoDlg.submitCheck = function () {
  842. var operation = function () {
  843. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/submitCheck", function (data) {
  844. if (data.code == 200) {
  845. Feng.success(data.msg);
  846. window.parent.TalentAllowanceInfo.table.refresh();
  847. TalentAllowanceInfoDlg.close();
  848. } else {
  849. Feng.error(data.msg);
  850. }
  851. }, function (data) {
  852. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  853. });
  854. ajax.setData({"id": $("#id").val(), "process": $("#process").val(), "companyId": $("#companyId").val()});
  855. ajax.start();
  856. }
  857. Feng.confirm("一旦提交无法修改,是否审核完毕且无误?", operation);
  858. }
  859. TalentAllowanceInfoDlg.attendanceCallBack = function (data) {
  860. if (data.code == 200) {
  861. Feng.success(data.msg);
  862. $("#" + data.obj).bootstrapTable("refresh", {});
  863. $("#jjAttendanceModal").modal("hide");
  864. } else {
  865. Feng.info(data.msg);
  866. }
  867. }
  868. TalentAllowanceInfoDlg.initICheck = function () {
  869. $('input[type=checkbox]').iCheck({
  870. labelHover: false,
  871. cursor: true,
  872. checkboxClass: 'icheckbox_square-green',
  873. radioClass: 'iradio_square-greene',
  874. increaseArea: '20%'
  875. });
  876. }
  877. TalentAllowanceInfoDlg.showAllLog = function () {
  878. var id = $("#id").val();
  879. if (Feng.isNotEmptyStr(id)) {
  880. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  881. }
  882. }
  883. TalentAllowanceInfoDlg.fileChange = function (context) {
  884. var file = $(context).val();
  885. var pos = file.lastIndexOf("\\");
  886. $("#fileInput").val(file.substring(pos + 1));
  887. }
  888. TalentAllowanceInfoDlg.calculator = function () {
  889. var id = $("#id").val();
  890. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/calculator/id/" + id, function (data) {
  891. var message = data.recommendAllowanceMsg.join("<br>");
  892. if (data.recommendAllowanceType != 3) {
  893. message += "<br>试算补贴金额:<span style='color:red;font-weight:bold;'>" + data.finnalMoney + "</span>";
  894. }
  895. $("#cal-result").html(message);
  896. }, function (data) {
  897. Feng.error("查询失败!" + data.responseJSON.message + "!");
  898. });
  899. ajax.start();
  900. }
  901. TalentAllowanceInfoDlg.allowanceTypeChange = function (content) {
  902. var allowanceType = $(content).val();
  903. console.log(allowanceType)
  904. if (allowanceType == 1) {
  905. $(".personDiv").css("display", "none");
  906. $("#otherEnjoyed").css("otherEnjoyed", "block");
  907. } else {
  908. $(".personDiv").css("display", "block");
  909. $("#otherEnjoyed").css("otherEnjoyed", "none");
  910. }
  911. }
  912. $(function () {
  913. if ($("#type").val() == 2) {
  914. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  915. }
  916. /*if ($("#type").val() == 6 && $("#process").val() == 1) {
  917. $(":input").prop("disabled", false);
  918. $(":input").prop("readonly", false);
  919. }*/
  920. $("select").each(function () {
  921. +
  922. $(this).val($(this).attr("value"));
  923. });
  924. TalentAllowanceInfoDlg.initFileTable();
  925. TalentAllowanceInfoDlg.initCommonFileTable();
  926. TalentAllowanceInfoDlg.initContract();
  927. TalentAllowanceInfoDlg.showAllLog();
  928. //批量加载时间控件
  929. $(".date").each(function () {
  930. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  931. });
  932. var process = $("#process").val();
  933. var compayCode = $("#companyCode").val();
  934. TalentAllowanceInfoDlg.calculator();
  935. });