talentAllowance_info.js 40 KB

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