PaiKu.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. var refreshGirdData;
  2. var selectedRow;
  3. var bootstrap = function ($, learun) {
  4. "use strict";
  5. var selectRowsData;
  6. var psuid = "";
  7. var urls = [{ "url": "/FJManager/BillBomSet/DFM1509", "name": "DFM1509", "width": 744, "height": 690 },
  8. { "url": "/FJManager/BillBomSet/DOF2", "name": "DOF2", "width": 920, "height": 676 },
  9. { "url": "/FJManager/BillBomSet/DOF4", "name": "DOF4", "width": 920, "height": 676 },
  10. { "url": "/FJManager/BillBomSet/DFM6", "name": "DFM6", "width": 920, "height": 676 },
  11. { "url": "/FJManager/BillBomSet/DFM09", "name": "DFM9", "width": 940, "height": 676 },
  12. { "url": "/FJManager/BillBomSet/Exception", "name": "Exception", "width": 920, "height": 676 },
  13. { "url": "/FJManager/BillBomSet/DFMAll", "name": "DFMAll", "width": 920, "height": 676 },
  14. { "url": "/FJManager/BillBomSet/Form", "name": "PaiKu", "width": 920, "height": 676 }];
  15. var page = {
  16. init: function () {
  17. page.bind();
  18. page.initGird();
  19. },
  20. bind: function () {
  21. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  22. // 调用后台查询
  23. // queryJson 查询条件
  24. console.log(queryJson);
  25. queryJson["Percent"] = $("#Percent").val();
  26. page.search({ queryJson: JSON.stringify(queryJson) });
  27. }, 250);
  28. // 查询
  29. $('#btn_Search').on('click', function () {
  30. var keyword = $('#txt_Keyword').val();
  31. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  32. });
  33. // 刷新
  34. $('#lr_refresh').on('click', function () {
  35. location.reload();
  36. });
  37. // 新增
  38. $('#lr_add').on('click', function () {
  39. learun.layerForm({
  40. id: 'form',
  41. title: '新增' + urls[7].name,
  42. url: top.$.rootUrl + urls[7].url,
  43. width: urls[7].width,
  44. height: urls[7].height,
  45. callBack: function (id) {
  46. return top[id].acceptClick(refreshGirdData);
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. selectedRow = $('#gridtable').jfGridGet("rowdata");
  53. if (selectedRow.length == 0) {
  54. learun.alert.error('未选择行!');
  55. return false;
  56. }
  57. if (selectedRow.length > 1) {
  58. learun.alert.error('选择了多行!');
  59. return false;
  60. }
  61. var keyValue = selectedRow[0].Id;
  62. selectedRow = selectedRow[0];
  63. if (learun.checkrow(keyValue)) {
  64. learun.layerForm({
  65. id: 'form',
  66. title: '编辑' + urls[7].name,
  67. url: top.$.rootUrl + urls[7].url + '?keyValue=' + keyValue,
  68. width: urls[7].width,
  69. height: urls[7].height,
  70. callBack: function (id) {
  71. return top[id].acceptClick(refreshGirdData);
  72. }
  73. });
  74. }
  75. });
  76. $("#lr_search").on('click', function () {
  77. let editSelRows = $('#gridtable').jfGridGet("rowdata");
  78. if (editSelRows.length == 0) {
  79. learun.alert.error('未选择行!');
  80. return false;
  81. }
  82. if (editSelRows.length > 1) {
  83. learun.alert.error('选择了多行!');
  84. return false;
  85. }
  86. var keyValue = $('#gridtable').jfGridValue('Id');
  87. if (learun.checkrow(keyValue)) {
  88. learun.layerForm({
  89. id: 'form',
  90. title: '查看' + urls[parseInt(stampType) - 1].name,
  91. btn: ['关闭'],
  92. url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
  93. width: urls[parseInt(stampType) - 1].width,
  94. height: urls[parseInt(stampType) - 1].height,
  95. callBack: function (id) {
  96. return true;
  97. //return top[id].acceptClick(refreshGirdData);
  98. }
  99. });
  100. }
  101. });
  102. // 删除
  103. $('#lr_delete').on('click', function () {
  104. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  105. if (selectRowsData.length == 0) {
  106. learun.alert.error('未选择行!');
  107. return false;
  108. }
  109. if (selectRowsData.length > 1) {
  110. learun.alert.error('只能选择一行!');
  111. return false;
  112. }
  113. var keyValue = selectRowsData.map((item) => item.Id);
  114. //var keyValue = $('#gridtable').jfGridValue('Id');
  115. if (learun.checkrow(keyValue)) {
  116. learun.layerConfirm('是否确认删除该项!', function (res) {
  117. if (res) {
  118. learun.deleteForm(top.$.rootUrl + '/FJManager/BillBomSet/DeletePK', { keyValue: keyValue }, function () {
  119. refreshGirdData();
  120. });
  121. }
  122. });
  123. }
  124. });
  125. // 启用
  126. $('#lr_enable').on('click', function () {
  127. var postData = $('#gridtable').jfGridGet("rowdata");
  128. if (postData.length == 0) {
  129. learun.alert.error('未选择行!');
  130. return false;
  131. }
  132. if (postData.length > 1) {
  133. learun.alert.error('启用只能选择一条数据!');
  134. return false;
  135. }
  136. learun.layerConfirm('是否确认启用该跺型!', function (res) {
  137. if (res) {
  138. learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Enables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  139. refreshGirdData();
  140. });
  141. }
  142. });
  143. });
  144. // 禁用
  145. $('#lr_disable').on('click', function () {
  146. var postData = $('#gridtable').jfGridGet("rowdata");
  147. if (postData.length == 0) {
  148. learun.alert.error('未选择行!');
  149. return false;
  150. }
  151. learun.layerConfirm('是否确认禁用该跺型!', function (res) {
  152. if (res) {
  153. learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Disables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  154. refreshGirdData();
  155. });
  156. }
  157. });
  158. });
  159. // 打印
  160. $('#lr_print').on('click', function () {
  161. $('#gridtable').jqprintTable();
  162. });
  163. $('#WarehouseId').lrselect({
  164. url: top.$.rootUrl + "/FJManager/BaseWarehouse/PaiKuGetSelectWarehouseCodeNameList",
  165. allowSearch: true,
  166. width: 180,
  167. });
  168. $('#BomsetgrpId').lrselect({
  169. url: top.$.rootUrl + "/FJManager/BillBomSet/PaiKuGetList",
  170. allowSearch: true,
  171. width: 180,
  172. });
  173. },
  174. // 初始化列表
  175. initGird: function () {
  176. $('#gridtable').jfGrid({
  177. url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
  178. headData: [
  179. { label: 'ID', name: 'Id', width: 160, align: 'left' },
  180. { label: '垛型名称', name: 'BomsetgrpName', width: 160, align: 'left' },
  181. { label: '仓库编码', name: 'WarehouseCode', width: 160, align: 'left' },
  182. { label: '排库占比', name: 'Percent', width: 100, align: 'left' },
  183. { label: '垛型编码', name: 'BomsetgrpId', width: 160, align: 'left' },
  184. { label: '仓库ID', name: 'WarehousId', width: 160, align: 'left' },
  185. learun.jfFormatter.col_AddWho(),
  186. learun.jfFormatter.col_AddTime(),
  187. learun.jfFormatter.col_EditWho(),
  188. learun.jfFormatter.col_EditTime(),
  189. learun.jfFormatter.col_MEMO()
  190. ],
  191. mainId: 'Id',
  192. isPage: true,
  193. isMultiselect: true,
  194. reloadSelected: true,
  195. sidx: 'BomsetgrpName',
  196. isSubGrid: false, // 是否有子表
  197. });
  198. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  199. },
  200. search: function (param) {
  201. $('#gridtable').jfGridSet('reload', param);
  202. }
  203. };
  204. refreshGirdData = function () {
  205. page.search();
  206. };
  207. page.init();
  208. }