跳转明细
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label for="date_filter" class="form-label small">报表日期</label>
|
||||
<input
|
||||
type="date"
|
||||
class="form-control form-control-sm"
|
||||
id="date_filter"
|
||||
t-model="state.filters.date"
|
||||
type="date"
|
||||
class="form-control form-control-sm"
|
||||
id="date_filter"
|
||||
t-model="state.filters.date"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label for="company_filter" class="form-label small">公司</label>
|
||||
<select
|
||||
class="form-select form-select-sm"
|
||||
id="company_filter"
|
||||
t-model="state.filters.company"
|
||||
class="form-select form-select-sm"
|
||||
id="company_filter"
|
||||
t-model="state.filters.company"
|
||||
>
|
||||
<t t-foreach="state.companys" t-as="company" t-key="company.id">
|
||||
<option t-att-value="company.id"><t t-esc="company.name" /></option>
|
||||
@@ -37,9 +37,9 @@
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label for="employee_filter" class="form-label small">员工</label>
|
||||
<select
|
||||
class="form-select form-select-sm"
|
||||
id="employee_filter"
|
||||
t-model="state.filters.employee"
|
||||
class="form-select form-select-sm"
|
||||
id="employee_filter"
|
||||
t-model="state.filters.employee"
|
||||
>
|
||||
<t t-foreach="state.staffs" t-as="staff" t-key="staff.id">
|
||||
<option t-att-value="staff.id"><t t-esc="staff.name" /></option>
|
||||
@@ -50,19 +50,19 @@
|
||||
<!-- 按钮区域 -->
|
||||
<div class="col-lg-3 col-md-6 d-flex gap-2 align-items-end">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-sm flex-grow-1"
|
||||
t-att-disabled="state.loading"
|
||||
t-on-click="onSearch"
|
||||
type="button"
|
||||
class="btn btn-primary btn-sm flex-grow-1"
|
||||
t-att-disabled="state.loading"
|
||||
t-on-click="onSearch"
|
||||
>
|
||||
<i t-att-class="state.loading ? 'fa fa-spinner fa-spin me-1' : 'fa fa-search me-1'"/>
|
||||
<t t-esc="state.loading ? '查询中...' : '查询'"/>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-secondary btn-sm"
|
||||
t-att-disabled="state.loading"
|
||||
t-on-click="onReset"
|
||||
type="button"
|
||||
class="btn btn-outline-secondary btn-sm"
|
||||
t-att-disabled="state.loading"
|
||||
t-on-click="onReset"
|
||||
>
|
||||
<i class="fa fa-refresh me-1"/>
|
||||
重置
|
||||
@@ -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>
|
||||
|
||||
@@ -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">-->
|
||||
|
||||
@@ -704,4 +704,4 @@
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user