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.
 
 
 
 
 
 

168 lines
6.1 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-26 15:02
  5. * 描 述:学生宿舍管理
  6. */
  7. var acceptClick;
  8. var keyValue = request('keyValue');
  9. var ParentID = request('ParentID');
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. $('.lr-form-wrap').lrscroll();
  15. page.bind();
  16. page.initData();
  17. page.initSelect();
  18. },
  19. bind: function () {
  20. $('#BuildType').lrDataItemSelect({ code: 'BuildType' });
  21. // 上级
  22. $('#ParentID').lrselect({
  23. url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyTree',
  24. type: 'tree',
  25. allowSearch: true,
  26. maxHeight: 225,
  27. select: function (item) {
  28. if (item&&item.id!='-1') {
  29. $('#BuildType').lrselectSet(item.title);
  30. $('#BuildType').attr('readonly', 'readonly');
  31. } else {
  32. $('#BuildType').lrselectSet('1');
  33. $('#BuildType').removeAttr('readonly');
  34. }
  35. }
  36. });
  37. $('#Sex').lrRadioCheckbox({
  38. type: 'radio',
  39. code: 'usersex',
  40. });
  41. $("#HasToilet").lrRadioCheckbox({
  42. type: 'radio',
  43. code: 'HasToilet',
  44. })
  45. //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoBasic', value: 'stuid', text: 'stuname' });
  46. //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoTwo', value: 'stuid', text: 'stuname' });
  47. $('#StudentID').lrselect({
  48. value: "stuid",
  49. text: "stuname",
  50. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic'
  51. });
  52. $('#Class').lrselect({
  53. value: "classno",
  54. text: "classname"
  55. });
  56. $('#Dept').lrselect({
  57. value: "deptno",
  58. text: "deptname",
  59. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo',
  60. select: function (item) {
  61. if (item) {
  62. $('#Major').lrselectRefresh({
  63. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
  64. param: { code: "CdMajorInfo", strWhere: "DeptNo='" + item.deptno + "'" }
  65. });
  66. }
  67. else {
  68. $('#Major').lrselectRefresh({
  69. url: "",
  70. data: []
  71. });
  72. }
  73. $('#Class').lrselectRefresh({
  74. url: "",
  75. data: []
  76. });
  77. }
  78. });
  79. $('#Major').lrselect({
  80. value: "majorno",
  81. text: "majorname",
  82. select: function (item) {
  83. if (item) {
  84. $('#Class').lrselectRefresh({
  85. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
  86. param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" }
  87. });
  88. }
  89. }
  90. });
  91. $('#Major').on("click",
  92. function () {
  93. var data = $('#Dept').lrselectGet();
  94. if (!data) {
  95. learun.alert.error('请先选择系');
  96. }
  97. });
  98. $('#Class').on("click",
  99. function () {
  100. var data1 = $('#Dept').lrselectGet();
  101. var data2 = $('#Major').lrselectGet();
  102. if (!data1 || !data2) {
  103. learun.alert.error('请先选择系和专业');
  104. }
  105. });
  106. },
  107. initData: function () {
  108. if (!!keyValue) {
  109. $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue,
  110. function(data) {
  111. for (var id in data) {
  112. if (!!data[id].length && data[id].length > 0) {
  113. $('#' + id).jfGridSet('refreshdata', data[id]);
  114. } else {
  115. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  116. }
  117. }
  118. });
  119. } else {
  120. $('#ParentID').lrselectSet(ParentID);
  121. }
  122. },
  123. initSelect: function () {
  124. var dfop = {
  125. type: 'tree',
  126. // 展开最大高度
  127. maxHeight: 200,
  128. // 是否允许搜索
  129. allowSearch: true,
  130. // 访问数据接口地址
  131. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree',
  132. // 访问数据接口参数
  133. param: { parentId: '0' },
  134. }
  135. $('#Campus').lrselect(dfop);
  136. }
  137. };
  138. // 保存数据
  139. acceptClick = function (callBack) {
  140. if (!$('body').lrValidform()) {
  141. return false;
  142. }
  143. var strEntity = $('body').lrGetFormData();
  144. if (!strEntity.ParentID && strEntity.BuildType != '1') {
  145. return learun.alert.warning("请选择上级!");
  146. }
  147. var postData = {
  148. strEntity: JSON.stringify(strEntity)
  149. };
  150. $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveForm?keyValue=' + keyValue, postData, function (res) {
  151. // 保存成功后才回调
  152. if (!!callBack) {
  153. callBack();
  154. }
  155. });
  156. };
  157. page.init();
  158. }