Index.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * 创建人:超级管理员
  3. * 日 期:2019-06-06 06:08
  4. * 描 述:库区管理
  5. */
  6. var selectedRow;
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var warehouseId = '';
  11. var page = {
  12. init: function () {
  13. page.inittree();
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. var keyword = $('#txt_Keyword').val();
  21. page.search({ keyword: keyword });
  22. });
  23. // 刷新
  24. $('#lr_refresh').on('click', function () {
  25. location.reload();
  26. });
  27. // 新增
  28. $('#lr_add').on('click', function () {
  29. selectedRow = null;
  30. learun.layerForm({
  31. id: 'form',
  32. title: '新增',
  33. url: top.$.rootUrl + '/BaseManager/BaseLocation/Form?warehouseId=' + warehouseId,
  34. width: 700,
  35. height: 500,
  36. callBack: function (id) {
  37. return top[id].acceptClick(refreshGirdData);
  38. }
  39. });
  40. });
  41. // 编辑
  42. $('#lr_edit').on('click', function () {
  43. var keyValue = $('#gridtable').jfGridValue('F_NO');
  44. selectedRow = $('#gridtable').jfGridGet('rowdata');
  45. if (learun.checkrow(keyValue)) {
  46. learun.layerForm({
  47. id: 'form',
  48. title: '编辑',
  49. url: top.$.rootUrl + '/BaseManager/BaseLocation/Form?keyValue=' + keyValue,
  50. width: 700,
  51. height: 500,
  52. callBack: function (id) {
  53. return top[id].acceptClick(refreshGirdData);
  54. }
  55. });
  56. }
  57. });
  58. // 删除
  59. $('#lr_delete').on('click', function () {
  60. var keyValue = $('#gridtable').jfGridValue('F_NO');
  61. if (learun.checkrow(keyValue)) {
  62. learun.layerConfirm('是否确认删除该项!', function (res) {
  63. if (res) {
  64. learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseLocation/DeleteForm', { keyValue: keyValue }, function () {
  65. });
  66. }
  67. });
  68. }
  69. });
  70. },
  71. inittree: function () {
  72. $('#warehouseTree').lrtree({
  73. url: top.$.rootUrl + '/BaseManager/BaseWarea/GetTree',
  74. param: { parentId: '0' },
  75. nodeClick: page.treeNodeClick
  76. });
  77. $('#warehouseTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  78. },
  79. treeNodeClick: function (item) {
  80. if (item.parentId == 0) {
  81. warehouseId = "";
  82. } else {
  83. warehouseId = item.id;
  84. }
  85. $('#titleinfo').text(item.text);
  86. page.search();
  87. },
  88. initGird: function () {
  89. $('#gridtable').jfGrid({
  90. url: top.$.rootUrl + '/BaseManager/BaseLocation/GetPageList',
  91. headData: [
  92. { label: '货位编号', name: 'F_no', width: 120, align: "left" },
  93. { label: '货位名称', name: 'F_name', width: 100, align: "left" },
  94. {
  95. label: '仓库名称', name: 'F_warehouseNo', width: 100, align: "left"
  96. , formatterAsync: function (callback, value, row) {
  97. learun.clientdata.getAsync('warehouse', {
  98. key: value,
  99. callback: function (item) {
  100. callback(item.F_NAME);
  101. }
  102. });
  103. }
  104. },
  105. {
  106. label: '区域名称', name: 'F_wareNo', width: 100, align: "left"
  107. , formatterAsync: function (callback, value, row) {
  108. learun.clientdata.getAsync('warea', {
  109. key: value,
  110. callback: function (item) {
  111. callback(item.F_NAME);
  112. }
  113. });
  114. }
  115. },
  116. {
  117. label: '货位类型', name: 'F_type', width: 80, align: "center"
  118. , formatterAsync: function (callback, value, row) {
  119. learun.clientdata.getAsync('dataItem', {
  120. Rowkey: value,
  121. GrpCode: 'ELocationType',
  122. getType: 'Num',
  123. callback: function (item) {
  124. callback(item.F_NAME);
  125. }
  126. });
  127. }
  128. },
  129. { label: '行', name: 'F_line', width: 60, align: "left" },
  130. { label: '列', name: 'F_cell', width: 60, align: "left" },
  131. { label: '层', name: 'F_layer', width: 60, align: "left" },
  132. { label: '货位高度', name: 'F_height', width: 60, align: "left" },
  133. { label: '货物高度', name: 'F_matWeight', width: 60, align: "left" },
  134. //{ label: '深度', name: 'F_depth', width: 60, align: "left" },
  135. //{ label: '设备号', name: 'F_EQPNO', width: 100, align: "left" },
  136. { label: '巷道号', name: 'F_roadway', width: 100, align: "left" },
  137. {
  138. label: '货位状态', name: 'F_status', width: 80, align: "center"
  139. , formatterAsync: function (callback, value, row) {
  140. learun.clientdata.getAsync('dataItem', {
  141. Rowkey: value,
  142. GrpCode: 'EWareCellState',
  143. getType: 'Num',
  144. callback: function (item) {
  145. callback(item.F_NAME);
  146. }
  147. });
  148. }
  149. },
  150. {
  151. label: '货物类型', name: 'F_matType', width: 100, align: "left",
  152. formatterAsync: function (callback, value, row) {
  153. learun.clientdata.getAsync('dataItem', {
  154. Rowkey: value,
  155. GrpCode: 'EMatType',
  156. getType: 'Num',
  157. callback: function (item) {
  158. callback(item.F_NAME);
  159. }
  160. });
  161. },
  162. },
  163. { label: '缓存货位', name: 'F_relateLocation', width: 100, align: "left" },
  164. { label: '是否保税', name: 'F_isBonded', width: 100, align: "left" },
  165. learun.jfFormatter.col_F_ISSTOP(),
  166. learun.jfFormatter.col_F_ADDUSERNO(),
  167. learun.jfFormatter.col_F_ADDTIME(),
  168. learun.jfFormatter.col_F_EDITUSERNO(),
  169. learun.jfFormatter.col_F_EDITTIME(),
  170. learun.jfFormatter.col_F_MEMO()
  171. ],
  172. mainId: 'F_NO',
  173. isPage: true,
  174. sidx: 'F_EDITTIME',
  175. sord: "desc"
  176. });
  177. page.search();
  178. },
  179. search: function (param) {
  180. param = param || {};
  181. param.warehouseId = warehouseId;
  182. $('#gridtable').jfGridSet('reload', param);
  183. //$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  184. }
  185. };
  186. refreshGirdData = function () {
  187. page.search();
  188. };
  189. page.init();
  190. }