talentAllowance_info.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  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. layer.tips('请勾选个税缴纳情况', '.tips', {tips: [1, "#1ab394"], time: 0, closeBtn: 2});
  274. },
  275. });
  276. }
  277. });
  278. }
  279. //显示修改工作单位合同情况模态框
  280. TalentAllowanceInfoDlg.showEditContractModel = function (id) {
  281. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/validateIsEdit", function (data) {
  282. if (data.code == 200) {
  283. $("#contractForm")[0].reset();
  284. $("#contractId").val(id);
  285. $("#contractModal").modal("show");
  286. } else {
  287. 1
  288. Feng.info(data.msg);
  289. }
  290. }, function (data) {
  291. Feng.error("校验失败!" + data.responseJSON.message + "!");
  292. });
  293. ajax.set("id", id);
  294. ajax.set("type", 1);
  295. ajax.start();
  296. }
  297. //修改合同起止时间提交
  298. TalentAllowanceInfoDlg.editContract = function () {
  299. var id = $("#contractId").val();
  300. var startTime = $("#startTime").val();
  301. var endTime = $("#endTime").val();
  302. if (startTime == null || startTime == '') {
  303. Feng.info("请选择合同起始时间");
  304. return;
  305. }
  306. if (endTime == null || endTime == '') {
  307. Feng.info("请选择合同截止时间");
  308. return;
  309. }
  310. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editContract", function (data) {
  311. if (data.code == 200) {
  312. Feng.success(data.msg);
  313. $("#projectTable").bootstrapTable("refresh", {});
  314. $("#contractModal").modal("hide");
  315. } else {
  316. Feng.info(data.msg);
  317. }
  318. }, function (data) {
  319. Feng.error("提交失败!" + data.responseJSON.message + "!");
  320. });
  321. ajax.set({"id": id, "startTime": startTime, "endTime": endTime});
  322. ajax.start();
  323. }
  324. //显示
  325. // 项目模态框
  326. TalentAllowanceInfoDlg.showEditProjectModal = function (project, id, enterpriseId, months, days, content) {
  327. var desc = $(content).attr("data-value");
  328. var type = $("#type").val();
  329. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/validateIsEdit", function (data) {
  330. if (data.code == 200) {
  331. TalentAllowanceInfoDlg.initICheck();
  332. $("#description").val(desc);
  333. if (project == 4 || project == 15 || project == 16) {
  334. if (type == 2) {
  335. if (project == 4) {
  336. $("#attendanceModalLabel").html("考勤");
  337. $("#heading").html("请填写每月考勤天数<span style=\"color: red\">(不填写或填写0则代表无考勤记录)</span>");
  338. }
  339. if (project == 15) {
  340. $("#attendanceModalLabel").html("在境时间");
  341. $("#heading").html("请填写每月在境内天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  342. }
  343. if (project == 16) {
  344. $("#attendanceModalLabel").html("境内工作日时间");
  345. $("#heading").html("请填写每月境内工作日天数<span style=\"color: red\">(不填写则代表为0天)</span>");
  346. }
  347. $("#attendanceForm")[0].reset();
  348. $("#attendanceId").val(id);
  349. $("#attendanceEnterpriseId").val(enterpriseId);
  350. if (months != null && months != '') {
  351. var arr = months.split(",");
  352. for (var key in arr) {
  353. var num = arr[key].split("=")[0];
  354. var day = arr[key].split("=")[1];
  355. $("#attendMonths input").each(function () {
  356. if ($(this).attr('num') == num)
  357. $(this).val(day);
  358. });
  359. }
  360. }
  361. $("#attendanceModal").modal("show");
  362. } else if (type == 1) {
  363. $('#jjAttendanceModal').on('show.bs.modal', function () {
  364. $("#jjmonths input").each(function () {
  365. $(this).iCheck("uncheck");
  366. });
  367. $("#jjAttendanceId").val(id);
  368. $("#jjAttendanceEnterpriseId").val(enterpriseId);
  369. if (Feng.isNotEmptyStr(months) && months.indexOf(",") != -1) {
  370. var arr = months.split(",");
  371. for (var key in arr) {
  372. $("#jjmonths input").each(function () {
  373. if ($(this).val() == arr[key])
  374. $(this).iCheck("check");
  375. });
  376. }
  377. }
  378. });
  379. if (days != null && days != '')
  380. $("#days").val(days);
  381. $("#jjAttendanceModal").modal("show");
  382. }
  383. } else {
  384. $('#projectModal').on('show.bs.modal', function () {
  385. $("#months input").each(function () {
  386. $(this).iCheck("uncheck");
  387. });
  388. $("#projectId").val(id);
  389. $("#enterpriseId").val(enterpriseId);
  390. if (Feng.isNotEmptyStr(months)) {
  391. var arr = months.split(",");
  392. for (var key in arr) {
  393. $("#months input").each(function () {
  394. if ($(this).val() == arr[key])
  395. $(this).iCheck("check");
  396. });
  397. }
  398. }
  399. });
  400. $("#projectModal").modal("show");
  401. }
  402. } else {
  403. Feng.info(data.msg);
  404. }
  405. }, function (data) {
  406. Feng.error("校验失败!" + data.responseJSON.message + "!");
  407. });
  408. ajax.set("id", id);
  409. ajax.set("type", 2);
  410. ajax.start();
  411. }
  412. //编辑项目提交
  413. TalentAllowanceInfoDlg.editProject = function () {
  414. var id = $("#projectId").val();
  415. var enterpriseId = $("#enterpriseId").val();
  416. var description = $("#description").val();
  417. var months = "";
  418. $("#months input").each(function () {
  419. if (this.checked) {
  420. months = months + $(this).val() + ",";
  421. }
  422. })
  423. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  424. if (data.code == 200) {
  425. Feng.success(data.msg);
  426. $("#" + enterpriseId).bootstrapTable("refresh", {});
  427. $("#projectModal").modal("hide");
  428. } else {
  429. Feng.info(data.msg);
  430. }
  431. }, function (data) {
  432. Feng.error("提交失败!" + data.responseJSON.message + "!");
  433. });
  434. ajax.set({"id": id, "months": months, "description": description});
  435. ajax.start();
  436. }
  437. TalentAllowanceInfoDlg.editJJAttendance = function () {
  438. var id = $("#jjAttendanceId").val();
  439. var enterpriseId = $("#jjAttendanceEnterpriseId").val();
  440. var description = $("#jjDescription").val();
  441. var days = $("#days").val();
  442. var months = "";
  443. $("#jjmonths input").each(function () {
  444. if (this.checked) {
  445. months = months + $(this).val() + ",";
  446. }
  447. })
  448. if (months == "" && (days == null || days == "")) {
  449. Feng.info("请填写考勤信息");
  450. return;
  451. }
  452. if (months != null && months != '' && days != null && days != '') {
  453. Feng.info("考勤天数和考勤月份只能选择一个填写");
  454. return;
  455. }
  456. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  457. if (data.code == 200) {
  458. Feng.success(data.msg);
  459. $("#" + enterpriseId).bootstrapTable("refresh", {});
  460. $("#projectModal").modal("hide");
  461. } else {
  462. Feng.info(data.msg);
  463. }
  464. }, function (data) {
  465. Feng.error("提交失败!" + data.responseJSON.message + "!");
  466. });
  467. ajax.set({"id": id, "months": months, "days": days, "description": description});
  468. ajax.start();
  469. }
  470. TalentAllowanceInfoDlg.editAttendanceProject = function () {
  471. var id = $("#attendanceId").val();
  472. var enterpriseId = $("#attendanceEnterpriseId").val();
  473. var description = $("#attendanceDescription").val();
  474. var months = "";
  475. var error = "";
  476. var name = $("#attendanceModalLabel").html();
  477. $("#attendMonths input").each(function () {
  478. var days = $(this).val();
  479. var num = $(this).attr("num");
  480. if (isNaN(days)) {
  481. error = error + num + "月的" + name + "天数不是数字;";
  482. } else {
  483. if (days < 0 || days > 31) {
  484. error = error + num + "月的" + name + "天数不在范围内(1-31);";
  485. }
  486. }
  487. if (days == null || days == '') {
  488. days = 0;
  489. }
  490. months = months + num + "=" + days + ",";
  491. });
  492. if (error != "") {
  493. Feng.error(error);
  494. return;
  495. }
  496. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
  497. if (data.code == 200) {
  498. Feng.success(data.msg);
  499. $("#" + enterpriseId).bootstrapTable("refresh", {});
  500. $("#attendanceModal").modal("hide");
  501. } else {
  502. Feng.info(data.msg);
  503. }
  504. }, function (data) {
  505. Feng.error("提交失败!" + data.responseJSON.message + "!");
  506. });
  507. ajax.set({"id": id, "months": months, "description": description});
  508. ajax.start();
  509. }
  510. //初始化附件类别表单
  511. TalentAllowanceInfoDlg.initFileTable = function () {
  512. TalentAllowanceInfoDlg.initContract();
  513. // Feng.showMiniFileModal(CONFIG.project_jbt,$("#type").val(),$("#id").val());
  514. var queryData = {};
  515. queryData['project'] = CONFIG.project_jbt;
  516. queryData['type'] = $("#type").val();
  517. $("#fileTable").bootstrapTable({
  518. url: Feng.ctxPath + "/common/api/findCommonFileType",
  519. method: 'POST',
  520. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  521. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  522. showRefresh: false, // 是否显示刷新按钮
  523. clickToSelect: true, // 是否启用点击选中行
  524. singleSelect: true, // 设置True 将禁止多选
  525. striped: true, // 是否显示行间隔色
  526. escape: true,
  527. pagination: false, // 设置为 true 会在表格底部显示分页条
  528. paginationHAlign: "left",
  529. paginationDetailHAlign: "right",
  530. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  531. showColumns: false,
  532. detailView: true, //是否显示父子表
  533. pageList: [10, 30, 50],
  534. queryParams: function (params) {
  535. return $.extend(queryData, params)
  536. },
  537. rowStyle: function (row, index) {
  538. return {classes: "info"};
  539. },
  540. columns: TalentAllowanceInfoDlg.initFileTypeColumn(),
  541. onPostBody: function () {
  542. $("td.uitd_showTip").bind("mouseover", function () {
  543. var htm = $(this).html();
  544. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  545. });
  546. },
  547. onLoadSuccess: function (data) {
  548. $("#fileTable").bootstrapTable('expandAllRows');
  549. },
  550. onExpandRow: function (index, row, $detail) {
  551. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  552. if (data == null || data.length == 0) {
  553. return;
  554. }
  555. 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>';
  556. var files = $("#files").val();
  557. var checkState = $("#checkState").val();
  558. for (var key in data) {
  559. var btn = "";
  560. if (checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1)) {
  561. btn = "<button type=\'button\' onclick=\"TalentAllowanceInfoDlg.checkFile(this,'" + row.id + "','" + data[key].id + "')\" style=\'margin-left: 5px\' class=\"btn btn-xs btn-success\">" +
  562. "<i class=\"fa fa-paste\"></i>修改" +
  563. "</button>" +
  564. "<button type='button' onclick=\"TalentAllowanceInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  565. "<i class=\"fa fa-times\"></i>删除" +
  566. "</button>";
  567. } else {
  568. btn = "";
  569. }
  570. var sn = data[key].url.lastIndexOf(".");
  571. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  572. var imgStr = "";
  573. if (suffix == "pdf" || suffix == "PDF") {
  574. 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>";
  575. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  576. 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>";
  577. } else {
  578. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  579. }
  580. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  581. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  582. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  583. '<li style="width: 10%;padding-top: 2px;">' + btn + '</li>';
  584. }
  585. html = html + '</ul>';
  586. $detail.html(html);
  587. $(".imgs").viewer({
  588. // toolbar:false,
  589. fullscreen: false
  590. });
  591. }, function (data) {
  592. Feng.error("查询失败!" + data.responseJSON.message + "!");
  593. });
  594. var queryData = {};
  595. queryData["mainId"] = $("#id").val();
  596. queryData["fileTypeId"] = row.id;
  597. ajax.set(queryData);
  598. ajax.start();
  599. }
  600. });
  601. TalentAllowanceInfoDlg.initCommonFileTable();
  602. }
  603. //初始化通用附件
  604. TalentAllowanceInfoDlg.initCommonFileTable = function () {
  605. var queryData = {};
  606. queryData.id = $("#id").val();
  607. $("#commonFileTable").bootstrapTable({
  608. url: Feng.ctxPath + "/common/api/listTalentAllowanceCommonFile",
  609. method: 'POST',
  610. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  611. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  612. showRefresh: false, // 是否显示刷新按钮
  613. clickToSelect: true, // 是否启用点击选中行
  614. singleSelect: true, // 设置True 将禁止多选
  615. striped: true, // 是否显示行间隔色
  616. pagination: false, // 设置为 true 会在表格底部显示分页条
  617. paginationHAlign: "left",
  618. paginationDetailHAlign: "right",
  619. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  620. showColumns: false,
  621. queryParams: function (params) {
  622. return $.extend(queryData, params)
  623. },
  624. rowStyle: function (row, index) {
  625. return {css: {"word-break": "break-word", "white-space": "inherit"}}
  626. },
  627. columns: [
  628. {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '70%', formatter: function (value, row, index) {
  629. return value;
  630. }},
  631. {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle', width: "20%",
  632. formatter: function (value, row, index) {
  633. var sn = value.lastIndexOf(".");
  634. var suffix = value.substring(sn + 1, value.length);
  635. var imgStr = "";
  636. if (suffix == "pdf" || suffix == "PDF") {
  637. 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>";
  638. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  639. 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>";
  640. } else {
  641. imgStr = '<img class=\"cImgUrl\" src=\"' + value + '\" style=\"width:25px;height:25px;\">';
  642. }
  643. return imgStr;
  644. }
  645. },
  646. {title: '操作', field: 'url', visible: true, align: 'center', valign: 'middle', width: '10%',
  647. formatter: function (value, row, index) {
  648. return "";
  649. }
  650. }
  651. ],
  652. onPostBody: function () {
  653. $("td.uitd_showTip").bind("mouseover", function () {
  654. var htm = $(this).html();
  655. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  656. });
  657. $(".cImgUrl").viewer({fullscreen: false});
  658. }
  659. });
  660. }
  661. //校验是否保存基础信息
  662. TalentAllowanceInfoDlg.validId = function () {
  663. var id = $("#id").val();
  664. if (id != null && id != '') {
  665. $("#fileLi").removeAttr("style");
  666. } else {
  667. $("#fileLi").attr("style", "pointer-events: none");
  668. $("#name").on('chosen:ready', function (e, params) {
  669. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  670. });
  671. $("#name").chosen({
  672. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  673. disable_search: false,
  674. width: "100%",
  675. enable_split_word_search: true
  676. });
  677. }
  678. }
  679. //选择附件并显示附件名
  680. TalentAllowanceInfoDlg.checkFile = function (content, fileTypeId, fileId) {
  681. if (!TalentAllowanceInfoDlg.validateIsEdit())
  682. return;
  683. $("#upload_file ").unbind("change");
  684. $("#upload_file ").change(function () {
  685. TalentAllowanceInfoDlg.upload(fileTypeId, fileId);
  686. });
  687. $('#upload_file').val("");
  688. $('#upload_file').click()
  689. }
  690. //上传附件
  691. TalentAllowanceInfoDlg.upload = function (fileTypeId, fileId) {
  692. var id = $("#id").val();
  693. if (!TalentAllowanceInfoDlg.validateIsEdit())
  694. return;
  695. if (fileId != null && fileId != 'null') {
  696. $("#fileId").val(fileId)
  697. } else {
  698. $("#fileId").val("");
  699. }
  700. $("#mainId").val(id);
  701. $("#fileTypeId").val(fileTypeId);
  702. var index = layer.load(0, {shade: false, time: 0});
  703. $("#index").val(index);
  704. $("#uploadForm").submit();
  705. }
  706. //删除附件
  707. TalentAllowanceInfoDlg.deleteFile = function (id) {
  708. if (!TalentAllowanceInfoDlg.validateIsEdit())
  709. return;
  710. var operation = function () {
  711. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  712. if (data.code = 200) {
  713. Feng.success(data.msg);
  714. $("#fileTable").bootstrapTable("refresh", {});
  715. } else {
  716. Feng.error(data.msg);
  717. }
  718. }, function (data) {
  719. Feng.error("删除失败!" + data.responseJSON.message + "!");
  720. });
  721. ajax.set("id", id);
  722. ajax.set("type", CONFIG.project_jbt);
  723. ajax.start();
  724. }
  725. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  726. }
  727. /**
  728. * 提交审核
  729. */
  730. TalentAllowanceInfoDlg.submitToCheck = function () {
  731. var id = $("#id").val();
  732. if (id == null || id == "") {
  733. Feng.info("请先填写基础信息并上传附件");
  734. return;
  735. }
  736. TalentAllowanceInfoDlg.clearData();
  737. TalentAllowanceInfoDlg.collectData();
  738. if (!TalentAllowanceInfoDlg.validateIsEdit())
  739. return;
  740. /*var active = $("#active").val();
  741. if (active == 2) {
  742. if (Feng.isEmptyStr(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  743. Feng.info("请填写上一年度年薪");
  744. return;
  745. }
  746. if (!/^([1-9][0-9]*)+(\.[0-9]{1,10})?$/.test(TalentAllowanceInfoDlg.talentAllowanceData.wage)) {
  747. Feng.info("上一年度年薪格式不合法,无需填写单位元");
  748. return;
  749. }
  750. }*/
  751. var operation = function () {
  752. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/submitToCheck", function (data) {
  753. if (data.code == 200) {
  754. Feng.success(data.msg);
  755. window.parent.TalentAllowanceInfo.table.refresh();
  756. TalentAllowanceInfoDlg.close();
  757. } else {
  758. Feng.error(data.msg);
  759. }
  760. }, function (data) {
  761. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  762. });
  763. ajax.set(TalentAllowanceInfoDlg.talentAllowanceData)
  764. // ajax.set("id", id);
  765. ajax.start();
  766. }
  767. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  768. }
  769. /**
  770. * 校验是否可以修改/提交审核
  771. */
  772. TalentAllowanceInfoDlg.validateIsEdit = function () {
  773. var id = $("#id").val();
  774. if (id == null || id == '') {
  775. Feng.info("请先添加基本信息并保存后再试");
  776. return false;
  777. }
  778. var checkState = $("#checkState").val();
  779. if (checkState != 1 && checkState != 10) {
  780. if (checkState == -1) {
  781. Feng.error("您的申报审核不通过,无法再修改");
  782. return false;
  783. } else if (checkState == 30) {
  784. Feng.error("您的申报已审核通过,无法再修改");
  785. return false;
  786. } else {
  787. Feng.error("您的申报正在审核中,请耐心等待");
  788. return false;
  789. }
  790. }
  791. return true;
  792. }
  793. TalentAllowanceInfoDlg.initICheck = function () {
  794. $('input[type=checkbox]').iCheck({
  795. labelHover: false,
  796. cursor: true,
  797. checkboxClass: 'icheckbox_square-green',
  798. radioClass: 'iradio_square-greene',
  799. increaseArea: '20%'
  800. });
  801. }
  802. TalentAllowanceInfoDlg.showAllLog = function () {
  803. var id = $("#id").val();
  804. if (Feng.isNotEmptyStr(id)) {
  805. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": "", "active": 1})
  806. }
  807. }
  808. $(function () {
  809. Feng.initValidatorTip("talentAllowanceForm", TalentAllowanceInfoDlg.validateFields);
  810. Feng.addAjaxSelect({
  811. "id": 'name',
  812. "displayCode": "id",
  813. "displayName": "name",
  814. "type": "GET",
  815. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year=" + $("#year").val()
  816. });
  817. TalentAllowanceInfoDlg.validId();
  818. if ($("#type").val() == 2) {
  819. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  820. }
  821. //批量加载时间控件
  822. $(".date").each(function () {
  823. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  824. });
  825. $("select").each(function () {
  826. $(this).val($(this).attr("value"));
  827. });
  828. if ($("#allowanceType").val() == 1) {
  829. //$("#wageDiv").css("display", "block");
  830. }
  831. //设置禁止字段
  832. var checkState = $("#checkState").val();
  833. if ($("#id").val() != "" && checkState != 1) {
  834. $("#allowanceType").attr("style", "pointer-events: none;background-color: #eee;");
  835. $("#wage").prop("readonly", true);
  836. }
  837. if (checkState == 10) {
  838. var fields = $("#fields").val().split(",");
  839. if (fields.indexOf("wage") > -1) {
  840. $("#wage").removeAttr("readonly");
  841. }
  842. if (fields.indexOf("allowanceType") > -1) {
  843. $("#allowanceType").removeAttr("style");
  844. }
  845. }
  846. TalentAllowanceInfoDlg.showAllLog();
  847. toastr.options = {
  848. "closeButton": true,
  849. "debug": false,
  850. "positionClass": "toast-bottom-right",
  851. "onclick": null,
  852. "showDuration": "300",
  853. "hideDuration": "1000",
  854. "timeOut": "600000",
  855. "extendedTimeOut": "1000",
  856. "showEasing": "swing",
  857. "hideEasing": "linear",
  858. "showMethod": "fadeIn",
  859. "hideMethod": "fadeOut",
  860. "tapToDismiss": true
  861. };
  862. toastr.success("请确保申报对象在申报津补贴之前已完成离职变更、工作单位变更、人才层次变更、银行账号变更且审核通过,否则可能带来不必要的损失,请在申报之前再次确认!!!");
  863. });