Index.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * 描 述:订单
  3. */
  4. var refreshGirdData; // 更新数据
  5. var logbegin = '';
  6. var logend = '';
  7. var selectedRow;
  8. var bootstrap = function ($, learun) {
  9. var psuid = "";
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGrid();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. page.search({queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  20. });
  21. // 刷新
  22. $('#lr_refresh').on('click', function () {
  23. location.reload();
  24. });
  25. // 作废
  26. $('#lr_cancel').on('click', function () {
  27. var keyValue = $('#gridtable').jfGridValue('F_no');
  28. if (learun.checkrow(keyValue)) {
  29. learun.layerConfirm('是否确认作废该入库单?', function (res) {
  30. if (res) {
  31. learun.deleteForm(top.$.rootUrl + '/OrderManager/EntryOrder/DeleteForm', { keyValue: keyValue }, function () {
  32. refreshGirdData();
  33. });
  34. }
  35. });
  36. }
  37. });
  38. // 导出数据
  39. $('#lr_exportnow').on('click', function () {
  40. var subsuid = "";
  41. if (psuid == "") {
  42. psuid = $('#gridtable').attr('id');
  43. }
  44. else if (psuid != "") {
  45. var t = $('#' + psuid).attr('id');
  46. if (t == undefined)
  47. psuid = $('#gridtable').attr('id');
  48. }
  49. var mainGridId = $('#gridtable').attr('id');
  50. learun.layerForm({
  51. id: "ExcelExportForm",
  52. title: '导出Excel数据',
  53. url: top.$.rootUrl + '/Utility/ExcelExportForm?mainGridId=' + mainGridId + '&gridId=' + psuid + '&filename=' + encodeURI(encodeURI("入库单")),
  54. width: 500,
  55. height: 380,
  56. callBack: function (id) {
  57. return top[id].acceptClick();
  58. },
  59. btn: ['导出Excel', '关闭']
  60. });
  61. });
  62. },
  63. initGrid: function () {
  64. $('#gridtable').jfGrid({
  65. url: top.$.rootUrl + '/OrderManager/EntryOrder/GetEntryOrderPageList',
  66. headData: [
  67. { label: '入库单号', name: 'F_no', width: 160, align: "left" },
  68. //learun.jfFormatter.col_EOrderState(),
  69. {
  70. label: '入库单类型', name: 'F_orderType', width: 100, align: "left",
  71. formatterAsync: function (callback, value, row) {
  72. learun.clientdata.getAsync('dataItem', {
  73. Rowkey: value,
  74. GrpCode: 'EntryOrderType',
  75. getType: 'Num',
  76. callback: function (item) {
  77. callback(item.F_NAME);
  78. }
  79. });
  80. },
  81. },
  82. { label: '仓库', name: 'F_warehouse', width: 100, align: "left" },
  83. { label: '关联单号', name: 'F_relatedOrderNo', width: 160, align: "left" },
  84. { label: '行数', name: 'F_totalOrderLines', width: 160, align: "left" },
  85. { label: '托盘号', name: 'F_trayNo', width: 100, align: "left" },
  86. {
  87. label: '订单状态', name: 'F_orderStatus', width: 100, align: "left",
  88. formatterAsync: function (callback, value, row) {
  89. learun.clientdata.getAsync('dataItem', {
  90. Rowkey: value,
  91. GrpCode: 'EOrderState',
  92. getType: 'Num',
  93. callback: function (item) {
  94. callback(item.F_NAME);
  95. }
  96. });
  97. },
  98. },
  99. {
  100. label: '是否保税', name: 'F_isBonded', width: 70, align: "center"
  101. , formatter: function (cellvalue) {
  102. if (cellvalue == 0) {
  103. return '<span class=\"label label-success\" style=\"cursor: pointer;\">否</span>';
  104. } else {
  105. return '<span class=\"label label-default\" style=\"cursor: pointer;\">是</span>';
  106. }
  107. }
  108. },
  109. {
  110. label: '是否整盘', name: 'F_fullPlate', width: 70, align: "center"
  111. , formatter: function (cellvalue) {
  112. if (cellvalue == 0) {
  113. return '<span class=\"label label-success\" style=\"cursor: pointer;\">否</span>';
  114. } else {
  115. return '<span class=\"label label-default\" style=\"cursor: pointer;\">是</span>';
  116. }
  117. }
  118. },
  119. { label: '备注', name: 'F_memo', width: 160, align: "left" },
  120. { label: '创建用户', name: 'F_addUserNo', width: 100, align: "left" },
  121. { label: '创建时间', name: 'F_addTime', width: 150, align: "left" },
  122. { label: '编辑用户', name: 'F_editUserNo', width: 100, align: "left" },
  123. { label: '编辑时间', name: 'F_editTime', width: 150, align: "left" },
  124. ],
  125. mainId: 'F_no',
  126. isPage: true,
  127. sidx: 'F_editTime',
  128. sord: 'desc',
  129. reloadSelected: true,
  130. isSubGrid: true, // 是否有子表
  131. subGridExpanded: function (subid, rowdata) {
  132. psuid = subid;
  133. $('#' + subid).jfGrid({
  134. url: top.$.rootUrl + '/OrderManager/EntryOrder/GetEntryOrderItem',
  135. headData: [
  136. { label: '物料编号', name: 'F_matNo', width: 100, align: "left" },
  137. { label: '物料名称', name: 'F_matName', width: 200, align: "left" },
  138. {
  139. label: '物料类型', name: 'F_matType', width: 100, align: "left",
  140. formatterAsync: function (callback, value, row) {
  141. learun.clientdata.getAsync('dataItem', {
  142. Rowkey: value,
  143. GrpCode: 'EMatType',
  144. getType: 'Num',
  145. callback: function (item) {
  146. callback(item.F_NAME);
  147. }
  148. });
  149. },
  150. },
  151. { label: '行号', name: 'F_boxNo', width: 100, align: "left" },
  152. { label: '数量', name: 'F_quantity', width: 100, align: "left" },
  153. //{ label: '实际入库数量', name: 'F_actualQty', width: 100, align: "left" },
  154. //{ label: '货位', name: 'F_location', width: 100, align: "left" },
  155. //{ label: '批次号', name: 'F_batchNo', width: 100, align: "left" },
  156. { label: '创建用户', name: 'F_addUserNo', width: 100, align: "left" },
  157. { label: '创建时间', name: 'F_addTime', width: 150, align: "left" },
  158. { label: '编辑用户', name: 'F_editUserNo', width: 100, align: "left" },
  159. { label: '编辑时间', name: 'F_editTime', width: 150, align: "left" },
  160. { label: '备注', name: 'F_memo', width: 100, align: "left" },
  161. ]
  162. });
  163. $('#' + subid).jfGridSet('reloadSon', { OrderNo: rowdata.F_no });
  164. }// 子表展开后调用函数
  165. });
  166. page.search({ queryJson: JSON.stringify({ Btime: logbegin, Etime: logend, keyword: $('#txt_Keyword').val() }) });
  167. },
  168. search: function (param) {
  169. $('#gridtable').jfGridSet('reload', param);
  170. }
  171. };
  172. // 保存数据后回调刷新
  173. refreshGirdData = function () {
  174. page.search();
  175. }
  176. page.init();
  177. }