Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
H5Public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
作业
日程
统计图
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
H5Public
Commits
5999131d
提交
5999131d
authored
10月 09, 2019
作者:
周盛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
‘学号/姓名搜索修改
上级
df8f8787
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
23 行删除
+23
-23
index.js
HighStateComponent/Filter/index.js
+23
-23
没有找到文件。
HighStateComponent/Filter/index.js
浏览文件 @
5999131d
...
@@ -12,16 +12,15 @@ const queryOptions = async() => {
...
@@ -12,16 +12,15 @@ const queryOptions = async() => {
gradeList
,
gradeList
,
institutionList
,
institutionList
,
}
}
}
;
}
export
default
class
Filter
extends
React
.
Component
{
export
default
class
Filter
extends
React
.
Component
{
stattic
constructor
(
props
){
constructor
(
props
){
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
inputValue
:
''
,
formValues
:
{
formValues
:
{
gradeId
:
""
,
},
},
options
:
{
options
:
{
gradeList
:[],
gradeList
:[],
...
@@ -40,12 +39,9 @@ export default class Filter extends React.Component{
...
@@ -40,12 +39,9 @@ export default class Filter extends React.Component{
const
res
=
await
queryOptions
();
const
res
=
await
queryOptions
();
if
(
!
res
||
!
res
.
gradeList
||
!
res
.
institutionList
)
return
false
;
if
(
!
res
||
!
res
.
gradeList
||
!
res
.
institutionList
)
return
false
;
const
gradeList
=
res
.
gradeList
.
map
(
i
=>
({
key
:
i
.
remark
,
value
:
i
.
id
}));
const
gradeList
=
res
.
gradeList
.
map
(
i
=>
({
key
:
i
.
name
,
value
:
i
.
id
}));
const
institutionList
=
res
.
institutionList
.
map
(
i
=>
({
key
:
i
.
fullName
,
value
:
i
.
id
}));
const
institutionList
=
res
.
institutionList
.
map
(
i
=>
({
key
:
i
.
fullName
,
value
:
i
.
id
}));
this
.
setState
({
this
.
setState
({
formValues
:{
gradeId
:
gradeList
[
0
].
value
},
options
:
{
options
:
{
gradeList
,
gradeList
,
institutionList
,
institutionList
,
...
@@ -85,15 +81,21 @@ export default class Filter extends React.Component{
...
@@ -85,15 +81,21 @@ export default class Filter extends React.Component{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
formValues
[
key
]
=
value
;
formValues
[
key
]
=
value
;
if
(
key
===
'gradeId'
)
{
delete
formValues
.
institutionId
;
delete
formValues
.
majorId
;
delete
formValues
.
clazzId
;
}
if
(
key
===
'institutionId'
)
{
if
(
key
===
'institutionId'
)
{
this
.
fetchMajorList
({
institutionId
:
value
});
this
.
fetchMajorList
({
institutionId
:
value
});
delete
formValues
.
majorId
delete
formValues
.
majorId
;
delete
formValues
.
clazzId
delete
formValues
.
clazzId
;
}
}
if
(
key
===
'majorId'
)
{
if
(
key
===
'majorId'
)
{
this
.
fetchClazzList
({
institutionId
:
formValues
.
institutionId
,
majorId
:
value
,
gradeId
:
formValues
.
gradeId
});
this
.
fetchClazzList
({
institutionId
:
formValues
.
institutionId
,
majorId
:
value
,
gradeId
:
formValues
.
gradeId
});
delete
formValues
.
clazzId
delete
formValues
.
clazzId
;
}
}
this
.
setState
({
this
.
setState
({
...
@@ -103,8 +105,7 @@ export default class Filter extends React.Component{
...
@@ -103,8 +105,7 @@ export default class Filter extends React.Component{
inputChange
=
(
e
)
=>
{
inputChange
=
(
e
)
=>
{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
var
value
=
Number
(
e
.
targetValue
);
var
value
=
Number
(
e
.
target
.
value
);
if
(
isNaN
(
value
)){
if
(
isNaN
(
value
)){
formValues
.
name
=
e
.
target
.
value
;
formValues
.
name
=
e
.
target
.
value
;
if
(
formValues
.
studentNo
)
delete
formVlaues
.
studentNo
;
if
(
formValues
.
studentNo
)
delete
formVlaues
.
studentNo
;
...
@@ -115,7 +116,8 @@ export default class Filter extends React.Component{
...
@@ -115,7 +116,8 @@ export default class Filter extends React.Component{
}
}
this
.
setState
({
this
.
setState
({
formValues
formValues
,
inputValue
:
e
.
target
.
value
,
})
})
}
}
...
@@ -135,37 +137,36 @@ export default class Filter extends React.Component{
...
@@ -135,37 +137,36 @@ export default class Filter extends React.Component{
search
=
()
=>
{
search
=
()
=>
{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
this
.
props
.
getPage
(
formValues
);
this
.
props
.
getPage
(
formValues
);
this
.
props
.
Toggle
()
&&
this
.
props
.
Toggle
();
this
.
props
.
Toggle
&&
this
.
props
.
Toggle
();
}
}
reset
=
()
=>
{
reset
=
()
=>
{
this
.
setState
({
this
.
setState
({
formValues
:
{
gradeId
:
this
.
state
.
options
.
gradeList
[
0
].
value
}
formValues
:
{}
})
})
}
}
render
(){
render
(){
const
{
gradeList
,
institutionList
,
majorList
,
clazzList
}
=
this
.
state
.
options
;
const
{
gradeList
,
institutionList
,
majorList
,
clazzList
}
=
this
.
state
.
options
;
const
{
institutionId
,
majorId
}
=
this
.
state
.
formValues
;
const
{
gradeId
,
institutionId
,
majorId
}
=
this
.
state
.
formValues
;
const
{
style
}
=
this
.
props
;
return
(
return
(
<
div
className
=
'siderBar'
style
=
{
style
?
style
:
null
}
>
<
div
className
=
'siderBar'
>
<
div
className
=
'searchBox'
>
<
div
className
=
'searchBox'
>
<
input
type
=
'text'
<
input
type
=
'text'
ref
=
{
node
=>
this
.
input
=
node
}
ref
=
{
node
=>
this
.
input
=
node
}
id
=
'searchInput'
id
=
'searchInput'
placeholder
=
'请输入姓名/学号'
placeholder
=
'请输入姓名/学号'
value
=
{
this
.
state
.
inputValue
}
value
=
{
this
.
state
.
inputValue
}
onChange
=
{
this
.
inputChange
}
><
/input>
onChange
=
{
this
.
inputChange
}
/
>
<
div
id
=
"searchButton"
onClick
=
{
this
.
search
}
><
Icon
type
=
'search'
size
=
'sm'
/><
/div
>
<
div
id
=
"searchButton"
onClick
=
{
this
.
search
}
><
Icon
type
=
'search'
size
=
'sm'
/><
/div
>
<
/div
>
<
/div
>
<
div
className
=
'mainContent'
>
<
div
className
=
'mainContent'
>
<
WhiteSpace
size
=
'lg'
/>
<
WhiteSpace
size
=
'lg'
/>
<
WingBlank
size
=
'lg'
>
<
WingBlank
size
=
'lg'
>
<
p
style
=
{{
color
:
'#666666'
}}
>
年
纪
选择
<
/p
>
<
p
style
=
{{
color
:
'#666666'
}}
>
年
级
选择
<
/p
>
{
this
.
generateItem
(
'gradeId'
,
gradeList
)}
{
this
.
generateItem
(
'gradeId'
,
gradeList
)}
<
p
style
=
{{
color
:
'#666666'
}}
>
学院选择
<
/p
>
{
gradeId
?
(
<>
<
p
style
=
{{
color
:
'#666666'
}}
>
学院选择
<
/p
>
{
this
.
generateItem
(
'institutionId'
,
institutionList
)}
{
this
.
generateItem
(
'institutionId'
,
institutionList
)}
<
/>
)
: null
}
{
institutionId
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
专业选择
<
/p
>
{
institutionId
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
专业选择
<
/p
>
{
this
.
generateItem
(
'majorId'
,
majorList
)}
<
/>
)
: null
}
{
this
.
generateItem
(
'majorId'
,
majorList
)}
<
/>
)
: null
}
{
majorId
?
<><
p
style
=
{{
color
:
'#666666'
}}
>
班级选择
<
/p
>
{
majorId
?
<><
p
style
=
{{
color
:
'#666666'
}}
>
班级选择
<
/p
>
...
@@ -184,7 +185,6 @@ export default class Filter extends React.Component{
...
@@ -184,7 +185,6 @@ export default class Filter extends React.Component{
Filter
.
propTypes
=
{
Filter
.
propTypes
=
{
getPage
:
PropTypes
.
func
.
isRequired
,
// 页面刷新方法
getPage
:
PropTypes
.
func
.
isRequired
,
// 页面刷新方法
toggle
:
PropTypes
.
func
,
// 收回侧边方法
toggle
:
PropTypes
.
func
,
// 收回侧边方法
style
:
PropTypes
.
object
,
// 外框样式
}
}
Filter
.
defaultProps
=
{
Filter
.
defaultProps
=
{
getPage
:
()
=>
{}
getPage
:
()
=>
{}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论