Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BudgetManagementSystem
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王利雷
BudgetManagementSystem
Commits
341ac144
Commit
341ac144
authored
May 16, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
劳务费数据库展示
parent
65a1aeaf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
21 deletions
+86
-21
DatabaseQueryHandler.java
src/main/java/handlers/DatabaseQueryHandler.java
+30
-0
BudgetService.java
src/main/java/service/impl/BudgetService.java
+0
-3
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+56
-18
No files found.
src/main/java/handlers/DatabaseQueryHandler.java
View file @
341ac144
...
...
@@ -3,10 +3,12 @@ package handlers;
import
beans.Budget
;
import
beans.Consultation
;
import
beans.Equipment
;
import
beans.Labour
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
dao.IConsultationDao
;
import
dao.IEquipmentDao
;
import
dao.ILabourDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -50,6 +52,34 @@ public class DatabaseQueryHandler {
}
@Autowired
private
ILabourDao
labourDao
;
@RequestMapping
(
"/Labour"
)
public
void
queryLabour
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"text/html;charset=utf-8"
);
PrintWriter
writer
=
response
.
getWriter
();
JSONObject
object
=
new
JSONObject
();
List
<
Labour
>
labours
=
labourDao
.
selectAll
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Labour
item
:
labours
)
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"people"
,
0
);
obj
.
put
(
"months"
,
0
);
obj
.
put
(
"nums"
,
0
);
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Autowired
private
IConsultationDao
consultationDao
;
@RequestMapping
(
"/Consultation"
)
public
void
queryConsultation
(
HttpServletRequest
request
,
HttpServletResponse
response
){
...
...
src/main/java/service/impl/BudgetService.java
View file @
341ac144
...
...
@@ -129,9 +129,6 @@ public class BudgetService implements IBudgetService {
return
(
int
)
diff
;
}
});
for
(
Equipment
equipment
:
equipments
)
{
map
.
put
(
equipment
,
0
);
}
Equipment
equipment
=
equipments
.
get
(
0
);
double
sum
=
0.0
;
int
i
=
0
;
...
...
src/main/webapp/budgetDetail.jsp
View file @
341ac144
...
...
@@ -134,7 +134,7 @@
<button
class=
"btn btn-success"
@
click=
"addToDatabase(sample)"
>
添加到数据库
</button>
</td>
</tr>
<tr
class=
"
success
"
>
<tr
class=
"
info
"
>
<td>
<select
v-model=
"selectedIndex"
class=
"form-control"
>
<option
v-for=
"(record,i) in database"
:value=
"i"
>
...
...
@@ -451,6 +451,24 @@
<button
class=
"btn btn-danger"
@
click=
"del(item)"
>
删除
</button>
</td>
</tr>
<tr
class=
"info"
>
<td>
<select
v-model=
"selectedIndex"
class=
"form-control"
>
<option
v-for=
"(record,i) in database"
:value=
"i"
>
{{record.name}}
</option>
</select>
</td>
<td>
<input
type=
"number"
v-model=
"database[selectedIndex].price"
class=
"form-control"
>
</td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].people"
class=
"form-control"
></td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].months"
class=
"form-control"
></td>
<td>
<button
class=
"btn btn-success"
@
click=
"add(database[selectedIndex])"
>
添加
</button>
</td>
</tr>
</tbody>
</table>
...
...
@@ -484,7 +502,7 @@
</td>
</tr>
<tr
class=
"
success
"
>
<tr
class=
"
info
"
>
<td>
<select
v-model=
"selectedIndex"
class=
"form-control"
>
<option
v-for=
"(record,i) in database"
:value=
"i"
>
...
...
@@ -570,25 +588,28 @@
function
(
data
)
{
this
.
items
=
data
.
body
.
data
;
console
.
log
(
"showlist"
);
updateBudgetPage
(
"equipment"
)
},
function
(
error
)
{
console
.
log
(
error
)
}
);
this
.
$http
.
get
(
"${pageContext.request.contextPath}/Database/Query/Equipment"
).
then
(
function
(
data
)
{
this
.
database
=
data
.
body
.
data
;
for
(
var
i
=
0
;
i
<
this
.
database
.
length
;
i
++
)
{
if
(
inItems
(
this
.
database
[
i
],
this
.
items
)){
this
.
database
.
splice
(
i
,
1
);
updateBudgetPage
(
"equipment"
);
this
.
$http
.
get
(
"${pageContext.request.contextPath}/Database/Query/Equipment"
).
then
(
function
(
data
)
{
var
tmp
=
data
.
body
.
data
;
for
(
var
i
=
0
;
i
<
tmp
.
length
;
i
++
)
{
if
(
inItems
(
tmp
[
i
],
this
.
items
)){
tmp
.
splice
(
i
,
1
);
}
}
this
.
database
=
tmp
;
console
.
log
(
"show database"
);
},
function
(
error
)
{
console
.
log
(
error
)
}
}
console
.
log
(
"show database"
);
)
},
function
(
error
)
{
console
.
log
(
error
)
}
)
)
;
},
doUpdate
:
function
(
item
,
curd
)
{
this
.
$http
.
post
(
"${pageContext.request.contextPath}/Budget/Modify/Equipment"
,
...
...
@@ -941,7 +962,9 @@
el
:
"#labour"
,
data
:
{
items
:
[],
sample
:
{
name
:
"sample"
,
price
:
0
,
nums
:
0
}
sample
:
{
name
:
"sample"
,
price
:
0
,
nums
:
0
},
selectedIndex
:
0
,
database
:[{
name
:
"sample"
,
price
:
0
,
nums
:
0
,
people
:
0
,
months
:
0
}]
},
methods
:
{
update
:
function
(
item
)
{
...
...
@@ -951,6 +974,7 @@
this
.
doUpdate
(
item
,
1
);
},
add
:
function
(
item
)
{
item
.
nums
=
1
;
this
.
doUpdate
(
item
,
0
);
},
showlist
:
function
()
{
...
...
@@ -962,6 +986,20 @@
},
function
(
error
)
{
console
.
log
(
error
)
}
);
this
.
$http
.
get
(
"${pageContext.request.contextPath}/Database/Query/Labour"
).
then
(
function
(
data
)
{
this
.
database
=
data
.
body
.
data
;
for
(
var
i
=
0
;
i
<
this
.
database
.
length
;
i
++
)
{
if
(
inItems
(
this
.
database
[
i
],
this
.
items
)){
this
.
database
.
splice
(
i
,
1
);
}
}
console
.
log
(
"show database"
);
},
function
(
error
)
{
console
.
log
(
error
)
}
)
},
doUpdate
:
function
(
item
,
curd
)
{
...
...
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