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
445041dc
Commit
445041dc
authored
Feb 20, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 玖姿收入支出添加类型字段
parent
0ad17b7f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
8 deletions
+69
-8
roke_product_income_expense/controller/main.py
+12
-4
roke_product_income_expense/models/product_income_expense.py
+2
-0
roke_product_income_expense/static/src/js/index.html
+55
-4
No files found.
roke_product_income_expense/controller/main.py
View file @
445041dc
...
...
@@ -35,6 +35,7 @@ class ProductIncomeExpenseIframe(http.Controller):
"business_date"
:
v
.
get
(
"business_date"
,
False
),
"abstract"
:
v
.
get
(
"abstract"
,
False
),
"income"
:
v
.
get
(
"income"
,
False
),
"machinery_type"
:
v
.
get
(
"machinery_type"
,
"其他"
),
"expenditure"
:
v
.
get
(
"expenditure"
,
False
)
}
_self
.
env
(
user
=
v
.
get
(
"user_id"
))[
"roke.product.income.expense"
]
.
create
(
data
)
...
...
@@ -48,12 +49,15 @@ class ProductIncomeExpenseIframe(http.Controller):
start_date
=
_self
.
jsonrequest
.
get
(
"start_date"
,
""
)
end_date
=
_self
.
jsonrequest
.
get
(
"end_date"
,
""
)
type_str
=
_self
.
jsonrequest
.
get
(
"type_str"
,
False
)
# income收入/expenditure支出
machinery_type
=
_self
.
jsonrequest
.
get
(
"machinery_type"
,
False
)
# income收入/expenditure支出
domain
=
[]
if
start_date
and
end_date
:
domain
.
append
((
"business_date"
,
">="
,
start_date
))
domain
.
append
((
"business_date"
,
"<="
,
end_date
))
if
type_str
:
domain
.
append
((
type_str
,
">"
,
0
))
if
machinery_type
:
domain
.
append
((
"machinery_type"
,
"="
,
machinery_type
))
data_list
=
_self
.
env
[
"roke.product.income.expense"
]
.
sudo
()
.
search
(
domain
,
limit
=
limit
,
offset
=
(
page
-
1
)
*
limit
,
order
=
"business_date desc, create_date desc"
)
...
...
@@ -65,6 +69,7 @@ class ProductIncomeExpenseIframe(http.Controller):
"business_date"
:
v
.
business_date
and
v
.
business_date
.
strftime
(
'
%
Y-
%
m-
%
d'
),
"abstract"
:
v
.
abstract
or
""
,
"income"
:
v
.
income
or
0
,
"machinery_type"
:
v
.
machinery_type
or
"其他"
,
"expenditure"
:
v
.
expenditure
or
0
,
"balance"
:
v
.
balance
or
0
,
"user_name"
:
v
.
create_uid
.
name
or
""
,
...
...
@@ -105,6 +110,7 @@ class ProductIncomeExpenseIframe(http.Controller):
"income"
:
v
.
income
or
0
,
"expenditure"
:
v
.
expenditure
or
0
,
"balance"
:
v
.
balance
or
0
,
"machinery_type"
:
v
.
machinery_type
or
'其他'
,
"user_name"
:
v
.
create_uid
.
name
or
""
,
"create_date"
:
v
.
create_date
+
datetime
.
timedelta
(
hours
=
8
),
})
...
...
@@ -127,8 +133,9 @@ class ProductIncomeExpenseIframe(http.Controller):
worksheet
.
write
(
0
,
2
,
"收入"
,
header_format
)
worksheet
.
write
(
0
,
3
,
"支出"
,
header_format
)
worksheet
.
write
(
0
,
4
,
"结余"
,
header_format
)
worksheet
.
write
(
0
,
5
,
"创建人"
,
header_format
)
worksheet
.
write
(
0
,
6
,
"创建时间"
,
header_format
)
worksheet
.
write
(
0
,
5
,
"类型"
,
header_format
)
worksheet
.
write
(
0
,
6
,
"创建人"
,
header_format
)
worksheet
.
write
(
0
,
7
,
"创建时间"
,
header_format
)
for
row_num
,
row_data
in
enumerate
(
data
):
worksheet
.
write_datetime
(
row_num
+
1
,
0
,
row_data
.
get
(
"business_date"
),
date_format
)
...
...
@@ -136,8 +143,9 @@ class ProductIncomeExpenseIframe(http.Controller):
worksheet
.
write_number
(
row_num
+
1
,
2
,
row_data
.
get
(
"income"
),
currency_format
)
worksheet
.
write_number
(
row_num
+
1
,
3
,
row_data
.
get
(
"expenditure"
),
currency_format
)
worksheet
.
write_number
(
row_num
+
1
,
4
,
row_data
.
get
(
"balance"
),
currency_format
)
worksheet
.
write
(
row_num
+
1
,
5
,
row_data
.
get
(
"user_name"
))
worksheet
.
write_datetime
(
row_num
+
1
,
6
,
row_data
.
get
(
"create_date"
),
datetime_format
)
worksheet
.
write
(
row_num
+
1
,
5
,
row_data
.
get
(
"machinery_type"
))
worksheet
.
write
(
row_num
+
1
,
6
,
row_data
.
get
(
"user_name"
))
worksheet
.
write_datetime
(
row_num
+
1
,
7
,
row_data
.
get
(
"create_date"
),
datetime_format
)
workbook
.
close
()
output
.
seek
(
0
)
...
...
roke_product_income_expense/models/product_income_expense.py
View file @
445041dc
...
...
@@ -14,6 +14,8 @@ class ProductIncomeExpense(models.Model):
income
=
fields
.
Float
(
string
=
"收入"
)
expenditure
=
fields
.
Float
(
string
=
"支出"
)
balance
=
fields
.
Float
(
string
=
"结余"
,
compute
=
"_compute_balance"
)
machinery_type
=
fields
.
Selection
([(
"烘干桶"
,
"烘干桶"
),
(
"钣金"
,
"钣金"
),
(
"颗粒机"
,
"颗粒机"
),
(
"其他"
,
"其他"
)],
default
=
"其他"
,
string
=
"类型"
)
@api.depends
(
"income"
,
"expenditure"
)
def
_compute_balance
(
self
):
...
...
roke_product_income_expense/static/src/js/index.html
View file @
445041dc
...
...
@@ -44,6 +44,17 @@
<el-input
v-model=
"scope.row.expenditure"
type=
"number"
placeholder=
"请输入"
></el-input>
</template>
</el-table-column>
<el-table-column
label=
"类型"
align=
"center"
width=
"180"
>
<template
slot-scope=
"scope"
>
<!-- <el-input v-model="scope.row.machinery_type" type="number" placeholder="请输入"></el-input> -->
<el-select
v-model=
"scope.row.machinery_type"
clearable
placeholder=
"请选择类型"
>
<el-option
v-for=
"item in machinery_type_options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</template>
</el-table-column>
<!-- <el-table-column label="创建人" align="center" width="110">
<template slot-scope="scope">
<div>
...
...
@@ -57,16 +68,22 @@
</template>
</el-table-column>
</el-table>
</div>
<div
style=
"text-align: right; margin-bottom: 5px;"
>
<el-select
v-model=
"select_value"
clearable
placeholder=
"请选择类型"
@
change=
"select_change"
>
<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
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-date-picker
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>
...
...
@@ -111,6 +128,13 @@
</div>
</template>
</el-table-column>
<el-table-column
label=
"类型"
align=
"center"
width=
"120"
>
<template
slot-scope=
"scope"
>
<div>
[[ scope.row.machinery_type ]]
</div>
</template>
</el-table-column>
<el-table-column
label=
"创建人"
align=
"center"
width=
"110"
>
<template
slot-scope=
"scope"
>
<div>
...
...
@@ -160,6 +184,7 @@
expenditure
:
''
,
user_name
:
''
,
user_id
:
null
,
machinery_type
:
''
}
],
datePickerValue
:
[
''
,
''
],
...
...
@@ -170,7 +195,21 @@
value
:
'expenditure'
,
label
:
'支出'
}],
select_value
:
''
machinery_type_options
:
[{
value
:
'烘干桶'
,
label
:
'烘干桶'
},
{
value
:
'钣金'
,
label
:
'钣金'
},
{
value
:
'颗粒机'
,
label
:
'颗粒机'
},
{
value
:
'其他'
,
label
:
'其他'
}],
select_value
:
''
,
machinery_type_value
:
''
};
},
...
...
@@ -184,6 +223,9 @@
this
.
getDataList
()
},
methods
:
{
machinery_type_change
(
e
)
{
this
.
getDataList
()
},
select_change
(
e
)
{
console
.
log
(
e
);
console
.
log
(
this
.
select_value
);
...
...
@@ -209,7 +251,8 @@
page
:
this
.
currentPageNo
,
//当前页码
start_date
:
this
.
datePickerValue
[
0
],
end_date
:
this
.
datePickerValue
[
1
],
type_str
:
this
.
select_value
type_str
:
this
.
select_value
,
machinery_type
:
this
.
machinery_type_value
}
axios
.
request
({
url
:
"/roke/product/product_income_expense/get"
,
...
...
@@ -306,6 +349,12 @@
},
// 保存
saveListData
()
{
if
(
this
.
createList
[
0
].
machinery_type
==
''
)
{
this
.
$message
({
type
:
"warning"
,
message
:
"请选择类型"
,
});
}
else
{
if
(
this
.
createList
[
0
].
income
!=
''
||
this
.
createList
[
0
].
expenditure
!=
''
)
{
this
.
loading
=
true
;
axios
.
request
({
...
...
@@ -349,6 +398,8 @@
message
:
"请填写收入或支出后保存"
,
});
}
}
},
// table样式
tableCellStyle
()
{
...
...
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