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 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2023-10-13 10:31
  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. page.initData();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#AcademicYearNo').lrselect({
  18. placeholder: "请选择学年",
  19. allowSearch: true,
  20. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  21. value: 'value',
  22. text: 'text'
  23. });
  24. $('#Semester').lrDataItemSelect({ code: 'Semester' });
  25. $('#IsPay').lrDataItemSelect({ code: 'YesOrNoBit' });
  26. $('#StuNo').lrGirdSelect({
  27. // 字段
  28. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic',
  29. selectWord: 'stuname',
  30. value: 'stuno',
  31. text: 'stuno',
  32. headData: [
  33. { label: "学号", name: "stuno", width: 100, align: "left" },
  34. { label: "姓名", name: "stuname", width: 100, align: "left" },
  35. {
  36. label: "性别", name: "genderno", width: 80, align: "left",
  37. formatter: function (cellvalue) {
  38. return cellvalue == true ? "男" : "女";
  39. }
  40. },
  41. {
  42. label: "系部", name: "deptno", width: 100, align: "left",
  43. formatterAsync: function (callback, value, row, op, $cell) {
  44. learun.clientdata.getAsync('custmerData', {
  45. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  46. key: value,
  47. keyId: 'deptno',
  48. callback: function (_data) {
  49. callback(_data['deptname']);
  50. }
  51. });
  52. }
  53. },
  54. {
  55. label: "专业", name: "majorno", width: 100, align: "left",
  56. formatterAsync: function (callback, value, row, op, $cell) {
  57. learun.clientdata.getAsync('custmerData', {
  58. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  59. key: value,
  60. keyId: 'majorno',
  61. callback: function (_data) {
  62. callback(_data['majorname']);
  63. }
  64. });
  65. }
  66. },
  67. {
  68. label: "班级", name: "classno", width: 100, align: "left",
  69. formatterAsync: function (callback, value, row, op, $cell) {
  70. learun.clientdata.getAsync('custmerData', {
  71. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  72. key: value,
  73. keyId: 'classno',
  74. callback: function (_data) {
  75. callback(_data['classname']);
  76. }
  77. });
  78. }
  79. },
  80. { label: "年级", name: "grade", width: 100, align: "left" }
  81. ],
  82. select: function (item) {
  83. $("#StuNo").val(item.stuno);
  84. $("#StuName").val(item.stuname);
  85. $("#DeptNo").lrselectSet(item.deptno);
  86. $("#MajorNo").lrselectSet(item.majorno);
  87. $("#ClassNo").lrselectSet(item.classno);
  88. $("#Grade").lrselectSet(item.grade);
  89. }
  90. });
  91. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  92. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  93. $('#ClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  94. $('#Grade').lrselect({
  95. url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear',
  96. value: 'value',
  97. text: 'text'
  98. });
  99. },
  100. initData: function () {
  101. if (!!keyValue) {
  102. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/BookPayDetail/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 (!$('#form').lrValidform()) {
  118. return false;
  119. }
  120. var postData = $('#form').lrGetFormData();
  121. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/BookPayDetail/SaveForm?keyValue=' + keyValue, postData, function (res) {
  122. // 保存成功后才回调
  123. if (!!callBack) {
  124. callBack();
  125. }
  126. });
  127. };
  128. page.init();
  129. }