Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
Project
Project
Details
Activity
Releases
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
Maple
TOSTUMI
Commits
a0927faa
Commit
a0927faa
authored
Mar 08, 2021
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预约设施同一组件不同条件搜索
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
2e28f266
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
217 deletions
+35
-217
index.jsx
src/components/SelectOptions/index.jsx
+3
-2
TitleSearch copy.tsx
src/components/TitleSearch/TitleSearch copy.tsx
+0
-207
TitleSearch.tsx
src/components/TitleSearch/TitleSearch.tsx
+13
-2
FacilityBookings.ts
src/models/CommunityManagement/FacilityBookings.ts
+11
-1
FacilityBookings.tsx
...CommunityManagement/FacilityBookings/FacilityBookings.tsx
+8
-5
No files found.
src/components/SelectOptions/index.jsx
View file @
a0927faa
...
...
@@ -93,10 +93,11 @@ class SelectOptions extends React.PureComponent {
componentWillReceiveProps
(
nextProps
)
{
// 如果存在更新 就拿取最新的选中小区值
// 判断是不是props 的最新值 否则每次点击都要更新
// console.log(nextProps.checklist);
if
(
nextProps
.
checklist
!==
this
.
props
.
checklist
)
{
if
(
nextProps
.
checklist
.
sort
().
toString
()
!==
this
.
props
.
checklist
.
sort
().
toString
()
)
{
this
.
setState
({
checkedList
:
nextProps
.
checklist
,
resultList
:
nextProps
.
checklist
,
});
}
}
...
...
src/components/TitleSearch/TitleSearch copy.tsx
deleted
100644 → 0
View file @
2e28f266
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
styles
from
'./index.less'
;
import
BackButton
from
'../BackButton/BackButton'
;
import
TitleGet
from
'../TitleGet/TitleGet'
;
import
{
SearchOutlined
}
from
'@ant-design/icons'
;
import
{
Input
,
Row
,
Col
,
Form
,
Select
,
Button
,
DatePicker
}
from
'antd'
;
const
{
Option
}
=
Select
;
import
SelectOptions
from
'../SelectOptions/Tow'
;
import
{
gray
}
from
'chalk'
;
import
SearchOptionsCommnity
from
'../SearchOptions/SearchOptionsCommnity'
;
const
TitleSearch
=
(
props
:
any
)
=>
{
// console.log("===================================", props)
const
{
dispatch
,
CommunityList
}
=
props
;
const
key
=
props
.
listkey
;
const
name
=
props
.
list
;
// const single = props.single
// const checklist = props.checklist;
// const status = props.status;
// const communitySelect = props.communitySelect
// const defaultValue = props.defaultValue;
const
{
single
,
checklist
,
status
,
communitySelect
,
defaultValue
}
=
props
;
const
time
=
props
.
time
;
const
community
=
props
.
community
;
const
[
selectOptions
,
setSelectOptions
]
=
useState
(
true
);
const
[
communitys
,
setCommunitys
]
=
useState
(
CommunityList
);
const
[
communitySingle
,
setCommunitySingle
]
=
useState
(
null
);
const
[
datePicker
,
setDate
]
=
useState
(
null
);
const
[
form
]
=
Form
.
useForm
();
const
tosCommunityget
=
(
values
:
any
)
=>
{
dispatch
({
type
:
'Init/tosCommunityget'
,
playload
:
values
});
};
useEffect
(()
=>
{
// console.log("标题搜寻组件初始化") OK
if
(
CommunityList
==
null
)
{
// console.log("小区数量初始化") OK
console
.
log
(
'这里开始获取小区'
);
tosCommunityget
(
null
);
}
if
(
defaultValue
!=
null
)
{
form
.
setFieldsValue
(
defaultValue
);
}
},
[]);
useEffect
(()
=>
{
if
(
defaultValue
!=
null
)
{
form
.
setFieldsValue
(
defaultValue
);
}
},
[
defaultValue
]);
useEffect
(()
=>
{
// console.log(CommunityList)
if
(
CommunityList
!=
null
)
{
// console.log("小区数量初始化完毕") OK
var
tmp
=
{};
tmp
[
community
]
=
CommunityList
;
// props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys
(
CommunityList
);
}
},
[
CommunityList
]);
const
onFinish
=
(
values
:
any
)
=>
{
if
(
datePicker
)
{
values
[
time
[
0
]]
=
datePicker
;
}
if
(
community
)
{
values
[
community
]
=
communitys
;
}
console
.
log
(
'Success:'
,
values
);
props
.
onSubmit
(
values
);
};
const
onFinishFailed
=
(
errorInfo
:
any
)
=>
{
console
.
log
(
'Failed:'
,
errorInfo
);
};
const
onChange
=
(
date
:
any
,
dateString
:
string
)
=>
{
setDate
(
dateString
);
};
const
printContent
=
(
comment
:
any
)
=>
{
setCommunitys
(
comment
);
};
// 选择小区名字并赋值
const
opname
=
(
value
:
any
)
=>
{
form
.
setFieldsValue
({
communityName
:
value
,
});
};
return
(
<>
<
Form
form=
{
form
}
name=
"basic"
onFinish=
{
onFinish
}
onFinishFailed=
{
onFinishFailed
}
>
<
Row
gutter=
{
32
}
>
{
communitySelect
!=
null
?
(
<
Col
key=
{
'communitySelect_'
}
>
<
Form
.
Item
name=
{
'communityName'
}
>
<
SearchOptionsCommnity
titleSearch=
{
true
}
opname=
{
opname
}
/>
</
Form
.
Item
>
</
Col
>
)
:
null
}
{
key
!=
null
?
key
.
map
((
item
,
index
)
=>
{
return
(
<
Col
key=
{
'KeyCol_'
+
index
}
>
<
Form
.
Item
name=
{
item
}
>
<
Input
placeholder=
{
name
[
index
]
}
allowClear
/>
</
Form
.
Item
>
</
Col
>
);
})
:
null
}
{
status
!=
null
?
status
.
map
((
item
,
index
)
=>
{
return
(
<
Col
key=
{
'StatusCol_'
+
index
}
>
<
Form
.
Item
name=
{
item
.
name
[
0
]
}
>
<
Select
style=
{
{
width
:
160
}
}
placeholder=
{
item
.
name
[
1
]
}
allowClear=
{
true
}
>
{
item
.
data
.
map
((
word
)
=>
{
return
(
<
Option
key=
{
word
}
value=
{
word
[
0
]
}
>
{
word
[
1
]
}
</
Option
>
);
})
}
</
Select
>
</
Form
.
Item
>
</
Col
>
);
})
:
null
}
{
time
!=
null
?
(
<
Col
key=
{
'datePicker_'
}
>
{
' '
}
<
DatePicker
placeholder=
{
time
[
1
]
}
onChange=
{
onChange
}
/>
</
Col
>
)
:
null
}
{
community
==
null
?
(
<
Col
>
<
Form
.
Item
>
<
Button
type=
"primary"
htmlType=
"submit"
>
Search
</
Button
>
</
Form
.
Item
>
</
Col
>
)
:
null
}
</
Row
>
{
community
!=
null
?
(
<>
{
CommunityList
!=
null
?
(
<
SelectOptions
checklist=
{
checklist
}
single=
{
single
}
list=
{
CommunityList
.
sort
()
}
show=
{
selectOptions
}
onSubmit=
{
printContent
}
/>
)
:
null
}
<
Form
.
Item
>
<
Button
type=
"primary"
htmlType=
"submit"
style=
{
{
backgroundColor
:
'#e7f4ff'
,
color
:
'rgba(24,144,255,1)'
}
}
>
<
SearchOutlined
/>
Search
</
Button
>
</
Form
.
Item
>
</>
)
:
null
}
</
Form
>
</>
);
};
function
mapStateToProps
(
state
:
any
)
{
// console.log("state参数",state)
const
{
CommunityList
}
=
state
.
Init
;
return
{
CommunityList
,
};
}
export
default
connect
(
mapStateToProps
)(
TitleSearch
);
// time={["key","预订时间筛选"]}
// status = [{name:"status",data:["处理", "未处理"]}]
// listkey={['A', 'C']} list={['订单状态', '预订时间筛选']}
// <TitleSearch
// status={[{
// name: ["status", "订单状态"],
// data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]]
// }]}
// time={["key", "预订时间筛选"]}
// community={"communityName"}
// // single={true}
// onSubmit={CallBackTitleSearch} />
src/components/TitleSearch/TitleSearch.tsx
View file @
a0927faa
...
...
@@ -34,7 +34,7 @@ const TitleSearch = (props: any) => {
const
community
=
props
.
community
;
// const [selectOptions, setSelectOptions] = useState(true);
const
[
communitys
,
setCommunitys
]
=
useState
(
CommunityList
);
const
[
communitys
,
setCommunitys
]
=
useState
(
[]
as
any
);
const
[
datePicker
,
setDate
]
=
useState
(
null
as
any
);
const
[
defalueName
,
setDefalueName
]
=
useState
(
undefined
);
...
...
@@ -48,10 +48,19 @@ const TitleSearch = (props: any) => {
// console.log("标题搜寻组件初始化") OK
if
(
CommunityList
==
null
)
{
// console.log("小区数量初始化") OK
tosCommunityget
(
null
);
tosCommunityget
(
[]
);
}
},
[]);
// 监听选择小区
useEffect
(()
=>
{
// console.log(checklist);
if
(
checklist
&&
checklist
.
sort
().
toString
()
!==
communitys
.
sort
().
toString
())
{
// form.setFieldsValue(checklist);
setCommunitys
(
checklist
);
}
},
[
checklist
]);
useEffect
(()
=>
{
if
(
defaultValue
!=
null
)
{
form
.
setFieldsValue
(
defaultValue
);
...
...
@@ -110,6 +119,8 @@ const TitleSearch = (props: any) => {
};
const
printContent
=
(
comment
:
any
)
=>
{
// console.log(comment);
setCommunitys
(
comment
);
};
...
...
src/models/CommunityManagement/FacilityBookings.ts
View file @
a0927faa
...
...
@@ -233,8 +233,18 @@ export default {
}
break
;
}
}
else
if
(
resp
.
error_code
==
'0002'
)
{
// 多端操作提示清空并返回
message
.
error
(
resp
.
error_msg
?
`
${
resp
.
error_msg
}
`
:
'This record has been processed!'
);
let
Data
,
Data2
,
Data3
=
null
;
yield
put
({
type
:
'returnPage'
,
Data
});
yield
put
({
type
:
'returnPage2'
,
Data2
});
yield
put
({
type
:
'returnPage3'
,
Data3
});
history
.
push
(
'/CommunityManagement/FacilityBookings'
);
}
else
{
console
.
log
(
'错误?'
);
//
console.log('错误?');
message
.
error
(
`
${
resp
.
error_code
}
:
${
resp
.
error_msg
}
`
);
}
},
...
...
src/pages/CommunityManagement/FacilityBookings/FacilityBookings.tsx
View file @
a0927faa
...
...
@@ -218,7 +218,7 @@ const FacilityBookings = (props: any) => {
};
// console.log(obj);
requse
(
obj
,
tab
);
}
else
{
}
else
if
(
tab
==
2
&&
CommunityList
!==
null
)
{
let
obj
=
{
communityNameList
:
search2
.
communityNameList
?
search2
.
communityNameList
:
CommunityList
,
facilityName
:
search2
.
facilityName
?
search2
.
facilityName
:
null
,
...
...
@@ -260,6 +260,7 @@ const FacilityBookings = (props: any) => {
// 切换tab
function
TabCallback
(
tab
:
any
)
{
// console.log(search2);
TB
(
tab
);
if
(
tab
==
1
)
{
// 搜索t
...
...
@@ -275,7 +276,7 @@ const FacilityBookings = (props: any) => {
}
else
{
// 储存的值
let
obj
=
{
communityNameList
:
search2
.
communityNameList
?
search2
.
communityNameList
:
CommunityList
,
communityNameList
:
search2
.
communityNameList
,
pageNum
:
search2
.
pageNum
,
userToken
:
token
,
};
...
...
@@ -297,7 +298,7 @@ const FacilityBookings = (props: any) => {
requse
(
obj
,
tab
);
}
else
{
let
obj
=
{
communityNameList
:
search2
.
communityNameList
?
search2
.
communityNameList
:
CommunityList
,
communityNameList
:
search2
.
communityNameList
,
pageNum
:
current
,
userToken
:
token
,
};
...
...
@@ -307,9 +308,11 @@ const FacilityBookings = (props: any) => {
// 储存并发起请求
const
requse
=
(
v
:
any
,
tab
:
any
)
=>
{
// console.log(v.communityNameList);
// console.log('发起');
if
(
tab
==
1
)
{
let
obj
=
{
communityNameList
:
v
.
communityNameList
?
v
.
communityNameList
:
null
,
communityNameList
:
v
.
communityNameList
?
v
.
communityNameList
:
CommunityList
,
userToken
:
token
,
pageNum
:
v
.
pageNum
?
v
.
pageNum
:
'1'
,
subscribeDate
:
v
.
subscribeDate
!==
null
?
v
.
subscribeDate
:
null
,
...
...
@@ -323,7 +326,7 @@ const FacilityBookings = (props: any) => {
// 储存的
// 搜索的
let
obj
=
{
communityNameList
:
v
.
communityNameList
?
v
.
communityNameList
:
null
,
communityNameList
:
v
.
communityNameList
?
v
.
communityNameList
:
CommunityList
,
facilityName
:
v
.
facilityName
?
v
.
facilityName
:
null
,
pageNum
:
v
.
curPage
?
v
.
curPage
:
'1'
,
};
...
...
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