Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
28dbdfb0
Commit
28dbdfb0
authored
Oct 20, 2025
by
malihua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收入支出合计
parent
40c7aaf6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
26 deletions
+54
-26
roke_product_income_expense/controller/main.py
+5
-1
roke_product_income_expense/static/src/js/index.html
+49
-25
No files found.
roke_product_income_expense/controller/main.py
View file @
28dbdfb0
...
...
@@ -150,6 +150,10 @@ class ProductIncomeExpenseIframe(http.Controller):
_self
.
env
.
cr
.
execute
(
sql
,
params
)
rows
=
_self
.
env
.
cr
.
dictfetchall
()
# 计算当前页的收入合计和支出合计
total_income
=
round
(
sum
(
row
.
get
(
'income'
,
0
)
or
0
for
row
in
rows
),
2
)
total_expenditure
=
round
(
sum
(
row
.
get
(
'expenditure'
,
0
)
or
0
for
row
in
rows
),
2
)
# 查询总数
sql_count
=
f
"SELECT COUNT(*) FROM roke_product_income_expense WHERE {where_sql}"
_self
.
env
.
cr
.
execute
(
sql_count
,
params
[:
-
2
])
# 去掉 limit 和 offset
...
...
@@ -174,7 +178,7 @@ class ProductIncomeExpenseIframe(http.Controller):
"user_name"
:
user_name
,
"create_date"
:
create_date
,
})
return
{
"code"
:
0
,
"message"
:
"获取成功!"
,
"data"
:
data
,
"count"
:
count
}
return
{
"code"
:
0
,
"message"
:
"获取成功!"
,
"data"
:
data
,
"count"
:
count
,
"total_income"
:
total_income
,
"total_expenditure"
:
total_expenditure
}
@http.route
(
"/roke/product/product_income_expense/delete"
,
type
=
"json"
,
auth
=
'none'
,
cors
=
'*'
,
csrf
=
False
)
def
product_income_expense_delete
(
self
):
...
...
roke_product_income_expense/static/src/js/index.html
View file @
28dbdfb0
...
...
@@ -4,16 +4,18 @@
<head>
<meta
charset=
"UTF-8"
/>
<title>
财务收支记录
</title>
<!-- 引入element-ui CSS样式 -->
<!-- 引入element-ui CSS样式
、vue js、axios.js、moment.js、element-ui.js 文件
-->
<link
rel=
"stylesheet"
href=
"/roke_product_income_expense/static/src/js/element-ui/index.css"
/>
<!-- 引入 vue js文件 -->
<script
src=
"/roke_product_income_expense/static/src/js/js/vue.js"
></script>
<!-- 引入 axios js文件 -->
<script
src=
"/roke_product_income_expense/static/src/js/js/axios.min.js"
></script>
<!-- moment.js 处理时间、日期 -->
<script
src=
"/roke_product_income_expense/static/src/js/js/moment.js"
></script>
<!-- 引入 element-ui js文件 -->
<script
src=
"/roke_product_income_expense/static/src/js/element-ui/index.js"
></script>
<!-- <link rel="stylesheet" href="./css/index.css" />
<script src="./js/vue.js"></script>
<script src="./js/axios.min.js"></script>
<script src="./js/moment.js"></script>
<script src="./js/index.js"></script> -->
</head>
<body>
...
...
@@ -74,35 +76,31 @@
</el-table-column>
</el-table>
</div>
<div
style=
"display: flex;justify-content: flex-end; text-align: right; margin-bottom: 5px;"
>
<el-input
style=
"width: 15%;"
v-model=
"abstract_value"
placeholder=
"请填写摘要信息"
@
change=
"select_change"
></el-input>
<el-input
style=
"width: 15%;"
v-model=
"abstract_value"
placeholder=
"请填写摘要信息"
@
change=
"select_change"
></el-input>
<el-select
v-model=
"select_value"
clearable
placeholder=
"请选择收支类型"
@
change=
"select_change"
>
<el-option
v-for=
"item in select_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-select
class=
"margin_sty"
v-model=
"machinery_type_value"
clearable
placeholder=
"请选择类型"
@
change=
"machinery_type_change"
>
<el-option
v-for=
"item in machinery_type_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input
style=
"width: 15%;"
v-model=
"customer_value"
placeholder=
"请填写客户名称"
@
change=
"select_change"
></el-input>
<el-date-picker
class=
"margin_sty"
v-model=
"datePickerValue"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期
"
end-placeholder=
"结束日期"
format=
"yyyy-MM-dd"
value-format=
"yyyy-MM-dd"
@
change=
"datePickerChange"
>
<el-input
style=
"width: 15%;"
v-model=
"customer_value"
placeholder=
"请填写客户名称"
@
change=
"select_change"
></el-input>
<el-date-picker
class=
"margin_sty"
v-model=
"datePickerValue"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
format=
"yyyy-MM-dd"
value-format=
"yyyy-MM-dd
"
@
change=
"datePickerChange"
>
</el-date-picker>
<el-button
type=
"primary"
@
click=
"export_click"
>
导出
</el-button>
<el-button
v-if=
"edit_state"
type=
"primary"
@
click=
"save_modifications"
>
保存修改
</el-button>
</div>
<el-table
:data=
"dataList"
border
height=
"500"
:row-style=
"{height: '0'}"
:key=
"table_key"
s
tyle=
"width: 100%;border: 1px solid black;border-color: black"
:cell-style=
"tableCellStyle
"
:header-cell-style=
"tableHeaderCellStyle"
>
<el-table
ref=
"table"
:data=
"dataList"
border
height=
"500"
:row-style=
"{height: '0'}"
:key=
"table_key"
s
how-summary
:summary-method=
"getSummaries"
style=
"width: 100%;border: 1px solid black;border-color: black
"
:
cell-style=
"tableCellStyle"
:
header-cell-style=
"tableHeaderCellStyle"
>
<el-table-column
label=
"业务日期"
align=
"center"
width=
"150"
>
<template
slot-scope=
"scope"
>
<el-date-picker
v-if=
"scope.row.whether_edit"
v-model=
"scope.row.business_date"
type=
"date"
...
...
@@ -201,7 +199,7 @@
<script>
new
Vue
({
el
:
"#app"
,
delimiters
:
[
"[["
,
"]]"
],
// 替换原本vue的
{{ key }}
取值方式(与odoo使用的jinja2冲突问题)
delimiters
:
[
"[["
,
"]]"
],
// 替换原本vue的取值方式(与odoo使用的jinja2冲突问题)
data
()
{
return
{
...
...
@@ -251,11 +249,15 @@
customer_value
:
''
,
abstract_value
:
''
,
edit_state
:
false
,
edit_list
:
[]
edit_list
:
[],
total_income
:
0
,
// 收入总计
total_expenditure
:
0
,
// 支出总计
};
},
created
()
{
// axios.defaults.baseURL = 'http://jzjx.dws.rokecloud.com'
// axios.defaults.baseURL = 'http://192.168.8.61:8020'
this
.
user_name
=
this
.
getUrlSearch
(
'user_name'
)
//截取url后面的参数
this
.
user_id
=
this
.
getUrlSearch
(
'user_id'
)
this
.
createList
[
0
].
user_name
=
this
.
user_name
...
...
@@ -264,7 +266,31 @@
this
.
TableHeight
=
window
.
innerHeight
;
this
.
getDataList
()
},
updated
()
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
table
.
doLayout
()
})
},
methods
:
{
getSummaries
(
param
)
{
const
{
columns
,
data
}
=
param
const
sums
=
[]
columns
.
forEach
((
column
,
index
)
=>
{
if
(
index
===
0
)
{
sums
[
index
]
=
'总价'
return
}
else
if
(
index
===
3
)
{
sums
[
index
]
=
this
.
total_income
return
}
else
if
(
index
===
4
)
{
sums
[
index
]
=
this
.
total_expenditure
return
}
else
{
sums
[
index
]
=
''
}
})
return
sums
},
// 保存修改
save_modifications
()
{
for
(
let
i
=
0
;
i
<
this
.
edit_list
.
length
;
i
++
)
{
...
...
@@ -337,8 +363,6 @@
this
.
getDataList
()
},
select_change
(
e
)
{
console
.
log
(
e
);
console
.
log
(
this
.
select_value
);
this
.
getDataList
()
},
// 列表 时间过滤
...
...
@@ -397,6 +421,8 @@
item
.
whether_edit
=
false
});
this
.
dataList
=
res
.
data
.
result
.
data
this
.
total_income
=
res
.
data
.
result
.
total_income
||
0
this
.
total_expenditure
=
res
.
data
.
result
.
total_expenditure
||
0
}
else
{
this
.
$message
({
type
:
"error"
,
...
...
@@ -405,7 +431,6 @@
}
this
.
loading
=
false
;
}).
catch
(
err
=>
{
console
.
log
(
err
);
this
.
$message
({
type
:
"error"
,
message
:
"接口报错,获取列表数据失败"
,
...
...
@@ -413,7 +438,6 @@
})
},
item_edit
(
scope
)
{
console
.
log
(
scope
);
this
.
edit_list
.
push
(
scope
.
row
)
this
.
edit_state
=
true
scope
.
row
.
whether_edit
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment