talentAllowance_info.js 38 KB

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