Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
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
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
45cc51ab
Commit
45cc51ab
authored
Aug 16, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:排序
parent
65495721
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
15 deletions
+39
-15
src/modules/task-center/data-center/components/StudyTable.tsx
+39
-15
No files found.
src/modules/task-center/data-center/components/StudyTable.tsx
View file @
45cc51ab
...
...
@@ -26,16 +26,33 @@ function StudyTable(props: any) {
const
[
list
,
setList
]
=
useState
<
any
[]
>
([]);
const
[
total
,
setTotal
]
=
useState
<
any
>
(
0
);
const
[
name
,
setName
]
=
useState
<
any
>
(
''
);
const
timer
=
useRef
<
any
>
(
null
)
const
[
orderFiled
,
setOrderFiled
]
=
useState
<
any
>
(
null
);
const
[
sort
,
setSort
]
=
useState
<
any
>
(
null
);
const
timer
=
useRef
<
any
>
(
null
);
const
sortNameMap
:
any
=
{
learnPercentage
:
'LEARN_NUM'
,
latelyLearnTime
:
'LATE_LEARN_TIME'
,
startLearnTime
:
'START_LEARN_TIME'
,
}
useEffect
(()
=>
{
getList
()
},
[
query
])
},
[
query
,
orderFiled
,
sort
])
function
getList
()
{
Service
.
Hades
(
'public/hades/getTaskCustomerRecordPage'
,
query
).
then
((
res
:
any
)
=>
{
const
_query
=
{
...
query
};
delete
_query
.
sortMap
;
if
(
sort
)
{
_query
.
sortMap
=
{
[
sortNameMap
[
orderFiled
]]:
sort
===
"ascend"
?
'SORT_ASC'
:
'SORT_DESC'
}
}
Service
.
Hades
(
'public/hades/getTaskCustomerRecordPage'
,
_query
).
then
((
res
:
any
)
=>
{
res
.
result
.
records
.
map
((
item
:
any
)
=>
{
item
.
department
=
item
.
departmentNameList
.
map
((
_item
:
any
)
=>
{
item
.
department
=
item
.
departmentNameList
.
map
((
_item
:
any
)
=>
{
if
(
_item
==
'1000'
)
{
return
'微信'
}
else
{
...
...
@@ -49,11 +66,6 @@ function StudyTable(props: any) {
})
}
const
columns
=
[
{
title
:
'学员'
,
...
...
@@ -75,11 +87,11 @@ function StudyTable(props: any) {
render
:
(
val
:
any
,
record
:
any
)
=>
{
return
<
div
>
{
record
.
department
.
map
((
item
:
any
,
index
:
number
)
=>
{
if
((
index
+
1
)
==
record
.
department
.
length
)
{
record
.
department
.
map
((
item
:
any
,
index
:
number
)
=>
{
if
((
index
+
1
)
==
record
.
department
.
length
)
{
return
item
}
else
{
return
[
item
,
';'
]
}
else
{
return
[
item
,
';'
]
}
})
...
...
@@ -105,7 +117,9 @@ function StudyTable(props: any) {
{
title
:
'学习进度'
,
key
:
'learnPercentage'
,
sorter
:
true
,
dataIndex
:
'learnPercentage'
,
sortOrder
:
(
orderFiled
==
'learnPercentage'
)
?
sort
:
null
,
render
:
(
val
:
any
,
record
:
any
)
=>
{
return
`
${
val
}
%`
;
},
...
...
@@ -117,8 +131,8 @@ function StudyTable(props: any) {
dataIndex
:
'latelyLearnTime'
,
sorter
:
true
,
width
:
240
,
sortOrder
:
(
orderFiled
==
'latelyLearnTime'
)
?
sort
:
null
,
render
:
(
val
:
any
,
record
:
any
)
=>
{
return
`
${
formatDate
(
'YYYY-MM-DD H:i'
,
parseInt
(
record
.
latelyLearnTime
))}
`
;
},
},
...
...
@@ -128,6 +142,8 @@ function StudyTable(props: any) {
dataIndex
:
'startLearnTime'
,
width
:
240
,
sorter
:
true
,
field
:
'yuiooo'
,
sortOrder
:
(
orderFiled
==
'startLearnTime'
)
?
sort
:
null
,
render
:
(
val
:
any
,
record
:
any
)
=>
{
return
<
div
>
{
formatDate
(
'YYYY-MM-DD H:i'
,
val
)
}
</
div
>;
},
...
...
@@ -154,6 +170,13 @@ function StudyTable(props: any) {
},
];
function
onChange
(
pagination
:
any
,
filters
:
any
,
sorter
:
any
,
extra
:
any
)
{
console
.
log
(
sorter
)
setOrderFiled
(
sorter
.
field
||
null
)
setSort
(
sorter
.
order
)
}
return
<
div
className=
"study_Table"
>
<
div
className=
"filter"
>
...
...
@@ -256,6 +279,7 @@ function StudyTable(props: any) {
storeUserId
:
User
.
getStoreUserId
(),
userId
:
User
.
getStoreUserId
(),
})
setSort
(
''
)
}
}
>

{
' '
}
</
span
>
...
...
@@ -275,7 +299,7 @@ function StudyTable(props: any) {
columns=
{
columns
}
pagination=
{
false
}
className=
'user-learning-table'
onChange=
{
()
=>
{
}
}
onChange=
{
onChange
}
showSorterTooltip=
{
false
}
bordered
/>
...
...
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