talentAllowance_info.js 30 KB

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