DeskProduct.js 8.0 KB

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