123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- Ext.define('erp.view.pm.atp.ATPOperateDetail', {
- extend: 'Ext.Viewport',
- layout: 'anchor',
- hideBorders: true,
- initComponent: function () {
- var me = this;
- Ext.apply(me, {
- items: [{
- items: [{
- xtype: "erpATPOpDetailFormPanel",
- anchor: '100% 20%'
- },
- {
- anchor: '100% 80%',
- xtype: "tabpanel",
- id: 'tabpanel',
- minTabWidth: 80,
- layout: 'border',
- items: [{
- title: '库存明细',
- id: 'ProductWh',
- iconCls: 'workrecord-log',
- /** items:[{
- xtype:'DeskProductGridPanel1',
- height:height,
- }]**/
- listeners: {
- activate: function (tab) {
- caller = 'Desk!ProductWh';
- var item = {
- itemId: 'ProductWhgrid',
- xtype: 'ATPOpDetailGridPanel1',
- height: height
- };
- var tabgrid = tab.getComponent('ProductWhgrid');
- if (!tab.getComponent('ProductWhgrid')) {
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- tabgrid.getCount("Desk!ProductWh", BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- },
- {
- title: '在 途',
- iconCls: 'workrecord-log',
- id: 'MPSPRonorder',
- listeners: {
- activate: function (tab) {
- caller = 'Desk!MPSPRonorder';
- var item = {
- itemId: 'MPSPRonordergrid',
- xtype: 'ATPOpDetailGridPanel2',
- height: height,
- };
- var tabgrid = tab.getComponent('MPSPRonordergrid');
- if (!tabgrid) {
- item.LastCondition = BaseQueryCondition;
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- //说明条件更新了
- tabgrid.getCount('MPSPRonordergrid', BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- },
- {
- title: '预 约',
- id: 'MakeCommit',
- iconCls: 'workrecord-log',
- listeners: {
- activate: function (tab) {
- caller = 'Desk!MakeCommit';
- var item = {
- itemId: 'MakeCommitgrid',
- xtype: 'ATPOpDetailGridPanel3',
- height: height
- };
- var tabgrid = tab.getComponent('MakeCommitgrid');
- if (!tabgrid) {
- item.LastCondition = BaseQueryCondition;
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- tabgrid.getCount('Desk!MakeCommit', BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- },
- {
- title: '需 求',
- iconCls: 'workrecord-log',
- id: 'ATPNeed',
- listeners: {
- activate: function (tab) {
- caller = 'ATPDATA';
- var item = {
- itemId: 'ATPNeedgrid',
- xtype: 'ATPOpDetailGridPanel4'
- };
- var tabgrid = tab.getComponent('ATPNeedgrid');
- if (!tabgrid) {
- item.LastCondition = BaseQueryCondition;
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- tabgrid.getCount('ATPDATA', BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- },
- {
- title: '供 应',
- iconCls: 'workrecord-log',
- id: 'ATPSupply',
- listeners: {
- activate: function (tab) {
- caller = 'ATPDATA';
- var item = {
- itemId: 'ATPSupplygrid',
- xtype: 'ATPOpDetailGridPanel5',
- height: height,
- region: 'north'
- };
- var tabgrid = tab.getComponent('ATPSupplygrid');
- if (!tabgrid) {
- item.LastCondition = BaseQueryCondition;
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- tabgrid.getCount('ATPDATA', BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- },
- {
- title: '运算明细',
- iconCls: 'workrecord-log',
- id: 'ATPResultDetail',
- listeners: {
- activate: function (tab) {
- caller = 'Desk!ATPResultDetail';
- var item = {
- itemId: 'ATPResultDetailgrid',
- xtype: 'ATPOpDetailGridPanel6',
- height: height,
- region: 'north'
- };
- var tabgrid = tab.getComponent('ATPResultDetailgrid');
- if (!tabgrid) {
- item.LastCondition = BaseQueryCondition;
- tab.add(item);
- } else {
- if (tabgrid.LastCondition != BaseQueryCondition) {
- tabgrid.getCount('Desk!ATPResultDetail', BaseQueryCondition);
- tabgrid.LastCondition = BaseQueryCondition;
- }
- }
- }
- }
- }
- ]
- }]
- }]
- });
- me.callParent(arguments);
- },
- getCount: function (caller, condition) {
- var me = this;
- var info = {};
- Ext.Ajax.request({ //拿到grid的数据总数count
- url: basePath + '/common/datalistCount.action',
- async: false,
- params: {
- caller: caller,
- condition: condition
- },
- method: 'post',
- callback: function (options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exception || res.exceptionInfo) {
- showError(res.exceptionInfo);
- return;
- }
- dataCount = res.count;
- pageSize = 1000, info = me.getColumnsAndStore(caller, condition, page, pageSize);
- }
- });
- return info;
- },
- getColumnsAndStore: function (caller, condition, page, pageSize) {
- var info = {};
- var me = this;
- Ext.Ajax.request({ //拿到grid的columns
- url: basePath + 'common/datalist.action',
- async: false,
- params: {
- caller: caller,
- condition: condition,
- page: page,
- pageSize: pageSize
- },
- method: 'post',
- callback: function (options, success, response) {
- var res = new Ext.decode(response.responseText);
- if (res.exception || res.exceptionInfo) {
- showError(res.exceptionInfo);
- return;
- };
- var data = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : []; //一定要去掉多余逗号,ie对此很敏感
- info.data = data;
- info.fields = res.fields;
- info.columns = res.columns;
- }
- });
- return info;
- },
- createGrid: function (store, column) {
- var grid = Ext.create('Ext.grid.Panel', {
- //emptyText : $I18N.common.grid.emptyText,
- columnLines: true,
- layout: 'fit',
- height: height,
- verticalScrollerType: 'paginggridscroller',
- loadMask: true,
- disableSelection: true,
- invalidateScrollerOnRefresh: false,
- viewConfig: {
- trackOver: false
- },
- id: 'grid3',
- selModel: Ext.create('Ext.selection.CheckboxModel', {
- headerWidth: 0
- }),
- xtype: 'gridpanel',
- plugins: [Ext.create('Ext.ux.grid.GridHeaderFilters')],
- columns: [],
- store: [],
- });
- return grid;
- }
- });
|