talentAllowanceInfo_info.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  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. if (calResult) {
  604. $("#otherEnjoyedMoney").val(info.otherEnjoyedMoney);
  605. $("#otherEnjoyedDescription").val(info.otherEnjoyedDescription);
  606. TalentAllowanceInfoDlg.cal();
  607. }
  608. },
  609. yes: function (index, layero) {
  610. TalentAllowanceInfoDlg.checkSubmit(index);
  611. }
  612. });
  613. } else {
  614. Feng.info(data.msg);
  615. }
  616. }, function (data) {
  617. Feng.error("校验失败!" + data.responseJSON.message + "!");
  618. });
  619. ajax.set("id", $("#id").val());
  620. ajax.set("type", 3);
  621. ajax.set("process", $("#process").val())
  622. ajax.set("companyId", $("#companyId").val())
  623. ajax.start();
  624. }
  625. TalentAllowanceInfoDlg.cal = function () {
  626. var value = $("#otherEnjoyedMoney").val();
  627. var totalMoney = $("#otherEnjoyedMoney").data("money");
  628. var result = totalMoney - value;
  629. $("#finalMoney").val(result);
  630. }
  631. /**
  632. * 显示/隐藏设置津补贴类型
  633. */
  634. TalentAllowanceInfoDlg.toggleSetAllowance = function () {
  635. var checkState = $("#reviewState").val();
  636. if (checkState == 2) {
  637. $("#setAllowanceHeading,#setAllowanceBody").css("display", "none");
  638. $("#processLable,#processDiv").css("display", "block");
  639. $("#checkMsg").val("审核通过");
  640. } else if (checkState == 3) {
  641. $("#setAllowanceHeading,#setAllowanceBody").css("display", "block");
  642. $("#processLable,#processDiv").css("display", "none");
  643. }
  644. }
  645. /**
  646. * 保存复核审核结果
  647. */
  648. TalentAllowanceInfoDlg.saveReviewCheck = function () {
  649. var id = $("#id").val();
  650. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  651. if (data.code == 200) {
  652. var checkState = $("#reviewState").val();
  653. var checkMsg = $("#allowanceCheckMsg").val();
  654. if (checkState == null || checkState == '') {
  655. Feng.info("请选择审核状态");
  656. return;
  657. }
  658. var toPorcess = $("#toProcess").val();
  659. var allowanceType = null, months = "", allowanceMsg = null;
  660. if (checkState == 3) {
  661. allowanceType = $("#newAllowanceType").val();
  662. $("#allowanceMonths input[type=checkbox]").each(function () {
  663. if (this.checked) {
  664. months = months + $(this).val() + ",";
  665. }
  666. });
  667. allowanceMsg = $("#newAllowanceMsg").val();
  668. }
  669. var param = {"id": id, "checkState": checkState, "checkMsg": checkMsg, "process": $("#process").val(),
  670. "toPorcess": toPorcess, "allowanceType": allowanceType, "allowanceMsg": allowanceMsg, "months": months, "source": $("#source").val(), "resAllowanceType": $("#resAllowanceType").val(), resAllowanceMsg: $("#resAllowanceMsg").val()};
  671. var checkAjax = new $ax(Feng.ctxPath + "/admin/talentAllowance/reviewCheck", function (res) {
  672. if (res.code == 200) {
  673. Feng.success(res.msg)
  674. } else {
  675. Feng.error(res.msg);
  676. }
  677. }, function (data) {
  678. Feng.error("提交失败!" + data.responseJSON.message + "!");
  679. });
  680. checkAjax.setData(param);
  681. checkAjax.start();
  682. } else {
  683. Feng.error(data.msg);
  684. }
  685. }, function (data) {
  686. Feng.error("校验失败!" + data.responseJSON.message + "!");
  687. });
  688. ajax.set("id", id);
  689. ajax.set("type", 3);
  690. ajax.set("process", $("#process").val())
  691. ajax.set("companyId", $("#companyId").val())
  692. ajax.start();
  693. }
  694. /**
  695. * 显示字段或者隐藏字段选择
  696. */
  697. TalentAllowanceInfoDlg.toggleField = function () {
  698. var checkState = $("#checkStateModal").val();
  699. var process = $("#process").val();
  700. var type = $("#type").val();
  701. $("#otherEnjoyedMoney").val(0);
  702. TalentAllowanceInfoDlg.cal();
  703. //$("#otherEnjoyed").css("display", "none");
  704. if (checkState == 2 || checkState == -2) {
  705. $("#toProcessDiv").css("display", process == 3 ? "block" : "none");
  706. $("#field").show();
  707. $("#otherSence").css("display", "none");
  708. } else {
  709. if (checkState == 3) {
  710. if (type == 6) {
  711. $("#otherSence").css("display", "block");
  712. }
  713. $("#checkMsg").val(process == 3 ? "复核通过,待核查征信" : "初审通过");
  714. }
  715. $("#field").hide();
  716. $("#field").find("input[type=checkbox]").each(function () {
  717. $(this).iCheck("uncheck");
  718. });
  719. $("#toProcessDiv").css("display", "none");
  720. }
  721. }
  722. TalentAllowanceInfoDlg.save = function () {
  723. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/validateIsCheck", function (data) {
  724. if (data.code == 200) {
  725. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/save", function (data) {
  726. if (data.code == 200) {
  727. Feng.success(data.msg);
  728. } else {
  729. Feng.error(data.msg);
  730. }
  731. }, function (data) {
  732. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  733. });
  734. var id = $("#id").val();
  735. var allowanceType = $("#allowanceType").val();
  736. ajax.setData({"id": id, "allowanceType": allowanceType});
  737. ajax.start();
  738. } else {
  739. Feng.info(data.msg);
  740. }
  741. }, function (data) {
  742. Feng.error("校验失败!" + data.responseJSON.message + "!");
  743. });
  744. ajax.set("id", $("#id").val());
  745. ajax.set("type", 3);
  746. ajax.set("process", $("#process").val())
  747. ajax.set("companyId", $("#companyId").val())
  748. ajax.start();
  749. }
  750. /**
  751. * 审核信息提交
  752. */
  753. TalentAllowanceInfoDlg.checkSubmit = function (index) {
  754. var id = $("#id").val();
  755. var type = $("#type").val();
  756. var checkState = $("#checkStateModal").val();
  757. var checkMsg = $("#checkMsg").val();
  758. var process = $("#process").val();
  759. var companyCode = $("#companyCode").val();
  760. var companyCodes = "";
  761. var otherEnjoyedMoney = $("#otherEnjoyedMoney").val();
  762. var otherEnjoyedDescription = $("#otherEnjoyedDescription").val();
  763. // var absolute_control = $("input[name='absolute_control']").val()
  764. var crontol_money = $("#crontol_money").val();
  765. if (Feng.isEmptyStr(checkState)) {
  766. Feng.info("请选择审核状态");
  767. return;
  768. }
  769. if (Feng.isEmptyStr(checkMsg)) {
  770. Feng.info("请填写审核意见");
  771. return;
  772. }
  773. if (type == 6 && process == 3 && checkState == 3 && otherEnjoyedMoney != 0 && Feng.isEmptyStr(otherEnjoyedDescription)) {
  774. Feng.info("其它补贴金额不为0时需要填写其它补贴金额说明");
  775. return;
  776. }
  777. /*if (process == 3 && checkState == 2) {
  778. var toProcess = $("#toProcess").val();
  779. if (Feng.isEmptyStr(toProcess)) {
  780. Feng.info("请选择驳回至流程");
  781. return;
  782. }
  783. if (toProcess == 1) {
  784. var toDep = $("#toDep").val();
  785. for (var key in toDep) {
  786. companyCodes = companyCodes + toDep[key] + ",";
  787. }
  788. if (Feng.isEmptyStr(companyCodes)) {
  789. Feng.info("请选择驳回单位");
  790. return;
  791. }
  792. }
  793. }*/
  794. var projects = '', files = '', concats = '', fields = "";
  795. if (process == 1) {
  796. $("#field_project li input").each(function (index) {
  797. if ($(this).is(":checked")) {
  798. projects = projects + $(this).val() + ",";
  799. }
  800. });
  801. $("#field_file li input").each(function (index) {
  802. if ($(this).is(":checked")) {
  803. files = files + $(this).val() + ",";
  804. }
  805. });
  806. //if(companyCode == CONFIG.COM_RSJ || companyCode == CONFIG.COM_IC){
  807. $("#field_concat li input").each(function (index) {
  808. if ($(this).is(":checked")) {
  809. concats = concats + $(this).val() + ",";
  810. }
  811. });
  812. $("#field_field li input").each(function (index) {
  813. if ($(this).is(":checked")) {
  814. fields = fields + $(this).val() + ",";
  815. }
  816. });
  817. fields = fields.substring(0, fields.length - 1);
  818. //}
  819. }
  820. // if(process ==1 && checkState==2 && projects=='' && files==''){
  821. // Feng.info("请选择可修改的项目或附件!");
  822. // return ;
  823. // }
  824. if (Feng.isNotEmptyStr(companyCodes)) {
  825. companyCodes = companyCodes.substring(0, companyCodes.length - 1);
  826. }
  827. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/check", function (data) {
  828. if (data.code == 200) {
  829. layer.close(index);
  830. Feng.success(data.msg);
  831. } else {
  832. Feng.error(data.msg);
  833. }
  834. }, function (data) {
  835. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  836. });
  837. 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()});
  838. ajax.start();
  839. }
  840. /**
  841. * 提交审核
  842. */
  843. TalentAllowanceInfoDlg.submitCheck = function () {
  844. var operation = function () {
  845. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/submitCheck", function (data) {
  846. if (data.code == 200) {
  847. Feng.success(data.msg);
  848. window.parent.TalentAllowanceInfo.table.refresh();
  849. TalentAllowanceInfoDlg.close();
  850. } else {
  851. Feng.error(data.msg);
  852. }
  853. }, function (data) {
  854. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  855. });
  856. ajax.setData({"id": $("#id").val(), "process": $("#process").val(), "companyId": $("#companyId").val()});
  857. ajax.start();
  858. }
  859. Feng.confirm("一旦提交无法修改,是否审核完毕且无误?", operation);
  860. }
  861. TalentAllowanceInfoDlg.attendanceCallBack = function (data) {
  862. if (data.code == 200) {
  863. Feng.success(data.msg);
  864. $("#" + data.obj).bootstrapTable("refresh", {});
  865. $("#jjAttendanceModal").modal("hide");
  866. } else {
  867. Feng.info(data.msg);
  868. }
  869. }
  870. TalentAllowanceInfoDlg.initICheck = function () {
  871. $('input[type=checkbox]').iCheck({
  872. labelHover: false,
  873. cursor: true,
  874. checkboxClass: 'icheckbox_square-green',
  875. radioClass: 'iradio_square-greene',
  876. increaseArea: '20%'
  877. });
  878. }
  879. TalentAllowanceInfoDlg.showAllLog = function () {
  880. var id = $("#id").val();
  881. if (Feng.isNotEmptyStr(id)) {
  882. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  883. }
  884. }
  885. TalentAllowanceInfoDlg.fileChange = function (context) {
  886. var file = $(context).val();
  887. var pos = file.lastIndexOf("\\");
  888. $("#fileInput").val(file.substring(pos + 1));
  889. }
  890. TalentAllowanceInfoDlg.calculator = function () {
  891. var id = $("#id").val();
  892. var ajax = new $ax(Feng.ctxPath + "/admin/talentAllowance/calculator/id/" + id, function (data) {
  893. var message = data.recommendAllowanceMsg.join("<br>");
  894. if (data.recommendAllowanceType != 3) {
  895. message += "<br>试算补贴金额:<span style='color:red;font-weight:bold;'>" + data.finnalMoney + "</span>";
  896. }
  897. $("#cal-result").html(message);
  898. }, function (data) {
  899. Feng.error("查询失败!" + data.responseJSON.message + "!");
  900. });
  901. ajax.start();
  902. }
  903. TalentAllowanceInfoDlg.allowanceTypeChange = function (content) {
  904. var allowanceType = $(content).val();
  905. console.log(allowanceType)
  906. if (allowanceType == 1) {
  907. $(".personDiv").css("display", "none");
  908. $("#otherEnjoyed").css("display", "block");
  909. } else {
  910. $(".personDiv").css("display", "block");
  911. $("#otherEnjoyed").css("display", "none");
  912. }
  913. }
  914. $(function () {
  915. if ($("#type").val() == 2) {
  916. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  917. }
  918. /*if ($("#type").val() == 6 && $("#process").val() == 1) {
  919. $(":input").prop("disabled", false);
  920. $(":input").prop("readonly", false);
  921. }*/
  922. $("select").each(function () {
  923. +
  924. $(this).val($(this).attr("value"));
  925. });
  926. TalentAllowanceInfoDlg.initFileTable();
  927. TalentAllowanceInfoDlg.initCommonFileTable();
  928. TalentAllowanceInfoDlg.initContract();
  929. TalentAllowanceInfoDlg.showAllLog();
  930. //批量加载时间控件
  931. $(".date").each(function () {
  932. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  933. });
  934. var process = $("#process").val();
  935. var compayCode = $("#companyCode").val();
  936. TalentAllowanceInfoDlg.calculator();
  937. });