123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- Ext.define('erp.view.ma.MultiForm',{
- extend: 'Ext.Viewport',
- layout: 'anchor',
- hideBorders: true,
- initComponent : function(){
- var me = this;
- Ext.apply(me, {
- items: [{
- xtype: 'tabpanel',
- anchor: '100% 95%',
- id: 'mytab',
- items: []
- },{
- xtype: 'toolbar',
- anchor: '100% 5%',
- items: ['->',{
- iconCls: 'x-button-icon-preview',
- name: 'FormBook',
- cls: 'x-btn-gray',
- text: $I18N.common.button.erpFormBookButton
- },'-',{
- iconCls: 'x-button-icon-add',
- name: 'ReportFiles',
- cls: 'x-btn-gray',
- text: $I18N.common.button.erpReportFilesButton
- },'-',{
- iconCls: 'x-button-icon-set',
- name: 'listSetting',
- cls: 'x-btn-gray',
- id:"listSetting",
- text: '列表设置'
- },'-',{
- iconCls: 'tree-save',
- name: 'save',
- cls: 'x-btn-gray',
- text: $I18N.common.button.erpSaveButton
- },'-',{
- xtype: 'erpSyncButton',
- style: {
- marginLeft: '0'
- }
- },'-',{
- iconCls: 'tree-delete',
- name: 'delete',
- cls: 'x-btn-gray',
- text: $I18N.common.button.erpDeleteButton
- },'-',{
- iconCls: 'tree-close',
- name: 'close',
- cls: 'x-btn-gray',
- text: $I18N.common.button.erpCloseButton
- },'->']
- }]
- });
- me.callParent(arguments);
- me.insertFormSet();
- me.insertGridSet();
- },
- insertFormSet: function() {
- var me = this, whoami = getUrlParam('formParam'), cond = getUrlParam('formCondition');
- if(typeof whoami !== 'undefined' || typeof cond !== 'undefined') {
- if(cond) {
- cond = cond.replace('IS','=');// 兼容原写法
- whoami = cond.substr(cond.indexOf('=')+1);
- }
- var formParams = whoami.split(','), tab = me.down('#mytab');
- Ext.Array.each(formParams, function(p, index){
- tab.add({
- title: '主表' + (formParams.length > 1 ? (index + 1) : ''),
- iconCls: 'formset-form',
- layout: 'anchor',
- items: [],
- dataId: p,
- listeners: {
- activate: function(panel) {
- me.getForm(panel);
- }
- }
- });
- });
- }
- },
- insertGridSet: function() {
- var me = this, whoami = getUrlParam('gridParam'), cal = getUrlParam('whoami');
- if(typeof whoami !== 'undefined') {
- cal && (whoami = cal);
- if(whoami && whoami != 'null') {
- var gridParams = whoami.split(','), tab = me.down('#mytab');
- Ext.Array.each(gridParams, function(p, index){
- tab.add({
- title: '从表' + (gridParams.length > 1 ? (index + 1) : ''),
- iconCls: 'formset-grid',
- layout: 'anchor',
- items: [],
- whoami: p,
- listeners: {
- activate: function(panel) {
- // 第一次activate的时候才加载
- me.getDetail(panel);
- }
- }
- });
- });
- }
- }
- },
- getForm: function(panel) {
- if(!panel.firstReady) {
- panel.add([{
- xtype: 'myform',
- deleteUrl: 'ma/deleteMultiForm.action',
- updateUrl: 'ma/updateMultiForm.action',
- keyField: 'fo_id',
- anchor: '100% 45%',
- dataId: panel.dataId
- },{
- xtype: 'mygrid',
- anchor: '100% 55%',
- dataId: panel.dataId
- }]);
- panel.firstReady = true;
- }
- },
- getDetail: function(panel) {
- if(!panel.firstReady) {
- panel.add({
- xtype: 'mydetail',
- id: panel.id + '-grid',
- whoami: panel.whoami,
- anchor: '100% 100%',
- detno: 'dg_sequence',
- necessaryField: 'dg_field',
- keyField: 'dg_id',
- plugins: Ext.create('Ext.grid.plugin.CellEditing', {
- pluginId: panel.id + '-grid-editor',
- clicksToEdit: 1
- })
- });
- panel.firstReady = true;
- }
- }
- });
|