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
f7079474
Commit
f7079474
authored
Dec 04, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signed-off-by: cellee <893264950@qq.com>
parent
b2039d32
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
701 additions
and
1935 deletions
+701
-1935
defaultSettings.ts
config/defaultSettings.ts
+9
-1
TitleSearch.tsx
src/components/TitleSearch/TitleSearch.tsx
+1
-1
BasicLayout.tsx
src/layouts/BasicLayout.tsx
+12
-25
logo.less
src/layouts/logo.less
+12
-0
login.ts
src/models/login.ts
+23
-16
Account.less
src/pages/AccountManagement/account/Account.less
+1
-1
AccountAdds.tsx
src/pages/AccountManagement/account/AccountAdds.tsx
+8
-9
Add.tsx
src/pages/CommunityManagement/CellList/Add.tsx
+3
-4
Adds.tsx
src/pages/CommunityManagement/CellList/Adds.tsx
+2
-5
CellList.tsx
src/pages/CommunityManagement/CellList/CellList.tsx
+10
-14
celllist.less
src/pages/CommunityManagement/CellList/celllist.less
+1
-1
CommunityAnnouncement.tsx
...anagement/CommunityAnnouncement/CommunityAnnouncement.tsx
+6
-8
BookingDetail.tsx
...es/CommunityManagement/FacilityBookings/BookingDetail.tsx
+1
-1
Facility copy 2.tsx
.../CommunityManagement/FacilityBookings/Facility copy 2.tsx
+0
-508
Facility copy.tsx
...es/CommunityManagement/FacilityBookings/Facility copy.tsx
+0
-439
FacilityBookings copy.tsx
...nityManagement/FacilityBookings/FacilityBookings copy.tsx
+0
-398
Bookings.less
...es/CommunityManagement/FacilityBookings/css/Bookings.less
+1
-1
VisitorRecord.tsx
...pages/CommunityManagement/VisitorRecord/VisitorRecord.tsx
+19
-4
index.less
src/pages/CommunityManagement/VisitorRecord/index.less
+1
-1
CommunityNotice.tsx
...s/CommunityManagement/communityNotice/CommunityNotice.tsx
+316
-256
VisitorRecord.tsx
...pages/CommunityManagement/visitorRecord/VisitorRecord.tsx
+19
-4
ContractContent.less
src/pages/ContractManagement/ContractContent.less
+185
-189
tip.ts
src/utils/tip.ts
+71
-49
No files found.
config/defaultSettings.ts
View file @
f7079474
/*
* @Author: your name
* @Date: 2020-11-24 11:24:06
* @LastEditTime: 2020-12-04 10:48:48
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \tostumi\config\defaultSettings.ts
*/
import
{
Settings
as
ProSettings
}
from
'@ant-design/pro-layout'
;
type
DefaultSettings
=
ProSettings
&
{
...
...
@@ -16,7 +24,7 @@ const proSettings: DefaultSettings = {
menu
:
{
locale
:
true
,
},
title
:
'TOS Manage
r
'
,
title
:
'TOS Manage
ment
'
,
pwa
:
false
,
iconfontUrl
:
''
,
};
...
...
src/components/TitleSearch/TitleSearch.tsx
View file @
f7079474
...
...
@@ -134,7 +134,7 @@ const TitleSearch = (props: any) => {
{
/* 小区列表的管理员姓名搜索 */
}
{
username
!=
null
?
(
<
Col
key=
{
'username_'
+
username
[
0
]
}
>
<
Form
.
Item
name=
{
username
[
0
]
}
style=
{
{
marginBottom
:
15
,
width
:
240
}
}
>
<
Form
.
Item
name=
{
username
[
0
]
}
style=
{
{
width
:
240
}
}
>
<
Input
placeholder=
{
username
[
1
]
}
allowClear
/>
</
Form
.
Item
>
</
Col
>
...
...
src/layouts/BasicLayout.tsx
View file @
f7079474
...
...
@@ -18,6 +18,8 @@ import Authorized from '@/utils/Authorized';
import
RightContent
from
'@/components/GlobalHeader/RightContent'
;
import
{
ConnectState
}
from
'@/models/connect'
;
import
{
getAuthorityFromRouter
}
from
'@/utils/utils'
;
import
style
from
'./logo.less'
;
import
logo
from
'../assets/logo.svg'
;
import
tsIcon
from
'../assets/logo.png'
;
...
...
@@ -110,34 +112,19 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
return
(
<
ProLayout
logo=
{
logo
}
logo=
{
tsIcon
}
contentStyle=
{
{
backgroundColor
:
'#fff'
}
}
formatMessage=
{
formatMessage
}
menuHeaderRender=
{
(
logoDom
,
titleDom
)
=>
(
<
div
style=
{
{
marginLeft
:
-
25
,
width
:
260
,
height
:
64
,
backgroundColor
:
'#ffffff'
,
paddingLeft
:
16
,
paddingTop
:
10
,
}
}
>
<
img
src=
{
tsIcon
}
style=
{
{
width
:
50
,
height
:
50
}
}
/>
<
span
style=
{
{
fontSize
:
18
,
fontFamily
:
'Source Han Sans CN'
,
fontWeight
:
'bold'
,
color
:
'rgba(51,51,51,1)'
,
}
}
>
{
' '
}
TOS Management
</
span
>
menuHeaderRender=
{
(
logo
,
title
)
=>
(
<
div
id=
{
style
.
customize_menu_header
}
>
<
Link
to=
"/"
>
{
logo
}
{
title
}
</
Link
>
</
div
>
// <Link to="/">
//
{
/* {logoDom} */
}
//
{
logoDom
}
//
{
titleDom
}
// </Link>
)
}
...
...
src/layouts/logo.less
0 → 100644
View file @
f7079474
#customize_menu_header {
margin-left: -24px;
width: 256px;
height: 64px;
line-height: 64px;
background-color: #ffffff;
padding-left: 24px;
h1 {
font-weight: bold;
color: rgb(51, 51, 51);
}
}
src/models/login.ts
View file @
f7079474
...
...
@@ -93,6 +93,8 @@ const Model: LoginModelType = {
setCookie
(
'id'
,
userMessage
.
userModel
.
id
);
setCookie
(
'name'
,
userMessage
.
userModel
.
tosUserName
);
setCookie
(
'phone'
,
userMessage
.
userModel
.
tosUserPhone
);
// 更新用户信息
localStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
userMessage
));
localStorage
.
setItem
(
'permission'
,
JSON
.
stringify
(
userMessage
.
permission
));
console
.
log
(
'获取到Token:'
+
getCookie
(
'token'
));
yield
put
({
...
...
@@ -102,22 +104,26 @@ const Model: LoginModelType = {
password
:
payload
.
password
,
result
:
false
,
});
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
params
=
getPageQuery
();
let
{
redirect
}
=
params
as
{
redirect
:
string
};
if
(
redirect
)
{
const
redirectUrlParams
=
new
URL
(
redirect
);
if
(
redirectUrlParams
.
origin
===
urlParams
.
origin
)
{
redirect
=
redirect
.
substr
(
urlParams
.
origin
.
length
);
if
(
redirect
.
match
(
/^
\/
.*#/
))
{
redirect
=
redirect
.
substr
(
redirect
.
indexOf
(
'#'
)
+
1
);
}
}
else
{
window
.
location
.
href
=
'/'
;
return
;
}
}
history
.
replace
(
redirect
||
'/'
);
// 路由缓存 再次登录回到上次打开页面
// const urlParams = new URL(window.location.href);
// const params = getPageQuery();
// let { redirect } = params as { redirect: string };
// if (redirect) {
// const redirectUrlParams = new URL(redirect);
// if (redirectUrlParams.origin === urlParams.origin) {
// redirect = redirect.substr(urlParams.origin.length);
// if (redirect.match(/^\/.*#/)) {
// redirect = redirect.substr(redirect.indexOf('#') + 1);
// }
// } else {
// window.location.href = '/';
// return;
// }
// }
// history.replace(redirect || '/');
// 只跳到首页
history
.
replace
(
'/'
);
}
else
{
message
.
error
(
'Login Error! Username or Password is wrong!'
,
3
);
}
...
...
@@ -129,6 +135,7 @@ const Model: LoginModelType = {
// const response = yield call(AccountOut, payload);
if
(
window
.
location
.
pathname
!==
'/user/login'
&&
!
redirect
)
{
// 清楚用户信息
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'permission'
);
setCookie
(
'token'
,
''
);
setCookie
(
'id'
,
''
);
...
...
src/pages/AccountManagement/account/Account.less
View file @
f7079474
...
...
@@ -8,7 +8,7 @@ hr {
background: #fff;
padding: 20px;
border-right: 4px;
margin-bottom:
15px
;
margin-bottom:
0
;
h3 {
margin-bottom: 15px;
position: relative;
...
...
src/pages/AccountManagement/account/AccountAdds.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Pagination
,
message
,
Descriptions
,
Spin
,
Tree
,
Radio
}
from
'antd'
;
import
{
Form
,
Input
,
Button
,
message
,
Descriptions
,
Spin
,
Tree
,
Radio
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
SearchOutlined
,
ClearOutlined
,
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
'./Account.less'
;
...
...
@@ -12,12 +12,10 @@ import SelectCommunity from '@/components/SelectCommunity';
import
{
getNumber
}
from
'@/utils/string'
;
// 正则
import
{
RA
}
from
'@/utils/method'
;
import
moment
from
'moment'
;
const
Account
=
(
props
:
any
)
=>
{
const
module
=
'Account'
;
const
{
dispatch
,
Data
,
DataSave
,
SubResult
,
CommunityList
,
loading
,
user
}
=
props
;
const
{
dispatch
,
SubResult
,
CommunityList
,
loading
,
user
}
=
props
;
// 权限列表
const
treeData
=
enUsFaci
||
zhCnFaci
;
...
...
@@ -119,13 +117,14 @@ const Account = (props: any) => {
let
obj
=
{
userName
:
value
.
tosUserName
,
userPassword
:
value
.
tosUserPwd
,
permissionArray
:
checkedKeys
.
sort
((
n1
,
n2
)
=>
{
permissionArray
:
checkedKeys
.
sort
((
n1
:
any
,
n2
:
any
)
=>
{
return
parseInt
(
n1
)
-
parseInt
(
n2
);
}),
};
RA
(
38
,
value
,
module
,
dispatch
);
// 信息上传
RA
(
42
,
obj
,
module
,
dispatch
);
// 权限上传
return
true
;
}
};
...
...
@@ -199,7 +198,7 @@ const Account = (props: any) => {
>
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosUserName"
label=
"Account ID"
rules=
{
AccountTip
[
0
]
}
>
<
Form
.
Item
name=
"tosUserName"
label=
"Account ID"
rules=
{
AccountTip
[
0
]
as
any
}
>
<
Input
placeholder=
"Login Account"
className=
"input"
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
...
...
@@ -207,12 +206,12 @@ const Account = (props: any) => {
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosAccountName"
label=
"Name"
rules=
{
AccountTip
[
1
]
}
>
<
Form
.
Item
name=
"tosAccountName"
label=
"Name"
rules=
{
AccountTip
[
1
]
as
any
}
>
<
Input
placeholder=
"Name Of Administrator"
className=
"input"
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosUserPhone"
label=
"Phone"
rules=
{
AccountTip
[
2
]
}
>
<
Form
.
Item
name=
"tosUserPhone"
label=
"Phone"
rules=
{
AccountTip
[
2
]
as
any
}
>
<
Input
placeholder=
"Contact Information"
className=
"input"
...
...
src/pages/CommunityManagement/CellList/Add.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Input
,
Tabs
,
Form
,
InputNumber
,
Col
,
Button
,
Row
,
message
}
from
'antd'
;
const
{
TabPane
}
=
Tabs
;
import
{
Input
,
Form
,
Button
,
message
}
from
'antd'
;
import
{
connect
}
from
'umi'
;
...
...
@@ -119,7 +118,7 @@ const Add = (props: any) => {
<
Line
/>
{
extend
.
length
>
0
?
(
<>
<
Form
.
Item
wrapperCol=
{
{
...
layout
.
wrapperCol
,
offset
:
2
}
}
style=
{
{
marginBottom
:
0
}
}
>
<
Form
.
Item
wrapperCol=
{
{
offset
:
2
}
}
style=
{
{
marginBottom
:
0
}
}
>
<
Form
.
Item
style=
{
{
display
:
'inline-block'
,
width
:
'200'
}
}
name=
{
'balouscheduleFile'
}
...
...
@@ -157,7 +156,7 @@ const Add = (props: any) => {
</>
)
:
null
}
<
Form
.
Item
wrapperCol=
{
{
...
layout
.
wrapperCol
,
offset
:
2
}
}
>
<
Form
.
Item
wrapperCol=
{
{
offset
:
2
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
>
Submit
</
Button
>
...
...
src/pages/CommunityManagement/CellList/Adds.tsx
View file @
f7079474
...
...
@@ -28,9 +28,6 @@ import PDF from 'react-pdf-js';
const
{
RangePicker
}
=
TimePicker
;
// 接口申明
interface
objc
{}
const
Adds
=
(
props
:
any
)
=>
{
const
module
=
'CellList'
;
...
...
@@ -195,7 +192,7 @@ const Adds = (props: any) => {
// 保质期上传
const
upload3
=
{
onChange
({
file
,
fileList
}:
any
)
{
onChange
({
file
}:
any
)
{
file
.
status
===
'uploading'
?
setimgLoad
(
true
)
:
setimgLoad
(
false
);
if
(
file
.
status
===
'done'
)
{
setPeriod
(
BackFormat
(
file
.
name
,
file
.
response
.
data
));
...
...
@@ -233,7 +230,7 @@ const Adds = (props: any) => {
// 表单验证
const
onFinish
=
(
values
:
any
)
=>
{
let
{
residentialZipCode
,
residentialAddress
,
residentialName
}
=
values
.
des
;
let
{
residentialZipCode
}
=
values
.
des
;
let
tel
=
values
.
info
.
tel
;
if
(
values
.
residentialManagerUserName
.
length
<
2
)
{
message
.
error
(
'Please Enter 2-digit Zip Code!'
);
...
...
src/pages/CommunityManagement/CellList/CellList.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Space
,
Button
,
Form
,
message
,
Pagination
,
Tag
}
from
'antd'
;
import
{
Space
,
Button
,
message
,
Pagination
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
// 图标
...
...
@@ -9,7 +9,6 @@ import ProTable from '@ant-design/pro-table';
import
TitleSearch
from
'@/components/TitleSearch/TitleSearch'
;
import
{
RA
,
SA
}
from
'@/utils/method'
;
import
{
objectColumns
}
from
'@/utils/string'
;
import
{
Prompt
}
from
'react-router'
;
const
module
=
'CellList'
;
import
'./celllist.less'
;
...
...
@@ -63,14 +62,14 @@ const CellLists = (props: any) => {
const
[
term
,
setTerm
]
=
useState
({}
as
any
);
// 拉取数据的条件存储
// 翻页数据
function
pagesList
(
name
:
string
,
list
:
any
,
num
:
number
)
{
let
msg
=
{
residentialManagerUserName
:
name
?
name
:
''
,
communityNameList
:
list
,
pageNum
:
num
,
};
return
msg
;
}
//
function pagesList(name: string, list: any, num: number) {
//
let msg = {
//
residentialManagerUserName: name ? name : '',
//
communityNameList: list,
//
pageNum: num,
//
};
//
return msg;
//
}
// 监听是否有小区列表
useEffect
(()
=>
{
...
...
@@ -93,11 +92,8 @@ const CellLists = (props: any) => {
}
},
[
village
]);
const
CallbackSearch
=
(
values
:
any
)
=>
{
RA
(
24
,
{
communityName
:
values
},
module
,
dispatch
);
};
const
goToAdd
=
()
=>
{
SA
(
null
,
module
,
dispatch
);
// 清空之前传递的数据
SA
(
null
as
any
,
module
,
dispatch
);
// 清空之前传递的数据
dispatch
({
type
:
module
+
'/urlRemove'
});
// 清掉图片信息
history
.
push
(
'/CommunityManagement/CellList/Add'
);
};
...
...
src/pages/CommunityManagement/CellList/celllist.less
View file @
f7079474
...
...
@@ -2,7 +2,7 @@ li {
list-style: none;
}
.contop {
padding: 1
6
px;
padding: 1
5px 15px 10
px;
background: #fff;
margin-bottom: 15px;
}
...
...
src/pages/CommunityManagement/CommunityAnnouncement/CommunityAnnouncement.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
connect
,
history
,
useModel
,
Loading
}
from
'umi'
;
import
{
Input
,
Tabs
,
Table
,
Space
,
Button
,
Tooltip
,
Form
,
message
,
Pagination
,
Tag
}
from
'antd'
;
const
{
TabPane
}
=
Tabs
;
import
React
,
{
useEffect
}
from
'react'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
Input
,
Space
,
Button
,
Form
,
message
,
Pagination
,
Tag
}
from
'antd'
;
import
moment
from
'moment'
;
import
{
PlusOutlined
,
SearchOutlined
,
ClearOutlined
}
from
'@ant-design/icons'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
{
RA
,
SA
}
from
'@/utils/method'
;
// import { objectColumns } from '@/utils/string';
import
{
timestampToTime3
,
timestampToTime
}
from
'@/utils/time'
;
import
SearchOptionsCommnity
from
'@/components/SearchOptions/SearchOptionsCommnity'
;
const
module
=
'CommunityAnnouncement'
;
const
CommunityAnnouncement
=
(
props
:
any
)
=>
{
const
{
dispatch
,
Data
,
curString
,
userListLoading
,
DataSaveDetail
}
=
props
;
const
{
dispatch
,
Data
,
userListLoading
,
DataSaveDetail
}
=
props
;
// 先清空 其他信息
useEffect
(()
=>
{
...
...
@@ -176,14 +174,14 @@ const CommunityAnnouncement = (props: any) => {
SA
(
DetailPage
(
mlist
),
module
,
dispatch
);
};
const
onKeyUp
=
(
value
)
=>
{
const
onKeyUp
=
(
value
:
any
)
=>
{
console
.
log
(
value
);
return
false
;
};
return
(
<>
<
div
style=
{
{
width
:
'100%'
,
padding
:
20
,
marginBottom
:
15
,
backgroundColor
:
'#ffffff'
}
}
>
<
div
style=
{
{
width
:
'100%'
,
padding
:
20
,
marginBottom
:
0
,
backgroundColor
:
'#ffffff'
}
}
>
<
Form
autoComplete=
"off"
layout=
"inline"
...
...
src/pages/CommunityManagement/FacilityBookings/BookingDetail.tsx
View file @
f7079474
...
...
@@ -198,7 +198,7 @@ const BookingDetail = (props: any) => {
<
InputNumber
placeholder=
"00.00"
min=
{
0
}
max=
{
parseInt
(
DataSave
.
communityMargin
).
toFixed
(
2
)
}
max=
{
parseInt
(
DataSave
.
communityMargin
).
toFixed
(
2
)
as
any
}
maxLength=
{
6
}
step=
{
0.01
}
prefix=
"$"
...
...
src/pages/CommunityManagement/FacilityBookings/Facility copy 2.tsx
deleted
100644 → 0
View file @
b2039d32
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
'./css/index.less'
;
import
{
Input
,
TimePicker
,
InputNumber
,
Button
,
Space
,
Pagination
,
Tooltip
,
Upload
,
Form
,
Select
,
message
,
}
from
'antd'
;
const
{
RangePicker
}
=
TimePicker
;
const
{
Option
}
=
Select
;
import
{
PlusOutlined
,
MinusCircleOutlined
,
ClearOutlined
}
from
'@ant-design/icons'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
{
FieldTimeOutlined
}
from
'@ant-design/icons'
;
import
PictureOptions
from
'../../../components/PictureOptions/PictureOptions'
;
import
PictureOptionsRow
from
'../../../components/PictureOptions/PictureOptionsRow'
;
import
TitleBack
from
'../../../components/TitleBack/TitleBack'
;
import
TimeSelect
from
'../../../components/TimeSelect/TimeSelect'
;
import
Line
from
'../../../components/Line/Line'
;
import
{
getNumber
}
from
'../../../utils/string'
;
import
SearchOptionsCommnity
from
'../../../components/SearchOptions/SearchOptionsCommnity'
;
import
{
NewFaci
}
from
'@/utils/tip'
;
// categoriesDetailsImageName: ["test.jpg"],
// categoriesName: ["篮球场A&test.jpg"],
// reservationQuantumTime: ["09:00-07:00"]
import
Facilitys
from
'@/components/Facilitys/Facilitys'
;
import
{
getUrlLast
,
numberToString
}
from
'../../../utils/string'
;
import
{
checkParam
,
timeForm
}
from
'@/utils/method'
;
import
{
validateMessages
}
from
'@/utils/params'
;
const
module
=
'FacilityBookings'
;
import
moment
from
'moment'
;
const
Facility
=
(
props
:
any
)
=>
{
const
{
dispatch
,
location
,
token
,
sourceData
,
DataSave
,
Result
,
imgList
,
load
}
=
props
;
const
RA
=
(
index
:
any
,
values
:
any
)
=>
{
dispatch
({
type
:
'FacilityBookings/RA'
,
playload
:
{
index
:
index
,
body
:
values
}
});
};
const
ResultClear
=
()
=>
{
dispatch
({
type
:
'FacilityBookings/ResultClear'
});
};
const
openCheck
=
true
;
const
[
Ref3
,
setRef3
]
=
useState
([]);
const
[
extend
,
setExtend
]
=
useState
(
null
);
const
[
timeExtend
,
setTimeExtend
]
=
useState
(
null
);
const
[
pictrueExtend
,
setPictrueExtend
]
=
useState
({
pic
:
null
,
pics
:
null
,
tab
:
3
});
const
[
facilityDetail
,
setFacilityDetail
]
=
useState
(
false
);
const
[
PATHNAME
,
setPATHNAME
]
=
useState
(
''
);
const
formRef
=
useRef
(
null
);
// 再监听列表
const
[
extImgList
,
setextImgList
]
=
useState
(
imgList
);
useEffect
(()
=>
{
console
.
log
(
'变化'
);
console
.
log
(
imgList
);
if
(
imgList
!=
null
)
{
setextImgList
(
imgList
);
}
},
[
imgList
]);
useEffect
(()
=>
{
if
(
Result
!=
null
)
{
console
.
log
(
'页面结果'
);
console
.
log
(
Result
);
ResultClear
();
history
.
push
(
'/CommunityManagement/FacilityBookings'
);
}
},
[
Result
]);
const
RA_S
=
()
=>
{
if
(
DataSave
!=
null
)
{
console
.
log
(
'请求的设施ID为:'
+
DataSave
.
id
);
RA
(
7
,
{
userToken
:
token
,
facilitieId
:
DataSave
.
id
,
});
}
else
{
history
.
go
(
-
1
);
}
};
useEffect
(()
=>
{
if
(
sourceData
!=
null
)
{
console
.
log
(
'【传入详情,当前数据不为空】'
);
console
.
log
(
sourceData
);
setExtend
(
sourceData
.
communityName
);
setTimeExtend
(
sourceData
.
reservationQuantumTime
);
// 中断
// setPictrueExtend({tab:null,pic:null,pics:null})
console
.
log
(
'重点检查'
);
console
.
log
(
sourceData
);
formRef
.
current
.
setFieldsValue
(
sourceData
);
}
},
[
sourceData
]);
useEffect
(()
=>
{
var
tmp
=
pictrueExtend
;
if
(
location
.
pathname
.
indexOf
(
'FacilityEdit'
)
>
-
1
)
{
setPATHNAME
(
'Edit Facility'
);
tmp
.
tab
=
1
;
setPictrueExtend
(
tmp
);
RA_S
();
}
else
if
(
location
.
pathname
.
indexOf
(
'FacilityDetail'
)
>
-
1
)
{
setFacilityDetail
(
true
);
tmp
.
tab
=
2
;
setPictrueExtend
(
tmp
);
setPATHNAME
(
'Facility Detail'
);
RA_S
();
}
else
{
tmp
.
tab
=
3
;
setPictrueExtend
(
tmp
);
setPATHNAME
(
'Add Facility'
);
}
},
[]);
// const TimeSelectRef = (values:any) => {
// setRef3(values)
// }
// 提交
const
onFinish
=
(
values
:
any
)
=>
{
var
result
=
values
;
// 过滤表单;
let
imgs
=
extImgList
.
filter
((
item
:
any
)
=>
(
Object
.
keys
(
item
).
length
==
0
?
false
:
true
));
console
.
log
(
imgs
.
length
);
// 开放时间判断
if
(
imgs
.
length
==
0
)
{
message
.
error
(
'Please upload at least one facility!'
);
}
else
if
(
!
result
.
endTime
&&
!
result
.
startTime
)
{
message
.
error
(
'Please select the opening time!'
);
}
else
{
// 先处理设施和时间
let
categoriesName
:
any
=
[];
let
reservationQuantumTime
:
any
=
[
moment
(
result
.
startTime
,
'HH:mm'
).
format
(
'HH:mm'
),
moment
(
result
.
endTime
,
'HH:mm'
).
format
(
'HH:mm'
),
];
for
(
var
i
in
imgs
)
{
if
(
imgs
[
i
].
name
&&
imgs
[
i
].
pic
)
{
categoriesName
[
i
]
=
`
${
imgs
[
i
].
name
}
&
${
imgs
[
i
].
pic
}
`
;
}
else
{
message
.
error
(
'Please fill in the name of the facility!'
);
return
;
}
}
result
.
categoriesName
=
categoriesName
;
// 设施内容
result
.
reservationQuantumTime
=
reservationQuantumTime
;
// 开放时间段
result
.
categoriesOpenTime
=
`
${
result
.
startTime
}
-
${
result
.
endTime
}
`
;
// 预约时间段 二开需要
delete
result
.
startTime
;
delete
result
.
periodType
;
delete
result
.
picList
;
console
.
log
(
reservationQuantumTime
);
console
.
log
(
result
);
RA
(
6
,
result
);
// 如果有了 开始上传
// if (categoriesName) {
// }
}
return
false
;
// if (Ref3.length!=0) {
// result.reservationQuantumTime = Ref3
// } else {
result
.
reservationQuantumTime
=
[
timeForm
(
result
.
categoriesOpenTime
,
'HH:mm'
)];
var
categoriesOpenTime
=
timeForm
(
result
.
categoriesOpenTime
,
'HH:mm'
);
result
.
categoriesOpenTime
=
categoriesOpenTime
;
// }
// console.log(timeForm(result.categoriesOpenTime,'HH:mm'))
// result.categoriesOpenTime = "09:00-20:00"
if
(
result
.
communityManagerFee
==
null
)
{
result
.
communityManagerFee
=
numberToString
(
0
);
}
else
{
result
.
communityManagerFee
=
numberToString
(
result
.
communityManagerFee
);
}
if
(
result
.
communityMargin
==
null
)
{
result
.
communityMargin
=
numberToString
(
0
);
}
else
{
result
.
communityMargin
=
numberToString
(
result
.
communityMargin
);
}
if
(
result
.
canReservationDay
<=
result
.
cancelReservationDay
||
result
.
canReservationDay
<=
result
.
nomarginCancelReservationDay
)
{
message
.
error
(
'can Reservation Day is invaild!'
,
3
);
result
.
canReservationDay
=
null
;
}
else
{
console
.
log
(
'Should be check:'
,
result
);
if
(
checkParam
(
result
))
{
//中断
if
(
pictrueExtend
.
tab
==
3
)
{
if
(
Result
==
null
)
{
console
.
log
(
'提交'
);
RA
(
6
,
result
);
}
}
else
{
result
.
id
=
DataSave
.
id
;
console
.
log
(
'编辑'
);
if
(
Result
==
null
)
{
RA
(
17
,
result
);
}
}
}
else
{
message
.
error
(
'Error,Please finish it,not empty!'
,
3
);
}
}
};
const
onFinishFailed
=
(
errorInfo
:
any
)
=>
{
console
.
log
(
'Failed:'
,
errorInfo
);
};
const
Subscribe
=
()
=>
{
history
.
push
(
getUrlLast
(
location
.
pathname
)
+
'/FacilityApply'
);
};
const
keyup_tool
=
(
value
:
any
)
=>
{
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
};
const
keyup_communityManagerFee
=
(
e
:
any
)
=>
{
e
.
target
.
value
=
keyup_tool
(
e
.
target
.
value
);
formRef
.
current
.
setFieldsValue
({
communityManagerFee
:
e
.
target
.
value
});
};
const
keyup_communityMargin
=
(
e
:
any
)
=>
{
e
.
target
.
value
=
keyup_tool
(
e
.
target
.
value
);
formRef
.
current
.
setFieldsValue
({
communityMargin
:
e
.
target
.
value
});
};
const
keyup
=
(
keyname
:
any
,
e
:
any
)
=>
{
e
.
target
.
value
=
e
.
target
.
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
);
var
tmp
=
{};
tmp
[
keyname
]
=
e
.
target
.
value
;
formRef
.
current
.
setFieldsValue
(
tmp
);
};
// 监听是否选择了小区
const
[
imgOpen
,
setImgOpen
]
=
useState
(
true
);
const
[
ctyName
,
setCtyName
]
=
useState
(
null
);
// 生成数组 -- 时间
const
createArray
=
(
num
:
any
)
=>
{
var
arr
=
[];
for
(
let
i
=
1
;
i
<
num
;
i
++
)
{
if
(
i
<
10
)
{
arr
[
i
]
=
`0
${
i
}
`
;
}
else
{
arr
[
i
]
=
i
;
}
}
return
arr
;
};
const
Option
=
Select
.
Option
;
//小时
const
hourS
=
createArray
(
24
).
map
((
item
)
=>
(
<
Option
value=
{
item
+
':00'
}
key=
{
item
}
>
{
`${item}:00`
}
</
Option
>
));
// 图片列表
const
fileList
:
any
=
[];
// 表单标识
const
[
form
]
=
Form
.
useForm
();
// 选择小区名字并赋值
const
opname
=
(
value
:
any
)
=>
{
if
(
value
)
{
setImgOpen
(
false
);
// 允许图片上传
setCtyName
(
value
);
// 给小区赋值
form
.
setFieldsValue
({
communityName
:
value
,
// 给表单赋值
});
}
else
{
// 设置是否能点击上传
setImgOpen
(
true
);
}
};
return
(
<
div
className=
{
'base basediy'
}
>
{
/* 头部组件v1.2 */
}
<
TitleBack
title=
{
PATHNAME
}
url=
{
getUrlLast
(
location
.
pathname
)
+
'?Facility=true'
}
/>
<
Form
ref=
{
formRef
}
form=
{
form
}
name=
"basic"
onFinish=
{
onFinish
}
onFinishFailed=
{
onFinishFailed
}
validateMessages=
{
validateMessages
}
>
{
/* 选择小区 */
}
<
Form
.
Item
label=
"Community"
name=
"communityName"
rules=
{
NewFaci
[
0
]
}
>
<
SearchOptionsCommnity
// ubmit={extendName}
opname=
{
opname
}
/>
</
Form
.
Item
>
{
/* 设施名称 以及费用 */
}
<
Input
.
Group
>
<
Form
.
Item
label=
"Facility"
name=
"facilityName"
rules=
{
NewFaci
[
1
]
}
>
<
Input
placeholder=
"Facility Name"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"Fee($)"
name=
"communityManagerFee"
rules=
{
NewFaci
[
2
]
}
>
<
span
className=
"divIconMoney"
>
$
</
span
>
<
InputNumber
onKeyUp=
{
keyup_communityManagerFee
}
prefix=
"$"
placeholder=
"00.00"
disabled=
{
facilityDetail
}
min=
{
0
}
max=
{
999
}
step=
{
0.01
}
style=
{
{
paddingLeft
:
'12px'
,
width
:
'120px'
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"Deposit"
name=
"communityMargin"
rules=
{
NewFaci
[
3
]
}
>
<
span
className=
"divIconMoney"
>
$
</
span
>
<
InputNumber
onKeyUp=
{
keyup_communityMargin
}
prefix=
"$"
placeholder=
"00.00"
disabled=
{
facilityDetail
}
min=
{
0
}
max=
{
999
}
step=
{
0.01
}
style=
{
{
paddingLeft
:
'12px'
,
width
:
'120px'
}
}
/>
</
Form
.
Item
>
</
Input
.
Group
>
<
hr
></
hr
>
{
/* 设施品类上传 */
}
<
Form
.
Item
label=
"Facility Classification"
className=
"flex required"
>
<
Facilitys
disabled=
{
imgOpen
}
updata=
{
{
// userToken: token,
imageType
:
'categoriesImageName'
,
extends
:
ctyName
,
}
}
></
Facilitys
>
</
Form
.
Item
>
{
/* 设施详情上传 */
}
<
Form
.
Item
name=
"categoriesDetailsImageName"
label=
"Facility Details"
rules=
{
NewFaci
[
4
]
}
>
<
PictureOptionsRow
over=
{
imgOpen
}
data=
{
{
userToken
:
token
,
imageType
:
'categoriesDetailsImageName'
,
extends
:
ctyName
,
}
}
/>
</
Form
.
Item
>
{
/* 时间 */
}
<
Form
.
Item
label=
"Opening Hours"
className=
"required"
>
<
Form
.
Item
name=
"startTime"
noStyle
>
<
Select
style=
{
{
width
:
140
}
}
placeholder=
"Start Time"
>
{
hourS
}
</
Select
>
</
Form
.
Item
>
<
span
className=
"diyspan"
>
-
</
span
>
<
Form
.
Item
name=
"endTime"
noStyle
>
<
Select
style=
{
{
width
:
140
}
}
placeholder=
"Closing Time"
>
{
hourS
}
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
hr
></
hr
>
{
/* ------------- */
}
<
p
className=
"diyp"
>
Appointment Settings :
</
p
>
{
/* 预约设置 */
}
<
Input
.
Group
>
<
Form
.
Item
name=
"cancelReservationDay"
label=
"Early Cancellation"
rules=
{
NewFaci
[
5
]
}
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'cancelReservationDay'
)
}
disabled=
{
facilityDetail
}
prefix=
"Advance"
suffix=
"Day"
style=
{
{
width
:
160
,
textAlign
:
'center'
}
}
placeholder=
"0"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"No deposit to cancel reservation"
name=
"nomarginCancelReservationDay"
rules=
{
NewFaci
[
6
]
}
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'nomarginCancelReservationDay'
)
}
disabled=
{
facilityDetail
}
prefix=
"Advance"
suffix=
"Day"
style=
{
{
width
:
160
,
textAlign
:
'center'
}
}
placeholder=
"0"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"Booking"
name=
"canReservationDay"
rules=
{
NewFaci
[
7
]
}
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'canReservationDay'
)
}
placeholder=
"0"
style=
{
{
width
:
160
,
textAlign
:
'center'
}
}
disabled=
{
facilityDetail
}
prefix=
"Advance"
suffix=
"Day"
/>
</
Form
.
Item
>
</
Input
.
Group
>
{
/* 设置次数 */
}
<
Input
.
Group
>
<
Form
.
Item
label=
"Appointment Cycle"
name=
"periodType"
rules=
{
NewFaci
[
8
]
}
>
<
Select
placeholder=
"Period"
allowClear
style=
{
{
width
:
120
}
}
disabled=
{
facilityDetail
}
>
<
Option
value=
"1"
>
Week
</
Option
>
<
Option
value=
"2"
>
Month
</
Option
>
<
Option
value=
"3"
>
Year
</
Option
>
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
name=
"canReservationNum"
rules=
{
NewFaci
[
9
]
}
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'canReservationNum'
)
}
placeholder=
"second"
style=
{
{
width
:
120
}
}
disabled=
{
facilityDetail
}
suffix=
"second"
/>
</
Form
.
Item
>
</
Input
.
Group
>
<
hr
></
hr
>
{
/* <Row gutter={32} style={{ marginTop: 28 }}>
<Col>Appointment Period</Col>
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={timeExtend} disabled={facilityDetail}/></Col>
</Row> */
}
{
facilityDetail
?
(
<>
<
Button
type=
"primary"
onClick=
{
Subscribe
}
loading=
{
load
}
>
Subscribe
</
Button
>
</>
)
:
(
<>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
load
}
>
Submit
</
Button
>
</>
)
}
</
Form
>
</
div
>
);
};
function
mapStateToProps
(
state
:
any
)
{
const
{
sourceData
,
DataSave
,
Result
,
imgList
}
=
state
.
FacilityBookings
;
const
{
token
}
=
state
.
login
;
const
load
=
typeof
state
.
loading
.
models
.
FacilityBookings
==
'undefined'
?
true
:
state
.
loading
.
models
.
FacilityBookings
;
return
{
DataSave
,
sourceData
,
token
,
Result
,
imgList
,
load
,
};
}
export
default
connect
(
mapStateToProps
)(
Facility
);
// ["10:00-12:00","13:00-14:00"]
// defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场A"},{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场B" }]}
// defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" }]}
// const Data = {
// canReservationDay: "5",
// canReservationNum: "6",
// cancelReservationDay: "3",
// categoriesOpenTime: "09:00-20:00",
// communityManagerFee: "18",
// communityMargin: "20",
// communityName: "A9",
// facilityName: "篮球场",
// nomarginCancelReservationDay: "4",
// periodType: "2",
// }
src/pages/CommunityManagement/FacilityBookings/Facility copy.tsx
deleted
100644 → 0
View file @
b2039d32
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
styles
from
'./css/index.less'
;
import
{
Input
,
TimePicker
,
Modal
,
Button
,
Space
,
Pagination
,
Tooltip
,
Radio
,
Form
,
Row
,
Col
,
Select
,
message
,
}
from
'antd'
;
const
{
RangePicker
}
=
TimePicker
;
const
{
Option
}
=
Select
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
{
FieldTimeOutlined
}
from
'@ant-design/icons'
;
import
PictureOptions
from
'../../../components/PictureOptions/PictureOptions'
;
import
PictureOptionsRow
from
'../../../components/PictureOptions/PictureOptionsRow'
;
import
TitleBack
from
'../../../components/TitleBack/TitleBack'
;
import
TimeSelect
from
'../../../components/TimeSelect/TimeSelect'
;
import
Line
from
'../../../components/Line/Line'
;
import
{
getNumber
}
from
'../../../utils/string'
;
import
SearchOptionsCommnity
from
'../../../components/SearchOptions/SearchOptionsCommnity'
;
// categoriesDetailsImageName: ["test.jpg"],
// categoriesName: ["篮球场A&test.jpg"],
// reservationQuantumTime: ["09:00-07:00"]
import
{
getUrlLast
,
numberToString
}
from
'../../../utils/string'
;
import
{
checkParam
,
timeForm
}
from
'@/utils/method'
;
import
{
validateMessages
}
from
'@/utils/params'
;
const
Facility
=
(
props
:
any
)
=>
{
const
{
dispatch
,
location
,
token
,
sourceData
,
DataSave
,
Result
}
=
props
;
const
RA
=
(
index
:
any
,
values
:
any
)
=>
{
dispatch
({
type
:
'FacilityBookings/RA'
,
playload
:
{
index
:
index
,
body
:
values
}
});
};
const
ResultClear
=
()
=>
{
dispatch
({
type
:
'FacilityBookings/ResultClear'
});
};
const
openCheck
=
true
;
const
[
Ref3
,
setRef3
]
=
useState
([]);
const
[
extend
,
setExtend
]
=
useState
(
null
);
const
[
timeExtend
,
setTimeExtend
]
=
useState
(
null
);
const
[
pictrueExtend
,
setPictrueExtend
]
=
useState
({
pic
:
null
,
pics
:
null
,
tab
:
3
});
const
[
facilityDetail
,
setFacilityDetail
]
=
useState
(
false
);
const
[
PATHNAME
,
setPATHNAME
]
=
useState
(
''
);
const
formRef
=
useRef
(
null
);
useEffect
(()
=>
{
if
(
Result
!=
null
)
{
console
.
log
(
'页面结果'
);
console
.
log
(
Result
);
ResultClear
();
history
.
push
(
'/CommunityManagement/FacilityBookings'
);
}
},
[
Result
]);
const
RA_S
=
()
=>
{
if
(
DataSave
!=
null
)
{
console
.
log
(
'请求的设施ID为:'
+
DataSave
.
id
);
RA
(
7
,
{
userToken
:
token
,
facilitieId
:
DataSave
.
id
,
});
}
else
{
history
.
go
(
-
1
);
}
};
useEffect
(()
=>
{
if
(
sourceData
!=
null
)
{
console
.
log
(
'【传入详情,当前数据不为空】'
);
console
.
log
(
sourceData
);
setExtend
(
sourceData
.
communityName
);
setTimeExtend
(
sourceData
.
reservationQuantumTime
);
// 中断
// setPictrueExtend({tab:null,pic:null,pics:null})
console
.
log
(
'重点检查'
);
console
.
log
(
sourceData
);
formRef
.
current
.
setFieldsValue
(
sourceData
);
}
},
[
sourceData
]);
useEffect
(()
=>
{
var
tmp
=
pictrueExtend
;
if
(
location
.
pathname
.
indexOf
(
'FacilityEdit'
)
>
-
1
)
{
setPATHNAME
(
'Edit Facility'
);
tmp
.
tab
=
1
;
setPictrueExtend
(
tmp
);
RA_S
();
}
else
if
(
location
.
pathname
.
indexOf
(
'FacilityDetail'
)
>
-
1
)
{
setFacilityDetail
(
true
);
tmp
.
tab
=
2
;
setPictrueExtend
(
tmp
);
setPATHNAME
(
'Facility Detail'
);
RA_S
();
}
else
{
tmp
.
tab
=
3
;
setPictrueExtend
(
tmp
);
setPATHNAME
(
'Add Facility'
);
}
},
[]);
// const TimeSelectRef = (values:any) => {
// setRef3(values)
// }
const
onFinish
=
(
values
:
any
)
=>
{
var
result
=
values
;
// if (Ref3.length!=0) {
// result.reservationQuantumTime = Ref3
// } else {
result
.
reservationQuantumTime
=
[
timeForm
(
result
.
categoriesOpenTime
,
'HH:mm'
)];
var
categoriesOpenTime
=
timeForm
(
result
.
categoriesOpenTime
,
'HH:mm'
);
result
.
categoriesOpenTime
=
categoriesOpenTime
;
// }
// console.log(timeForm(result.categoriesOpenTime,'HH:mm'))
// result.categoriesOpenTime = "09:00-20:00"
if
(
result
.
communityManagerFee
==
null
)
{
result
.
communityManagerFee
=
numberToString
(
0
);
}
else
{
result
.
communityManagerFee
=
numberToString
(
result
.
communityManagerFee
);
}
if
(
result
.
communityMargin
==
null
)
{
result
.
communityMargin
=
numberToString
(
0
);
}
else
{
result
.
communityMargin
=
numberToString
(
result
.
communityMargin
);
}
if
(
result
.
canReservationDay
<=
result
.
cancelReservationDay
||
result
.
canReservationDay
<=
result
.
nomarginCancelReservationDay
)
{
message
.
error
(
'can Reservation Day is invaild!'
,
3
);
result
.
canReservationDay
=
null
;
}
else
{
console
.
log
(
'Should be check:'
,
result
);
if
(
checkParam
(
result
))
{
//中断
if
(
pictrueExtend
.
tab
==
3
)
{
if
(
Result
==
null
)
{
console
.
log
(
'提交'
);
RA
(
6
,
result
);
}
}
else
{
result
.
id
=
DataSave
.
id
;
console
.
log
(
'编辑'
);
if
(
Result
==
null
)
{
RA
(
17
,
result
);
}
}
}
else
{
message
.
error
(
'Error,Please finish it,not empty!'
,
3
);
}
}
};
const
onBillChange
=
(
values
:
any
,
allValues
:
any
)
=>
{
if
(
values
[
'communityName'
]
!=
null
)
{
setExtend
(
values
[
'communityName'
]);
}
};
const
onFinishFailed
=
(
errorInfo
:
any
)
=>
{
console
.
log
(
'Failed:'
,
errorInfo
);
};
const
Subscribe
=
()
=>
{
history
.
push
(
getUrlLast
(
location
.
pathname
)
+
'/FacilityApply'
);
};
const
keyup_tool
=
(
value
:
any
)
=>
{
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
};
const
keyup_communityManagerFee
=
(
e
:
any
)
=>
{
e
.
target
.
value
=
keyup_tool
(
e
.
target
.
value
);
formRef
.
current
.
setFieldsValue
({
communityManagerFee
:
e
.
target
.
value
});
};
const
keyup_communityMargin
=
(
e
:
any
)
=>
{
e
.
target
.
value
=
keyup_tool
(
e
.
target
.
value
);
formRef
.
current
.
setFieldsValue
({
communityMargin
:
e
.
target
.
value
});
};
const
keyup
=
(
keyname
:
any
,
e
:
any
)
=>
{
e
.
target
.
value
=
e
.
target
.
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
);
var
tmp
=
{};
tmp
[
keyname
]
=
e
.
target
.
value
;
formRef
.
current
.
setFieldsValue
(
tmp
);
};
return
(
<
div
className=
{
styles
.
base
}
>
{
/* 头部组件v1.2 */
}
<
TitleBack
title=
{
PATHNAME
}
url=
{
getUrlLast
(
location
.
pathname
)
+
'?Facility=true'
}
/>
<
Form
ref=
{
formRef
}
name=
"basic"
onFinish=
{
onFinish
}
onFinishFailed=
{
onFinishFailed
}
onValuesChange=
{
onBillChange
}
validateMessages=
{
validateMessages
}
>
<
Row
gutter=
{
32
}
>
<
Col
>
Community
</
Col
>
<
Col
>
<
Form
.
Item
name=
"communityName"
>
<
SearchOptionsCommnity
disabled=
{
pictrueExtend
.
tab
!=
3
?
true
:
false
}
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
gutter=
{
32
}
style=
{
{
marginTop
:
28
}
}
>
<
Col
>
Facility
</
Col
>
<
Col
>
<
Form
.
Item
name=
"facilityName"
rules=
{
[{
required
:
openCheck
}]
}
>
<
Input
placeholder=
"Facility Name"
disabled=
{
facilityDetail
}
/>
</
Form
.
Item
>
</
Col
>
<
Col
>
Fee($)
</
Col
>
<
Col
>
<
Form
.
Item
name=
"communityManagerFee"
rules=
{
[{
required
:
openCheck
}]
}
>
<
Input
onKeyUp=
{
keyup_communityManagerFee
}
prefix=
"$"
placeholder=
"00.00"
disabled=
{
facilityDetail
}
allowClear
/>
</
Form
.
Item
>
</
Col
>
<
Col
>
Deposit
</
Col
>
<
Col
>
<
Form
.
Item
name=
"communityMargin"
rules=
{
[{
required
:
openCheck
}]
}
>
<
Input
onKeyUp=
{
keyup_communityMargin
}
prefix=
"$"
placeholder=
"00.00"
disabled=
{
facilityDetail
}
allowClear
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
gutter=
{
32
}
style=
{
{
marginTop
:
28
}
}
>
{
extend
!=
null
?
(
<>
<
Col
>
Category Of Facilities
</
Col
>
<
Col
>
<
Form
.
Item
name=
"categoriesName"
>
<
PictureOptions
disabled=
{
facilityDetail
}
data=
{
{
userToken
:
token
,
imageType
:
'categoriesImageName'
,
extends
:
extend
,
}
}
/>
</
Form
.
Item
>
{
' '
}
</
Col
>
</>
)
:
null
}
</
Row
>
<
Row
gutter=
{
32
}
style=
{
{
marginTop
:
28
}
}
>
{
extend
!=
null
?
(
<>
<
Col
>
Facility Details
</
Col
>
<
Col
>
<
Form
.
Item
name=
"categoriesDetailsImageName"
>
<
PictureOptionsRow
disabled=
{
facilityDetail
}
data=
{
{
userToken
:
token
,
imageType
:
'categoriesDetailsImageName'
,
extends
:
extend
,
}
}
/>
</
Form
.
Item
>
</
Col
>
</>
)
:
null
}
</
Row
>
<
Line
/>
<
Row
gutter=
{
32
}
style=
{
{
marginTop
:
28
}
}
>
<
Col
>
Opening Hours
</
Col
>
{
/* <Input placeholder="09:00-20:00" suffix={<FieldTimeOutlined />} style={{width:160}}/> */
}
<
Col
>
<
Form
.
Item
name=
"categoriesOpenTime"
rules=
{
[{
required
:
openCheck
}]
}
>
<
RangePicker
format=
{
'HH'
}
hourStep=
{
1
}
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
gutter=
{
32
}
style=
{
{}
}
>
<
Col
>
Appointment Settings
</
Col
>
<
Col
>
<
Row
gutter=
{
20
}
>
<
Col
>
<
Form
.
Item
name=
"cancelReservationDay"
rules=
{
[{
required
:
openCheck
}]
}
label=
"Early cancellation"
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'cancelReservationDay'
)
}
placeholder=
"Cancel the reservation"
style=
{
{
width
:
160
}
}
disabled=
{
facilityDetail
}
suffix=
"Day"
/>
</
Form
.
Item
>
</
Col
>
<
Col
>
<
Form
.
Item
name=
"nomarginCancelReservationDay"
rules=
{
[{
required
:
openCheck
}]
}
label=
"Automatic cancellation without deposit"
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'nomarginCancelReservationDay'
)
}
placeholder=
"No deposit,cancellation"
style=
{
{
width
:
160
}
}
disabled=
{
facilityDetail
}
suffix=
"Day"
/>
</
Form
.
Item
>
</
Col
>
<
Col
>
<
Form
.
Item
name=
"canReservationDay"
rules=
{
[{
required
:
openCheck
}]
}
label=
"Advance booking is available"
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'canReservationDay'
)
}
placeholder=
"Bookable"
style=
{
{
width
:
160
}
}
disabled=
{
facilityDetail
}
suffix=
"Day"
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
gutter=
{
8
}
>
<
Col
>
<
Form
.
Item
name=
"periodType"
rules=
{
[{
required
:
openCheck
}]
}
label=
"Appointment Cycle"
>
<
Select
placeholder=
"period"
allowClear
style=
{
{
width
:
120
}
}
disabled=
{
facilityDetail
}
>
<
Option
value=
"1"
>
Week
</
Option
>
<
Option
value=
"2"
>
Month
</
Option
>
<
Option
value=
"3"
>
Year
</
Option
>
</
Select
>
</
Form
.
Item
>
</
Col
>
<
Col
>
<
Form
.
Item
name=
"canReservationNum"
rules=
{
[{
required
:
openCheck
}]
}
>
<
Input
onKeyUp=
{
keyup
.
bind
(
this
,
'canReservationNum'
)
}
placeholder=
"times"
style=
{
{
width
:
120
}
}
disabled=
{
facilityDetail
}
suffix=
"Times"
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Col
>
</
Row
>
{
/* <Row gutter={32} style={{ marginTop: 28 }}>
<Col>Appointment Period</Col>
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={timeExtend} disabled={facilityDetail}/></Col>
</Row> */
}
{
facilityDetail
?
(
<>
<
Line
/>
<
Button
type=
"primary"
onClick=
{
Subscribe
}
>
Subscribe
</
Button
>
</>
)
:
(
<>
<
Line
/>
<
Button
type=
"primary"
htmlType=
"submit"
>
Submit
</
Button
>
</>
)
}
</
Form
>
</
div
>
);
};
function
mapStateToProps
(
state
:
any
)
{
const
{
sourceData
,
DataSave
,
Result
}
=
state
.
FacilityBookings
;
const
{
token
}
=
state
.
login
;
return
{
DataSave
,
sourceData
,
token
,
Result
,
};
}
export
default
connect
(
mapStateToProps
)(
Facility
);
// ["10:00-12:00","13:00-14:00"]
// defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场A"},{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场B" }]}
// defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" }]}
// const Data = {
// canReservationDay: "5",
// canReservationNum: "6",
// cancelReservationDay: "3",
// categoriesOpenTime: "09:00-20:00",
// communityManagerFee: "18",
// communityMargin: "20",
// communityName: "A9",
// facilityName: "篮球场",
// nomarginCancelReservationDay: "4",
// periodType: "2",
// }
src/pages/CommunityManagement/FacilityBookings/FacilityBookings copy.tsx
deleted
100644 → 0
View file @
b2039d32
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Input
,
Tabs
,
Pagination
,
Space
,
Button
}
from
'antd'
;
const
{
TabPane
}
=
Tabs
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
{
objectColumns
}
from
'../../../utils/string'
;
import
{
timestampToTime
}
from
'../../../utils/time'
;
import
TitleSearch
from
'../../../components/TitleSearch/TitleSearch'
;
// const managerFeeStatusDes= ["未交", "已交", "已退"]
// const marginFeeStatusDes = ["未交", "已交", "未退", "已退部分", "已退全部"]
// const statusDes = ["全部", "已申请", "已预订", "已使用", "已取消", "已完成"]
const
managerFeeStatusDes
=
[
'Not paid'
,
'Paid'
,
'Returned'
];
const
marginFeeStatusDes
=
[
'Not paid'
,
'Paid'
,
'Not Returned'
,
'Returned part'
,
'Returned all'
];
const
statusDes
=
[
'All'
,
'Applied'
,
'Reserved'
,
'Used'
,
'Cancelled'
,
'Completed'
];
import
{
getUrlLastParams
}
from
'../../../utils/string'
;
import
'./css/index.less'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
{
PlusOutlined
,
ClockCircleOutlined
,
ClearOutlined
}
from
'@ant-design/icons'
;
import
moment
from
'moment'
;
const
FacilityBookings
=
(
props
:
any
)
=>
{
const
{
formatMessage
}
=
useIntl
();
const
{
dispatch
,
location
,
Data
,
Data2
,
token
,
DataSave
,
curString
,
Result
,
loading
}
=
props
;
const
RA
=
(
index
:
any
,
values
:
any
)
=>
{
console
.
log
(
values
);
dispatch
({
type
:
'FacilityBookings/RA'
,
playload
:
{
index
:
index
,
body
:
values
},
});
};
const
SA
=
(
values
:
any
)
=>
{
dispatch
({
type
:
'FacilityBookings/SA'
,
playload
:
values
});
};
const
QA
=
(
values
:
any
)
=>
{
dispatch
({
type
:
'FacilityBookings/QA'
,
playload
:
values
});
};
const
CA
=
()
=>
{
dispatch
({
type
:
'FacilityBookings/CA'
,
playload
:
null
});
};
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
columns2
,
setColumns2
]
=
useState
([]);
const
goToFunction
=
()
=>
{
if
(
curString
.
tab
==
2
)
{
CA
();
// 先清空上传图片列表
dispatch
({
type
:
'FacilityBookings/overAllImgList'
});
}
else
{
// 清空之前的数据
let
Data3
=
null
;
dispatch
({
type
:
'FacilityBookings/returnPage3'
,
Data3
});
}
history
.
push
(
location
.
pathname
+
(
curString
.
tab
==
1
?
'/Booking'
:
'/Adding'
));
};
// 预约详情跳转
const
goToDetail
=
(
values
:
any
)
=>
{
SA
(
values
);
history
.
push
(
location
.
pathname
+
'/Detail'
);
};
// 列表2 点击跳转
const
makeOperator
=
(
values
:
any
,
index
:
any
)
=>
{
const
path
=
[
'/FacilityDetail'
,
'/FacilityEdit'
,
'/FacilityApply'
];
SA
(
values
);
console
.
log
(
'准备页面跳转'
);
console
.
log
(
curString
);
history
.
push
(
location
.
pathname
+
path
[
index
]);
};
useEffect
(()
=>
{
const
key
=
[
[
'Service Community'
,
'communityName'
],
[
'User Name'
,
'accountName'
],
[
'Facility Bookings'
,
'facilityTitle'
],
[
'Order Time'
,
null
,
(
text
:
any
,
record
:
any
)
=>
(
<
div
>
<
ClockCircleOutlined
style=
{
{
color
:
'#666'
}
}
/>
{
moment
(
record
.
createTime
.
time
).
format
(
'YYYY-MM-DD'
)
}
</
div
>
),
],
[
'Booking Schedule'
,
'subscribeDate'
,
(
text
:
any
)
=>
(
<
div
>
<
ClockCircleOutlined
style=
{
{
color
:
'#666'
}
}
/>
{
moment
(
text
).
format
(
'YYYY-MM-DD'
)
}
</
div
>
),
],
[
'Fee'
,
'managerFeeStatus'
,
(
text
:
any
)
=>
<
div
>
{
managerFeeStatusDes
[
text
]
}
</
div
>],
[
'Deposit'
,
'marginFeeStatus'
,
(
text
:
any
)
=>
<
div
>
{
marginFeeStatusDes
[
text
]
}
</
div
>],
[
'Status'
,
'status'
,
(
text
:
any
)
=>
<
div
>
{
statusDes
[
text
]
}
</
div
>],
[
'Actions'
,
null
,
(
text
:
any
,
record
:
any
)
=>
(
<
Space
size=
"middle"
>
{
' '
}
<
a
onClick=
{
goToDetail
.
bind
(
this
,
record
)
}
>
Detail
</
a
>
</
Space
>
),
],
];
const
key2
=
[
[
'Community'
,
'communityName'
],
[
'Facilty'
,
'facilityName'
],
[
'Open Time'
,
'categoriesOpenTime'
],
[
'Action'
,
null
,
(
text
:
any
,
record
:
any
)
=>
(
<
Space
size=
"middle"
>
<
a
onClick=
{
()
=>
makeOperator
(
record
,
0
)
}
>
Detail
</
a
>
<
a
onClick=
{
()
=>
makeOperator
(
record
,
1
)
}
>
Edit
</
a
>
<
a
onClick=
{
()
=>
makeOperator
(
record
,
2
)
}
>
Booking
</
a
>
</
Space
>
),
],
];
setColumns
(
objectColumns
(
key
));
setColumns2
(
objectColumns
(
key2
));
console
.
log
(
'页面刷新'
);
console
.
log
(
DataSave
);
console
.
log
(
curString
);
if
(
curString
.
tab
==
1
)
{
RA
(
9
,
{
userToken
:
token
,
pageNum
:
curString
.
curPage
,
subscribeDate
:
curString
.
subscribeDate
,
status
:
curString
.
status
,
communityNameList
:
curString
.
communityNameList
,
});
}
else
{
RA
(
8
,
{
userToken
:
token
,
pageNum
:
curString
.
curPage2
});
}
},
[]);
const
CallBackTitleSearch
=
(
comment
:
any
)
=>
{
console
.
log
(
comment
);
if
(
curString
.
tab
==
1
)
{
if
(
comment
.
communityName
!=
null
||
comment
.
key
!=
null
||
comment
.
status
!=
null
)
{
var
tmp
=
curString
;
tmp
.
subscribeDate
=
comment
.
key
;
if
(
comment
.
status
==
null
||
comment
.
status
==
undefined
)
{
tmp
.
status
=
0
;
}
else
{
tmp
.
status
=
comment
.
status
;
}
tmp
.
communityNameList
=
comment
.
communityName
;
tmp
.
curPage
=
1
;
QA
(
tmp
);
console
.
log
(
tmp
);
//中断
RA
(
9
,
{
userToken
:
token
,
pageNum
:
'1'
,
subscribeDate
:
tmp
.
subscribeDate
,
status
:
tmp
.
status
,
communityNameList
:
comment
.
communityName
,
});
}
}
else
{
if
(
comment
.
communityName
!=
null
||
comment
.
facilityName
!=
null
)
{
var
tmp
=
curString
;
tmp
.
communityNameList
=
comment
.
communityName
;
tmp
.
facilityName
=
comment
.
facilityName
;
tmp
.
curPage
=
1
;
QA
(
tmp
);
RA
(
8
,
{
communityNameList
:
comment
.
communityName
,
facilityName
:
comment
.
facilityName
,
pageNum
:
'1'
,
});
}
}
};
function
TabCallback
(
tab
:
any
)
{
var
tmp
=
curString
;
tmp
.
tab
=
tab
;
QA
(
tmp
);
if
(
tab
==
1
)
{
RA
(
9
,
{
userToken
:
token
,
status
:
curString
.
status
,
subscribeDate
:
curString
.
subscribeDate
,
pageNum
:
curString
.
curPage
,
communityNameList
:
curString
.
communityNameList
,
});
}
else
{
RA
(
8
,
{
userToken
:
token
,
pageNum
:
curString
.
curPage2
});
}
}
function
Pagechange
(
current
:
any
,
pageSize
:
any
)
{
if
(
curString
.
tab
==
1
)
{
var
tmp
=
curString
;
tmp
.
curPage
=
current
;
QA
(
tmp
);
RA
(
9
,
{
userToken
:
token
,
pageNum
:
current
,
subscribeDate
:
curString
.
subscribeDate
,
status
:
curString
.
status
,
communityNameList
:
curString
.
communityNameList
,
});
}
else
{
var
tmp
=
curString
;
tmp
.
curPage2
=
current
;
QA
(
tmp
);
if
(
curString
.
communityNameList
!=
null
)
{
RA
(
8
,
{
userToken
:
token
,
pageNum
:
current
,
communityNameList
:
curString
.
communityNameList
,
});
}
else
{
RA
(
8
,
{
userToken
:
token
,
pageNum
:
current
});
}
}
}
return
(
<>
<
div
className=
"base"
>
{
/* 头部组件 */
}
{
curString
.
tab
==
1
?
(
<>
<
TitleSearch
status=
{
[
{
name
:
[
'status'
,
'Order status'
],
data
:
[
[
0
,
'All'
],
[
1
,
'Applied'
],
[
2
,
'Reserved'
],
[
3
,
'Used'
],
[
4
,
'Cancelled'
],
],
},
]
}
time=
{
[
'key'
,
'Booking time '
]
}
community=
{
'communityName'
}
checklist=
{
curString
.
communityNameList
!=
null
?
curString
.
communityNameList
:
null
}
onSubmit=
{
CallBackTitleSearch
}
/>
</>
)
:
(
<>
<
TitleSearch
listkey=
{
[
'facilityName'
]
}
list=
{
[
'Facility name'
]
}
community=
{
'communityName'
}
onSubmit=
{
CallBackTitleSearch
}
/>
</>
)
}
</
div
>
{
/* 下方及搜索 */
}
<
div
className=
{
'base'
}
>
{
/* <div style={{ position: 'relative', height: 40 }}>
<Button type="primary" style={{ position: 'absolute', right: 0 }} onClick={goToFunction}>
{curString.tab == 1 ? 'Booking' : 'Add Facility'}
</Button>
</div> */
}
<
Tabs
defaultActiveKey=
{
curString
.
tab
.
toString
()
}
onChange=
{
TabCallback
}
className=
"diytabs"
>
<
TabPane
tab=
"Facility Bookings"
key=
"1"
>
<
ProTable
loading=
{
loading
}
rowKey=
"id"
dataSource=
{
Data
.
data
}
columns=
{
columns
}
// pagination={{
// current: curString.curPage,
// total: Data.total.totalRow,
// showSizeChanger: false,
// onChange: Pagechange,
// }}
pagination=
{
false
}
search=
{
false
}
toolBarRender=
{
()
=>
[
<
Button
key=
"3"
type=
"primary"
onClick=
{
goToFunction
}
>
<
PlusOutlined
/>
添加预约
</
Button
>,
]
}
options=
{
{
density
:
true
,
fullScreen
:
true
,
reload
:
()
=>
{
// onReset();
},
setting
:
false
,
}
}
headerTitle=
"预约列表"
/>
{
curString
?
(
<
div
className=
"pages"
>
<
Pagination
current=
{
curString
.
curPage
}
total=
{
Data
.
total
.
totalRow
}
// pageSizeOptions=
{[]}
showSizeChanger=
{
false
}
// pageSize=
{
village
.
page
.
curPageSize
}
onChange=
{
Pagechange
}
/>
</
div
>
)
:
(
''
)
}
</
TabPane
>
<
TabPane
tab=
"Facility Management"
key=
"2"
>
<
ProTable
loading=
{
loading
}
rowKey=
"id"
dataSource=
{
Data2
.
data
}
columns=
{
columns2
}
pagination=
{
{
current
:
curString
.
curPage2
,
total
:
Data2
.
total
.
totalRow
,
showSizeChanger
:
false
,
onChange
:
Pagechange
,
}
}
// pagination={false} // 隐藏默认分页
search=
{
false
}
toolBarRender=
{
()
=>
[
<
Button
key=
"3"
type=
"primary"
onClick=
{
goToFunction
}
>
<
PlusOutlined
/>
添加设施
</
Button
>,
]
}
options=
{
{
density
:
true
,
fullScreen
:
true
,
reload
:
()
=>
{
// onReset();
},
setting
:
false
,
}
}
headerTitle=
"设施列表"
/>
</
TabPane
>
</
Tabs
>
</
div
>
</>
);
};
function
mapStateToProps
(
state
:
any
)
{
const
{
Data
,
Data2
,
DataSave
,
curString
,
Result
}
=
state
.
FacilityBookings
;
const
{
token
}
=
state
.
login
;
const
loading
=
typeof
state
.
loading
.
models
.
FacilityBookings
==
'undefined'
?
true
:
state
.
loading
.
models
.
FacilityBookings
;
return
{
Data
,
Data2
,
DataSave
,
curString
,
Result
,
token
,
loading
,
};
}
export
default
connect
(
mapStateToProps
)(
FacilityBookings
);
// status:预约设施状态 0:全部 1:已申请 2:已预订 3:已使用 4:已取消 5:已完成
// manager_fee_status:管理费 0:未 1:已交 2:已退
// margin_fee_status:押金 0:未 1:已交 2:未退 3:已退部分 4:已退全部 5:
src/pages/CommunityManagement/FacilityBookings/css/Bookings.less
View file @
f7079474
...
...
@@ -4,7 +4,7 @@
.base {
width: 100%;
background-color: #ffffff;
padding:
20
px;
padding:
15
px;
}
//头部组件
...
...
src/pages/CommunityManagement/VisitorRecord/VisitorRecord.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Input
,
Tabs
,
Ta
ble
,
Form
,
Button
,
message
,
DatePicker
}
from
'antd'
;
import
{
Input
,
Tabs
,
Ta
g
,
Form
,
Button
,
message
,
DatePicker
}
from
'antd'
;
const
{
TabPane
}
=
Tabs
;
import
{
connect
}
from
'umi'
;
import
{
objectColumns
}
from
'@/utils/string'
;
...
...
@@ -39,7 +39,22 @@ const VisitorRecord = (props: any) => {
{
title
:
'Security Guard'
,
dataIndex
:
'securityGuardName'
},
{
title
:
'Number Plate'
,
dataIndex
:
'numberPlate'
},
// 隐藏的搜索框
{
title
:
'Visitor Time'
,
dataIndex
:
'updateTime'
,
valueType
:
'date'
},
{
title
:
'Visitor Time'
,
dataIndex
:
'updateTime'
,
valueType
:
'date'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
if
(
record
.
linkStatus
==
1
)
{
return
text
;
}
else
{
return
(
<>
{
text
}
<
Tag
color=
"red"
>
Temporary
</
Tag
>
</>
);
}
},
},
{
title
:
'Community'
,
dataIndex
:
'visitorCommunity'
},
// { title: 'Unit', dataIndex: 'inviterAddress' },
{
...
...
@@ -236,14 +251,14 @@ const VisitorRecord = (props: any) => {
Reset
</
Button
>
</
Form
.
Item
>
<
div
style=
{
{
ma
xWidth
:
'100%'
,
marginTop
:
15
,
width
:
'100%'
}
}
>
<
div
style=
{
{
ma
rginTop
:
24
,
marginRight
:
-
16
}
}
>
<
Form
.
Item
name=
"community"
label=
""
>
<
SelectCommunity
/>
</
Form
.
Item
>
</
div
>
</
Form
>
</
div
>
<
div
style=
{
{
width
:
'100%'
,
padding
:
16
,
backgroundColor
:
'#ffffff'
}
}
>
<
div
style=
{
{
width
:
'100%'
,
padding
:
'0px 15px 15px 15px'
,
backgroundColor
:
'#ffffff'
}
}
>
<
ProTable
loading=
{
loading
}
rowKey=
"id"
...
...
src/pages/CommunityManagement/VisitorRecord/index.less
View file @
f7079474
...
...
@@ -5,5 +5,5 @@
.VisitorRecord {
padding: 15px;
background: #fff;
margin-bottom:
15px
;
margin-bottom:
0
;
}
src/pages/CommunityManagement/communityNotice/CommunityNotice.tsx
View file @
f7079474
import
React
from
'react'
;
import
{
connect
,
routerRedux
}
from
'dva'
;
import
{
Table
,
Button
,
Input
,
Select
,
Modal
,
Tooltip
,
Upload
,
Icon
,
Checkbox
,
Row
,
Radio
,
Tag
}
from
"antd"
;
import
{
connect
,
routerRedux
}
from
'dva'
;
import
{
Table
,
Button
,
Input
,
Select
,
Modal
,
Tooltip
,
Upload
,
Icon
,
Checkbox
,
Row
,
Radio
,
Tag
,
}
from
'antd'
;
import
styles
from
'./style.less'
;
import
{
ConnectState
}
from
"@/models/connect"
;
import
{
ConnectState
}
from
'@/models/connect'
;
// import XLSX from "@/pages/account/xlsx.core.min";
import
{
router
}
from
"umi"
;
import
{
router
}
from
'umi'
;
import
'moment/locale/zh-cn'
;
class
CommunityNotice
extends
React
.
Component
{
//构造
constructor
(
props
)
{
super
(
props
);
...
...
@@ -23,11 +34,15 @@ class CommunityNotice extends React.Component {
name
:
''
,
model
:
''
,
status
:
undefined
,
statusList
:
[{
label
:
"在线"
,
value
:
"1"
},
{
label
:
"故障"
,
value
:
"3"
},{
label
:
"未激活"
,
value
:
"4"
}],
statusList
:
[
{
label
:
'在线'
,
value
:
'1'
},
{
label
:
'故障'
,
value
:
'3'
},
{
label
:
'未激活'
,
value
:
'4'
},
],
provinceList
:
[],
cityList
:
[{
name
:
"未选择省"
}],
districtList
:
[{
name
:
"未选择市"
}],
streetList
:
[{
name
:
"未选择区"
}],
cityList
:
[{
name
:
'未选择省'
}],
districtList
:
[{
name
:
'未选择市'
}],
streetList
:
[{
name
:
'未选择区'
}],
delData
:
[],
visible
:
false
,
deviceStatus
:
''
,
...
...
@@ -36,147 +51,150 @@ class CommunityNotice extends React.Component {
used
:
null
,
newAdd
:
null
,
strList
:
[],
newList
:[],
authorityList
:[
newList
:
[],
authorityList
:
[
{
"children"
:
[
children
:
[
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
5
,
"name"
:
"组织架构"
,
"parentid"
:
1
,
"sort"
:
10
,
"state"
:
""
,
"is_checked"
:
true
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
5
,
name
:
'组织架构'
,
parentid
:
1
,
sort
:
10
,
state
:
''
,
is_checked
:
true
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
6
,
"name"
:
"员工管理"
,
"parentid"
:
1
,
"sort"
:
20
,
"state"
:
""
,
"is_checked"
:
true
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
6
,
name
:
'员工管理'
,
parentid
:
1
,
sort
:
20
,
state
:
''
,
is_checked
:
true
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
11
,
"name"
:
"角色管理"
,
"parentid"
:
1
,
"sort"
:
30
,
"state"
:
""
,
"is_checked"
:
false
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
11
,
name
:
'角色管理'
,
parentid
:
1
,
sort
:
30
,
state
:
''
,
is_checked
:
false
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
17
,
"name"
:
"企业设置"
,
"parentid"
:
1
,
"sort"
:
2
,
"state"
:
""
,
"is_checked"
:
true
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
17
,
name
:
'企业设置'
,
parentid
:
1
,
sort
:
2
,
state
:
''
,
is_checked
:
true
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
26
,
"name"
:
"员工管理"
,
"parentid"
:
1
,
"sort"
:
1
,
"state"
:
""
,
"is_checked"
:
false
}
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
26
,
name
:
'员工管理'
,
parentid
:
1
,
sort
:
1
,
state
:
''
,
is_checked
:
false
,
}
,
],
"hasChildren"
:
true
,
"is_admin"
:
1
,
"menuid"
:
1
,
"name"
:
"企业"
,
"parentid"
:
0
,
"sort"
:
20
,
"state"
:
"closed"
,
"is_checked"
:
true
hasChildren
:
true
,
is_admin
:
1
,
menuid
:
1
,
name
:
'企业'
,
parentid
:
0
,
sort
:
20
,
state
:
'closed'
,
is_checked
:
true
,
},
{
"children"
:
[
children
:
[
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
12
,
"name"
:
"供应商订单"
,
"parentid"
:
4
,
"sort"
:
10
,
"state"
:
""
,
"is_checked"
:
true
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
12
,
name
:
'供应商订单'
,
parentid
:
4
,
sort
:
10
,
state
:
''
,
is_checked
:
true
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
15
,
"name"
:
"供应商管理"
,
"parentid"
:
4
,
"sort"
:
20
,
"state"
:
""
,
"is_checked"
:
false
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
15
,
name
:
'供应商管理'
,
parentid
:
4
,
sort
:
20
,
state
:
''
,
is_checked
:
false
,
},
{
"children"
:
[],
"hasChildren"
:
false
,
"is_admin"
:
1
,
"menuid"
:
16
,
"name"
:
"成为供应商"
,
"parentid"
:
4
,
"sort"
:
30
,
"state"
:
""
,
"is_checked"
:
true
}
children
:
[],
hasChildren
:
false
,
is_admin
:
1
,
menuid
:
16
,
name
:
'成为供应商'
,
parentid
:
4
,
sort
:
30
,
state
:
''
,
is_checked
:
true
,
}
,
],
"hasChildren"
:
true
,
"is_admin"
:
1
,
"menuid"
:
4
,
"name"
:
"供应商"
,
"parentid"
:
0
,
"sort"
:
11
,
"state"
:
"closed"
,
"is_checked"
:
true
}
hasChildren
:
true
,
is_admin
:
1
,
menuid
:
4
,
name
:
'供应商'
,
parentid
:
0
,
sort
:
11
,
state
:
'closed'
,
is_checked
:
true
,
}
,
],
}
}
;
}
/*----------------- 方法集 ------------------*/
//重置
reset
=
()
=>
{
this
.
setState
({
province
:
undefined
,
city
:
undefined
,
district
:
undefined
,
street
:
undefined
,
status
:
undefined
,
name
:
''
,
},()
=>
{
this
.
getDevice
();
});
this
.
setState
(
{
province
:
undefined
,
city
:
undefined
,
district
:
undefined
,
street
:
undefined
,
status
:
undefined
,
name
:
''
,
},
()
=>
{
this
.
getDevice
();
},
);
};
//模态框相关
showModal
=
()
=>
{
let
flag
=
0
;
const
nowUser
=
this
.
props
.
currentUser
;
if
(
nowUser
.
permission
!=
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
"4"
)
{
if
(
this
.
state
.
delData
==
null
||
this
.
state
.
delData
.
length
<=
0
)
{
alert
(
"未选中删除项!"
);
if
(
nowUser
.
permission
!=
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'4'
)
{
if
(
this
.
state
.
delData
==
null
||
this
.
state
.
delData
.
length
<=
0
)
{
alert
(
'未选中删除项!'
);
return
;
}
flag
=
1
;
...
...
@@ -185,12 +203,12 @@ class CommunityNotice extends React.Component {
});
}
}
}
else
{
}
else
{
// alert("找不到用户权限记录!");
// return;
}
if
(
flag
==
0
)
{
alert
(
"缺少设备删除权限!"
);
if
(
flag
==
0
)
{
alert
(
'缺少设备删除权限!'
);
}
};
handleOk
=
()
=>
{
...
...
@@ -215,30 +233,29 @@ class CommunityNotice extends React.Component {
model
:
this
.
state
.
model
,
status
:
this
.
state
.
status
,
id
:
this
.
props
.
currentUser
.
userid
,
userPhone
:
"18813787835"
userPhone
:
'18813787835'
,
};
this
.
props
.
dispatch
({
type
:
'communityNoticeModel/getAllNotice'
,
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
)
{
/* this.setState({
/* this.setState({
data: res.rows,
total: res.total,
})*/
if
(
res
.
error_code
==
"0000"
)
{
if
(
res
.
error_code
==
'0000'
)
{
this
.
setState
({
data
:
res
.
data
.
rows
,
total
:
res
.
data
.
total
,
})
})
;
}
if
(
res
.
error_code
==
"0001"
)
{
if
(
res
.
error_code
==
'0001'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0002"
)
{
}
else
if
(
res
.
error_code
==
'0002'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
)
{
}
else
if
(
res
.
error_code
==
'0008'
)
{
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
...
...
@@ -247,40 +264,46 @@ class CommunityNotice extends React.Component {
// alert("Tos查询出错!未知错误!");
// }
}
}
}
,
});
};
//跳转到编辑页面
edit
=
(
params
)
=>
{
let
flag
=
0
;
const
nowUser
=
this
.
props
.
currentUser
;
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Create'
,
query
:
params
,
}))
if
(
nowUser
.
permission
!=
null
){
if
(
params
==
null
){
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
){
if
(
nowUser
.
permission
[
i
]
==
"3"
){
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Create'
,
query
:
params
,
}),
);
if
(
nowUser
.
permission
!=
null
)
{
if
(
params
==
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'3'
)
{
flag
=
1
;
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Create'
,
query
:
params
,
}))
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Create'
,
query
:
params
,
}),
);
}
}
}
else
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
"2"
)
{
}
else
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'2'
)
{
flag
=
1
;
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Edit'
,
query
:
params
,
}))
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Edit'
,
query
:
params
,
}),
);
}
}
}
}
else
{
}
else
{
// alert("找不到用户权限记录!");
// return;
}
...
...
@@ -297,87 +320,93 @@ class CommunityNotice extends React.Component {
edit2
=
(
params
)
=>
{
let
flag
=
0
;
const
nowUser
=
this
.
props
.
currentUser
;
if
(
nowUser
.
permission
!=
null
)
{
if
(
params
==
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
"3"
)
{
if
(
nowUser
.
permission
!=
null
)
{
if
(
params
==
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'3'
)
{
flag
=
1
;
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'tosUser/edit'
,
query
:
params
,
}))
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'tosUser/edit'
,
query
:
params
,
}),
);
}
}
}
else
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
"2"
)
{
}
else
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'2'
)
{
flag
=
1
;
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/tosUser/edit'
,
query
:
params
,
}))
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/tosUser/edit'
,
query
:
params
,
}),
);
}
}
}
}
else
{
}
else
{
// alert("找不到用户权限记录!");
// return;
}
if
(
flag
==
0
)
{
if
(
params
==
null
)
{
alert
(
"缺少设备添加权限!"
);
}
else
{
alert
(
"缺少设备修改权限!"
);
if
(
flag
==
0
)
{
if
(
params
==
null
)
{
alert
(
'缺少设备添加权限!'
);
}
else
{
alert
(
'缺少设备修改权限!'
);
}
}
};
//跳转到详情页面
details
=
(
params
)
=>
{
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Detail'
,
query
:
params
,
}))
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/CommunityManagement/CommunityAnnouncement/Detail'
,
query
:
params
,
}),
);
};
//设备状态变更
statusChange
=
(
e
)
=>
{
this
.
setState
({
status
:
e
==
undefined
?
undefined
:
e
});
this
.
setState
({
status
:
e
==
undefined
?
undefined
:
e
});
};
//设备名称和型号修改
nameAndModelChange
=
(
e
)
=>
{
this
.
setState
({
name
:
e
.
target
.
value
});
this
.
setState
({
name
:
e
.
target
.
value
});
};
//加载省
provinceload
=
(
code
)
=>
{
this
.
props
.
dispatch
({
type
:
'deviceModel/getRegion'
,
payload
:
{
code
:
code
,
},
payload
:
{
code
:
code
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
provinceList
:
res
.
data
,
});
}
}
}
,
});
};
//省变更
provinceChange
=
(
e
)
=>
{
if
(
e
==
undefined
)
{
this
.
setState
({
cityList
:
[{
name
:
"未选择省"
}],
districtList
:
[{
name
:
"未选择市"
}],
streetList
:
[{
name
:
"未选择区"
}],
cityList
:
[{
name
:
'未选择省'
}],
districtList
:
[{
name
:
'未选择市'
}],
streetList
:
[{
name
:
'未选择区'
}],
province
:
undefined
,
city
:
undefined
,
district
:
undefined
,
street
:
undefined
,
})
})
;
}
else
{
this
.
setState
({
province
:
{
label
:
e
.
label
,}
});
this
.
setState
({
province
:
{
label
:
e
.
label
}
});
this
.
props
.
dispatch
({
type
:
'deviceModel/getRegion'
,
payload
:
{
code
:
e
.
key
,
},
payload
:
{
code
:
e
.
key
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
...
...
@@ -387,7 +416,7 @@ class CommunityNotice extends React.Component {
street
:
undefined
,
});
}
}
}
,
});
}
};
...
...
@@ -395,17 +424,17 @@ class CommunityNotice extends React.Component {
cityChange
=
(
e
)
=>
{
if
(
e
==
undefined
)
{
this
.
setState
({
districtList
:
[{
name
:
"未选择市"
}],
streetList
:
[{
name
:
"未选择区"
}],
districtList
:
[{
name
:
'未选择市'
}],
streetList
:
[{
name
:
'未选择区'
}],
city
:
undefined
,
district
:
undefined
,
street
:
undefined
,
})
})
;
}
else
{
this
.
setState
({
city
:
{
label
:
e
.
label
,}
});
this
.
setState
({
city
:
{
label
:
e
.
label
}
});
this
.
props
.
dispatch
({
type
:
'deviceModel/getRegion'
,
payload
:
{
code
:
e
.
key
,
},
payload
:
{
code
:
e
.
key
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
...
...
@@ -414,7 +443,7 @@ class CommunityNotice extends React.Component {
street
:
undefined
,
});
}
}
}
,
});
}
};
...
...
@@ -422,15 +451,15 @@ class CommunityNotice extends React.Component {
districtChange
=
(
e
)
=>
{
if
(
e
==
undefined
)
{
this
.
setState
({
streetList
:
[{
name
:
"未选择区"
}],
streetList
:
[{
name
:
'未选择区'
}],
district
:
undefined
,
street
:
undefined
,
})
})
;
}
else
{
this
.
setState
({
district
:
{
label
:
e
.
label
,}
});
this
.
setState
({
district
:
{
label
:
e
.
label
}
});
this
.
props
.
dispatch
({
type
:
'deviceModel/getRegion'
,
payload
:
{
code
:
e
.
key
,
},
payload
:
{
code
:
e
.
key
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
...
...
@@ -438,7 +467,7 @@ class CommunityNotice extends React.Component {
street
:
undefined
,
});
}
}
}
,
});
}
};
...
...
@@ -449,36 +478,36 @@ class CommunityNotice extends React.Component {
payload
:
this
.
state
.
delData
,
callback
:
(
res
)
=>
{
if
(
res
)
{
if
(
res
.
error_code
==
"0000"
)
{
if
(
res
.
error_code
==
'0000'
)
{
alert
(
res
.
error_msg
);
this
.
getDevice
();
}
else
if
(
res
.
error_code
==
"0001"
)
{
}
else
if
(
res
.
error_code
==
'0001'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0002"
)
{
}
else
if
(
res
.
error_code
==
'0002'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
)
{
}
else
if
(
res
.
error_code
==
'0008'
)
{
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
alert
(
"删除失败!未知错误!"
);
alert
(
'删除失败!未知错误!'
);
}
}
}
}
,
});
}
;
}
//显示信息
info
()
{
const
{
used
,
newAdd
,
strList
}
=
this
.
state
;
const
strSelect
=
strList
.
map
((
item
)
=>
(
<
p
>
{
item
}
</
p
>
));
const
{
used
,
newAdd
,
strList
}
=
this
.
state
;
const
strSelect
=
strList
.
map
((
item
)
=>
<
p
>
{
item
}
</
p
>);
Modal
.
info
({
title
:
'批量导入结果'
,
content
:
(
<
div
>
<
p
>
绑定
<
span
style=
{
{
color
:
"lightgreen"
,
fontSize
:
24
}
}
>
{
newAdd
}
</
span
>
台设备,
以下
<
span
style=
{
{
color
:
"red"
,
fontSize
:
24
}
}
>
{
used
}
</
span
>
台设备已被占用
</
p
>
<
p
>
绑定
<
span
style=
{
{
color
:
'lightgreen'
,
fontSize
:
24
}
}
>
{
newAdd
}
</
span
>
台设备, 以下
<
span
style=
{
{
color
:
'red'
,
fontSize
:
24
}
}
>
{
used
}
</
span
>
台设备已被占用
</
p
>
{
strSelect
}
</
div
>
),
...
...
@@ -514,14 +543,11 @@ class CommunityNotice extends React.Component {
key
:
'noticStartTime'
,
},
{
title
:
'Status'
,
dataIndex
:
'noticScope'
,
key
:
'noticScope'
,
render
:
(
text
,
record
)
=>
(
<
span
>
{
record
.
noticScope
==
'1'
?
"全部小区"
:
"对应小区"
}
</
span
>
),
render
:
(
text
,
record
)
=>
<
span
>
{
record
.
noticScope
==
'1'
?
'全部小区'
:
'对应小区'
}
</
span
>,
/* render: (text, record) => (
<>
...
...
@@ -541,7 +567,6 @@ class CommunityNotice extends React.Component {
}
</>
),*/
},
/*{
...
...
@@ -565,27 +590,46 @@ class CommunityNotice extends React.Component {
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
<
span
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
details
(
record
)
}
>
Details
</
Button
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
edit
(
record
)
}
>
Edit
</
Button
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
details
(
record
)
}
>
Details
</
Button
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
edit
(
record
)
}
>
Edit
</
Button
>
</
span
>
),
},
];
//行选择
rowSelection
=
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
this
.
setState
({
delData
:
selectedRows
delData
:
selectedRows
,
});
},
};
//渲染
render
()
{
const
{
data
,
total
,
statusList
,
provinceList
,
cityList
,
districtList
,
province
,
city
,
district
,
status
,
name
,
newList
,
authorityList
data
,
total
,
statusList
,
provinceList
,
cityList
,
districtList
,
province
,
city
,
district
,
status
,
name
,
newList
,
authorityList
,
}
=
this
.
state
;
const
uploadprops
=
{
// 这里我们只接受excel2007以后版本的文件,accept就是指定文件选择框的文件类型
...
...
@@ -601,7 +645,7 @@ class CommunityNotice extends React.Component {
const
rABS
=
true
;
const
f
=
fileList
[
0
];
const
reader
=
new
FileReader
();
reader
.
onload
=
e
=>
{
reader
.
onload
=
(
e
)
=>
{
let
dataResult
=
e
.
target
.
result
;
if
(
!
rABS
)
dataResult
=
new
Uint8Array
(
dataResult
);
const
workbook
=
XLSX
.
read
(
dataResult
,
{
...
...
@@ -610,12 +654,17 @@ class CommunityNotice extends React.Component {
// 假设我们的数据在第一个标签
const
firstWorksheet
=
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]];
// XLSX自带了一个工具把导入的数据转成json
const
jsonArr
=
XLSX
.
utils
.
sheet_to_json
(
firstWorksheet
,
{
header
:
1
});
const
jsonArr
=
XLSX
.
utils
.
sheet_to_json
(
firstWorksheet
,
{
header
:
1
});
// 通过自定义的方法处理Json,得到Excel原始数据传给后端,后端统一处理
const
oldDeviceList
=
[];
for
(
let
i
=
0
;
i
<
jsonArr
.
length
;
i
++
)
{
//去重
if
(
!
oldDeviceList
.
includes
(
jsonArr
[
i
][
0
])
&&
jsonArr
[
i
][
0
]
!=
''
&&
jsonArr
[
i
][
0
]
!=
null
&&
jsonArr
[
i
][
0
]
!=
undefined
)
{
if
(
!
oldDeviceList
.
includes
(
jsonArr
[
i
][
0
])
&&
jsonArr
[
i
][
0
]
!=
''
&&
jsonArr
[
i
][
0
]
!=
null
&&
jsonArr
[
i
][
0
]
!=
undefined
)
{
oldDeviceList
.
push
(
jsonArr
[
i
][
0
]);
}
}
...
...
@@ -627,16 +676,19 @@ class CommunityNotice extends React.Component {
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
used
:
res
.
data
.
used
,
newAdd
:
res
.
data
.
integer
,
strList
:
res
.
data
.
strList
,
},()
=>
{
this
.
getDevice
();
this
.
info
();
});
this
.
setState
(
{
used
:
res
.
data
.
used
,
newAdd
:
res
.
data
.
integer
,
strList
:
res
.
data
.
strList
,
},
()
=>
{
this
.
getDevice
();
this
.
info
();
},
);
}
}
}
,
});
};
if
(
rABS
)
reader
.
readAsBinaryString
(
f
);
...
...
@@ -659,10 +711,12 @@ class CommunityNotice extends React.Component {
return
(
<
div
className=
{
styles
.
body
}
>
<
div
className=
{
styles
.
inputBox
}
>
<
Input
className=
{
styles
.
input
}
placeholder=
"User Name"
value=
{
name
}
onChange=
{
(
e
)
=>
this
.
nameAndModelChange
(
e
)
}
/>
<
Input
className=
{
styles
.
input
}
placeholder=
"User Name"
value=
{
name
}
onChange=
{
(
e
)
=>
this
.
nameAndModelChange
(
e
)
}
/>
{
/*<Select className={styles.input}*/
}
{
/* placeholder="设备状态"*/
}
{
/* onChange={(e) => this.statusChange(e)}*/
}
...
...
@@ -692,48 +746,54 @@ class CommunityNotice extends React.Component {
{
/* value={district}>*/
}
{
/* {districtSelect}*/
}
{
/*</Select>*/
}
</
div
>
<
div
>
<
Button
className=
{
styles
.
button1
}
onClick=
{
()
=>
this
.
getDevice
()
}
>
Search
</
Button
>
<
Button
className=
{
styles
.
button1
}
onClick=
{
()
=>
this
.
getDevice
()
}
>
Search
</
Button
>
{
/*<Button className={styles.button} onClick={() => this.reset()}>重置</Button>*/
}
<
Button
className=
{
styles
.
button2
}
onClick=
{
()
=>
this
.
edit
(
null
)
}
>
Create Notice
</
Button
>
<
Button
className=
{
styles
.
button2
}
onClick=
{
()
=>
this
.
edit
(
null
)
}
>
Create Notice
</
Button
>
<
Upload
{
...
uploadprops
}
>
<
Tooltip
title=
""
>
<
Button
className=
{
styles
.
button2
}
style=
{
{
width
:
150
}
}
>
<
Icon
type=
"upload"
/>
Batch Upload
<
Button
className=
{
styles
.
button2
}
style=
{
{
width
:
150
}
}
>
<
Icon
type=
"upload"
/
>
Batch Upload
</
Button
>
</
Tooltip
>
</
Upload
>
</
div
>
<
div
>
<
Table
rowKey=
{
record
=>
record
.
deviceID
}
rowKey=
{
(
record
)
=>
record
.
deviceID
}
className=
{
styles
.
table
}
rowSelection=
{
this
.
rowSelection
}
columns=
{
this
.
columns
}
dataSource=
{
data
}
size=
"small"
pagination=
{
{
showQuickJumper
:
true
,
pageSize
:
10
,
total
:
total
}
}
pagination=
{
{
showQuickJumper
:
true
,
pageSize
:
10
,
total
:
total
}
}
/>
<
Button
className=
{
styles
.
button3
}
onClick=
{
()
=>
this
.
showModal
()
}
>
Delete
</
Button
>
<
Button
className=
{
styles
.
button3
}
onClick=
{
()
=>
this
.
showModal
()
}
>
Delete
</
Button
>
</
div
>
<
Modal
title=
"确认删除?"
visible=
{
this
.
state
.
visible
}
onOk=
{
this
.
handleOk
}
onCancel=
{
this
.
handleCancel
}
>
<
div
style=
{
{
textAlign
:
"center"
}
}
><
p
style=
{
{
fontSize
:
18
}
}
>
删除信息将不可恢复
</
p
></
div
>
onCancel=
{
this
.
handleCancel
}
>
<
div
style=
{
{
textAlign
:
'center'
}
}
>
<
p
style=
{
{
fontSize
:
18
}
}
>
删除信息将不可恢复
</
p
>
</
div
>
</
Modal
>
</
div
>
);
}
}
export
default
connect
(({
user
}:
ConnectState
)
=>
({
export
default
connect
(({
user
}:
ConnectState
)
=>
({
currentUser
:
user
.
currentUser
,
}))(
CommunityNotice
);
src/pages/CommunityManagement/visitorRecord/VisitorRecord.tsx
View file @
f7079474
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Input
,
Tabs
,
Ta
ble
,
Form
,
Button
,
message
,
DatePicker
}
from
'antd'
;
import
{
Input
,
Tabs
,
Ta
g
,
Form
,
Button
,
message
,
DatePicker
}
from
'antd'
;
const
{
TabPane
}
=
Tabs
;
import
{
connect
}
from
'umi'
;
import
{
objectColumns
}
from
'@/utils/string'
;
...
...
@@ -39,7 +39,22 @@ const VisitorRecord = (props: any) => {
{
title
:
'Security Guard'
,
dataIndex
:
'securityGuardName'
},
{
title
:
'Number Plate'
,
dataIndex
:
'numberPlate'
},
// 隐藏的搜索框
{
title
:
'Visitor Time'
,
dataIndex
:
'updateTime'
,
valueType
:
'date'
},
{
title
:
'Visitor Time'
,
dataIndex
:
'updateTime'
,
valueType
:
'date'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
if
(
record
.
linkStatus
==
1
)
{
return
text
;
}
else
{
return
(
<>
{
text
}
<
Tag
color=
"red"
>
Temporary
</
Tag
>
</>
);
}
},
},
{
title
:
'Community'
,
dataIndex
:
'visitorCommunity'
},
// { title: 'Unit', dataIndex: 'inviterAddress' },
{
...
...
@@ -236,14 +251,14 @@ const VisitorRecord = (props: any) => {
Reset
</
Button
>
</
Form
.
Item
>
<
div
style=
{
{
ma
xWidth
:
'100%'
,
marginTop
:
15
,
width
:
'100%'
}
}
>
<
div
style=
{
{
ma
rginTop
:
24
,
marginRight
:
-
16
}
}
>
<
Form
.
Item
name=
"community"
label=
""
>
<
SelectCommunity
/>
</
Form
.
Item
>
</
div
>
</
Form
>
</
div
>
<
div
style=
{
{
width
:
'100%'
,
padding
:
16
,
backgroundColor
:
'#ffffff'
}
}
>
<
div
style=
{
{
width
:
'100%'
,
padding
:
'0px 15px 15px 15px'
,
backgroundColor
:
'#ffffff'
}
}
>
<
ProTable
loading=
{
loading
}
rowKey=
"id"
...
...
src/pages/ContractManagement/ContractContent.less
View file @
f7079474
...
...
@@ -2,231 +2,227 @@
//基石
.base {
width: 100%;
background-color: #ffffff;
padding: 20px;
width: 100%;
background-color: #ffffff;
padding: 20px;
}
//头部组件
.box{
width: 100%;
height: 64px;
position: relative;
}
.item1{
position: absolute;
width: 400px;
text-indent: 15px;
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item3{
width:80px;
height: 32px;
position: absolute;
right: 0;
outline: none;
background:none;
cursor: pointer;
border:1px solid rgba(217,217,217,1);
border-radius:2px;
}
.box1{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
line-height: 34px;
}
.box1item1{
position: absolute;
}
.box1item2{
position: absolute;
left: 164px;
.box {
width: 100%;
height: 64px;
position: relative;
}
.box1item3{
position: absolute;
left: 373px;
.item1 {
position: absolute;
width: 400px;
text-indent: 15px;
border-left: 5px solid rgba(24, 144, 255, 1);
font-family: 'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item3 {
width: 80px;
height: 32px;
position: absolute;
right: 0;
outline: none;
background: none;
cursor: pointer;
border: 1px solid rgba(217, 217, 217, 1);
border-radius: 2px;
}
.box1 {
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
line-height: 34px;
}
.box1item1 {
position: absolute;
}
.box1item2 {
position: absolute;
left: 164px;
}
.box1item3 {
position: absolute;
left: 373px;
}
.box1item4 {
position: absolute;
left: 530px;
}
.box1item5 {
position: absolute;
left: 740px;
}
.box1item6 {
position: absolute;
left: 890px;
}
.box4 {
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
}
.box4item1 {
position: absolute;
}
.box4item2 {
position: absolute;
left: 164px;
}
.box5 {
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
}
.box1item4{
position: absolute;
left: 530px;
.box5item1 {
position: absolute;
}
.box
1item5
{
position: absolute;
left: 740
px;
.box
5item2
{
position: absolute;
left: 164
px;
}
.box1item6{
position: absolute;
left: 890px;
}
.box
4
{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
.box
6
{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
}
.box
4item1
{
position: absolute;
.box
6item1
{
position: absolute;
}
.box
4item2
{
position: absolute;
left: 164px;
.box
6item2
{
position: absolute;
left: 164px;
}
.box5{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
.box6item3 {
position: absolute;
left: 330px;
}
.box5item1{
position: absolute;
}
.box5item2{
position: absolute;
left: 164px;
.box6item2x1 {
width: 120px;
height: 34px;
background: rgba(255, 255, 255, 1);
border: 1px solid rgba(217, 217, 217, 1);
border-radius: 2px;
text-align: center;
font-family: 'Source Han Sans CN';
font-weight: 400;
color: rgba(191, 191, 191, 1);
line-height: 34px;
}
.box
6
{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
.box
7
{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
}
.box6item1{
position: absolute;
.box7p {
width: 100%;
position: relative;
margin-bottom: 28px;
}
.box
6item2
{
position: absolute
;
left: 164
px;
.box
7item0
{
padding-left: 164px
;
width: 400
px;
}
.box6item3{
position: absolute;
left: 330px;
}
.box6item2x1{
width:120px;
height:34px;
background:rgba(255,255,255,1);
border:1px solid rgba(217,217,217,1);
border-radius:2px;
text-align: center;
font-family:'Source Han Sans CN';
font-weight:400;
color:rgba(191,191,191,1);
line-height:34px;
.box7item1 {
position: absolute;
width: 100%;
height: 34px;
}
.box7{
width: 100%;
height: 34px;
position: relative;
margin-bottom: 28px;
}
.box7p{
width: 100%;
position: relative;
margin-bottom: 28px;
}
.box7item0{
padding-left: 164px;
width: 400px;
}
.box7item1{
position: absolute;
width: 100%;
height: 34px;
}
.box7item2{
position: absolute;
left: 164px;
}
.box7item3{
position: absolute;
margin-left: 330px;
.box7item2 {
position: absolute;
left: 164px;
}
.box7item3 {
position: absolute;
margin-left: 330px;
}
.box8{
width: 100%;
height:
194px;
position: relative;
margin-bottom: 56px;
.box8
{
width: 100%;
height:
194px;
position: relative;
margin-bottom: 56px;
}
.box8item1{
position: absolute;
.box8item1
{
position: absolute;
}
.box8item2{
position: absolute;
left: 164px;
.box8item2
{
position: absolute;
left: 164px;
}
.box8item2x2{
font-size:12px;
font-family:'Source Han Sans CN';
font-weight:400;
color:rgba(153,153,153,1);
line-height:30px;
.box8item2x2 {
font-size: 12px;
font-family: 'Source Han Sans CN';
font-weight: 400;
color: rgba(153, 153, 153, 1);
line-height: 30px;
}
.contop{
padding: 20px;
background: #fff;
margin-bottom: 20px;
.contop {
padding: 20px 20px 10px;
background: #fff;
margin-bottom: 0;
}
// 字符串变红
.red{
color: red;
.red
{
color: red;
}
// 合同详情
.contract_box{
overflow: hidden;
.list_1{
display: flex;
justify-content: flex-start;
justify-items: center;
flex-wrap: wrap;
.item_1{
display: flex;
justify-content: flex-start;
justify-items: center;
line-height: 34px;
margin-right: 20px;
label{
display: inline-block;
width: 150px;
line-height: 32px;
}
}
}
.ant-form-item-label > label,.label{
.contract_box {
overflow: hidden;
.list_1 {
display: flex;
justify-content: flex-start;
justify-items: center;
flex-wrap: wrap;
.item_1 {
display: flex;
justify-content: flex-start;
justify-items: center;
line-height: 34px;
margin-right: 20px;
label {
display: inline-block;
width: 150px;
line-height: 32px;
}
}
}
.ant-form-item-label > label,
.label {
display: inline-block;
width: 150px;
line-height: 32px;
}
}
.listbox{
width: 100%;
background-color: #ffffff;
padding: 10px;
.listbox
{
width: 100%;
background-color: #ffffff;
padding: 10px;
}
.pages{
text-align: right;
padding: 10px ;
}
\ No newline at end of file
.pages {
text-align: right;
padding: 10px;
}
src/utils/tip.ts
View file @
f7079474
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-0
2 16:32:42
* @LastEditTime: 2020-12-0
4 11:41:39
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\tip.ts
*/
// 只能输入字母数字限制
const
inputNumberStr
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
value
)
{
if
(
/^
[
a-zA-Z0-9
]
+$/g
.
test
(
value
))
{
callback
();
}
else
{
callback
(
new
Error
(
'Only numbers and letters can be entered!'
));
}
}
callback
();
};
// 只能输入数字限制
const
inputNumber
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
value
)
{
if
(
/^
[
0-9
]
+$/g
.
test
(
value
))
{
callback
();
}
else
{
callback
(
new
Error
(
'Only numbers!'
));
}
}
callback
();
};
const
reqMes
=
(
msg
:
string
)
=>
{
return
{
required
:
true
,
message
:
msg
,
};
};
// 合同提示
export
const
tipList
=
[
[
'Please Input Contract Numbe!'
],
[
'Please Input Contract Party A!'
],
[
'Please Input Contract Party B!'
],
[
'Please Choice CommunityName!'
],
[
'Please Choice Contract Title!'
],
[
'Please Choice Contract Time!'
],
[
'Please upload Contract Annex!'
],
// [
'Please Input Contract Remarks!'
],
[
reqMes
(
'Please Input Contract Numbe!'
)
],
[
reqMes
(
'Please Input Contract Party A!'
)
],
[
reqMes
(
'Please Input Contract Party B!'
)
],
[
reqMes
(
'Please Choice CommunityName!'
)
],
[
reqMes
(
'Please Choice Contract Title!'
)
],
[
reqMes
(
'Please Choice Contract Time!'
)
],
[
reqMes
(
'Please upload Contract Annex!'
)
],
// [
reqMes('Please Input Contract Remarks!')
],
];
// 小区提示
export
const
village
=
[
[{
required
:
true
,
message
:
'Please enter the postcode'
}],
[{
required
:
true
,
message
:
'Please enter the address of the community !'
}],
[{
required
:
true
,
message
:
'Please enter the cell name !'
}],
[{
required
:
true
,
message
:
'Please select the time !'
}],
[{
required
:
true
,
message
:
'Please enter your mobile phone number !'
}],
[
{
required
:
true
,
type
:
'email'
,
message
:
'Please enter the correct email address !'
,
},
],
[{
required
:
true
,
message
:
'Please enter the name of the community administrator !'
}],
[
reqMes
(
'Please enter the postcode !'
)],
[
reqMes
(
'Please enter the address of the community !'
)],
[
reqMes
(
'Please enter the cell name !'
)],
[
reqMes
(
'Please select the time !'
)],
[
reqMes
(
'Please enter your mobile phone number !'
)],
[{
...
reqMes
(
'Please enter the correct email address !'
),
type
:
'email'
}],
[
reqMes
(
'Please enter the name of the community administrator !'
)],
];
//公告提示
export
const
Notice
=
[
[
{
required
:
true
,
message
:
'Please select community'
}
],
[
{
required
:
true
,
message
:
'Please input the notice title.'
}
],
[
{
required
:
true
,
message
:
'Please input the announcement content.'
}
],
[
{
required
:
true
,
message
:
'Please choose the effective time of the announcement.'
}
],
[
reqMes
(
'Please select community'
)
],
[
reqMes
(
'Please input the notice title.'
)
],
[
reqMes
(
'Please input the announcement content.'
)
],
[
reqMes
(
'Please choose the effective time of the announcement.'
)
],
];
// 新增设施
export
const
NewFaci
=
[
[
{
required
:
true
,
message
:
'Please select community'
}
],
[
{
required
:
true
,
message
:
'Please input Facility Name'
}
],
[
{
required
:
false
,
message
:
'Please Set management fee'
}
],
[
{
required
:
false
,
message
:
'Please Set Setting deposit'
}
],
[
{
required
:
true
,
message
:
'Please Upload facility photos'
}
],
[
{
required
:
true
,
message
:
'Required'
}
],
[
{
required
:
true
,
message
:
'Required'
}
],
[
{
required
:
true
,
message
:
'Required'
}
],
[
{
required
:
true
,
message
:
'Required'
}
],
[
{
required
:
true
,
message
:
'Required'
}
],
[
reqMes
(
'Please select community'
)
],
[
reqMes
(
'Please input Facility Name'
)
],
[
reqMes
(
'Please Set management fee'
)
],
[
reqMes
(
'Please Set Setting deposit'
)
],
[
reqMes
(
'Please Upload facility photos'
)
],
[
reqMes
(
'Required'
)
],
[
reqMes
(
'Required'
)
],
[
reqMes
(
'Required'
)
],
[
reqMes
(
'Required'
)
],
[
reqMes
(
'Required'
)
],
];
// 设施预订
export
const
BookingsTip
=
[
[{
required
:
true
,
message
:
'Please input Name '
}],
[{
required
:
true
,
message
:
'Please input Contact Details'
}],
[{
required
:
true
,
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'g'
),
message
:
'Only numbers!'
}],
[{
required
:
true
,
pattern
:
new
RegExp
(
/^
[
1-9
]\d
*$/
,
'g'
),
message
:
'Only numbers!'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
required
:
true
,
message
:
'Please Select The Date'
}],
[
reqMes
(
'Please input Name '
)],
[
reqMes
(
'Please input Contact Details'
)],
// [{ required: true, pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: 'Only numbers!')],
[{
...
reqMes
(
''
),
validator
:
inputNumber
}],
[{
...
reqMes
(
''
),
validator
:
inputNumber
}],
[{
...
reqMes
(
''
),
validator
:
inputNumberStr
}],
[
reqMes
(
'Please Select The Date'
)],
];
// 账号新增编辑
export
const
AccountTip
=
[
[{
required
:
true
,
type
:
'email'
,
message
:
'Please enter email address !'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
required
:
true
,
message
:
'Please enter the correct contact information !'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
required
:
true
,
message
:
'Required'
}],
[{
...
reqMes
(
'Please enter email address !'
),
type
:
'email'
}],
[
reqMes
(
'Required'
)],
[
reqMes
(
'Please enter the correct contact information !'
)],
];
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