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.

FormView.js 5.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-11-21 11:32
  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. },
  17. bind: function () {
  18. //学年
  19. $('#AcademicYearNo').lrselect({
  20. placeholder: "请选择学年",
  21. allowSearch: true,
  22. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  23. value: 'value',
  24. text: 'text'
  25. });
  26. //学期
  27. $('#Semester').lrselect({
  28. placeholder: "请选择学年",
  29. allowSearch: true,
  30. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  31. value: 'value',
  32. text: 'text'
  33. });
  34. //$('#StuId').lrDataSourceSelect({ code: 'StuInfoBasic',value: 'stuid',text: 'stuname' });
  35. $('#StuId').lrGirdSelect({
  36. // 字段
  37. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic',
  38. selectWord: 'stuname',
  39. value: 'stuid',
  40. text: 'stuno',
  41. headData: [
  42. { label: "学号", name: "stuno", width: 100, align: "left" },
  43. { label: "姓名", name: "stuname", width: 100, align: "left" },
  44. {
  45. label: "性别", name: "genderno", width: 80, align: "left",
  46. formatter: function (cellvalue) {
  47. return cellvalue == true ? "男" : "女";
  48. }
  49. },
  50. { label: "身份证号", name: "identitycardno", width: 100, align: "left" },
  51. {
  52. label: "系所", name: "deptno", width: 100, align: "left",
  53. formatterAsync: function (callback, value, row, op, $cell) {
  54. learun.clientdata.getAsync('custmerData', {
  55. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  56. key: value,
  57. keyId: 'deptno',
  58. callback: function (_data) {
  59. callback(_data['deptname']);
  60. }
  61. });
  62. }
  63. },
  64. {
  65. label: "专业", name: "majorno", width: 100, align: "left",
  66. formatterAsync: function (callback, value, row, op, $cell) {
  67. learun.clientdata.getAsync('custmerData', {
  68. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  69. key: value,
  70. keyId: 'majorno',
  71. callback: function (_data) {
  72. callback(_data['majorname']);
  73. }
  74. });
  75. }
  76. },
  77. {
  78. label: "班级", name: "classno", width: 100, align: "left",
  79. formatterAsync: function (callback, value, row, op, $cell) {
  80. learun.clientdata.getAsync('custmerData', {
  81. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  82. key: value,
  83. keyId: 'classno',
  84. callback: function (_data) {
  85. callback(_data['classname']);
  86. }
  87. });
  88. }
  89. },
  90. { label: "年级", name: "grade", width: 100, align: "left" }
  91. ],
  92. select: function (item) {
  93. $("#StuName").val(item.stuname);
  94. }
  95. });
  96. $('#TypeId').lrDataSourceSelect({ code: 'StuSubsidizeType', value: 'id', text: 'name' });
  97. $('#Levels').lrDataItemSelect({ code: 'SubsidizeLevels' });
  98. $('#IsIssue').lrDataItemSelect({ code: 'YesOrNoInt' });
  99. },
  100. initData: function () {
  101. if (!!keyValue) {
  102. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuSubsidize/GetFormData?keyValue=' + keyValue, function (data) {
  103. for (var id in data) {
  104. if (!!data[id].length && data[id].length > 0) {
  105. $('#' + id ).jfGridSet('refreshdata', data[id]);
  106. }
  107. else {
  108. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  109. }
  110. }
  111. });
  112. }
  113. }
  114. };
  115. // 保存数据
  116. acceptClick = function (callBack) {
  117. if (!$('body').lrValidform()) {
  118. return false;
  119. }
  120. var postData = {
  121. strEntity: JSON.stringify($('body').lrGetFormData())
  122. };
  123. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/StuSubsidize/SaveForm?keyValue=' + keyValue, postData, function (res) {
  124. // 保存成功后才回调
  125. if (!!callBack) {
  126. callBack();
  127. }
  128. });
  129. };
  130. page.init();
  131. }