OdDynamicAnalysis.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * 删除按钮
  3. */
  4. Ext.define('erp.view.core.button.OdDynamicAnalysis',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpOrderAnalysisButton',
  7. id:'oddynamicanalysis',
  8. text: '订单异动分析',
  9. requires:['erp.util.BaseUtil'],
  10. initComponent : function(){
  11. this.callParent(arguments);
  12. },
  13. listeners:{
  14. click:function(btn){
  15. var id=Ext.getCmp('mm_id').getValue();
  16. var OrderWin = new Ext.window.Window({
  17. id : 'OrderWin',
  18. title: "订单异动分析",
  19. height: "70%",
  20. width: "93%",
  21. maximizable : false,
  22. closeAction:'destroy',
  23. buttonAlign : 'center',
  24. autoScroll:true,
  25. layout : 'anchor',
  26. listeners:{
  27. beforeshow: function(win){
  28. var values='';
  29. values+=id+",";
  30. Ext.Ajax.request({
  31. url:basePath+'pm/mps/getMaxCode.action',
  32. params:{
  33. code:id
  34. },
  35. method : 'post',
  36. callback : function(options,success,response){
  37. var res = new Ext.decode(response.responseText);
  38. if(res.data)
  39. { values+=res.data;
  40. Ext.getCmp('oddynamicanalysis').getGridColumnsAndStore(win,values);
  41. }
  42. }
  43. })
  44. }
  45. },
  46. items:[{
  47. xtype: 'grid',
  48. loadMask:'true',
  49. columns: [{
  50. text: '物料编号',
  51. cls: 'x-grid-header-1',
  52. dataIndex:'MD_PRODCODE',
  53. width: 130
  54. },{
  55. text: '物料名称',
  56. cls: 'x-grid-header-1',
  57. dataIndex: 'PR_DETAIL',
  58. width: 110
  59. },{
  60. text: '规格',
  61. cls: 'x-grid-header-1',
  62. dataIndex: 'PR_SPEC',
  63. width: 100
  64. },{
  65. text: '订单编号',
  66. cls: 'x-grid-header-1',
  67. dataIndex: 'MD_ORDERCODE',
  68. width: 100
  69. },{
  70. text: '订单序号',
  71. cls: 'x-grid-header-1',
  72. dataIndex: 'MD_ORDERDETNO',
  73. width: 80
  74. },{
  75. text: '订单类型',
  76. cls: 'x-grid-header-1',
  77. dataIndex: 'MD_ORDERKIND',
  78. width: 90
  79. },{
  80. text: '差异数',
  81. cls: 'x-grid-header-1',
  82. dataIndex: 'DIFFQTY',
  83. width: 100
  84. },{
  85. text: '差异描述',
  86. cls: 'x-grid-header-1',
  87. dataIndex: 'CHANGEKIND',
  88. width: 100
  89. },{
  90. text: '本次计划数',
  91. cls: 'x-grid-header-1',
  92. dataIndex: 'QTY1',
  93. width: 100
  94. },{
  95. text: '上次计划数',
  96. cls: 'x-grid-header-1',
  97. dataIndex: 'QTY2',
  98. width: 100
  99. }],
  100. columnLines: true,
  101. store: new Ext.data.Store({
  102. fields: ['MD_PRODCODE', 'PR_DETAIL', 'PR_SPEC','MD_ORDERCODE','MD_ORDERDETNO','MD_ORDERKIND','DIFFQTY','CHANGEKIND','QTY1','QTY2'],
  103. data: [{},{},{},{},{},{},{},{},{},{},{},{}]
  104. })
  105. }],
  106. bbar: ['->',{
  107. text:'导出',
  108. iconCls: 'x-button-icon-excel',
  109. cls: 'x-btn-gray',
  110. handler: function(btn){
  111. var grid=Ext.getCmp('win').down('grid');//.getGrid();
  112. var BaseUtil=Ext.create('erp.util.BaseUtil');
  113. BaseUtil.exportGrid(grid,'订单异动分析');
  114. }
  115. },{
  116. text:'关闭',
  117. cls: 'x-btn-gray',
  118. iconCls: 'x-button-icon-close',
  119. listeners: {
  120. click: function(){
  121. OrderWin.close();
  122. }
  123. }
  124. },'->']
  125. });
  126. OrderWin.show();
  127. }
  128. },
  129. getGridColumnsAndStore: function(view,values){
  130. var me = this;
  131. Ext.getCmp('oddynamicanalysis').setLoading(true,view);
  132. Ext.Ajax.request({//拿到grid的columns
  133. url : basePath+"pm/mps/OrderAnalysis.action",
  134. params: {
  135. caller: 'OrderAnalysis',
  136. condition: values
  137. },
  138. method : 'post',
  139. callback : function(options,success,response){
  140. var res = new Ext.decode(response.responseText);
  141. view.down('grid').store.loadData(res.data);
  142. Ext.getCmp('oddynamicanalysis').setLoading(false,view);
  143. if(res.exceptionInfo){
  144. showError(res.exceptionInfo);
  145. return;
  146. }
  147. }
  148. });
  149. },
  150. setLoading : function(b,view) {
  151. var mask = this.mask;
  152. this.mask = mask = new Ext.LoadMask(view.down('grid'), {
  153. msg : "处理中,请稍后...",
  154. msgCls : 'z-index:10000;'
  155. });
  156. if (b)
  157. mask.show();
  158. else
  159. mask.hide();
  160. }
  161. });