talentAllowance_info.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  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/findCommonFileType",
  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. TalentAllowanceInfoDlg.initCommonFileTable();
  576. }
  577. //初始化通用附件
  578. TalentAllowanceInfoDlg.initCommonFileTable = function () {
  579. var queryData = {};
  580. queryData.id = $("#id").val();
  581. $("#commonFileTable").bootstrapTable({
  582. url: Feng.ctxPath + "/common/api/listTalentAllowanceCommonFile",
  583. method: 'POST',
  584. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  585. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  586. showRefresh: false, // 是否显示刷新按钮
  587. clickToSelect: true, // 是否启用点击选中行
  588. singleSelect: true, // 设置True 将禁止多选
  589. striped: true, // 是否显示行间隔色
  590. pagination: false, // 设置为 true 会在表格底部显示分页条
  591. paginationHAlign: "left",
  592. paginationDetailHAlign: "right",
  593. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  594. showColumns: false,
  595. queryParams: function (params) {
  596. return $.extend(queryData, params)
  597. },
  598. rowStyle: function (row, index) {
  599. return {css: {"word-break": "break-word", "white-space": "inherit"}}
  600. },
  601. columns: [
  602. {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '70%', formatter: function (value, row, index) {
  603. return value;
  604. }},
  605. {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle',width: "20%",
  606. formatter: function (value, row, index) {
  607. var sn = value.lastIndexOf(".");
  608. var suffix = value.substring(sn + 1, value.length);
  609. var imgStr = "";
  610. if (suffix == "pdf" || suffix == "PDF") {
  611. 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>";
  612. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  613. 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>";
  614. } else {
  615. imgStr = '<img class=\"cImgUrl\" src=\"' + value + '\" style=\"width:25px;height:25px;\">';
  616. }
  617. return imgStr;
  618. }
  619. },
  620. {title: '操作', field: 'url', visible: true, align: 'center', valign: 'middle', width: '10%',
  621. formatter: function (value, row, index) {
  622. return "";
  623. }
  624. }
  625. ],
  626. onPostBody: function () {
  627. $("td.uitd_showTip").bind("mouseover", function () {
  628. var htm = $(this).html();
  629. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  630. });
  631. $(".cImgUrl").viewer({fullscreen: false});
  632. }
  633. });
  634. }
  635. //校验是否保存基础信息
  636. TalentAllowanceInfoDlg.validId = function () {
  637. var id = $("#id").val();
  638. if (id != null && id != '') {
  639. $("#fileLi").removeAttr("style");
  640. } else {
  641. $("#fileLi").attr("style", "pointer-events: none");
  642. $("#name").on('chosen:ready', function (e, params) {
  643. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  644. });
  645. $("#name").chosen({
  646. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  647. disable_search: false,
  648. width: "100%",
  649. enable_split_word_search: true
  650. });
  651. }
  652. }
  653. //选择附件并显示附件名
  654. TalentAllowanceInfoDlg.checkFile = function (content, fileTypeId, fileId) {
  655. if (!TalentAllowanceInfoDlg.validateIsEdit())
  656. return;
  657. $("#upload_file ").unbind("change");
  658. $("#upload_file ").change(function () {
  659. TalentAllowanceInfoDlg.upload(fileTypeId, fileId);
  660. });
  661. $('#upload_file').val("");
  662. $('#upload_file').click()
  663. }
  664. //上传附件
  665. TalentAllowanceInfoDlg.upload = function (fileTypeId, fileId) {
  666. var id = $("#id").val();
  667. if (!TalentAllowanceInfoDlg.validateIsEdit())
  668. return;
  669. if (fileId != null && fileId != 'null') {
  670. $("#fileId").val(fileId)
  671. } else {
  672. $("#fileId").val("");
  673. }
  674. $("#mainId").val(id);
  675. $("#fileTypeId").val(fileTypeId);
  676. var index = layer.load(0, {shade: false, time: 0});
  677. $("#index").val(index);
  678. $("#uploadForm").submit();
  679. }
  680. //删除附件
  681. TalentAllowanceInfoDlg.deleteFile = function (id) {
  682. if (!TalentAllowanceInfoDlg.validateIsEdit())
  683. return;
  684. var operation = function () {
  685. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  686. if (data.code = 200) {
  687. Feng.success(data.msg);
  688. $("#fileTable").bootstrapTable("refresh", {});
  689. } else {
  690. Feng.error(data.msg);
  691. }
  692. }, function (data) {
  693. Feng.error("删除失败!" + data.responseJSON.message + "!");
  694. });
  695. ajax.set("id", id);
  696. ajax.set("type", CONFIG.project_jbt);
  697. ajax.start();
  698. }
  699. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  700. }
  701. /**
  702. * 提交审核
  703. */
  704. TalentAllowanceInfoDlg.submitToCheck = function () {
  705. var id = $("#id").val();
  706. if (id == null || id == "") {
  707. Feng.info("请先填写基础信息并上传附件");
  708. return;
  709. }
  710. TalentAllowanceInfoDlg.clearData();
  711. TalentAllowanceInfoDlg.collectData();
  712. if (!TalentAllowanceInfoDlg.validateIsEdit())
  713. return;
  714. /*var active = $("#active").val();
  715. if (active == 2) {
  716. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  717. Feng.info("请填写上一年度年薪");
  718. return;
  719. }
  720. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  721. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  722. return;
  723. }
  724. }*/
  725. var operation = function () {
  726. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/submitToCheck", function (data) {
  727. if (data.code == 200) {
  728. Feng.success(data.msg);
  729. window.parent.TalentAllowanceInfo.table.refresh();
  730. TalentAllowanceInfoDlg.close();
  731. } else {
  732. Feng.error(data.msg);
  733. }
  734. }, function (data) {
  735. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  736. });
  737. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData)
  738. // ajax.set("id", id);
  739. ajax.start();
  740. }
  741. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  742. }
  743. /**
  744. * 校验是否可以修改/提交审核
  745. */
  746. TalentAllowanceInfoDlg.validateIsEdit = function () {
  747. var id = $("#id").val();
  748. if (id == null || id == '') {
  749. Feng.info("请先添加基本信息并保存后再试");
  750. return false;
  751. }
  752. var checkState = $("#checkState").val();
  753. if (checkState != 1 && checkState != 10) {
  754. if (checkState == -1) {
  755. Feng.error("您的申报审核不通过,无法再修改");
  756. return false;
  757. } else if (checkState == 30) {
  758. Feng.error("您的申报已审核通过,无法再修改");
  759. return false;
  760. } else {
  761. Feng.error("您的申报正在审核中,请耐心等待");
  762. return false;
  763. }
  764. }
  765. return true;
  766. }
  767. TalentAllowanceInfoDlg.initICheck = function () {
  768. $('input[type=checkbox]').iCheck({
  769. labelHover: false,
  770. cursor: true,
  771. checkboxClass: 'icheckbox_square-green',
  772. radioClass: 'iradio_square-greene',
  773. increaseArea: '20%'
  774. });
  775. }
  776. TalentAllowanceInfoDlg.showAllLog = function () {
  777. var id = $("#id").val();
  778. if (Feng.isNotEmptyStr(id)) {
  779. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  780. }
  781. }
  782. $(function () {
  783. Feng.initValidatorTip("talentAllowanceForm", TalentAllowanceInfoDlg.validateFields);
  784. Feng.addAjaxSelect({
  785. "id": 'name',
  786. "displayCode": "id",
  787. "displayName": "name",
  788. "type": "GET",
  789. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year=" + $("#year").val()
  790. });
  791. TalentAllowanceInfoDlg.validId();
  792. if ($("#type").val() == 2) {
  793. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  794. }
  795. //批量加载时间控件
  796. $(".date").each(function () {
  797. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  798. });
  799. $("select").each(function () {
  800. $(this).val($(this).attr("value"));
  801. });
  802. if ($("#allowanceType").val() == 1) {
  803. //$("#wageDiv").css("display", "block");
  804. }
  805. //设置禁止字段
  806. var checkState = $("#checkState").val();
  807. if ($("#id").val() != "" && checkState != 1) {
  808. $("#allowanceType").attr("style", "pointer-events: none;background-color: #eee;");
  809. $("#wage").prop("readonly", true);
  810. }
  811. if (checkState == 10) {
  812. var fields = $("#fields").val().split(",");
  813. if (fields.indexOf("wage") > -1) {
  814. $("#wage").removeAttr("readonly");
  815. }
  816. if (fields.indexOf("allowanceType") > -1) {
  817. $("#allowanceType").removeAttr("style");
  818. }
  819. }
  820. TalentAllowanceInfoDlg.showAllLog();
  821. toastr.options = {
  822. "closeButton": true,
  823. "debug": false,
  824. "positionClass": "toast-bottom-right",
  825. "onclick": null,
  826. "showDuration": "300",
  827. "hideDuration": "1000",
  828. "timeOut": "600000",
  829. "extendedTimeOut": "1000",
  830. "showEasing": "swing",
  831. "hideEasing": "linear",
  832. "showMethod": "fadeIn",
  833. "hideMethod": "fadeOut",
  834. "tapToDismiss": true
  835. };
  836. toastr.success("请确保申报对象在申报津补贴之前已完成离职变更、工作单位变更、人才层次变更、银行账号变更且审核通过,否则可能带来不必要的损失,请在申报之前再次确认!!!");
  837. });