DeskProduct.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. Ext.define('erp.view.pm.mps.DeskProduct', {
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent: function () {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. items: [{
  10. xtype: "erpDeskProductFormPanel",
  11. anchor: '100% 20%',
  12. },
  13. {
  14. anchor: '100% 80%',
  15. xtype: "tabpanel",
  16. id: 'tabpanel',
  17. minTabWidth: 80,
  18. layout: 'border',
  19. items: [{
  20. title: '库存明细',
  21. id: 'ProductWh',
  22. iconCls: 'workrecord-log',
  23. /** items:[{
  24. xtype:'DeskProductGridPanel1',
  25. height:height,
  26. }]**/
  27. listeners: {
  28. activate: function (tab) {
  29. caller = 'Desk!ProductWh';
  30. var item = {
  31. itemId: 'ProductWhgrid',
  32. xtype: 'DeskProductGridPanel1',
  33. height: height,
  34. };
  35. var tabgrid = tab.getComponent('ProductWhgrid');
  36. if (!tab.getComponent('ProductWhgrid')) {
  37. tab.add(item);
  38. } else {
  39. if (tabgrid.LastCondition != BaseQueryCondition) {
  40. tabgrid.getCount("Desk!ProductWh", BaseQueryCondition);
  41. tabgrid.LastCondition = BaseQueryCondition;
  42. }
  43. }
  44. }
  45. }
  46. },
  47. {
  48. title: '在 途',
  49. iconCls: 'workrecord-log',
  50. id: 'MPSPRonorder',
  51. listeners: {
  52. activate: function (tab) {
  53. caller = 'Desk!MPSPRonorder';
  54. var item = {
  55. itemId: 'MPSPRonordergrid',
  56. xtype: 'DeskProductGridPanel2',
  57. height: height,
  58. };
  59. var tabgrid = tab.getComponent('MPSPRonordergrid');
  60. if (!tabgrid) {
  61. item.LastCondition = BaseQueryCondition;
  62. tab.add(item);
  63. } else {
  64. if (tabgrid.LastCondition != BaseQueryCondition) {
  65. //说明条件更新了
  66. tabgrid.getCount('MPSPRonordergrid', BaseQueryCondition);
  67. tabgrid.LastCondition = BaseQueryCondition;
  68. }
  69. }
  70. }
  71. }
  72. },
  73. {
  74. title: '预 约',
  75. id: 'MakeCommit',
  76. iconCls: 'workrecord-log',
  77. listeners: {
  78. activate: function (tab) {
  79. caller = 'Desk!MakeCommit';
  80. var item = {
  81. itemId: 'MakeCommitgrid',
  82. xtype: 'DeskProductGridPanel3',
  83. height: height,
  84. };
  85. var tabgrid = tab.getComponent('MakeCommitgrid');
  86. if (!tabgrid) {
  87. item.LastCondition = BaseQueryCondition;
  88. tab.add(item);
  89. } else {
  90. if (tabgrid.LastCondition != BaseQueryCondition) {
  91. tabgrid.getCount('Desk!MakeCommit', BaseQueryCondition);
  92. tabgrid.LastCondition = BaseQueryCondition;
  93. }
  94. }
  95. }
  96. }
  97. },
  98. {
  99. title: '需 求',
  100. iconCls: 'workrecord-log',
  101. id: 'MPSNeed',
  102. listeners: {
  103. activate: function (tab) {
  104. caller = 'Desk!MPSNeed';
  105. var item = {
  106. itemId: 'MPSNeedgrid',
  107. xtype: 'DeskProductGridPanel4'
  108. };
  109. var tabgrid = tab.getComponent('MPSNeedgrid');
  110. if (!tabgrid) {
  111. item.LastCondition = BaseQueryCondition;
  112. tab.add(item);
  113. } else {
  114. if (tabgrid.LastCondition != BaseQueryCondition) {
  115. tabgrid.getCount('Desk!MPSNeed', BaseQueryCondition);
  116. tabgrid.LastCondition = BaseQueryCondition;
  117. }
  118. }
  119. }
  120. }
  121. },
  122. {
  123. title: '供 应',
  124. iconCls: 'workrecord-log',
  125. id: 'MPSSupply',
  126. listeners: {
  127. activate: function (tab) {
  128. caller = 'Desk!MPSSupply';
  129. var item = {
  130. itemId: 'MPSSupplygrid',
  131. xtype: 'DeskProductGridPanel5',
  132. height: height,
  133. region: 'north'
  134. };
  135. var tabgrid = tab.getComponent('MPSSupplygrid');
  136. if (!tabgrid) {
  137. item.LastCondition = BaseQueryCondition;
  138. tab.add(item);
  139. } else {
  140. if (tabgrid.LastCondition != BaseQueryCondition) {
  141. tabgrid.getCount('Desk!MPSSupply', BaseQueryCondition);
  142. tabgrid.LastCondition = BaseQueryCondition;
  143. }
  144. }
  145. }
  146. }
  147. },
  148. {
  149. title: '运算明细',
  150. iconCls: 'workrecord-log',
  151. id: 'MrpResultDetail',
  152. listeners: {
  153. activate: function (tab) {
  154. caller = 'Desk!MrpResultDetail';
  155. var item = {
  156. itemId: 'MrpResultDetailgrid',
  157. xtype: 'DeskProductGridPanel6',
  158. height: height,
  159. region: 'north'
  160. };
  161. var tabgrid = tab.getComponent('MrpResultDetailgrid');
  162. if (!tabgrid) {
  163. item.LastCondition = BaseQueryCondition;
  164. tab.add(item);
  165. } else {
  166. if (tabgrid.LastCondition != BaseQueryCondition) {
  167. tabgrid.getCount('Desk!MrpResultDetail', BaseQueryCondition);
  168. tabgrid.LastCondition = BaseQueryCondition;
  169. }
  170. }
  171. }
  172. }
  173. },
  174. {
  175. title: 'BOM',
  176. iconCls: 'workrecord-log',
  177. },
  178. {
  179. title: '反 查',
  180. iconCls: 'workrecord-log',
  181. },
  182. {
  183. title: '历史明细',
  184. iconCls: 'workrecord-log',
  185. }],
  186. }]
  187. }]
  188. });
  189. me.callParent(arguments);
  190. },
  191. getCount: function (caller, condition) {
  192. var me = this;
  193. var info = {};
  194. Ext.Ajax.request({ //拿到grid的数据总数count
  195. url: basePath + '/common/datalistCount.action',
  196. async: false,
  197. params: {
  198. caller: caller,
  199. condition: condition
  200. },
  201. method: 'post',
  202. callback: function (options, success, response) {
  203. var res = new Ext.decode(response.responseText);
  204. if (res.exception || res.exceptionInfo) {
  205. showError(res.exceptionInfo);
  206. return;
  207. }
  208. dataCount = res.count;
  209. pageSize = 1000, info = me.getColumnsAndStore(caller, condition, page, pageSize);
  210. }
  211. });
  212. return info;
  213. },
  214. getColumnsAndStore: function (caller, condition, page, pageSize) {
  215. var info = {};
  216. var me = this;
  217. Ext.Ajax.request({ //拿到grid的columns
  218. url: basePath + 'common/datalist.action',
  219. async: false,
  220. params: {
  221. caller: caller,
  222. condition: condition,
  223. page: page,
  224. pageSize: pageSize
  225. },
  226. method: 'post',
  227. callback: function (options, success, response) {
  228. var res = new Ext.decode(response.responseText);
  229. if (res.exception || res.exceptionInfo) {
  230. showError(res.exceptionInfo);
  231. return;
  232. };
  233. var data = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : []; //一定要去掉多余逗号,ie对此很敏感
  234. info.data = data;
  235. info.fields = res.fields;
  236. info.columns = res.columns;
  237. }
  238. });
  239. return info;
  240. },
  241. createGrid: function (store, column) {
  242. var grid = Ext.create('Ext.grid.Panel', {
  243. //emptyText : $I18N.common.grid.emptyText,
  244. columnLines: true,
  245. layout: 'fit',
  246. height: height,
  247. verticalScrollerType: 'paginggridscroller',
  248. loadMask: true,
  249. disableSelection: true,
  250. invalidateScrollerOnRefresh: false,
  251. viewConfig: {
  252. trackOver: false
  253. },
  254. id: 'grid3',
  255. selModel: Ext.create('Ext.selection.CheckboxModel', {
  256. headerWidth: 0
  257. }),
  258. xtype: 'gridpanel',
  259. plugins: [Ext.create('Ext.ux.grid.GridHeaderFilters')],
  260. columns: [],
  261. store: [],
  262. });
  263. return grid;
  264. }
  265. });