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.
 
 
 
 
 
 

175 lines
7.3 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. {
  37. label: "专业部", name: "DeptNo", width: 100, align: "left",
  38. formatterAsync: function (callback, value, row, op, $cell) {
  39. learun.clientdata.getAsync('custmerData', {
  40. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  41. key: value,
  42. keyId: 'deptno',
  43. callback: function (_data) {
  44. callback(_data['deptname']);
  45. }
  46. });
  47. }
  48. },
  49. {
  50. label: "专业", name: "MajorNo", width: 120, align: "left",
  51. formatterAsync: function (callback, value, row, op, $cell) {
  52. learun.clientdata.getAsync('custmerData', {
  53. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  54. key: value,
  55. keyId: 'majorno',
  56. callback: function (_data) {
  57. callback(_data['majorname']);
  58. }
  59. });
  60. }
  61. },
  62. {
  63. label: "课程", name: "LessonNo", width: 150, align: "left",
  64. formatterAsync: function (callback, value, row, op, $cell) {
  65. learun.clientdata.getAsync('custmerData', {
  66. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  67. key: value,
  68. keyId: 'lessonno',
  69. callback: function (_data) {
  70. callback(_data['lessonname']);
  71. }
  72. });
  73. }
  74. },
  75. {
  76. label: "班级", name: "ClassNo", width: 100, align: "left",
  77. formatterAsync: function (callback, value, row, op, $cell) {
  78. learun.clientdata.getAsync('custmerData', {
  79. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  80. key: value,
  81. keyId: 'classno',
  82. callback: function (_data) {
  83. callback(_data['classname']);
  84. }
  85. });
  86. }
  87. },
  88. { label: '学年', name: 'AcademicYearNo', width: 80, align: 'left' },
  89. { label: '学期', name: 'Semester', width: 80, align: 'left' },
  90. { label: '领用人', name: 'Recipient', width: 100, align: 'left' },
  91. { label: '出库数量', name: 'Variate', width: 100, align: 'left' },
  92. { label: '出库时间', name: 'CreateTime', width: 200, align: 'left' },
  93. { label: '出库用户', name: 'CrateUserID', width: 100, align: 'left' },
  94. { label: '备注', name: 'Remark', width: 100, align: 'left' },
  95. ],
  96. height: 400,
  97. mainId: 'CreateTime desc',
  98. reloadSelected: false,
  99. });
  100. },
  101. initData: function () {
  102. if (!!keyValue) {
  103. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?keyValue=' + keyValue, function (data) {
  104. for (var id in data) {
  105. if (!!data[id].length && data[id].length > 0) {
  106. $('#' + id).jfGridSet('refreshdata', data[id]);
  107. tempdatra = data[id];
  108. }
  109. else {
  110. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  111. }
  112. }
  113. });
  114. }
  115. }
  116. };
  117. refreshGirdData = function (temprow) {
  118. var ifnewrow = true;
  119. $.each(tempdatra, function (key, val) {
  120. if (tempdatra[key].ID === temprow.ID) {
  121. tempdatra[key] = temprow;
  122. ifnewrow = false;
  123. }
  124. });
  125. if (ifnewrow) {
  126. tempdatra.push(temprow);
  127. }
  128. $('#TextBookOut').jfGridSet('refreshdata', tempdatra);
  129. };
  130. // 设置表单数据
  131. setFormData = function (processId, param, callback) {
  132. if (!!processId) {
  133. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/GetFormData?processId=' + processId, function (data) {
  134. for (var id in data) {
  135. if (!!data[id] && data[id].length > 0) {
  136. $('#' + id).jfGridSet('refreshdata', data[id]);
  137. }
  138. else {
  139. if (id == 'TextBookOut' && data[id]) {
  140. keyValue = data[id].ID;
  141. }
  142. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  143. }
  144. }
  145. });
  146. }
  147. callback && callback();
  148. }
  149. // 验证数据是否填写完整
  150. validForm = function () {
  151. var datas = $('#TextBookOut').jfGridGet('rowdatas');
  152. if (datas == null || datas.length == 0) {
  153. learun.alert.warning("申请未包含出库申请!请先添加入库申请!");
  154. return false;
  155. }
  156. return true;
  157. };
  158. // 保存数据
  159. save = function (callBack) {
  160. var postData = {};
  161. var formData = $('[data-table="TextBookInOut"]').lrGetFormData();
  162. postData.strEntity = JSON.stringify(formData);
  163. postData.strTextBookOutList = JSON.stringify($('#TextBookOut').jfGridGet('rowdatas'));
  164. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookOut/SaveForm?keyValue=' + keyValue, postData, function (res) {
  165. // 保存成功后才回调
  166. if (!!callBack) {
  167. callBack();
  168. }
  169. });
  170. };
  171. page.init();
  172. }