talentAllowance_info.js 38 KB

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