talentAllowance_info.js 31 KB

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