talentAllowance_info.js 37 KB

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