调整接口
This commit is contained in:
@@ -6,6 +6,8 @@ import { Component, onMounted, useRef, useState } from "@odoo/owl";
|
||||
import { useBus, useService } from "@web/core/utils/hooks";
|
||||
import { standardActionServiceProps } from "@web/webclient/actions/action_service";
|
||||
import { DateTimeInput } from "@web/core/datetime/datetime_input";
|
||||
import { CheckBox } from "@web/core/checkbox/checkbox";
|
||||
import { Many2XAutocomplete } from "@web/views/fields/relational_utils";
|
||||
|
||||
class YouthonReport extends Component {
|
||||
setup() {
|
||||
@@ -19,6 +21,17 @@ class YouthonReport extends Component {
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
keyword: "",
|
||||
booleanValue:true,
|
||||
partnerValue:false,
|
||||
selectPartner:{},
|
||||
condition:false,
|
||||
conditions:[{
|
||||
'name':'name1',
|
||||
'value':'value1'
|
||||
},{
|
||||
'name':'name2',
|
||||
'value':'value2'
|
||||
}]
|
||||
});
|
||||
|
||||
this.config = this.props.action.context.report_config || {};
|
||||
@@ -33,12 +46,31 @@ class YouthonReport extends Component {
|
||||
rowData: [],
|
||||
sideBar: true,
|
||||
defaultColDef: { resizable: true, sortable: true, filter: true },
|
||||
|
||||
};
|
||||
this.grid = new agGrid.createGrid(this.gridRef.el, this.gridOptions);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变布尔值
|
||||
* @param e
|
||||
*/
|
||||
async onChangeBoolean(v){
|
||||
this.state.booleanValue = v
|
||||
}
|
||||
|
||||
getDomain(){
|
||||
// 过滤条件
|
||||
return [];
|
||||
}
|
||||
async onUpdatePartner(v){
|
||||
console.log(v)
|
||||
this.state.selectPartner = v
|
||||
this.state.partnerValue = v.display_name
|
||||
}
|
||||
|
||||
async onSearch() {
|
||||
const params = {
|
||||
date_start: this.state.startDate,
|
||||
@@ -71,7 +103,9 @@ class YouthonReport extends Component {
|
||||
YouthonReport.props = {...standardActionServiceProps };
|
||||
YouthonReport.template = "youthon_report.YouthonReport";
|
||||
YouthonReport.components = {
|
||||
DateTimeInput
|
||||
DateTimeInput,
|
||||
CheckBox,
|
||||
Many2XAutocomplete,
|
||||
};
|
||||
|
||||
registry.category("actions").add("youthon_report_client", YouthonReport);
|
||||
|
||||
@@ -1 +1,26 @@
|
||||
|
||||
.stat-card {
|
||||
border-radius: 0.75rem;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
||||
padding: 1.5rem;
|
||||
position: relative;
|
||||
}
|
||||
.stat-card.danger {
|
||||
border-top: 4px solid #f87171; /* 红色 */
|
||||
}
|
||||
.stat-card.success {
|
||||
border-top: 4px solid #4ade80; /* 绿色 */
|
||||
}
|
||||
.stat-card.info {
|
||||
border-top: 4px solid #60a5fa; /* 蓝色 */
|
||||
}
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
.stat-label {
|
||||
font-size: 1rem;
|
||||
color: #6b7280;
|
||||
}
|
||||
.stat-change {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
@@ -4,42 +4,164 @@
|
||||
<t t-name="youthon_report.YouthonReport">
|
||||
|
||||
<div class="container-fluid d-flex flex-column h-100 mt-2 pb-3 ">
|
||||
<div class="card mb-2">
|
||||
<div class="row g-4">
|
||||
|
||||
<!-- 未处理违约金 -->
|
||||
<div class="col-md-4">
|
||||
<div class="stat-card danger bg-white">
|
||||
<div class="stat-label mb-2">未处理违约金</div>
|
||||
<div class="stat-value text-dark">¥245,890.00</div>
|
||||
<div class="stat-change text-danger mt-1">
|
||||
▲ 12.5% <small class="text-muted">较上月</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 已收回违约金 -->
|
||||
<div class="col-md-4">
|
||||
<div class="stat-card success bg-white">
|
||||
<div class="stat-label mb-2">已收回违约金</div>
|
||||
<div class="stat-value text-dark">¥1,320,560.00</div>
|
||||
<div class="stat-change text-success mt-1">
|
||||
▲ 8.2% <small class="text-muted">较上月</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 违约合同数 -->
|
||||
<div class="col-md-4">
|
||||
<div class="stat-card info bg-white">
|
||||
<div class="stat-label mb-2">违约合同数</div>
|
||||
<div class="stat-value text-dark">148</div>
|
||||
<div class="stat-change text-danger mt-1">
|
||||
▲ 3.1% <small class="text-muted">较上月</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card mb-2 ">
|
||||
<div class="card-header">
|
||||
销售报表
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- 搜索区域 -->
|
||||
<div class="row mb-2" t-ref="search_area">
|
||||
<div class="col-4">
|
||||
<!-- m2o -->
|
||||
<div class="col-4">
|
||||
<label>筛选</label>
|
||||
<Many2XAutocomplete
|
||||
value="state.partnerValue?.display_name"
|
||||
resModel="'res.partner'"
|
||||
getDomain="getDomain"
|
||||
fieldString="'客户'"
|
||||
activeActions="{}"
|
||||
update.bind="onUpdatePartner"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<label>条件</label>
|
||||
<select id="formview_default_conditions" class="o_input"
|
||||
t-model="state.condition">
|
||||
|
||||
<option t-foreach="state.conditions" t-as="cond"
|
||||
t-att-value="cond.value"
|
||||
t-key="cond.name">
|
||||
<t t-esc="cond.name"/>
|
||||
</option>
|
||||
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<!-- bool -->
|
||||
<div class="col-4">
|
||||
<label>Boolean</label>
|
||||
<CheckBox value="state.booleanValue"
|
||||
className="'o_field_boolean o_boolean_toggle form-switch'"
|
||||
onChange.bind="onChangeBoolean">
|
||||
​
|
||||
</CheckBox>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label>日期范围</label>
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'date'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
<i class="oi oi-arrow-right"></i>
|
||||
<DateTimeInput
|
||||
value="state.endDate"
|
||||
type="'date'"
|
||||
placeholder="toPlaceholder"
|
||||
onChange="(date) => this.onChangeEndDate(date)"
|
||||
/>
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'date'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
<i class="oi oi-arrow-right"></i>
|
||||
<DateTimeInput
|
||||
value="state.endDate"
|
||||
type="'date'"
|
||||
placeholder="toPlaceholder"
|
||||
onChange="(date) => this.onChangeEndDate(date)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<label>日期范围</label>
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'date'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-2">至</div>
|
||||
<div class="col-5">
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'date'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<label>日期范围</label>
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'date'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
<i class="oi oi-arrow-right"></i>
|
||||
<DateTimeInput
|
||||
value="state.endDate"
|
||||
type="'date'"
|
||||
placeholder="toPlaceholder"
|
||||
onChange="(date) => this.onChangeEndDate(date)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label>关键字</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" t-model="state.keyword" />
|
||||
</div>
|
||||
<label>关键字(datetime)</label>
|
||||
<DateTimeInput
|
||||
value="state.startDate"
|
||||
type="'datetime'"
|
||||
placeholder="fromPlaceholder"
|
||||
onChange="(date) => this.onChangeStartDate(date)"
|
||||
/>
|
||||
<i class="oi oi-arrow-right"></i>
|
||||
<DateTimeInput
|
||||
value="state.endDate"
|
||||
type="'datetime'"
|
||||
placeholder="toPlaceholder"
|
||||
onChange="(date) => this.onChangeEndDate(date)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-4 align-self-end">
|
||||
|
||||
<button class="btn btn-primary" t-on-click="onSearch">搜索</button>
|
||||
<button class="btn btn-primary" t-on-click="onExportExcel">导出</button>
|
||||
|
||||
</div>
|
||||
<button class="btn btn-primary" t-on-click="onSearch">搜索</button>
|
||||
<button class="btn btn-primary" t-on-click="onExportExcel">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- <menuitem-->
|
||||
<!-- name="报表"-->
|
||||
<!-- id="yuthon_report_root"-->
|
||||
<!-- web_icon="yuthon_report,static/description/icon.png"-->
|
||||
<!-- sequence="125"-->
|
||||
<!-- />-->
|
||||
<menuitem
|
||||
name="报表"
|
||||
id="yuthon_report_root"
|
||||
web_icon="yuthon_report,static/description/icon.png"
|
||||
sequence="125"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -25,12 +25,12 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <menuitem id="menu_youthon_report"-->
|
||||
<!-- name="Youthon 报表"-->
|
||||
<!-- parent="yuthon_report_root"-->
|
||||
<!-- action="action_youthon_report"-->
|
||||
<!-- sequence="160"-->
|
||||
<!-- />-->
|
||||
<menuitem id="menu_youthon_report"
|
||||
name="Youthon 报表"
|
||||
parent="yuthon_report_root"
|
||||
action="action_youthon_report"
|
||||
sequence="160"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user