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.
 
 
 
 
 
 

176 lines
7.4 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-03-02 10:37
  5. * 描 述:教材库存表
  6. */
  7. var acceptClick;
  8. var keyValue = request('keyValue');
  9. // 设置权限
  10. var setAuthorize;
  11. // 设置表单数据
  12. var setFormData;
  13. // 验证数据是否填写完整
  14. var validForm;
  15. // 保存数据
  16. var save;
  17. var selectedRow;
  18. var refreshGirdData;
  19. var tempdatra = new Array();
  20. var bootstrap = function ($, learun) {
  21. "use strict";
  22. // 设置权限
  23. setAuthorize = function (data) {
  24. };
  25. var page = {
  26. init: function () {
  27. $('.lr-form-wrap').lrscroll();
  28. page.bind();
  29. page.initData();
  30. },
  31. bind: function () {
  32. $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  33. $('#TextBookOut').jfGrid({
  34. headData: [
  35. { label: '出库单', name: 'BookCode', width: 180, align: 'left' },
  36. { label: '数量', name: 'Variate', width: 100, align: 'left' },
  37. {
  38. label: "专业部", name: "DeptNo", width: 100, align: "left",
  39. formatterAsync: function (callback, value, row, op, $cell) {
  40. learun.clientdata.getAsync('custmerData', {
  41. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  42. key: value,
  43. keyId: 'deptno',
  44. callback: function (_data) {
  45. callback(_data['deptname']);
  46. }
  47. });
  48. }
  49. },
  50. {
  51. label: "专业", name: "MajorNo", width: 120, align: "left",
  52. formatterAsync: function (callback, value, row, op, $cell) {
  53. learun.clientdata.getAsync('custmerData', {
  54. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  55. key: value,
  56. keyId: 'majorno',
  57. callback: function (_data) {
  58. callback(_data['majorname']);
  59. }
  60. });
  61. }
  62. },
  63. {
  64. label: "课程", name: "LessonNo", width: 150, align: "left",
  65. formatterAsync: function (callback, value, row, op, $cell) {
  66. learun.clientdata.getAsync('custmerData', {
  67. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  68. key: value,
  69. keyId: 'lessonno',
  70. callback: function (_data) {
  71. callback(_data['lessonname']);
  72. }
  73. });
  74. }
  75. },
  76. {
  77. label: "班级", name: "ClassNo", width: 100, align: "left",
  78. formatterAsync: function (callback, value, row, op, $cell) {
  79. learun.clientdata.getAsync('custmerData', {
  80. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  81. key: value,
  82. keyId: 'classno',
  83. callback: function (_data) {
  84. callback(_data['classname']);
  85. }
  86. });
  87. }
  88. },
  89. { label: '学年', name: 'AcademicYearNo', width: 80, align: 'left' },
  90. { label: '学期', name: 'Semester', width: 80, align: 'left' },
  91. { label: '领用人', name: 'Recipient', width: 100, align: 'left' },
  92. { label: '出库数量', name: 'Variate', width: 100, align: 'left' },
  93. { label: '出库时间', name: 'CreateTime', width: 200, align: 'left' },
  94. { label: '出库用户', name: 'CrateUserID', width: 100, align: 'left' },
  95. { label: '备注', name: 'Remark', width: 100, align: 'left' },
  96. ],
  97. height: 400,
  98. mainId: 'CreateTime desc',
  99. reloadSelected: false,
  100. });
  101. },
  102. initData: function () {
  103. if (!!keyValue) {
  104. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?keyValue=' + keyValue, function (data) {
  105. for (var id in data) {
  106. if (!!data[id].length && data[id].length > 0) {
  107. $('#' + id).jfGridSet('refreshdata', data[id]);
  108. tempdatra = data[id];
  109. }
  110. else {
  111. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  112. }
  113. }
  114. });
  115. }
  116. }
  117. };
  118. refreshGirdData = function (temprow) {
  119. var ifnewrow = true;
  120. $.each(tempdatra, function (key, val) {
  121. if (tempdatra[key].ID === temprow.ID) {
  122. tempdatra[key] = temprow;
  123. ifnewrow = false;
  124. }
  125. });
  126. if (ifnewrow) {
  127. tempdatra.push(temprow);
  128. }
  129. $('#TextBookOut').jfGridSet('refreshdata', tempdatra);
  130. };
  131. // 设置表单数据
  132. setFormData = function (processId, param, callback) {
  133. if (!!processId) {
  134. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?processId=' + processId, function (data) {
  135. for (var id in data) {
  136. if (!!data[id] && data[id].length > 0) {
  137. $('#' + id).jfGridSet('refreshdata', data[id]);
  138. }
  139. else {
  140. if (id == 'TextBookOut' && data[id]) {
  141. keyValue = data[id].ID;
  142. }
  143. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  144. }
  145. }
  146. });
  147. }
  148. callback && callback();
  149. }
  150. // 验证数据是否填写完整
  151. validForm = function () {
  152. var datas = $('#TextBookOut').jfGridGet('rowdatas');
  153. if (datas == null || datas.length == 0) {
  154. learun.alert.warning("申请未包含出库申请!请先添加入库申请!");
  155. return false;
  156. }
  157. return true;
  158. };
  159. // 保存数据
  160. save = function (callBack) {
  161. var postData = {};
  162. var formData = $('[data-table="TextBookInOut"]').lrGetFormData();
  163. postData.strEntity = JSON.stringify(formData);
  164. postData.strTextBookOutList = JSON.stringify($('#TextBookOut').jfGridGet('rowdatas'));
  165. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/SaveForm?keyValue=' + keyValue, postData, function (res) {
  166. // 保存成功后才回调
  167. if (!!callBack) {
  168. callBack();
  169. }
  170. });
  171. };
  172. page.init();
  173. }