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.
 
 
 
 
 
 

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