Index.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * 描 述:库区管理
  3. */
  4. var selectedRow;
  5. var refreshGirdData;
  6. var typnum = 1;
  7. var bootstrap = function ($, learun) {
  8. "use strict";
  9. var warehouseId = '';
  10. var page = {
  11. init: function () {
  12. page.inittree();
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. var keyword = $('#txt_Keyword').val();
  20. page.search({ keyword: keyword });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. selectedRow = null;
  29. learun.layerForm({
  30. id: 'form',
  31. title: '新增',
  32. url: top.$.rootUrl + '/BaseManager/BaseWarea/Form?warehouseId=' + warehouseId,
  33. width: 700,
  34. height: 400,
  35. callBack: function (id) {
  36. return top[id].acceptClick(refreshGirdData);
  37. }
  38. });
  39. });
  40. // 编辑
  41. $('#lr_edit').on('click', function () {
  42. var keyValue = $('#gridtable').jfGridValue('F_NO');
  43. selectedRow = $('#gridtable').jfGridGet('rowdata');
  44. if (learun.checkrow(keyValue)) {
  45. learun.layerForm({
  46. id: 'form',
  47. title: '编辑',
  48. url: top.$.rootUrl + '/BaseManager/BaseWarea/Form?keyValue=' + keyValue,
  49. width: 700,
  50. height: 400,
  51. callBack: function (id) {
  52. return top[id].acceptClick(refreshGirdData);
  53. }
  54. });
  55. }
  56. });
  57. // 删除
  58. $('#lr_delete').on('click', function () {
  59. var keyValue = $('#gridtable').jfGridValue('F_NO');
  60. if (learun.checkrow(keyValue)) {
  61. learun.layerConfirm('是否确认删除该项!', function (res) {
  62. if (res) {
  63. learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseWarea/DeleteForm', { keyValue: keyValue }, function () {
  64. refreshGirdData();
  65. });
  66. }
  67. });
  68. }
  69. });
  70. $('#lr_import').on('click', function () {
  71. learun.layerForm({
  72. id: 'ImportForm',
  73. title: '导入Excel数据',
  74. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + typnum,
  75. width: 600,
  76. height: 400,
  77. maxmin: true,
  78. btn: null
  79. });
  80. });
  81. $('#lr_exportnow').on('click', function () {
  82. learun.layerForm({
  83. id: "ExcelExportForm",
  84. title: '导出Excel数据',
  85. url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("区域列表")),
  86. width: 500,
  87. height: 380,
  88. callBack: function (id) {
  89. return top[id].acceptClick();
  90. },
  91. btn: ['导出Excel', '关闭']
  92. });
  93. });
  94. },
  95. inittree: function () {
  96. $('#warehouseTree').lrtree({
  97. url: top.$.rootUrl + '/BaseManager/BaseWarea/GetTree',
  98. param: { parentId: '0' },
  99. nodeClick: page.treeNodeClick
  100. });
  101. $('#warehouseTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  102. },
  103. treeNodeClick: function (item) {
  104. if (item.parentId == 0) {
  105. warehouseId = "";
  106. } else {
  107. warehouseId = item.id;
  108. }
  109. $('#titleinfo').text(item.text);
  110. //$('#department_select').lrselectRefresh({
  111. // // 访问数据接口地址
  112. // url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
  113. // // 访问数据接口参数
  114. // param: { companyId: companyId, parentId: '0' },
  115. //});
  116. page.search();
  117. },
  118. initGird: function () {
  119. $('#gridtable').jfGrid({
  120. url: top.$.rootUrl + '/BaseManager/BaseWarea/GetPageList',
  121. headData: [
  122. learun.jfFormatter.col_F_NO("区域编号"),
  123. learun.jfFormatter.col_F_NAME("区域名称"),
  124. {
  125. label: '区域类型', name: 'F_FTYPE', width: 100, align: "left"
  126. , formatterAsync: function (callback, value, row) {
  127. learun.clientdata.getAsync('dataItem', {
  128. Rowkey: value,
  129. GrpCode: 'EWAreaType',
  130. getType: 'Num',
  131. callback: function (item) {
  132. callback(item.F_NAME);
  133. }
  134. });
  135. }
  136. },
  137. {
  138. label: '所属仓库', name: 'F_WAREHOUSENO', width: 150, align: "left"
  139. , formatterAsync: function (callback, value, row) {
  140. learun.clientdata.getAsync('warehouse', {
  141. key: value,
  142. callback: function (item) {
  143. callback(item.F_NAME);
  144. }
  145. });
  146. }
  147. },
  148. learun.jfFormatter.col_F_ISSTOP(),
  149. learun.jfFormatter.col_F_ADDUSERNO(),
  150. learun.jfFormatter.col_F_ADDTIME(),
  151. learun.jfFormatter.col_F_EDITUSERNO(),
  152. learun.jfFormatter.col_F_EDITTIME(),
  153. learun.jfFormatter.col_F_MEMO()
  154. ],
  155. mainId: 'F_NO',
  156. sidx: 'F_NO',
  157. reloadSelected: true,
  158. isPage: true
  159. });
  160. page.search();
  161. },
  162. search: function (param) {
  163. param = param || {};
  164. param.warehouseId = warehouseId;
  165. $('#gridtable').jfGridSet('reload', param);
  166. }
  167. };
  168. refreshGirdData = function () {
  169. page.search();
  170. };
  171. page.init();
  172. }