talentAllowanceInfo_info.js 41 KB

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