talentAllowanceInfo_info.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  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. var allowanceType = $("#allowanceType").val();
  187. if (allowanceType == 1) {
  188. $('#jjAttendanceModal').on('show.bs.modal', function () {
  189. $("#jjAttendanceForm")[0].reset();
  190. $("#jjmonths input").each(function () {
  191. $(this).iCheck("uncheck");
  192. });
  193. $("#jjAttendanceId").val(id);
  194. $("#jjAttendanceEnterpriseId").val(enterpriseId);
  195. if (Feng.isNotEmptyStr(months)) {
  196. if (months.indexOf(",") != -1) {
  197. var arr = months.split(",");
  198. for (var key in arr) {
  199. $("#jjmonths input").each(function () {
  200. if ($(this).val() == arr[key])
  201. $(this).iCheck("check");
  202. });
  203. }
  204. }
  205. }
  206. });
  207. if (days != null && days != '')
  208. $("#days").val(days);
  209. $("#jjAttendanceModal").modal("show");
  210. } else {
  211. $("#attendanceModalLabel").html("考勤");
  212. $("#heading").html("请填写每月考勤天数<span style=\"color: red\">(不填写或填写0则代表无考勤记录)</span>");
  213. $("#attendanceForm")[0].reset();
  214. $("#attendanceId").val(id);
  215. $("#attendanceEnterpriseId").val(enterpriseId);
  216. if (months != null && months != '') {
  217. var arr = months.split(",");
  218. for (var key in arr) {
  219. var num = arr[key].split("=")[0];
  220. var day = arr[key].split("=")[1];
  221. $("#attendMonths input").each(function () {
  222. if ($(this).attr('num') == num)
  223. $(this).val(day);
  224. });
  225. }
  226. }
  227. $("#attendanceModal").modal("show");
  228. }
  229. break;
  230. case "15":
  231. $("#attendanceModalLabel").html("在境时间");
  232. $("#heading").html("请填写每月在境内天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  233. $("#attendanceForm")[0].reset();
  234. $("#attendanceId").val(id);
  235. $("#attendanceEnterpriseId").val(enterpriseId);
  236. if (months != null && months != '') {
  237. var arr = months.split(",");
  238. for (var key in arr) {
  239. var num = arr[key].split("=")[0];
  240. var day = arr[key].split("=")[1];
  241. $("#attendMonths input").each(function () {
  242. if ($(this).attr('num') == num)
  243. $(this).val(day);
  244. });
  245. }
  246. }
  247. $("#attendanceModal").modal("show");
  248. break;
  249. case "16":
  250. $("#attendanceModalLabel").html("境内工作日时间");
  251. $("#heading").html("请填写每月境内工作日天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  252. $("#attendanceForm")[0].reset();
  253. $("#attendanceId").val(id);
  254. $("#attendanceEnterpriseId").val(enterpriseId);
  255. if (months != null && months != '') {
  256. var arr = months.split(",");
  257. for (var key in arr) {
  258. var num = arr[key].split("=")[0];
  259. var day = arr[key].split("=")[1];
  260. $("#attendMonths input").each(function () {
  261. if ($(this).attr('num') == num)
  262. $(this).val(day);
  263. });
  264. }
  265. }
  266. $("#attendanceModal").modal("show");
  267. break;
  268. default:
  269. $('#projectModal').on('show.bs.modal', function () {
  270. $("#months input").each(function () {
  271. $(this).iCheck("uncheck");
  272. });
  273. $("#projectId").val(id);
  274. $("#enterpriseId").val(enterpriseId);
  275. TalentAllowanceInfoDlg.initICheck();
  276. if (Feng.isNotEmptyStr(months)) {
  277. var arr = months.split(",");
  278. for (var key in arr) {
  279. $("#months input").each(function () {
  280. if ($(this).val() == arr[key])
  281. $(this).iCheck("check");
  282. });
  283. }
  284. }
  285. });
  286. $("#projectModal").modal("show");
  287. break;
  288. }
  289. } else {
  290. Feng.info(data.msg);
  291. }
  292. }, function (data) {
  293. Feng.error("校验失败!" + data.responseJSON.message + "!");
  294. });
  295. ajax.set("id", id);
  296. ajax.set("type", 2);
  297. ajax.set("process", $("#process").val())
  298. ajax.set("companyId", $("#companyId").val())
  299. ajax.start();
  300. }
  301. //审核合同满两年提交
  302. TalentAllowanceInfoDlg.contractCheckSubmit = function () {
  303. var id = $("#contractCheckId").val();
  304. var enterpriseId = $("#contractEnterpriseId").val();
  305. var description = $("#msg").val();
  306. var months = $("#state").val();
  307. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  308. if (data.code == 200) {
  309. Feng.success(data.msg);
  310. $("#" + enterpriseId).bootstrapTable("refresh", {});
  311. $("#contractCheckModal").modal("hide");
  312. } else {
  313. Feng.info(data.msg);
  314. }
  315. }, function (data) {
  316. Feng.error("提交失败!" + data.responseJSON.message + "!");
  317. });
  318. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  319. ajax.start();
  320. }
  321. //编辑项目提交
  322. TalentAllowanceInfoDlg.editProject = function () {
  323. var id = $("#projectId").val();
  324. var enterpriseId = $("#enterpriseId").val();
  325. var description = $("#description").val();
  326. var months = "";
  327. $("#months input").each(function () {
  328. if (this.checked) {
  329. months = months + $(this).val() + ",";
  330. }
  331. })
  332. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  333. if (data.code == 200) {
  334. Feng.success(data.msg);
  335. $("#" + enterpriseId).bootstrapTable("refresh", {});
  336. $("#projectModal").modal("hide");
  337. } else {
  338. Feng.info(data.msg);
  339. }
  340. }, function (data) {
  341. Feng.error("提交失败!" + data.responseJSON.message + "!");
  342. });
  343. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  344. ajax.start();
  345. }
  346. /**
  347. * 提交晋江市现代产业体系人才的考勤
  348. */
  349. TalentAllowanceInfoDlg.editJJAttendance = function () {
  350. var id = $("#jjAttendanceId").val();
  351. var enterpriseId = $("#jjAttendanceEnterpriseId").val();
  352. var description = $("#jjDescription").val();
  353. var days = $("#days").val();
  354. var months = "";
  355. $("#jjmonths input").each(function () {
  356. if (this.checked) {
  357. months = months + $(this).val() + ",";
  358. }
  359. })
  360. if (months == "" && (days == null || days == "")) {
  361. //Feng.info("请填写考勤信息");
  362. //return;
  363. }
  364. if (months != null && months != '' && days != null && days != '') {
  365. Feng.info("考勤天数和考勤月份只能选择一个填写");
  366. return;
  367. }
  368. $("#attendanceMonths").val(months);
  369. //$("#jjAttendanceForm")[0].submit();
  370. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  371. if (data.code == 200) {
  372. Feng.success(data.msg);
  373. $("#" + enterpriseId).bootstrapTable("refresh", {});
  374. $("#jjAttendanceModal").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, "months": months, "days": days, "description": description, "process": $("#process").val()});
  382. ajax.start();
  383. }
  384. TalentAllowanceInfoDlg.editAttendanceProject = function () {
  385. var id = $("#attendanceId").val();
  386. var enterpriseId = $("#attendanceEnterpriseId").val();
  387. var description = $("#attendanceDescription").val();
  388. var months = "";
  389. var error = "";
  390. $("#attendMonths input").each(function () {
  391. var days = $(this).val();
  392. var num = $(this).attr("num");
  393. if (isNaN(days)) {
  394. error = error + num + "月的考勤天数不是数字;";
  395. } else {
  396. if (days < 0 || days > 31) {
  397. error = error + num + "月的考勤天数不在范围内(1-31);";
  398. }
  399. }
  400. if (days == null || days == '') {
  401. days = 0;
  402. }
  403. months = months + num + "=" + days + ",";
  404. });
  405. if (error != "") {
  406. Feng.error(error);
  407. return;
  408. }
  409. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/editProject", function (data) {
  410. if (data.code == 200) {
  411. Feng.success(data.msg);
  412. $("#" + enterpriseId).bootstrapTable("refresh", {});
  413. $("#attendanceModal").modal("hide");
  414. } else {
  415. Feng.info(data.msg);
  416. }
  417. }, function (data) {
  418. Feng.error("提交失败!" + data.responseJSON.message + "!");
  419. });
  420. ajax.set({"id": id, "months": months, "description": description, "process": $("#process").val()});
  421. ajax.start();
  422. }
  423. /**
  424. * 锁定工作单位合同
  425. * @param id
  426. */
  427. TalentAllowanceInfoDlg.lockContract = function (id) {
  428. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  429. if (data.code == 200) {
  430. var operation = function () {
  431. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/lockContract", function (data) {
  432. if (data.code == 200) {
  433. Feng.success(data.msg);
  434. $("#projectTable").bootstrapTable("refresh", {});
  435. } else {
  436. Feng.info(data.msg);
  437. }
  438. }, function (data) {
  439. Feng.error("删除失败!" + data.responseJSON.message + "!");
  440. });
  441. ajax.set("id", id);
  442. ajax.set("process", $("#process").val())
  443. ajax.start();
  444. }
  445. Feng.confirm("一旦锁定无法修改,确认锁定吗?", operation);
  446. } else {
  447. Feng.info(data.msg);
  448. }
  449. }, function (data) {
  450. Feng.error("校验失败!" + data.responseJSON.message + "!");
  451. });
  452. ajax.set("id", id);
  453. ajax.set("type", 1);
  454. ajax.set("process", $("#process").val())
  455. ajax.set("companyId", $("#companyId").val())
  456. ajax.start();
  457. }
  458. /**
  459. * 锁定项目
  460. * @param id
  461. */
  462. TalentAllowanceInfoDlg.lockProject = function (id, enterpriseId) {
  463. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  464. if (data.code == 200) {
  465. var operation = function () {
  466. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/lockProject", function (data) {
  467. if (data.code == 200) {
  468. Feng.success(data.msg);
  469. $("#" + enterpriseId).bootstrapTable("refresh", {});
  470. } else {
  471. Feng.info(data.msg);
  472. }
  473. }, function (data) {
  474. Feng.error("删除失败!" + data.responseJSON.message + "!");
  475. });
  476. ajax.set("id", id);
  477. ajax.set("process", $("#process").val())
  478. ajax.start();
  479. }
  480. Feng.confirm("一旦锁定无法修改,确认锁定吗?", operation);
  481. } else {
  482. Feng.info(data.msg);
  483. }
  484. }, function (data) {
  485. Feng.error("校验失败!" + data.responseJSON.message + "!");
  486. });
  487. ajax.set("id", id);
  488. ajax.set("type", 2);
  489. ajax.set("process", $("#process").val())
  490. ajax.set("companyId", $("#companyId").val())
  491. ajax.start();
  492. }
  493. /**
  494. * 显示审核模态框
  495. */
  496. TalentAllowanceInfoDlg.showCheckModal = function () {
  497. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  498. if (data.code == 200) {
  499. layer.open({
  500. type: 1,
  501. id: "neewFieldFormModel",
  502. title: '审核',
  503. area: ['800px', '450px'], //宽高
  504. fix: false, //不固定
  505. shade: 0,
  506. maxmin: true,
  507. content: TalentAllowanceInfoDlg.createCheckHtml(),
  508. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  509. btnAlign: 'c',
  510. zIndex: layer.zIndex,
  511. success: function (layero, index) {
  512. var projectList = data.obj.projects;
  513. var fileList = data.obj.files;
  514. var concatList = data.obj.concats;
  515. var files = data.obj.info.files;
  516. var projects = data.obj.info.projects;
  517. var concats = data.obj.info.concats;
  518. var fields = data.obj.info.fields;
  519. var info = data.obj.info;
  520. var calResult = typeof data.obj.calResult != "undefined" ? data.obj.calResult : {};
  521. //初始化附件、核查项目、合同
  522. if (projectList != null && projectList.length != 0) {
  523. var html = '<ul>';
  524. for (var key in projectList) {
  525. html = html + '<li style="width: 100%"><input type="checkbox" value="' + projectList[key].id + '"><span>' + projectList[key].projectName + '</span></li>';
  526. }
  527. html = html + "</ul>";
  528. $("#field_project").empty().append(html);
  529. }
  530. if (fileList != null && fileList.length != 0) {
  531. var html = '';
  532. for (var key in fileList) {
  533. 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>';
  534. }
  535. $("#field_file").empty().append(html);
  536. }
  537. if (concatList != null && concatList.length != 0) {
  538. var html = '';
  539. for (var key in concatList) {
  540. html = html + '<ul><li style="width: 100%"><input type="checkbox" value="' + concatList[key].id + '"><span>' + concatList[key].enterpriseName + '</span></li></ul>';
  541. }
  542. $("#field_concat").empty().append(html);
  543. }
  544. if (calResult) {
  545. $("#otherEnjoyedMoney").data("money", calResult.recommendMoney);
  546. $("#finalMoney").val(calResult.recommendMoney);
  547. if (calResult.recommendAllowanceType == 1) {
  548. var text = "补贴类型:工作津贴\n满足条件的月份:" + calResult.recommendMonths;
  549. text += "\n可享受补贴(元):" + calResult.recommendMoney;
  550. $("#calResult").text(text);
  551. } else if (calResult.recommendAllowanceType == 2) {
  552. var text = "补贴类型:一次性交通补贴";
  553. text += "\n可享受补贴(元):" + calResult.recommendMoney;
  554. $("#calResult").text(text);
  555. } else {
  556. $("#calResult").text(calResult.recommendAllowanceMsg);
  557. }
  558. }
  559. TalentAllowanceInfoDlg.initICheck();
  560. //回显数据
  561. $("#checkStateModal").val(info.checkState).trigger("change");
  562. $("#toProcess").val(info.toProcess).trigger("change");
  563. if (Feng.isNotEmptyStr(info.toDep))
  564. $("#toDep").val(info.toDep.split(",")).trigger("chosen:updated");
  565. $("#checkMsg").val(info.checkMsg);
  566. if (Feng.isNotEmptyStr(projects)) {
  567. $("#field_project input").each(function () {
  568. if (projects.indexOf($(this).val()) != -1) {
  569. $(this).iCheck("check");
  570. }
  571. });
  572. }
  573. if (files != null && files != '') {
  574. $("#field_file input").each(function () {
  575. if (files.indexOf($(this).val()) != -1) {
  576. $(this).iCheck("check");
  577. }
  578. });
  579. }
  580. if (concats != null && concats != '') {
  581. $("#field_concat input").each(function () {
  582. if (concats.indexOf($(this).val()) != -1) {
  583. $(this).iCheck("check");
  584. }
  585. });
  586. }
  587. if (Feng.isNotEmptyStr(fields)) {
  588. $("#field_field input").each(function () {
  589. if (fields.indexOf($(this).val()) != -1) {
  590. $(this).iCheck("check");
  591. }
  592. });
  593. }
  594. $("input[type=checkbox][value=allowanceType]").on("ifChanged", function (e) {
  595. var isChecked = $(this).is(":checked") ? "check" : "uncheck";
  596. $("#field_file input").each(function () {
  597. $(this).iCheck(isChecked);
  598. })
  599. $("#field_project input").each(function () {
  600. $(this).iCheck(isChecked);
  601. })
  602. })
  603. $("input[type=checkbox][value=postType]").on("ifChanged", function (e) {
  604. var isChecked = $(this).is(":checked") ? "check" : "uncheck";
  605. $("#field_file input").each(function () {
  606. $(this).iCheck(isChecked);
  607. })
  608. })
  609. if (calResult) {
  610. $("#otherEnjoyedMoney").val(info.otherEnjoyedMoney);
  611. $("#otherEnjoyedDescription").val(info.otherEnjoyedDescription);
  612. TalentAllowanceInfoDlg.cal();
  613. }
  614. },
  615. yes: function (index, layero) {
  616. TalentAllowanceInfoDlg.checkSubmit(index);
  617. }
  618. });
  619. } else {
  620. Feng.info(data.msg);
  621. }
  622. }, function (data) {
  623. Feng.error("校验失败!" + data.responseJSON.message + "!");
  624. });
  625. ajax.set("id", $("#id").val());
  626. ajax.set("type", 3);
  627. ajax.set("process", $("#process").val())
  628. ajax.set("companyId", $("#companyId").val())
  629. ajax.start();
  630. }
  631. TalentAllowanceInfoDlg.cal = function () {
  632. var value = $("#otherEnjoyedMoney").val();
  633. var totalMoney = $("#otherEnjoyedMoney").data("money");
  634. var result = totalMoney - value;
  635. $("#finalMoney").val(result);
  636. }
  637. /**
  638. * 显示/隐藏设置津补贴类型
  639. */
  640. TalentAllowanceInfoDlg.toggleSetAllowance = function () {
  641. var checkState = $("#reviewState").val();
  642. if (checkState == 2) {
  643. $("#setAllowanceHeading,#setAllowanceBody").css("display", "none");
  644. $("#processLable,#processDiv").css("display", "block");
  645. $("#checkMsg").val("审核通过");
  646. } else if (checkState == 3) {
  647. $("#setAllowanceHeading,#setAllowanceBody").css("display", "block");
  648. $("#processLable,#processDiv").css("display", "none");
  649. }
  650. }
  651. /**
  652. * 保存复核审核结果
  653. */
  654. TalentAllowanceInfoDlg.saveReviewCheck = function () {
  655. var id = $("#id").val();
  656. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  657. if (data.code == 200) {
  658. var checkState = $("#reviewState").val();
  659. var checkMsg = $("#allowanceCheckMsg").val();
  660. if (checkState == null || checkState == '') {
  661. Feng.info("请选择审核状态");
  662. return;
  663. }
  664. var toPorcess = $("#toProcess").val();
  665. var allowanceType = null, months = "", allowanceMsg = null;
  666. if (checkState == 3) {
  667. allowanceType = $("#newAllowanceType").val();
  668. $("#allowanceMonths input[type=checkbox]").each(function () {
  669. if (this.checked) {
  670. months = months + $(this).val() + ",";
  671. }
  672. });
  673. allowanceMsg = $("#newAllowanceMsg").val();
  674. }
  675. var param = {"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(),
  676. "toPorcess": toPorcess, "allowanceType": allowanceType, "allowanceMsg": allowanceMsg, "months": months, "source": $("#source").val(), "resAllowanceType": $("#resAllowanceType").val(), resAllowanceMsg: $("#resAllowanceMsg").val()};
  677. var checkAjax = new $ax(Feng.ctxPath + "/admin/talentAllowance/reviewCheck", function (res) {
  678. if (res.code == 200) {
  679. Feng.success(res.msg)
  680. } else {
  681. Feng.error(res.msg);
  682. }
  683. }, function (data) {
  684. Feng.error("提交失败!" + data.responseJSON.message + "!");
  685. });
  686. checkAjax.setData(param);
  687. checkAjax.start();
  688. } else {
  689. Feng.error(data.msg);
  690. }
  691. }, function (data) {
  692. Feng.error("校验失败!" + data.responseJSON.message + "!");
  693. });
  694. ajax.set("id", id);
  695. ajax.set("type", 3);
  696. ajax.set("process", $("#process").val())
  697. ajax.set("companyId", $("#companyId").val())
  698. ajax.start();
  699. }
  700. /**
  701. * 显示字段或者隐藏字段选择
  702. */
  703. TalentAllowanceInfoDlg.toggleField = function () {
  704. var checkState = $("#checkStateModal").val();
  705. var process = $("#process").val();
  706. var type = $("#type").val();
  707. $("#otherEnjoyedMoney").val(0);
  708. TalentAllowanceInfoDlg.cal();
  709. //$("#otherEnjoyed").css("display", "none");
  710. if (checkState == 2 || checkState == -2) {
  711. $("#toProcessDiv").css("display", process == 3 ? "block" : "none");
  712. $("#field").show();
  713. $("#otherSence").css("display", "none");
  714. } else {
  715. if (checkState == 3) {
  716. if (type == 6) {
  717. $("#otherSence").css("display", "block");
  718. }
  719. $("#checkMsg").val(process == 3 ? "复核通过,待核查征信" : "初审通过");
  720. }
  721. $("#field").hide();
  722. $("#field").find("input[type=checkbox]").each(function () {
  723. $(this).iCheck("uncheck");
  724. });
  725. $("#toProcessDiv").css("display", "none");
  726. }
  727. }
  728. TalentAllowanceInfoDlg.save = function () {
  729. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  730. if (data.code == 200) {
  731. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/save", function (data) {
  732. if (data.code == 200) {
  733. Feng.success(data.msg);
  734. } else {
  735. Feng.error(data.msg);
  736. }
  737. }, function (data) {
  738. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  739. });
  740. var id = $("#id").val();
  741. var allowanceType = $("#allowanceType").val();
  742. ajax.setData({"id": id, "allowanceType": allowanceType});
  743. ajax.start();
  744. } else {
  745. Feng.info(data.msg);
  746. }
  747. }, function (data) {
  748. Feng.error("校验失败!" + data.responseJSON.message + "!");
  749. });
  750. ajax.set("id", $("#id").val());
  751. ajax.set("type", 3);
  752. ajax.set("process", $("#process").val())
  753. ajax.set("companyId", $("#companyId").val())
  754. ajax.start();
  755. }
  756. /**
  757. * 审核信息提交
  758. */
  759. TalentAllowanceInfoDlg.checkSubmit = function (index) {
  760. var id = $("#id").val();
  761. var type = $("#type").val();
  762. var checkState = $("#checkStateModal").val();
  763. var checkMsg = $("#checkMsg").val();
  764. var process = $("#process").val();
  765. var companyCode = $("#companyCode").val();
  766. var companyCodes = "";
  767. var otherEnjoyedMoney = $("#otherEnjoyedMoney").val();
  768. var otherEnjoyedDescription = $("#otherEnjoyedDescription").val();
  769. // var absolute_control = $("input[name='absolute_control']").val()
  770. var crontol_money = $("#crontol_money").val();
  771. if (Feng.isEmptyStr(checkState)) {
  772. Feng.info("请选择审核状态");
  773. return;
  774. }
  775. if (Feng.isEmptyStr(checkMsg)) {
  776. Feng.info("请填写审核意见");
  777. return;
  778. }
  779. if (type == 6 && process == 3 && checkState == 3 && otherEnjoyedMoney != 0 && Feng.isEmptyStr(otherEnjoyedDescription)) {
  780. Feng.info("其它补贴金额不为0时需要填写其它补贴金额说明");
  781. return;
  782. }
  783. /*if (process == 3 && checkState == 2) {
  784. var toProcess = $("#toProcess").val();
  785. if (Feng.isEmptyStr(toProcess)) {
  786. Feng.info("请选择驳回至流程");
  787. return;
  788. }
  789. if (toProcess == 1) {
  790. var toDep = $("#toDep").val();
  791. for (var key in toDep) {
  792. companyCodes = companyCodes + toDep[key] + ",";
  793. }
  794. if (Feng.isEmptyStr(companyCodes)) {
  795. Feng.info("请选择驳回单位");
  796. return;
  797. }
  798. }
  799. }*/
  800. var projects = '', files = '', concats = '', fields = "";
  801. if (process == 1) {
  802. $("#field_project li input").each(function (index) {
  803. if ($(this).is(":checked")) {
  804. projects = projects + $(this).val() + ",";
  805. }
  806. });
  807. $("#field_file li input").each(function (index) {
  808. if ($(this).is(":checked")) {
  809. files = files + $(this).val() + ",";
  810. }
  811. });
  812. //if(companyCode == CONFIG.COM_RSJ || companyCode == CONFIG.COM_IC){
  813. $("#field_concat li input").each(function (index) {
  814. if ($(this).is(":checked")) {
  815. concats = concats + $(this).val() + ",";
  816. }
  817. });
  818. $("#field_field li input").each(function (index) {
  819. if ($(this).is(":checked")) {
  820. fields = fields + $(this).val() + ",";
  821. }
  822. });
  823. fields = fields.substring(0, fields.length - 1);
  824. //}
  825. }
  826. // if(process ==1 && checkState==2 && projects=='' && files==''){
  827. // Feng.info("请选择可修改的项目或附件!");
  828. // return ;
  829. // }
  830. if (Feng.isNotEmptyStr(companyCodes)) {
  831. companyCodes = companyCodes.substring(0, companyCodes.length - 1);
  832. }
  833. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/check", function (data) {
  834. if (data.code == 200) {
  835. layer.close(index);
  836. Feng.success(data.msg);
  837. } else {
  838. Feng.error(data.msg);
  839. }
  840. }, function (data) {
  841. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  842. });
  843. 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()});
  844. ajax.start();
  845. }
  846. /**
  847. * 提交审核
  848. */
  849. TalentAllowanceInfoDlg.submitCheck = function () {
  850. var operation = function () {
  851. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/submitCheck", function (data) {
  852. if (data.code == 200) {
  853. Feng.success(data.msg);
  854. window.parent.TalentAllowanceInfo.table.refresh();
  855. TalentAllowanceInfoDlg.close();
  856. } else {
  857. Feng.error(data.msg);
  858. }
  859. }, function (data) {
  860. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  861. });
  862. ajax.setData({"id": $("#id").val(), "process": $("#process").val(), "companyId": $("#companyId").val()});
  863. ajax.start();
  864. }
  865. Feng.confirm("一旦提交无法修改,是否审核完毕且无误?", operation);
  866. }
  867. TalentAllowanceInfoDlg.attendanceCallBack = function (data) {
  868. if (data.code == 200) {
  869. Feng.success(data.msg);
  870. $("#" + data.obj).bootstrapTable("refresh", {});
  871. $("#jjAttendanceModal").modal("hide");
  872. } else {
  873. Feng.info(data.msg);
  874. }
  875. }
  876. TalentAllowanceInfoDlg.initICheck = function () {
  877. $('input[type=checkbox]').iCheck({
  878. labelHover: false,
  879. cursor: true,
  880. checkboxClass: 'icheckbox_square-green',
  881. radioClass: 'iradio_square-greene',
  882. increaseArea: '20%'
  883. });
  884. }
  885. TalentAllowanceInfoDlg.showAllLog = function () {
  886. var id = $("#id").val();
  887. if (Feng.isNotEmptyStr(id)) {
  888. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  889. }
  890. }
  891. TalentAllowanceInfoDlg.fileChange = function (context) {
  892. var file = $(context).val();
  893. var pos = file.lastIndexOf("\\");
  894. $("#fileInput").val(file.substring(pos + 1));
  895. }
  896. TalentAllowanceInfoDlg.calculator = function () {
  897. var id = $("#id").val();
  898. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/calculator/id/" + id, function (data) {
  899. var message = data.recommendAllowanceMsg.join("<br>");
  900. if (data.recommendAllowanceType != 3) {
  901. message += "<br>试算补贴金额:<span style='color:red;font-weight:bold;'>" + data.finnalMoney + "</span>";
  902. }
  903. $("#cal-result").html(message);
  904. }, function (data) {
  905. Feng.error("查询失败!" + data.responseJSON.message + "!");
  906. });
  907. ajax.start();
  908. }
  909. TalentAllowanceInfoDlg.allowanceTypeChange = function (content) {
  910. var allowanceType = $(content).val();
  911. console.log(allowanceType)
  912. if (allowanceType == 1) {
  913. $(".personDiv").css("display", "none");
  914. $("#otherEnjoyed").css("display", "block");
  915. } else {
  916. $(".personDiv").css("display", "block");
  917. $("#otherEnjoyed").css("display", "none");
  918. }
  919. }
  920. $(function () {
  921. if ($("#type").val() == 2) {
  922. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  923. }
  924. /*if ($("#type").val() == 6 && $("#process").val() == 1) {
  925. $(":input").prop("disabled", false);
  926. $(":input").prop("readonly", false);
  927. }*/
  928. $("select").each(function () {
  929. +
  930. $(this).val($(this).attr("value"));
  931. });
  932. TalentAllowanceInfoDlg.initFileTable();
  933. TalentAllowanceInfoDlg.initCommonFileTable();
  934. TalentAllowanceInfoDlg.initContract();
  935. TalentAllowanceInfoDlg.showAllLog();
  936. //批量加载时间控件
  937. $(".date").each(function () {
  938. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  939. });
  940. var process = $("#process").val();
  941. var compayCode = $("#companyCode").val();
  942. TalentAllowanceInfoDlg.calculator();
  943. });