MultiForm.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. Ext.define('erp.view.oa.custom.MultiForm',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. layout: 'anchor',
  10. items: [{
  11. xtype: 'tabpanel',
  12. anchor: '100% 95%',
  13. id: 'mytab',
  14. items: [{
  15. title: '主表',
  16. id: 'maintab',
  17. iconCls: 'formset-form',
  18. layout: 'anchor',
  19. items: [{
  20. xtype: 'myform',
  21. saveUrl:'ma/saveMultiForm.action',
  22. deleteUrl: 'ma/deleteMultiForm.action',
  23. updateUrl: 'ma/updateMultiForm.action',
  24. getIdUrl: 'common/getId.action?seq=FORM_SEQ',
  25. keyField: 'fo_id',
  26. caller:caller,
  27. anchor: '100% 45%'
  28. },{
  29. xtype: 'customgrid',
  30. anchor: '100% 55%'
  31. }]
  32. },{
  33. title: '从表',
  34. id: 'detailtab',
  35. iconCls: 'formset-grid',
  36. layout: 'anchor',
  37. items: [{
  38. xtype: 'mydetail',
  39. anchor: '100% 100%',
  40. detno: 'dg_sequence',
  41. necessaryField: 'dg_field',
  42. keyField: 'dg_id',
  43. getGridColumnsAndStore: function(){
  44. var grid = this;
  45. var main = parent.Ext.getCmp("content-panel");
  46. if(!main)
  47. main = parent.parent.Ext.getCmp("content-panel");
  48. if(main){
  49. main.getActiveTab().setLoading(true);//loading...
  50. }
  51. Ext.Ajax.request({//拿到grid的columns
  52. url : basePath + 'common/singleGridPanel.action',
  53. async: false,
  54. params: {
  55. caller: grid.caller,
  56. condition: "dg_caller='" + whoami + "'"
  57. },
  58. method : 'post',
  59. callback : function(options,success,response){
  60. if(main){
  61. main.getActiveTab().setLoading(false);
  62. }
  63. var res = new Ext.decode(response.responseText);
  64. if(res.exceptionInfo){
  65. showError(res.exceptionInfo);return;
  66. }
  67. if(res.columns){
  68. grid.columns = res.columns;
  69. grid.fields = res.fields;
  70. grid.columns.push({
  71. xtype: 'checkcolumn',
  72. text: '配置',
  73. width: 60,
  74. dataIndex: 'deploy',
  75. cls: "x-grid-header-1",
  76. locked: true,
  77. editor: {
  78. xtype: 'checkbox',
  79. cls: "x-grid-checkheader-editor"
  80. }
  81. });
  82. grid.fields.push({name: 'deploy', type: 'bool'});
  83. //renderer
  84. grid.getRenderer();
  85. var data = Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']'));
  86. Ext.each(data, function(d){
  87. d.deploy = true;
  88. });
  89. grid.data = data;
  90. if(res.dbfinds.length > 0){
  91. grid.dbfinds = res.dbfinds;
  92. }
  93. //取数据字典配置
  94. grid.getDataDictionaryData('CUSTOMTABLEDETAIL');
  95. grid.reconfigureGrid();
  96. }
  97. }
  98. });
  99. }
  100. }]
  101. }]
  102. },{
  103. xtype: 'toolbar',
  104. anchor: '100% 5%',
  105. items: ['->',{
  106. xtype: 'erpUUListenerButton'
  107. },'-',{
  108. iconCls: 'x-button-icon-preview',
  109. name: 'preview',
  110. cls: 'x-btn-gray',
  111. text: $I18N.common.button.erpPreviewButton
  112. },'-',{
  113. iconCls: 'tree-save',
  114. name: 'save',
  115. cls: 'x-btn-gray',
  116. text: $I18N.common.button.erpSaveButton
  117. },'-',{
  118. xtype: 'erpSyncButton',
  119. },'-',{
  120. iconCls: 'tree-delete',
  121. name: 'delete',
  122. cls: 'x-btn-gray',
  123. text: $I18N.common.button.erpDeleteButton
  124. },'-',{
  125. iconCls: 'tree-close',
  126. name: 'close',
  127. cls: 'x-btn-gray',
  128. text: $I18N.common.button.erpCloseButton
  129. },'->']
  130. }]
  131. }]
  132. });
  133. me.callParent(arguments);
  134. }
  135. });