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.
 
 
 
 
 
 

133 lines
5.1 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. var DelkeyValue = request('DelkeyValue');
  10. // 设置权限
  11. var setAuthorize;
  12. // 设置表单数据
  13. var setFormData;
  14. // 验证数据是否填写完整
  15. var validForm;
  16. // 保存数据
  17. var save;
  18. var selectedRow;
  19. var refreshGirdData;
  20. var tempdatra = new Array();
  21. var bootstrap = function ($, learun) {
  22. "use strict";
  23. // 设置权限
  24. setAuthorize = function (data) {
  25. };
  26. var page = {
  27. init: function () {
  28. $('.lr-form-wrap').lrscroll();
  29. page.bind();
  30. page.initData();
  31. },
  32. bind: function () {
  33. $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  34. $('#TextBookIn').jfGrid({
  35. headData: [
  36. { label: '入库单', name: 'BookCode', width: 180, align: 'left' },
  37. { label: '入库数量', name: 'variate', width: 100, align: 'left' },
  38. { label: '入库时间', name: 'CreateTime', width: 200, align: 'left' },
  39. { label: '入库用户', name: 'CrateUserID', width: 100, align: 'left' },
  40. { label: '备注', name: 'Remark', width: 100, align: 'left' },
  41. ],
  42. height: 400,
  43. mainId: 'CreateTime desc',
  44. reloadSelected: false,
  45. });
  46. $("#detaildel").on('click', function () {
  47. var NewkeyValue = $('#TextBookIn').jfGridValue('ID');
  48. if (learun.checkrow(NewkeyValue)) {
  49. learun.layerConfirm('是否确认删除该项!', function (res, index) {
  50. if (res) {
  51. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/DeleteForm', { keyValue: NewkeyValue }, function () {
  52. var index = top.layer.getFrameIndex(window.name);
  53. console.log('index', index);
  54. top.layer.close(index);
  55. });
  56. }
  57. });
  58. }
  59. });
  60. },
  61. initData: function () {
  62. if (!!keyValue) {
  63. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/GetFormData?keyValue=' + keyValue, function (data) {
  64. for (var id in data) {
  65. if (!!data[id].length && data[id].length > 0) {
  66. $('#' + id).jfGridSet('refreshdata', data[id]);
  67. }
  68. else {
  69. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  70. }
  71. }
  72. });
  73. }
  74. }
  75. };
  76. refreshGirdData = function (temprow) {
  77. var ifnewrow = true;
  78. $.each(tempdatra, function (key, val) {
  79. if (tempdatra[key].BookCode === temprow.InOutBook) {
  80. tempdatra[key] = temprow;
  81. ifnewrow = false;
  82. }
  83. });
  84. if (ifnewrow) {
  85. tempdatra.push(temprow);
  86. }
  87. $('#TextBookIn').jfGridSet('refreshdata', tempdatra);
  88. };
  89. // 设置表单数据
  90. setFormData = function (processId, param, callback) {
  91. if (!!processId) {
  92. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/GetFormDataByProcessId?processId=' + processId, function (data) {
  93. for (var id in data) {
  94. if (!!data[id] && data[id].length > 0) {
  95. $('#' + id).jfGridSet('refreshdata', data[id]);
  96. }
  97. else {
  98. if (id == 'TextBookIn' && data[id]) {
  99. keyValue = data[id].ID;
  100. }
  101. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  102. }
  103. }
  104. });
  105. }
  106. }
  107. // 验证数据是否填写完整
  108. validForm = function () {
  109. var datas = $('#TextBookIn').jfGridGet('rowdatas');
  110. if (datas == null || datas.length == 0) {
  111. learun.alert.warning("申请未包含入库申请!请先添加入库申请!");
  112. return false;
  113. }
  114. return true;
  115. };
  116. // 保存数据
  117. save = function (callBack) {
  118. var postData = {};
  119. var formData = $('[data-table="TextBookInOut"]').lrGetFormData();
  120. postData.strEntity = JSON.stringify(formData);
  121. postData.strTextBookInList = JSON.stringify($('#TextBookIn').jfGridGet('rowdatas'));
  122. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/SaveForm?keyValue=' + keyValue, postData, function (res) {
  123. // 保存成功后才回调
  124. if (!!callBack) {
  125. callBack();
  126. }
  127. });
  128. };
  129. page.init();
  130. }