diff --git a/yuthon_report/static/src/components/yuthon_report/receivable_flow_report.js b/yuthon_report/static/src/components/yuthon_report/receivable_flow_report.js index 655fb2de3..87da7d964 100644 --- a/yuthon_report/static/src/components/yuthon_report/receivable_flow_report.js +++ b/yuthon_report/static/src/components/yuthon_report/receivable_flow_report.js @@ -88,6 +88,8 @@ class ReceivableFlowReport extends Component { minWidth: 250, flex: 1.5, pinned: 'left', + // 合同/明细列左对齐显示 + cellClass: 'receivable-group-left', cellRendererParams: { suppressCount: true, innerRenderer: (params) => { @@ -370,6 +372,33 @@ class ReceivableFlowReport extends Component { this.grid.setGridOption('pinnedBottomRowData', []); this.state.stats = []; } + + // 数据加载完成后,自动调整所有列宽,等价于菜单里的“自动调整所有列” + if (this.grid) { + // 优先走 columnApi(老版本写法) + const columnApi = this.grid.columnApi && this.grid.columnApi; + if (columnApi && typeof columnApi.autoSizeAllColumns === 'function') { + try { + if (typeof columnApi.getAllColumns === 'function') { + const allCols = columnApi.getAllColumns() || []; + const allColIds = allCols.map(col => col.getColId()); + columnApi.autoSizeAllColumns(allColIds); + } else { + columnApi.autoSizeAllColumns(); + } + } catch (e) { + // 忽略自动调整异常,避免影响报表使用 + console.error('autoSizeAllColumns failed:', e); + } + } else if (typeof this.grid.autoSizeAllColumns === 'function') { + // 新版 GridApi 可能直接挂在 grid 上 + try { + this.grid.autoSizeAllColumns(); + } catch (e) { + console.error('grid.autoSizeAllColumns failed:', e); + } + } + } } this._applyManagementTypeFilter(); } diff --git a/yuthon_report/static/src/components/yuthon_report/receivable_report.xml b/yuthon_report/static/src/components/yuthon_report/receivable_report.xml index 9229e82a8..c81e9c32b 100644 --- a/yuthon_report/static/src/components/yuthon_report/receivable_report.xml +++ b/yuthon_report/static/src/components/yuthon_report/receivable_report.xml @@ -172,7 +172,7 @@
-
+
diff --git a/yuthon_report/static/src/components/yuthon_report/yuthon_report.scss b/yuthon_report/static/src/components/yuthon_report/yuthon_report.scss index a0fa3f486..21619d483 100644 --- a/yuthon_report/static/src/components/yuthon_report/yuthon_report.scss +++ b/yuthon_report/static/src/components/yuthon_report/yuthon_report.scss @@ -62,4 +62,22 @@ color: #16a34a !important; font-weight: bold; text-align: center; - } \ No newline at end of file + } + + /* 应收流水报表:列标题/内容居中 */ + .receivable-flow-grid .ag-header-cell-label { + justify-content: center; + } + + .receivable-flow-grid .ag-cell { + display: flex; + align-items: center; + justify-content: center; + text-align: center; + } + + /* 合同/明细列左对齐(通过 JS 的 cellClass: 'receivable-group-left' 标记) */ + .receivable-flow-grid .ag-cell.receivable-group-left { + justify-content: flex-start; + text-align: left; + }