Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
H5Public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
作业
日程
统计图
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
H5Public
Commits
f5908a97
提交
f5908a97
authored
10月 10, 2019
作者:
周盛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Filter优化
上级
cf39cd4a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
132 行增加
和
51 行删除
+132
-51
apiConfig.js
HighStateComponent/Filter/apiConfig.js
+6
-2
index.js
HighStateComponent/Filter/index.js
+126
-49
没有找到文件。
HighStateComponent/Filter/apiConfig.js
浏览文件 @
f5908a97
export
default
{
export
default
{
// 业务处理接口
APPLYRECORD
:
'/TrainStationApplyApi/getPage'
,
// 申请记录
APPLYRECORD
:
'/TrainStationApplyApi/getPage'
,
// 申请记录
HANDLEAPPLY
:
'TrainStationApplyApi/cancelApply'
,
// 完成办理但不开放领取 ids cancelStatusKey=1 完成办理并开放领取cancelStatusKey=2
HANDLEAPPLY
:
'TrainStationApplyApi/cancelApply'
,
// 完成办理但不开放领取 ids cancelStatusKey=1 完成办理并开放领取cancelStatusKey=2
HANDLERECORD
:
'/TrainStationApplyApi/getPage'
,
// 办理记录
HANDLERECORD
:
'/TrainStationApplyApi/getPage'
,
// 办理记录
OPENRECEIVE
:
'/TrainStationApplyApi/openReceive'
,
// 开放领取 ids cancelStatusKey =2
OPENRECEIVE
:
'/TrainStationApplyApi/openReceive'
,
// 开放领取 ids cancelStatusKey =2
// 查询接口
GETGRADELIST
:
'/CommonApi/getGradeList'
,
// 获取年级
GETGRADELIST
:
'/CommonApi/getGradeList'
,
// 获取年级
GETINSTITUTION
:
'/InstitutionApi/queryAllInstitution'
,
// 获取院系
GETINSTITUTION
:
'/InstitutionApi/queryAllInstitution'
,
// 获取院系
GETMAJOR
:
'/MajorApi/queryMajorByInstitutionId'
,
// 获取专业 institutionId
GETMAJOR
:
'/MajorApi/queryMajorByInstitutionId'
,
// 获取专业 institutionId
GETCLAZZLIST
:
'/ClazzApi/queryClazzByInstitutionIdAndMajorId'
//获取班级 gradeId: majorId:
GETMAJORBYIDS
:
'/MajorApi/queryMajorByInstitutionIds'
,
// 通过ids 获取专业
GETCLAZZLIST
:
'/ClazzApi/queryClazzByInstitutionIdAndMajorId'
,
//获取班级 gradeId: majorId:
GETCLAZZLISTBYIDS
:
'/ClazzApi/queryClazzByMajorIds'
,
// 通过ids 获取专业
}
}
\ No newline at end of file
HighStateComponent/Filter/index.js
浏览文件 @
f5908a97
...
@@ -7,20 +7,20 @@ import PropTypes from 'prop-types';
...
@@ -7,20 +7,20 @@ import PropTypes from 'prop-types';
const
queryOptions
=
async
()
=>
{
const
queryOptions
=
async
()
=>
{
const
gradeList
=
await
getWebInfo
({},
api
.
GETGRADELIST
);
const
gradeList
=
await
getWebInfo
({},
api
.
GETGRADELIST
);
const
institutionList
=
await
getWebInfo
({},
api
.
GETINSTITUTION
);
return
{
return
{
gradeList
,
gradeList
,
institutionList
,
}
}
}
}
export
default
class
Filter
extends
React
.
Component
{
export
default
class
Filter
extends
React
.
Component
{
constructor
(
props
){
constructor
(
props
){
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
role
:
2
,
inputValue
:
''
,
inputValue
:
''
,
formValues
:
{
formValues
:
{
institutionIds
:
[],
majorIds
:[],
clazzIds
:
[],
clazzIds
:
[],
},
},
options
:
{
options
:
{
...
@@ -34,25 +34,69 @@ export default class Filter extends React.Component{
...
@@ -34,25 +34,69 @@ export default class Filter extends React.Component{
componentDidMount
()
{
componentDidMount
()
{
this
.
fetchOptions
();
this
.
fetchOptions
();
this
.
fetchRoleType
();
}
}
// 获取年级和系列表
// 获取角色类型信息
fetchRoleType
=
async
()
=>
{
const
res
=
await
getMobileInfo
({},
'/CommonApi/currentUser'
);
if
(
res
&&
!
res
.
errCode
)
{
const
{
options
}
=
this
.
state
;
var
role
=
res
.
type
;
options
.
institutionList
=
res
.
institutionModelList
.
map
(
i
=>
({
key
:
i
.
name
,
value
:
i
.
id
}));
if
(
role
===
0
)
{
this
.
setState
({
role
,
options
})
}
}
}
// 获取 key value
fetchOptions
=
async
()
=>
{
fetchOptions
=
async
()
=>
{
const
res
=
await
queryOptions
();
const
res
=
await
queryOptions
();
if
(
!
res
||
!
res
.
gradeList
||
!
res
.
institutionList
)
return
false
;
if
(
!
res
||
!
res
.
gradeList
)
return
false
;
const
gradeList
=
res
.
gradeList
.
map
(
i
=>
({
key
:
i
.
name
,
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
}));
this
.
setState
({
this
.
setState
({
options
:
{
options
:
{
gradeList
,
gradeList
,
institutionList
,
institutionList
:
[]
,
majorList
:[],
majorList
:[],
clazzList
:
[],
clazzList
:
[],
}
}
})
})
}
}
// 获取专业
fetchMajorList
=
(
params
=
{})
=>
{
const
{
options
}
=
this
.
state
;
getWebInfo
(
params
,
api
.
GETMAJOR
).
then
(
res
=>
{
if
(
res
&&
!
res
.
errCode
)
{
const
majorList
=
res
.
map
(
i
=>
({
key
:
i
.
name
,
value
:
i
.
id
}));
options
.
majorList
=
majorList
;
this
.
setState
({
options
})
}
})
}
// 通过系ids获取专业
fetchMajorListByIds
=
(
params
=
{})
=>
{
const
{
options
}
=
this
.
state
;
getWebInfo
(
params
,
api
.
GETMAJORBYIDS
).
then
(
res
=>
{
if
(
res
&&
!
res
.
errCode
)
{
const
majorList
=
res
.
map
(
i
=>
({
key
:
i
.
name
,
value
:
i
.
id
}));
options
.
majorList
=
majorList
;
this
.
setState
({
options
})
}
})
}
// 获取班级列表
// 获取班级列表
fetchClazzList
=
(
params
=
{})
=>
{
fetchClazzList
=
(
params
=
{})
=>
{
const
{
options
}
=
this
.
state
;
const
{
options
}
=
this
.
state
;
...
@@ -67,13 +111,13 @@ export default class Filter extends React.Component{
...
@@ -67,13 +111,13 @@ export default class Filter extends React.Component{
})
})
}
}
// 获取专业
列表
// 通过专业ids获取班级
列表
fetch
MajorList
=
(
params
=
{})
=>
{
fetch
ClazzListByIds
=
(
params
=
{})
=>
{
const
{
options
}
=
this
.
state
;
const
{
options
}
=
this
.
state
;
getWebInfo
(
params
,
api
.
GET
MAJOR
).
then
(
res
=>
{
getWebInfo
(
params
,
api
.
GET
CLAZZLISTBYIDS
).
then
(
res
=>
{
if
(
res
&&
!
res
.
errCode
)
{
if
(
res
&&
!
res
.
errCode
)
{
const
majorList
=
res
.
map
(
i
=>
({
key
:
i
.
n
ame
,
value
:
i
.
id
}));
const
clazzList
=
res
.
map
(
i
=>
({
key
:
i
.
fullN
ame
,
value
:
i
.
id
}));
options
.
majorList
=
major
List
;
options
.
clazzList
=
clazz
List
;
this
.
setState
({
this
.
setState
({
options
options
})
})
...
@@ -81,12 +125,11 @@ export default class Filter extends React.Component{
...
@@ -81,12 +125,11 @@ export default class Filter extends React.Component{
})
})
}
}
//
选择时处理函数
//
搜索条件变化处理
formChange
=
(
key
,
value
)
=>
{
formChange
=
(
key
,
value
)
=>
{
let
{
formValues
}
=
this
.
state
;
let
{
formValues
,
role
}
=
this
.
state
;
// 判断是否第二次取消
// 判断是否第二次取消
if
(
key
===
'clazzIds'
)
{
if
(
key
===
'clazzIds'
||
key
===
'institutionIds'
||
key
===
'majorIds'
)
{
if
(
formValues
[
key
].
indexOf
(
value
)
!==
-
1
){
if
(
formValues
[
key
].
indexOf
(
value
)
!==
-
1
){
formValues
[
key
]
=
formValues
[
key
].
filter
(
i
=>
i
!==
value
);
formValues
[
key
]
=
formValues
[
key
].
filter
(
i
=>
i
!==
value
);
}
}
...
@@ -99,23 +142,19 @@ export default class Filter extends React.Component{
...
@@ -99,23 +142,19 @@ export default class Filter extends React.Component{
else
formValues
[
key
]
=
value
;
else
formValues
[
key
]
=
value
;
}
}
// 年级变化时
if
(
key
===
'gradeId'
)
{
if
(
key
===
'gradeId'
)
{
delete
formValues
.
institutionId
;
formValues
.
majorIds
=
[];
delete
formValues
.
majorId
formValues
.
clazzIds
=
[];
formValues
.
clazzIds
=
[];
}
}
// 专业变化时
if
(
key
===
'institutionIds'
)
{
if
(
key
===
'institutionId'
)
{
this
.
fetchMajorListByIds
({
institutionIds
:
formValues
.
institutionIds
.
join
(
','
)});
this
.
fetchMajorList
({
institutionId
:
value
});
formValues
.
majorIds
=
[];
delete
formValues
.
majorId
formValues
.
clazzIds
=
[];
formValues
.
clazzIds
=
[];
}
}
// 专业变化时
if
(
key
===
'majorIds'
)
{
if
(
key
===
'majorId'
)
{
this
.
fetchClazzListByIds
({
majorIds
:
formValues
.
majorIds
.
join
(
','
)});
this
.
fetchClazzList
({
institutionId
:
formValues
.
institutionId
,
majorId
:
value
,
gradeId
:
formValues
.
gradeId
});
formValues
.
clazzIds
=
[];
formValues
.
clazzIds
=
[];
}
}
...
@@ -124,17 +163,17 @@ export default class Filter extends React.Component{
...
@@ -124,17 +163,17 @@ export default class Filter extends React.Component{
})
})
}
}
//
学号/姓名
输入处理
//
搜索框
输入处理
inputChange
=
(
e
)
=>
{
inputChange
=
(
e
)
=>
{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
var
value
=
Number
(
e
.
target
.
value
);
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
formV
la
ues
.
studentNo
;
if
(
formValues
.
studentNo
)
delete
formV
al
ues
.
studentNo
;
}
}
else
{
else
{
formValues
.
studentNo
=
value
;
formValues
.
studentNo
=
value
;
if
(
formValues
.
name
)
delete
formV
la
ues
.
name
;
if
(
formValues
.
name
)
delete
formV
al
ues
.
name
;
}
}
this
.
setState
({
this
.
setState
({
...
@@ -143,13 +182,12 @@ export default class Filter extends React.Component{
...
@@ -143,13 +182,12 @@ export default class Filter extends React.Component{
})
})
}
}
//
选择列表状态
生成
//
搜索条件DOM
生成
generateItem
=
(
keyName
,
dataList
)
=>
{
generateItem
=
(
keyName
,
dataList
)
=>
{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
// 判断类名
// 判断是否选中
const
isSelect
=
(
value
)
=>
{
const
isSelect
=
(
value
)
=>
{
if
(
keyName
===
'clazzIds'
)
{
if
(
keyName
===
'
institutionIds'
||
keyName
===
'majorIds'
||
keyName
===
'
clazzIds'
)
{
if
(
formValues
[
keyName
].
indexOf
(
value
)
!==
-
1
)
return
true
;
if
(
formValues
[
keyName
].
indexOf
(
value
)
!==
-
1
)
return
true
;
}
}
else
if
(
formValues
[
keyName
]
===
value
){
else
if
(
formValues
[
keyName
]
===
value
){
...
@@ -162,7 +200,7 @@ export default class Filter extends React.Component{
...
@@ -162,7 +200,7 @@ export default class Filter extends React.Component{
{
dataList
.
map
(
i
=>
(
{
dataList
.
map
(
i
=>
(
<
div
className
=
{
isSelect
(
i
.
value
)?
'cusLabelFocus'
:
'cusLabel'
}
<
div
className
=
{
isSelect
(
i
.
value
)?
'cusLabelFocus'
:
'cusLabel'
}
key
=
{
i
.
value
}
key
=
{
i
.
value
}
on
TouchStart
=
{()
=>
this
.
formChange
(
keyName
,
i
.
value
)}
>
{
i
.
key
}
<
/div>
)
)
on
Click
=
{()
=>
this
.
formChange
(
keyName
,
i
.
value
)}
>
{
i
.
key
}
<
/div>
)
)
}
}
<
/div
>
<
/div
>
)
)
...
@@ -171,8 +209,32 @@ export default class Filter extends React.Component{
...
@@ -171,8 +209,32 @@ export default class Filter extends React.Component{
// 搜索处理
// 搜索处理
search
=
()
=>
{
search
=
()
=>
{
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
const
clazzIds
=
formValues
.
clazzIds
.
join
(
','
);
const
temp
=
{...
formValues
};
this
.
props
.
getPage
({...
formValues
,
clazzIds
});
// 判断系是否为空
if
(
formValues
.
institutionIds
.
length
!==
0
){
temp
.
institutionIds
=
formValues
.
institutionIds
.
join
(
','
);
}
else
{
delete
temp
.
institutionIds
;
}
// 判断专业是否为空
if
(
formValues
.
majorIds
.
length
!==
0
){
temp
.
majorIds
=
formValues
.
majorIds
.
join
(
','
);
}
else
{
delete
temp
.
majorIds
;
}
// 判断班级是否为空
if
(
formValues
.
clazzIds
.
length
!==
0
){
temp
.
clazzIds
=
formValues
.
clazzIds
.
join
(
','
);
}
else
{
delete
temp
.
clazzIds
;
}
this
.
props
.
getPage
({...
temp
});
this
.
props
.
Toggle
&&
this
.
props
.
Toggle
();
this
.
props
.
Toggle
&&
this
.
props
.
Toggle
();
}
}
...
@@ -180,14 +242,36 @@ export default class Filter extends React.Component{
...
@@ -180,14 +242,36 @@ export default class Filter extends React.Component{
reset
=
()
=>
{
reset
=
()
=>
{
this
.
setState
({
this
.
setState
({
formValues
:
{
formValues
:
{
institutionIds
:
[],
majorIds
:[],
clazzIds
:
[],
clazzIds
:
[],
}
}
})
})
}
}
render
(){
// 生成选择
createSelect
=
()
=>
{
const
{
gradeList
,
institutionList
,
majorList
,
clazzList
}
=
this
.
state
.
options
;
const
{
gradeList
,
institutionList
,
majorList
,
clazzList
}
=
this
.
state
.
options
;
const
{
gradeId
,
institutionId
,
majorId
}
=
this
.
state
.
formValues
;
const
{
gradeId
,
institutionIds
,
majorIds
}
=
this
.
state
.
formValues
;
const
{
role
}
=
this
.
state
;
if
(
role
===
0
){
return
(
<>
<
p
style
=
{{
color
:
'#666666'
}}
>
年级选择
<
/p
>
{
this
.
generateItem
(
'gradeId'
,
gradeList
)}
{
gradeId
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
学院选择
<
/p
>
{
this
.
generateItem
(
'institutionIds'
,
institutionList
)}
<
/>
)
: null
}
{
institutionIds
.
length
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
专业选择
<
/p
>
{
this
.
generateItem
(
'majorIds'
,
majorList
)}
<
/>
)
: null
}
{
majorIds
.
length
?
<><
p
style
=
{{
color
:
'#666666'
}}
>
班级选择
<
/p
>
{
this
.
generateItem
(
'clazzIds'
,
clazzList
)}
<
/> : null
}
<
/
>
)
}
return
null
;
}
render
(){
return
(
return
(
<
div
className
=
'siderBar'
>
<
div
className
=
'siderBar'
>
<
div
className
=
'searchBox'
>
<
div
className
=
'searchBox'
>
...
@@ -203,19 +287,12 @@ export default class Filter extends React.Component{
...
@@ -203,19 +287,12 @@ export default class Filter extends React.Component{
<
div
className
=
'mainContent'
>
<
div
className
=
'mainContent'
>
<
WhiteSpace
size
=
'lg'
/>
<
WhiteSpace
size
=
'lg'
/>
<
WingBlank
size
=
'lg'
>
<
WingBlank
size
=
'lg'
>
<
p
style
=
{{
color
:
'#666666'
}}
>
年级选择
<
/p
>
{
this
.
createSelect
()}
{
this
.
generateItem
(
'gradeId'
,
gradeList
)}
{
gradeId
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
学院选择
<
/p
>
{
this
.
generateItem
(
'institutionId'
,
institutionList
)}
<
/>
)
: null
}
{
institutionId
?
(
<><
p
style
=
{{
color
:
'#666666'
}}
>
专业选择
<
/p
>
{
this
.
generateItem
(
'majorId'
,
majorList
)}
<
/>
)
: null
}
{
majorId
?
<><
p
style
=
{{
color
:
'#666666'
}}
>
班级选择
<
/p
>
{
this
.
generateItem
(
'clazzIds'
,
clazzList
)}
<
/> : null
}
<
/WingBlank
>
<
/WingBlank
>
<
/div
>
<
/div
>
<
div
className
=
'buttonBox'
>
<
div
className
=
'buttonBox'
>
<
div
on
TouchStart
=
{
this
.
reset
}
>
重置
<
/div
>
<
div
on
Click
=
{
this
.
reset
}
>
重置
<
/div
>
<
div
on
TouchStart
=
{
this
.
search
}
>
确定
<
/div
>
<
div
on
Click
=
{
this
.
search
}
>
确定
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论