Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
cdc42d4b
Commit
cdc42d4b
authored
Aug 24, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 导出自动分页
parent
6a189251
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
6 deletions
+25
-6
list-table.js
client/components/list/list-table/list-table.js
+1
-1
awards.controller.js
server/duiba/controller/awards.controller.js
+18
-3
rankopenprize.service.js
server/duiba/service/rankopenprize.service.js
+6
-2
No files found.
client/components/list/list-table/list-table.js
View file @
cdc42d4b
...
...
@@ -92,7 +92,7 @@ Component({
// 获取中奖名单
async
handleOpenWinnerList
(
evt
)
{
const
{
activityId
}
=
evt
.
target
.
dataset
.
x
.
record
;
const
{
data
,
success
}
=
await
findWinnerInfoList
({
activityId
});
const
{
data
,
success
}
=
await
findWinnerInfoList
({
activityId
});
if
(
success
)
{
this
.
setData
({
...
...
server/duiba/controller/awards.controller.js
View file @
cdc42d4b
...
...
@@ -14,14 +14,16 @@ let resultsModel = new ResultsModel();
// 活动中奖名单
const
findWinnerInfoList
=
async
(
context
)
=>
{
let
{
activityId
activityId
,
pageNo
=
1
,
pageSize
=
500
}
=
context
.
data
;
if
(
!
activityId
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
);
}
let
rankopenprizeService
=
new
RankopenprizeService
(
context
);
// 获取活动中奖列表
let
awardslist
=
await
rankopenprizeService
.
getAwardslistByActivityId
(
activityId
);
let
awardslist
=
await
rankopenprizeService
.
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
);
console
.
log
(
`awardslist:
${
JSON
.
stringify
(
awardslist
)}
`
);
let
winnersObj
=
{};
awardslist
.
forEach
((
v
,
index
,
arr
)
=>
{
...
...
@@ -62,8 +64,21 @@ const exportAwardsList = async (context) => {
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
);
}
let
rankopenprizeService
=
new
RankopenprizeService
(
context
);
let
pageNo
=
1
;
let
pageSize
=
500
let
awardslist
=
[]
// 自动分页
while
(
awardslist
.
length
>=
(
pageNo
-
1
)
*
500
)
{
let
nowPageNoList
=
await
rankopenprizeService
.
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
);
awardslist
=
[...
awardslist
,
...
nowPageNoList
]
pageNo
+=
1
;
}
// 获取活动中奖列表
let
awardslist
=
await
rankopenprizeService
.
getAwardslistByActivityId
(
activityId
);
console
.
log
(
`awardslist:
${
JSON
.
stringify
(
awardslist
)}
`
);
let
xlsxData
=
[
...
...
server/duiba/service/rankopenprize.service.js
View file @
cdc42d4b
...
...
@@ -28,11 +28,11 @@ class RankopenprizeService {
}
// 根据活动id查找中奖名单
async
getAwardslistByActivityId
(
activityId
)
{
async
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
)
{
if
(
!
activityId
)
{
return
false
;
}
return
await
this
.
rankopenprizeDao
.
find
(
let
result
=
await
this
.
rankopenprizeDao
.
find
(
{
activityId
:
activityId
,
},
...
...
@@ -41,8 +41,12 @@ class RankopenprizeService {
score
:
-
1
,
rankTime
:
-
1
,
},
limit
:
pageSize
,
skip
:
(
pageNo
-
1
)
*
pageSize
,
}
);
return
result
}
}
...
...
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