ATPOperateDetail.js.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. Ext.define('erp.view.pm.atp.ATPOperateDetail', {
  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: "erpATPOpDetailFormPanel",
  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: 'ATPOpDetailGridPanel1',
  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: 'ATPOpDetailGridPanel2',
  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: 'ATPOpDetailGridPanel3',
  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: 'ATPNeed',
  102. listeners: {
  103. activate: function (tab) {
  104. caller = 'ATPDATA';
  105. var item = {
  106. itemId: 'ATPNeedgrid',
  107. xtype: 'ATPOpDetailGridPanel4'
  108. };
  109. var tabgrid = tab.getComponent('ATPNeedgrid');
  110. if (!tabgrid) {
  111. item.LastCondition = BaseQueryCondition;
  112. tab.add(item);
  113. } else {
  114. if (tabgrid.LastCondition != BaseQueryCondition) {
  115. tabgrid.getCount('ATPDATA', BaseQueryCondition);
  116. tabgrid.LastCondition = BaseQueryCondition;
  117. }
  118. }
  119. }
  120. }
  121. },
  122. {
  123. title: '供 应',
  124. iconCls: 'workrecord-log',
  125. id: 'ATPSupply',
  126. listeners: {
  127. activate: function (tab) {
  128. caller = 'ATPDATA';
  129. var item = {
  130. itemId: 'ATPSupplygrid',
  131. xtype: 'ATPOpDetailGridPanel5',
  132. height: height,
  133. region: 'north'
  134. };
  135. var tabgrid = tab.getComponent('ATPSupplygrid');
  136. if (!tabgrid) {
  137. item.LastCondition = BaseQueryCondition;
  138. tab.add(item);
  139. } else {
  140. if (tabgrid.LastCondition != BaseQueryCondition) {
  141. tabgrid.getCount('ATPDATA', BaseQueryCondition);
  142. tabgrid.LastCondition = BaseQueryCondition;
  143. }
  144. }
  145. }
  146. }
  147. },
  148. {
  149. title: '运算明细',
  150. iconCls: 'workrecord-log',
  151. id: 'ATPResultDetail',
  152. listeners: {
  153. activate: function (tab) {
  154. caller = 'Desk!ATPResultDetail';
  155. var item = {
  156. itemId: 'ATPResultDetailgrid',
  157. xtype: 'ATPOpDetailGridPanel6',
  158. height: height,
  159. region: 'north'
  160. };
  161. var tabgrid = tab.getComponent('ATPResultDetailgrid');
  162. if (!tabgrid) {
  163. item.LastCondition = BaseQueryCondition;
  164. tab.add(item);
  165. } else {
  166. if (tabgrid.LastCondition != BaseQueryCondition) {
  167. tabgrid.getCount('Desk!ATPResultDetail', BaseQueryCondition);
  168. tabgrid.LastCondition = BaseQueryCondition;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. ]
  175. }]
  176. }]
  177. });
  178. me.callParent(arguments);
  179. },
  180. getCount: function (caller, condition) {
  181. var me = this;
  182. var info = {};
  183. Ext.Ajax.request({ //拿到grid的数据总数count
  184. url: basePath + '/common/datalistCount.action',
  185. async: false,
  186. params: {
  187. caller: caller,
  188. condition: condition
  189. },
  190. method: 'post',
  191. callback: function (options, success, response) {
  192. var res = new Ext.decode(response.responseText);
  193. if (res.exception || res.exceptionInfo) {
  194. showError(res.exceptionInfo);
  195. return;
  196. }
  197. dataCount = res.count;
  198. pageSize = 1000, info = me.getColumnsAndStore(caller, condition, page, pageSize);
  199. }
  200. });
  201. return info;
  202. },
  203. getColumnsAndStore: function (caller, condition, page, pageSize) {
  204. var info = {};
  205. var me = this;
  206. Ext.Ajax.request({ //拿到grid的columns
  207. url: basePath + 'common/datalist.action',
  208. async: false,
  209. params: {
  210. caller: caller,
  211. condition: condition,
  212. page: page,
  213. pageSize: pageSize
  214. },
  215. method: 'post',
  216. callback: function (options, success, response) {
  217. var res = new Ext.decode(response.responseText);
  218. if (res.exception || res.exceptionInfo) {
  219. showError(res.exceptionInfo);
  220. return;
  221. };
  222. var data = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : []; //一定要去掉多余逗号,ie对此很敏感
  223. info.data = data;
  224. info.fields = res.fields;
  225. info.columns = res.columns;
  226. }
  227. });
  228. return info;
  229. },
  230. createGrid: function (store, column) {
  231. var grid = Ext.create('Ext.grid.Panel', {
  232. //emptyText : $I18N.common.grid.emptyText,
  233. columnLines: true,
  234. layout: 'fit',
  235. height: height,
  236. verticalScrollerType: 'paginggridscroller',
  237. loadMask: true,
  238. disableSelection: true,
  239. invalidateScrollerOnRefresh: false,
  240. viewConfig: {
  241. trackOver: false
  242. },
  243. id: 'grid3',
  244. selModel: Ext.create('Ext.selection.CheckboxModel', {
  245. headerWidth: 0
  246. }),
  247. xtype: 'gridpanel',
  248. plugins: [Ext.create('Ext.ux.grid.GridHeaderFilters')],
  249. columns: [],
  250. store: [],
  251. });
  252. return grid;
  253. }
  254. });