Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/useRecordRecyclingDelayView.js =================================================================== diff -u -r41249 -r41255 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/useRecordRecyclingDelayView.js (.../useRecordRecyclingDelayView.js) (revision 41249) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/useRecordRecyclingDelayView.js (.../useRecordRecyclingDelayView.js) (revision 41255) @@ -92,6 +92,53 @@ Ext.onReady(function () { Ext.QuickTips.init(); + + function adjustLayoutHeight() { + if (!viewport || !appGrid || !reportForm) return; + + setTimeout(function() { + try { + // 方法1:使用视口高度计算 + var viewportHeight = Ext.getBody().getViewSize().height; + var formEl = form.getEl(); + var formHgt = form.collapsed ? 0 : (formEl ? formEl.getHeight() : formHeight); + + // 方法2:使用 Viewport 内部计算 + var centerRegion = viewport.findBy(function(comp) { + return comp.region === 'center'; + })[0]; + + var availableHeight; + if (centerRegion && centerRegion.getHeight) { + availableHeight = centerRegion.getHeight(); + } else { + // 备用计算方法 + availableHeight = viewportHeight - formHgt - 10; + } + + // 确保合理的高度范围 + availableHeight = Math.max(300, availableHeight); + + // console.log('高度计算 - 视口:', viewportHeight, '表单:', formHgt, '可用:', availableHeight); + + // 设置 Grid 高度 + reportForm.setHeight(availableHeight); + appGrid.setHeight(availableHeight - 10); + + // 强制刷新 + if (viewport.doLayout) { + viewport.doLayout(); + } + if (reportForm.doLayout) { + reportForm.doLayout(); + } + + } catch(e) { + console.error('高度调整错误:', e); + } + }, 100); + } + var tousseDefinitionStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getAllTousseDefinitionData.do', @@ -158,13 +205,28 @@ region: 'north', buttonAlign: 'center', labelAlign: 'right', - // collapsible: true, - // collapseMode: 'mini', + collapsible: true, + collapseMode: 'mini', split: true, border: 0, frame: true, bodyStyle: 'padding:0px auto;margin:0px', height: formHeight, + listeners: { + // 添加展开/折叠事件监听 + collapse: function() { + // console.log('表单折叠'); + adjustLayoutHeight(); + }, + expand: function() { + // console.log('表单展开'); + adjustLayoutHeight(); + }, + afterrender: function() { + // 表单渲染后也调整一次高度 + setTimeout(adjustLayoutHeight, 100); + } + }, items: [{ layout: 'column', height: 103, @@ -352,10 +414,16 @@ rootVisible: false, autoScroll: true, title: entityName, - // height: '100%', //gridHeight, - autoHeight: true, + // height: gridHeight, + // autoHeight: true, frame: false, columns: appColumns, + listeners: { + render: function() { + // Grid 渲染后调整高度 + setTimeout(adjustLayoutHeight, 200); + } + }, loader: new Ext.tree.TreeLoader({ url: WWWROOT + '/disinfectSystem/reports/recyclingdelay.mhtml', requestMethod: 'GET', @@ -456,19 +524,28 @@ id: 'reportFormID', frame: false,//渲染面板 autoScroll: true,//自动显示滚动条 - autoHeight: true, + // autoHeight: true, collapsible: true,//允许展开和收缩 bodyStyle: 'border:1px solid #afd7af; height: 100%;', bodyPadding: 0, + // layout: 'fit', items: appGrid }); var viewport = new Ext.Viewport({ layout: 'border', + listeners: { + afterrender: function () { + adjustLayoutHeight() + }, + resize: function () { + adjustLayoutHeight() + } + }, items: [form, { region: 'center', margins: '0 0 0 0', - autoHeight: true, + // autoHeight: true, layout: 'fit', items: reportForm }]