From 7a75a73b0e8120a14d1a22d0dcd3eb18dffc89a8 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Mon, 23 Feb 2026 18:32:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yuthon_report/receivable_report.js | 48 +------------------ 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/yuthon_report/static/src/components/yuthon_report/receivable_report.js b/yuthon_report/static/src/components/yuthon_report/receivable_report.js index 97bdc3142..ac112b13a 100644 --- a/yuthon_report/static/src/components/yuthon_report/receivable_report.js +++ b/yuthon_report/static/src/components/yuthon_report/receivable_report.js @@ -19,8 +19,7 @@ class ReceivableReport extends Component { this.gridRef = useRef("grid"); console.log(this.props.action.context.report_config) - this.serviceOrm = useService("orm"); - this.actionService = useService("action"); // 获取 actionService 用于跳转 + this.serviceOrm = useService("orm") // 计算 本月的开始,结束 @@ -47,17 +46,10 @@ class ReceivableReport extends Component { onMounted(async () => { // 加载 ag-grid //await loadJS("https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"); - - // 统一处理 columns:给所有列添加穿透渲染器 - const columns = this.config.columns || []; - columns.forEach((col) => { - col.cellRenderer = this.linkRender.bind(this); - }); - this.gridOptions = { localeText: AG_GRID_LOCALE_CN, theme: agGrid.themeMaterial, - columnDefs: columns, + columnDefs: this.config.columns || [], rowData: [], rowClassRules: { 'ag-row-new-rent': function(params) { @@ -110,9 +102,6 @@ class ReceivableReport extends Component { items.push("chartRange"); return items; }, - context: { - actionService: this.actionService // 传递 actionService 用于穿透跳转 - } }; this.grid = new agGrid.createGrid(this.gridRef.el, this.gridOptions); @@ -120,39 +109,6 @@ class ReceivableReport extends Component { }); } - /** - * 穿透渲染器:将对象格式的字段渲染为可点击的链接 - * 如果字段值是对象(包含 model、id、display_name),则渲染为可点击链接 - * 否则直接显示原值 - */ - linkRender(params) { - if (!params.value) return ''; - - // 如果是对象格式(包含 model 和 id),渲染为可点击链接 - if (typeof params.value === 'object' && params.value.model && params.value.id) { - const { model, id, display_name } = params.value; - - const el = document.createElement('div'); - el.className = 'o_record_cell'; - el.innerText = display_name || ''; - el.classList.add('btn'); - el.classList.add('btn-link'); - el.onclick = () => { - params.context.actionService.doAction({ - type: 'ir.actions.act_window', - res_model: model, - res_id: id, - views: [[false, 'form']] - }); - }; - - return el; - } - - // 否则直接返回原值(纯文本/数字) - return params.value; - } - /** * 改变布尔值 * @param e