跳转明细

This commit is contained in:
Admin
2025-12-20 08:45:24 +00:00
parent 81da4ab6fc
commit 315ff35816
6 changed files with 147 additions and 35 deletions
@@ -1,7 +1,7 @@
/** @odoo-module **/
import {registry} from "@web/core/registry";
import {useService} from "@web/core/utils/hooks";
import { useService } from "@web/core/utils/hooks";
const {Component, useState, onWillStart, onMounted} = owl;
@@ -409,6 +409,36 @@ class FinancialPage extends Component {
}
// 数据点击事件
onDataCellClick(params){
const queryParams = {
project_id: params.row.id,
group_id: params.group.id,
date: params.filters.date,
};
let domain = []
if(queryParams.date){
domain.push(['sheet_id.create_date', '<=', queryParams.date])
}
if(queryParams.group_id){
domain.push(['sheet_id.company_id.id', '=', queryParams.group_id])
}
if(queryParams.project_id){
domain.push(['collection_id', '=', queryParams.project_id])
}
this.action.doAction({
type: 'ir.actions.act_window',
res_model: 'financial.sheet.line',
name: '提报数据明细',
view_mode: 'tree',
view_type: 'tree',
views: [[false, 'tree']],
target: 'new', // 以弹窗形式打开
domain: domain,
context: {},
})
}
// 重置筛选条件
onReset() {
this.state.filters = {
@@ -260,6 +260,36 @@ export class FinancialSinglePage extends Component {
this.notification.add("使用演示数据", { type: "info" });
}
// 数据点击事件
onDataCellClick(params){
const queryParams = {
project_id: params.row.id,
group_id: params.group.id,
date: params.filters.date,
};
let domain = []
if(queryParams.date){
domain.push(['summary_id.create_date', '<=', queryParams.date])
}
if(queryParams.group_id && Number.isFinite(queryParams.group_id)){
domain.push(['summary_id.company_id.id', '=', queryParams.group_id])
}
if(queryParams.project_id){
domain.push(['table_id', '=', queryParams.project_id])
}
this.action.doAction({
type: 'ir.actions.act_window',
res_model: 'information.summary.line',
name: '信息汇总明细',
view_mode: 'tree',
view_type: 'tree',
views: [[false, 'tree']],
target: 'new', // 以弹窗形式打开
domain: domain,
context: {},
})
}
fillExampleData() {
// 填充一些示例数据以便预览
const rows = this.state.tableData.rows;
@@ -115,8 +115,10 @@
<div class="diagonal-project">项目</div>
</div>
</th>
<t t-foreach="state.tableData.displayHeaders" t-as="group" t-key="group.id">
<th t-att-colspan="group.items.length" class="text-center group-header">
<t t-foreach="state.tableData.displayHeaders" t-as="group"
t-key="group.id">
<th t-att-colspan="group.items.length"
class="text-center group-header">
<div class="group-title">
<t t-esc="group.groupName"/>
</div>
@@ -125,7 +127,8 @@
</tr>
<!-- 第二行:具体项目 -->
<tr>
<t t-foreach="state.tableData.displayHeaders" t-as="group" t-key="group.id">
<t t-foreach="state.tableData.displayHeaders" t-as="group"
t-key="group.id">
<t t-foreach="group.items" t-as="item" t-key="item.id">
<th class="text-center item-header">
<div class="item-title">
@@ -155,9 +158,14 @@
<t t-esc="dataRow.name"/>
</div>
</td>
<t t-foreach="state.tableData.displayHeaders" t-as="group" t-key="group.id">
<t t-foreach="state.tableData.displayHeaders" t-as="group"
t-key="group.id">
<t t-foreach="group.items" t-as="item" t-key="item.id">
<td class="text-end data-cell">
<td class="text-end data-cell" t-on-click="() => this.onDataCellClick({
row: dataRow,
group: group,
filters: state.filters
})">
<t t-esc="dataRow.values[item.id] || '0.00'"/>
</td>
</t>
@@ -169,7 +177,8 @@
<!-- 无数据时显示空状态 -->
<t t-if="state.tableData.rows.length === 0">
<tr>
<td t-att-colspan="state.tableData.displayHeaders.length + 1" class="text-center text-muted py-5">
<td t-att-colspan="state.tableData.displayHeaders.length + 1"
class="text-center text-muted py-5">
<div class="empty-state">
<i class="fa fa-database fa-2x mb-3"></i>
<p class="mb-0">暂无数据</p>
@@ -160,7 +160,12 @@
<!-- 数据列 -->
<t t-foreach="state.tableData.headers" t-as="header" t-key="header.id">
<td class="text-center data-cell">
<td class="text-center data-cell"
t-on-click="() => this.onDataCellClick({
row: dataRow,
group: header,
filters: state.filters
})">
<t t-esc="dataRow.values[header.id] || ''"/>
</td>
</t>
+46 -8
View File
@@ -11,15 +11,53 @@
</record>
<!-- <menuitem id="financial_sheet_collection_report_menu"-->
<!-- name="财务数据表报表"-->
<!-- action="yuthon_account_report.financial_data_action"-->
<!-- sequence="10"/>-->
<menuitem id="financial_sheet_collection_report_menu"
name="财务数据表报表"
action="yuthon_account_report.financial_data_action"
sequence="10"/>
<!-- <menuitem id="information_summary_table_report_menu"-->
<!-- name="信息汇总报表"-->
<!-- action="yuthon_account_report.information_aggregation_action"-->
<!-- sequence="10"/>-->
<menuitem id="information_summary_table_report_menu"
name="信息汇总报表"
action="yuthon_account_report.information_aggregation_action"
sequence="10"/>
<record id="financial_sheet_line_tree" model="ir.ui.view">
<field name="name">financial.sheet.line.tree</field>
<field name="model">financial.sheet.line</field>
<field name="arch" type="xml">
<tree string="财务数据表收集" editable="bottom" create="False" delete="False">
<field name="collection_id"/>
<field name="this_issue_number"/>
<field name="same_last_year"/>
<field name="remake"/>
</tree>
</field>
</record>
<record id="financial_sheet_line_action" model="ir.actions.act_window">
<field name="name">财务数据表收集明细</field>
<field name="res_model">financial.sheet.line</field>
<field name="view_mode">tree</field>
</record>
<record id="Information_Summary_Line_tree" model="ir.ui.view">
<field name="name">information.summary.line.tree</field>
<field name="model">information.summary.line</field>
<field name="arch" type="xml">
<tree string="信息汇总收集" editable="bottom" create="False" delete="False">
<field name="table_id"/>
<field name="this_year"/>
<field name="remake"/>
</tree>
</field>
</record>
<record id="Information_Summary_Line_action" model="ir.actions.act_window">
<field name="name">信息汇总收集明细</field>
<field name="res_model">information.summary.line</field>
<field name="view_mode">tree</field>
</record>
<!-- <record id="information_aggregation_action" model="ir.actions.client">-->