You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Form.js 3.0 KiB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-01-05 11:38
  5. * 描 述:社团签到
  6. */
  7. var acceptClick;
  8. var keyValue = request('keyValue');
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. $('.lr-form-wrap').lrscroll();
  14. page.bind();
  15. page.initData();
  16. if (!!keyValue) {
  17. $("#CommunityId").attr("readonly", "readonly");
  18. $("#StuNo").attr("readonly", "readonly");
  19. } else {
  20. $("#CommunityId").removeAttr("readonly");
  21. $("#StuNo").removeAttr("readonly");
  22. }
  23. },
  24. bind: function () {
  25. $('#CommunityId').lrDataSourceSelect({
  26. code: 'CommunityInfo', value: 'id', text: 'communityname', select: function (item) {
  27. if (!keyValue) {
  28. if (!!item) {
  29. $('#StuNo').lrselectRefresh({
  30. url: "/PersonnelManagement/CommunityMember/GetList",
  31. param: { communityId: item.id },
  32. value: 'StuNo',
  33. text: 'StuName'
  34. });
  35. }
  36. }
  37. }
  38. });
  39. $('#StuNo').lrselect({
  40. allowSearch: true,
  41. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic',
  42. param: { strWhere: "1=1 order by stuno" },
  43. value: "stuno",
  44. text: "stuname"
  45. });
  46. $('#Type').lrDataItemSelect({ code: 'CommunityAttendanceType' });
  47. },
  48. initData: function () {
  49. if (!!keyValue) {
  50. $.lrSetForm(top.$.rootUrl + '/PersonnelManagement/CommunityAttendance/GetFormData?keyValue=' + keyValue, function (data) {
  51. for (var id in data) {
  52. if (!!data[id].length && data[id].length > 0) {
  53. $('#' + id).jfGridSet('refreshdata', data[id]);
  54. }
  55. else {
  56. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  57. }
  58. }
  59. });
  60. }
  61. }
  62. };
  63. // 保存数据
  64. acceptClick = function (callBack) {
  65. if (!$('body').lrValidform()) {
  66. return false;
  67. }
  68. var postData = {
  69. strEntity: JSON.stringify($('body').lrGetFormData())
  70. };
  71. $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/CommunityAttendance/SaveForm?keyValue=' + keyValue, postData, function (res) {
  72. // 保存成功后才回调
  73. if (!!callBack) {
  74. callBack();
  75. }
  76. });
  77. };
  78. page.init();
  79. }