talentAllowance_info.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  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 += "\n" + "试算补贴金额:" + data.recommendMoney;
  91. }
  92. Feng.confirm(message);
  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. if (days < 0 || days > max) {
  355. error = error + num + "月的考勤天数不在范围内(1-" + max + ");";
  356. }
  357. }
  358. if (days == null || days == '') {
  359. days = 0;
  360. }
  361. months.push(num + "=" + days);
  362. })
  363. } else {
  364. $("#m" + id + " input[name=month]").each(function () {
  365. if (this.checked) {
  366. months.push($(this).val());
  367. }
  368. })
  369. }
  370. if (error != "") {
  371. Feng.error(error);
  372. return;
  373. }
  374. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  375. if (data.code == 200) {
  376. Feng.success(data.msg);
  377. } else {
  378. Feng.info(data.msg);
  379. }
  380. }, function (data) {
  381. Feng.error("提交失败!" + data.responseJSON.message + "!");
  382. });
  383. ajax.set({"id": id, "months": months.join(","), "description": description});
  384. ajax.start();
  385. }
  386. //显示
  387. // 项目模态框
  388. TalentAllowanceInfoDlg.showEditProjectModal = function (project, id, enterpriseId, months, days, content) {
  389. var desc = $(content).attr("data-value");
  390. var type = $("#type").val();
  391. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/validateIsEdit", function (data) {
  392. if (data.code == 200) {
  393. TalentAllowanceInfoDlg.initICheck();
  394. $("#description").val(desc);
  395. if (project == 4 || project == 15 || project == 16) {
  396. if (type == 2) {
  397. if (project == 4) {
  398. $("#attendanceModalLabel").html("考勤");
  399. $("#heading").html("请填写每月考勤天数<span style=\"color: red\">(不填写或填写0则代表无考勤记录)</span>");
  400. }
  401. if (project == 15) {
  402. $("#attendanceModalLabel").html("在境时间");
  403. $("#heading").html("请填写每月在境内天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  404. }
  405. if (project == 16) {
  406. $("#attendanceModalLabel").html("境内工作日时间");
  407. $("#heading").html("请填写每月境内工作日天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  408. }
  409. $("#attendanceForm")[0].reset();
  410. $("#attendanceId").val(id);
  411. $("#attendanceEnterpriseId").val(enterpriseId);
  412. if (months != null && months != '') {
  413. var arr = months.split(",");
  414. for (var key in arr) {
  415. var num = arr[key].split("=")[0];
  416. var day = arr[key].split("=")[1];
  417. $("#attendMonths input").each(function () {
  418. if ($(this).attr('num') == num)
  419. $(this).val(day);
  420. });
  421. }
  422. }
  423. $("#attendanceModal").modal("show");
  424. } else if (type == 1) {
  425. $('#jjAttendanceModal').on('show.bs.modal', function () {
  426. $("#jjmonths input").each(function () {
  427. $(this).iCheck("uncheck");
  428. });
  429. $("#jjAttendanceId").val(id);
  430. $("#jjAttendanceEnterpriseId").val(enterpriseId);
  431. if (Feng.isNotEmptyStr(months) && months.indexOf(",") != -1) {
  432. var arr = months.split(",");
  433. for (var key in arr) {
  434. $("#jjmonths input").each(function () {
  435. if ($(this).val() == arr[key])
  436. $(this).iCheck("check");
  437. });
  438. }
  439. }
  440. });
  441. if (days != null && days != '')
  442. $("#days").val(days);
  443. $("#jjAttendanceModal").modal("show");
  444. }
  445. } else {
  446. $('#projectModal').on('show.bs.modal', function () {
  447. $("#months input").each(function () {
  448. $(this).iCheck("uncheck");
  449. });
  450. $("#projectId").val(id);
  451. $("#enterpriseId").val(enterpriseId);
  452. if (Feng.isNotEmptyStr(months)) {
  453. var arr = months.split(",");
  454. for (var key in arr) {
  455. $("#months input").each(function () {
  456. if ($(this).val() == arr[key])
  457. $(this).iCheck("check");
  458. });
  459. }
  460. }
  461. });
  462. $("#projectModal").modal("show");
  463. }
  464. } else {
  465. Feng.info(data.msg);
  466. }
  467. }, function (data) {
  468. Feng.error("校验失败!" + data.responseJSON.message + "!");
  469. });
  470. ajax.set("id", id);
  471. ajax.set("type", 2);
  472. ajax.start();
  473. }
  474. //编辑项目提交
  475. TalentAllowanceInfoDlg.editProject = function () {
  476. var id = $("#projectId").val();
  477. var enterpriseId = $("#enterpriseId").val();
  478. var description = $("#description").val();
  479. var months = "";
  480. $("#months input").each(function () {
  481. if (this.checked) {
  482. months = months + $(this).val() + ",";
  483. }
  484. })
  485. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  486. if (data.code == 200) {
  487. Feng.success(data.msg);
  488. $("#" + enterpriseId).bootstrapTable("refresh", {});
  489. $("#projectModal").modal("hide");
  490. } else {
  491. Feng.info(data.msg);
  492. }
  493. }, function (data) {
  494. Feng.error("提交失败!" + data.responseJSON.message + "!");
  495. });
  496. ajax.set({"id": id, "months": months, "description": description});
  497. ajax.start();
  498. }
  499. TalentAllowanceInfoDlg.editJJAttendance = function () {
  500. var id = $("#jjAttendanceId").val();
  501. var enterpriseId = $("#jjAttendanceEnterpriseId").val();
  502. var description = $("#jjDescription").val();
  503. var days = $("#days").val();
  504. var months = "";
  505. $("#jjmonths input").each(function () {
  506. if (this.checked) {
  507. months = months + $(this).val() + ",";
  508. }
  509. })
  510. if (months == "" && (days == null || days == "")) {
  511. Feng.info("请填写考勤信息");
  512. return;
  513. }
  514. if (months != null && months != '' && days != null && days != '') {
  515. Feng.info("考勤天数和考勤月份只能选择一个填写");
  516. return;
  517. }
  518. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  519. if (data.code == 200) {
  520. Feng.success(data.msg);
  521. $("#" + enterpriseId).bootstrapTable("refresh", {});
  522. $("#projectModal").modal("hide");
  523. } else {
  524. Feng.info(data.msg);
  525. }
  526. }, function (data) {
  527. Feng.error("提交失败!" + data.responseJSON.message + "!");
  528. });
  529. ajax.set({"id": id, "months": months, "days": days, "description": description});
  530. ajax.start();
  531. }
  532. TalentAllowanceInfoDlg.editAttendanceProject = function () {
  533. var id = $("#attendanceId").val();
  534. var enterpriseId = $("#attendanceEnterpriseId").val();
  535. var description = $("#attendanceDescription").val();
  536. var months = "";
  537. var error = "";
  538. var name = $("#attendanceModalLabel").html();
  539. $("#attendMonths input").each(function () {
  540. var days = $(this).val();
  541. var num = $(this).attr("num");
  542. if (isNaN(days)) {
  543. error = error + num + "月的" + name + "天数不是数字;";
  544. } else {
  545. if (days < 0 || days > 31) {
  546. error = error + num + "月的" + name + "天数不在范围内(1-31);";
  547. }
  548. }
  549. if (days == null || days == '') {
  550. days = 0;
  551. }
  552. months = months + num + "=" + days + ",";
  553. });
  554. if (error != "") {
  555. Feng.error(error);
  556. return;
  557. }
  558. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  559. if (data.code == 200) {
  560. Feng.success(data.msg);
  561. $("#" + enterpriseId).bootstrapTable("refresh", {});
  562. $("#attendanceModal").modal("hide");
  563. } else {
  564. Feng.info(data.msg);
  565. }
  566. }, function (data) {
  567. Feng.error("提交失败!" + data.responseJSON.message + "!");
  568. });
  569. ajax.set({"id": id, "months": months, "description": description});
  570. ajax.start();
  571. }
  572. //初始化附件类别表单
  573. TalentAllowanceInfoDlg.initFileTable = function () {
  574. TalentAllowanceInfoDlg.initContract();
  575. // Feng.showMiniFileModal(CONFIG.project_jbt,$("#type").val(),$("#id").val());
  576. var queryData = {};
  577. queryData['project'] = CONFIG.project_jbt;
  578. queryData['type'] = $("#type").val();
  579. queryData['allowanceType'] = $("#allowanceType").val();
  580. $("#fileTable").bootstrapTable({
  581. url: Feng.ctxPath + "/common/api/findCommonFileType",
  582. method: 'POST',
  583. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  584. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  585. showRefresh: false, // 是否显示刷新按钮
  586. clickToSelect: true, // 是否启用点击选中行
  587. singleSelect: true, // 设置True 将禁止多选
  588. striped: true, // 是否显示行间隔色
  589. escape: true,
  590. pagination: false, // 设置为 true 会在表格底部显示分页条
  591. paginationHAlign: "left",
  592. paginationDetailHAlign: "right",
  593. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  594. showColumns: false,
  595. detailView: true, //是否显示父子表
  596. pageList: [10, 30, 50],
  597. queryParams: function (params) {
  598. return $.extend(queryData, params)
  599. },
  600. rowStyle: function (row, index) {
  601. return {classes: "info"};
  602. },
  603. columns: TalentAllowanceInfoDlg.initFileTypeColumn(),
  604. onPostBody: function () {
  605. $("td.uitd_showTip").bind("mouseover", function () {
  606. var htm = $(this).html();
  607. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  608. });
  609. },
  610. onLoadSuccess: function (data) {
  611. $("#fileTable").bootstrapTable('expandAllRows');
  612. },
  613. onExpandRow: function (index, row, $detail) {
  614. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  615. if (data == null || data.length == 0) {
  616. return;
  617. }
  618. 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>';
  619. var files = $("#files").val();
  620. var checkState = $("#checkState").val();
  621. for (var key in data) {
  622. var btn = "";
  623. if (checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1)) {
  624. btn = "<button type=\'button\' onclick=\"TalentAllowanceInfoDlg.checkFile(this,'" + row.id + "','" + data[key].id + "')\" style=\'margin-left: 5px\' class=\"btn btn-xs btn-success\">" +
  625. "<i class=\"fa fa-paste\"></i>修改" +
  626. "</button>" +
  627. "<button type='button' onclick=\"TalentAllowanceInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  628. "<i class=\"fa fa-times\"></i>删除" +
  629. "</button>";
  630. } else {
  631. btn = "";
  632. }
  633. var sn = data[key].url.lastIndexOf(".");
  634. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  635. var imgStr = "";
  636. if (suffix == "pdf" || suffix == "PDF") {
  637. 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>";
  638. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  639. 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>";
  640. } else {
  641. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  642. }
  643. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  644. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  645. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  646. '<li style="width: 10%;padding-top: 2px;">' + btn + '</li>';
  647. }
  648. html = html + '</ul>';
  649. $detail.html(html);
  650. $(".imgs").viewer({
  651. // toolbar:false,
  652. fullscreen: false
  653. });
  654. }, function (data) {
  655. Feng.error("查询失败!" + data.responseJSON.message + "!");
  656. });
  657. var queryData = {};
  658. queryData["mainId"] = $("#id").val();
  659. queryData["fileTypeId"] = row.id;
  660. ajax.set(queryData);
  661. ajax.start();
  662. }
  663. });
  664. TalentAllowanceInfoDlg.initCommonFileTable();
  665. }
  666. //初始化通用附件
  667. TalentAllowanceInfoDlg.initCommonFileTable = function () {
  668. var queryData = {};
  669. queryData.id = $("#id").val();
  670. $("#commonFileTable").bootstrapTable({
  671. url: Feng.ctxPath + "/common/api/listTalentAllowanceCommonFile",
  672. method: 'POST',
  673. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  674. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  675. showRefresh: false, // 是否显示刷新按钮
  676. clickToSelect: true, // 是否启用点击选中行
  677. singleSelect: true, // 设置True 将禁止多选
  678. striped: true, // 是否显示行间隔色
  679. pagination: false, // 设置为 true 会在表格底部显示分页条
  680. paginationHAlign: "left",
  681. paginationDetailHAlign: "right",
  682. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  683. showColumns: false,
  684. queryParams: function (params) {
  685. return $.extend(queryData, params)
  686. },
  687. rowStyle: function (row, index) {
  688. return {css: {"word-break": "break-word", "white-space": "inherit"}}
  689. },
  690. columns: [
  691. {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '70%', formatter: function (value, row, index) {
  692. return value;
  693. }},
  694. {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle', width: "20%",
  695. formatter: function (value, row, index) {
  696. var sn = value.lastIndexOf(".");
  697. var suffix = value.substring(sn + 1, value.length);
  698. var imgStr = "";
  699. if (suffix == "pdf" || suffix == "PDF") {
  700. 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>";
  701. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  702. 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>";
  703. } else {
  704. imgStr = '<img class=\"cImgUrl\" src=\"' + value + '\" style=\"width:25px;height:25px;\">';
  705. }
  706. return imgStr;
  707. }
  708. },
  709. {title: '操作', field: 'url', visible: true, align: 'center', valign: 'middle', width: '10%',
  710. formatter: function (value, row, index) {
  711. return "";
  712. }
  713. }
  714. ],
  715. onPostBody: function () {
  716. $("td.uitd_showTip").bind("mouseover", function () {
  717. var htm = $(this).html();
  718. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  719. });
  720. $(".cImgUrl").viewer({fullscreen: false});
  721. }
  722. });
  723. }
  724. //校验是否保存基础信息
  725. TalentAllowanceInfoDlg.validId = function () {
  726. var id = $("#id").val();
  727. if (id != null && id != '') {
  728. $("#fileLi").removeAttr("style");
  729. } else {
  730. $("#fileLi").attr("style", "pointer-events: none");
  731. $("#name").on('chosen:ready', function (e, params) {
  732. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  733. });
  734. $("#name").chosen({
  735. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  736. disable_search: false,
  737. width: "100%",
  738. enable_split_word_search: true
  739. });
  740. }
  741. }
  742. //选择附件并显示附件名
  743. TalentAllowanceInfoDlg.checkFile = function (content, fileTypeId, fileId) {
  744. if (!TalentAllowanceInfoDlg.validateIsEdit())
  745. return;
  746. $("#upload_file ").unbind("change");
  747. $("#upload_file ").change(function () {
  748. TalentAllowanceInfoDlg.upload(fileTypeId, fileId);
  749. });
  750. $('#upload_file').val("");
  751. $('#upload_file').click()
  752. }
  753. //上传附件
  754. TalentAllowanceInfoDlg.upload = function (fileTypeId, fileId) {
  755. var id = $("#id").val();
  756. if (!TalentAllowanceInfoDlg.validateIsEdit())
  757. return;
  758. if (fileId != null && fileId != 'null') {
  759. $("#fileId").val(fileId)
  760. } else {
  761. $("#fileId").val("");
  762. }
  763. $("#mainId").val(id);
  764. $("#fileTypeId").val(fileTypeId);
  765. var index = layer.load(0, {shade: false, time: 0});
  766. $("#index").val(index);
  767. $("#uploadForm").submit();
  768. }
  769. //删除附件
  770. TalentAllowanceInfoDlg.deleteFile = function (id) {
  771. if (!TalentAllowanceInfoDlg.validateIsEdit())
  772. return;
  773. var operation = function () {
  774. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  775. if (data.code = 200) {
  776. Feng.success(data.msg);
  777. $("#fileTable").bootstrapTable("refresh", {});
  778. } else {
  779. Feng.error(data.msg);
  780. }
  781. }, function (data) {
  782. Feng.error("删除失败!" + data.responseJSON.message + "!");
  783. });
  784. ajax.set("id", id);
  785. ajax.set("type", CONFIG.project_jbt);
  786. ajax.start();
  787. }
  788. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  789. }
  790. /**
  791. * 提交审核
  792. */
  793. TalentAllowanceInfoDlg.submitToCheck = function () {
  794. var id = $("#id").val();
  795. if (id == null || id == "") {
  796. Feng.info("请先填写基础信息并上传附件");
  797. return;
  798. }
  799. TalentAllowanceInfoDlg.clearData();
  800. TalentAllowanceInfoDlg.collectData();
  801. if (!TalentAllowanceInfoDlg.validateIsEdit())
  802. return;
  803. /*var active = $("#active").val();
  804. if (active == 2) {
  805. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  806. Feng.info("请填写上一年度年薪");
  807. return;
  808. }
  809. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  810. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  811. return;
  812. }
  813. }*/
  814. var operation = function () {
  815. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/submitToCheck", function (data) {
  816. if (data.code == 200) {
  817. Feng.success(data.msg);
  818. window.parent.TalentAllowanceInfo.table.refresh();
  819. TalentAllowanceInfoDlg.close();
  820. } else {
  821. Feng.error(data.msg);
  822. }
  823. }, function (data) {
  824. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  825. });
  826. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData)
  827. // ajax.set("id", id);
  828. ajax.start();
  829. }
  830. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  831. }
  832. /**
  833. * 校验是否可以修改/提交审核
  834. */
  835. TalentAllowanceInfoDlg.validateIsEdit = function () {
  836. var id = $("#id").val();
  837. if (id == null || id == '') {
  838. Feng.info("请先添加基本信息并保存后再试");
  839. return false;
  840. }
  841. var checkState = $("#checkState").val();
  842. if (checkState != 1 && checkState != 10) {
  843. if (checkState == -1) {
  844. Feng.error("您的申报审核不通过,无法再修改");
  845. return false;
  846. } else if (checkState == 30) {
  847. Feng.error("您的申报已审核通过,无法再修改");
  848. return false;
  849. } else {
  850. Feng.error("您的申报正在审核中,请耐心等待");
  851. return false;
  852. }
  853. }
  854. return true;
  855. }
  856. TalentAllowanceInfoDlg.initICheck = function () {
  857. $('input[type=checkbox]').iCheck({
  858. labelHover: false,
  859. cursor: true,
  860. checkboxClass: 'icheckbox_square-green',
  861. radioClass: 'iradio_square-greene',
  862. increaseArea: '20%'
  863. });
  864. }
  865. TalentAllowanceInfoDlg.showAllLog = function () {
  866. var id = $("#id").val();
  867. if (Feng.isNotEmptyStr(id)) {
  868. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  869. }
  870. }
  871. $(function () {
  872. Feng.initValidatorTip("talentAllowanceForm", TalentAllowanceInfoDlg.validateFields);
  873. Feng.addAjaxSelect({
  874. "id": 'name',
  875. "displayCode": "id",
  876. "displayName": "name",
  877. "type": "GET",
  878. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year=" + $("#year").val()
  879. });
  880. TalentAllowanceInfoDlg.validId();
  881. if ($("#type").val() == 2) {
  882. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  883. }
  884. //批量加载时间控件
  885. $(".date").each(function () {
  886. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  887. });
  888. $("select").each(function () {
  889. $(this).val($(this).attr("value"));
  890. });
  891. if ($("#allowanceType").val() == 1) {
  892. //$("#wageDiv").css("display", "block");
  893. }
  894. //设置禁止字段
  895. var checkState = $("#checkState").val();
  896. if ($("#id").val() != "" && checkState != 1) {
  897. $("#allowanceType").attr("style", "pointer-events: none;background-color: #eee;");
  898. $("#wage").prop("readonly", true);
  899. }
  900. if (checkState == 10) {
  901. var fields = $("#fields").val().split(",");
  902. if (fields.indexOf("wage") > -1) {
  903. $("#wage").removeAttr("readonly");
  904. }
  905. if (fields.indexOf("allowanceType") > -1) {
  906. $("#allowanceType").removeAttr("style");
  907. }
  908. }
  909. TalentAllowanceInfoDlg.showAllLog();
  910. toastr.options = {
  911. "closeButton": true,
  912. "debug": false,
  913. "positionClass": "toast-bottom-right",
  914. "onclick": null,
  915. "showDuration": "300",
  916. "hideDuration": "1000",
  917. "timeOut": "600000",
  918. "extendedTimeOut": "1000",
  919. "showEasing": "swing",
  920. "hideEasing": "linear",
  921. "showMethod": "fadeIn",
  922. "hideMethod": "fadeOut",
  923. "tapToDismiss": true
  924. };
  925. toastr.success("请确保申报对象在申报津补贴之前已完成离职变更、工作单位变更、人才层次变更、银行账号变更且审核通过,否则可能带来不必要的损失,请在申报之前再次确认!!!");
  926. });