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
c9b23759
Commit
c9b23759
authored
Dec 23, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账号权限
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
d1381930
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
888 additions
and
93 deletions
+888
-93
Facilitys copy.tsx
src/components/Facilitys/Facilitys copy.tsx
+228
-0
Facilitys.tsx
src/components/Facilitys/Facilitys.tsx
+13
-15
PictureOptionsRow.tsx
src/components/PictureOptions/PictureOptionsRow.tsx
+1
-1
Account.ts
src/models/CommunityManagement/Account.ts
+5
-0
Account.tsx
src/pages/AccountManagement/account/Account.tsx
+2
-2
AccountAdds.tsx
src/pages/AccountManagement/account/AccountAdds.tsx
+80
-6
AccountEdit copy.tsx
src/pages/AccountManagement/account/AccountEdit copy.tsx
+389
-0
AccountEdit.tsx
src/pages/AccountManagement/account/AccountEdit.tsx
+139
-64
CardDetail.tsx
src/pages/CommercialService/CardDetail.tsx
+7
-2
RenovationDetail.tsx
src/pages/CommercialService/RenovationDetail.tsx
+6
-1
Facility.tsx
src/pages/CommunityManagement/FacilityBookings/Facility.tsx
+17
-1
FacilityBookings.tsx
...CommunityManagement/FacilityBookings/FacilityBookings.tsx
+1
-1
No files found.
src/components/Facilitys/Facilitys copy.tsx
0 → 100644
View file @
c9b23759
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
'./index.less'
;
import
{
Button
,
Form
,
message
,
Modal
,
Input
,
Upload
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
// import FacilitysTow from './FacilitysTow';
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
function
getBase64
(
file
:
any
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
()
=>
resolve
(
reader
.
result
);
reader
.
onerror
=
(
error
)
=>
reject
(
error
);
});
}
const
module
=
'FacilityBookings'
;
const
Facilitys
=
(
props
:
any
)
=>
{
//传递值
const
{
updata
,
disabled
,
FacilitysList
,
dispatch
,
dumps
}
=
props
;
//上传列表
// const [FacilitysList, setFileList] = useState(FacilitysList);
//显示隐藏
const
[
previewVisible
,
setpreviewVisible
]
=
useState
(
false
);
// 名称
const
[
previewTitle
,
setpreviewTitle
]
=
useState
(
''
);
// 图片地址
const
[
previewImage
,
setpreviewImage
]
=
useState
(
''
);
// 传递给后台加 key
const
updetaTow
=
(
key
:
any
)
=>
{
let
data
=
updata
;
data
.
identification
=
key
;
return
data
;
};
//绑定值
const
updetaList
=
(
key
:
any
)
=>
{
return
FacilitysList
[
key
].
fileList
;
};
// 预览
const
handlePreview
=
async
(
file
:
any
)
=>
{
if
(
!
file
.
url
&&
!
file
.
preview
)
{
file
.
preview
=
await
getBase64
(
file
.
originFileObj
);
}
setpreviewImage
(
file
.
url
||
file
.
preview
);
setpreviewTitle
(
file
.
name
);
setpreviewVisible
(
true
);
};
// 点击遮罩回调
const
handleCancel
=
()
=>
{
setpreviewVisible
(
false
);
};
// 上传属性
const
uploadProps
:
any
=
{
listType
:
'picture-card'
,
accept
:
'.jpeg,.png,.jpg'
,
action
:
'/tos/image/upload'
,
onChange
(
info
:
any
)
{
// console.log(info);
if
(
info
.
file
.
status
===
'done'
)
{
message
.
success
(
`
${
info
.
file
.
name
}
file uploaded successfully`
);
// 拿到key 值 开始存储
let
key
=
info
.
fileList
[
0
].
response
.
data
.
identification
;
let
list
=
FacilitysList
;
list
[
key
].
id
=
key
;
list
[
key
].
fileList
=
info
.
fileList
;
// 存储到mode里面去
dispatch
({
type
:
module
+
'/genxin'
,
list
});
// 当前页面也要刷新
// let list = fileList;
// setFileList(list); // 注意 不能直接赋值 因为使用完全绑定需要全部更新
// setFileList(list);
// let list: any = [...fileList, ...info.fileList];
// setFileList(list);
console
.
log
(
list
);
// 将图片信息提交给state
// let data = { val: info.file.name, key: keys };
// dispatch({ type: module + '/retImgsList', data });
// 结束
}
else
if
(
info
.
file
.
status
===
'error'
)
{
message
.
error
(
`
${
info
.
file
.
name
}
file upload failed.`
);
}
},
};
// 新增动作
const
add
=
()
=>
{
let
list
=
FacilitysList
;
let
adds
=
{
id
:
'-1'
,
fileList
:
[],
name
:
''
,
};
// 验证已添加的是否上传完整
let
complete
=
list
.
every
((
item
:
any
)
=>
{
// return item.fileList.length > 0 && item.name !== '';
return
item
.
fileList
.
length
>
0
;
});
if
(
list
.
length
==
0
||
complete
)
{
list
.
push
(
adds
);
// 存储到mode里面去
dispatch
({
type
:
module
+
'/genxin'
,
list
});
}
else
{
// 提示每一项都要填写完
message
.
error
(
'Please fill out each item !'
);
}
};
//删除动作
const
deleteImg
=
(
key
:
any
)
=>
{
console
.
log
(
key
);
let
list
=
FacilitysList
;
// list[key].name = '';
// 这里还要清除表单的值,否则再次新增输入框的值会重复出现
dumps
(
key
);
list
.
splice
(
key
,
1
);
console
.
log
(
list
);
// // 存储到mode里面去
dispatch
({
type
:
module
+
'/genxin'
,
list
});
};
// 新增按钮
const
uploadButton
=
(
<
div
>
<
PlusOutlined
/>
<
div
className=
"ant-upload-text"
>
Upload
</
div
>
</
div
>
);
// 输入框内容
const
monitor
=
(
e
:
any
)
=>
{
let
list
=
FacilitysList
;
let
{
id
,
value
}
=
e
.
target
;
if
(
id
==
'basic_shebei_0'
)
{
id
=
0
;
}
list
[
id
].
name
=
value
;
dispatch
({
type
:
module
+
'/genxin'
,
list
});
};
return
(
<>
<
Form
.
Item
name=
"picList"
required=
{
false
}
style=
{
{
marginBottom
:
0
}
}
>
{
FacilitysList
.
map
((
item
:
any
,
index
:
any
,
keys
:
any
)
=>
{
console
.
log
(
item
);
return
(
<
div
className=
{
'test'
}
key=
{
item
.
id
}
>
<
div
className=
{
'diybox'
}
key=
{
item
.
id
}
>
<
Upload
{
...
uploadProps
}
fileList=
{
FacilitysList
[
index
].
fileList
.
length
>
0
?
FacilitysList
[
index
].
fileList
:
false
}
// data=
{
updata
}
data=
{
updetaTow
(
index
)
}
// 携带数据
disabled=
{
disabled
}
// 禁止
onPreview=
{
handlePreview
}
// 预览
onRemove=
{
()
=>
{
deleteImg
(
index
);
}
}
//移除
>
{
FacilitysList
[
index
].
fileList
.
length
>
0
?
null
:
uploadButton
}
</
Upload
>
<
div
className=
{
'Facility'
}
key=
{
item
.
id
}
>
<
Form
.
Item
label=
{
`Facility Name ${index + 1}`
}
name=
{
'shebei_'
+
index
}
rules=
{
[{
required
:
true
,
message
:
'Please input Facility Name!'
}]
}
>
<
Input
placeholder=
"Facility Name"
disabled=
{
disabled
}
id=
{
index
}
onChange=
{
(
e
:
any
)
=>
monitor
(
e
)
}
value=
{
FacilitysList
[
index
].
name
}
/>
</
Form
.
Item
>
<
div
className=
{
'over'
}
>
<
Button
type=
"link"
disabled=
{
disabled
}
onClick=
{
()
=>
deleteImg
(
index
)
}
>
Delete
</
Button
>
</
div
>
</
div
>
</
div
>
</
div
>
);
})
}
</
Form
.
Item
>
<
Form
.
Item
>
<
Button
type=
"dashed"
onClick=
{
()
=>
add
()
}
style=
{
{
width
:
'100px'
,
height
:
'100px'
}
}
icon=
{
<
PlusOutlined
/>
}
disabled=
{
disabled
}
></
Button
>
</
Form
.
Item
>
{
/* 预览表格 */
}
<
Modal
visible=
{
previewVisible
}
title=
{
previewTitle
}
footer=
{
null
}
onCancel=
{
handleCancel
}
>
<
img
alt=
"example"
style=
{
{
width
:
'100%'
}
}
src=
{
previewImage
}
/>
</
Modal
>
</>
);
};
function
mapStateToProps
(
state
:
any
)
{
const
{
FacilitysList
}
=
state
.
FacilityBookings
;
return
{
FacilitysList
,
};
}
export
default
connect
(
mapStateToProps
)(
Facilitys
);
src/components/Facilitys/Facilitys.tsx
View file @
c9b23759
...
@@ -50,13 +50,6 @@ const Facilitys = (props: any) => {
...
@@ -50,13 +50,6 @@ const Facilitys = (props: any) => {
setpreviewVisible
(
true
);
setpreviewVisible
(
true
);
};
};
// 点击移除图片
const
handRemove
=
(
key
:
any
)
=>
{
// let list = fileList;
// 将图片信息提交给state
deleteImg
(
key
);
};
// 点击遮罩回调
// 点击遮罩回调
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
setpreviewVisible
(
false
);
setpreviewVisible
(
false
);
...
@@ -123,12 +116,13 @@ const Facilitys = (props: any) => {
...
@@ -123,12 +116,13 @@ const Facilitys = (props: any) => {
};
};
//删除动作
//删除动作
const
deleteImg
=
(
key
:
any
)
=>
{
const
deleteImg
=
(
key
:
any
,
id
:
any
)
=>
{
let
list
=
FacilitysList
;
let
list
=
FacilitysList
;
list
[
key
].
name
=
''
;
list
[
key
].
name
=
''
;
// 这里还要清除表单的值,否则再次新增输入框的值会重复出现
// 这里还要清除表单的值,否则再次新增输入框的值会重复出现
dumps
(
key
);
dumps
(
id
);
list
.
splice
(
key
,
1
);
list
.
splice
(
key
,
1
);
// 存储到mode里面去
// 存储到mode里面去
...
@@ -159,8 +153,8 @@ const Facilitys = (props: any) => {
...
@@ -159,8 +153,8 @@ const Facilitys = (props: any) => {
<
Form
.
Item
name=
"picList"
required=
{
false
}
style=
{
{
marginBottom
:
0
}
}
>
<
Form
.
Item
name=
"picList"
required=
{
false
}
style=
{
{
marginBottom
:
0
}
}
>
{
FacilitysList
.
map
((
item
:
any
,
index
:
any
,
key
:
any
)
=>
{
{
FacilitysList
.
map
((
item
:
any
,
index
:
any
,
key
:
any
)
=>
{
return
(
return
(
<
div
className=
{
'test'
}
key=
{
'pic_'
+
index
}
>
<
div
className=
{
'test'
}
key=
{
item
.
id
}
>
<
div
className=
{
'diybox'
}
key=
{
'pic_'
+
index
}
>
<
div
className=
{
'diybox'
}
key=
{
item
.
id
}
>
<
Upload
<
Upload
{
...
uploadProps
}
{
...
uploadProps
}
fileList=
{
fileList=
{
...
@@ -171,16 +165,16 @@ const Facilitys = (props: any) => {
...
@@ -171,16 +165,16 @@ const Facilitys = (props: any) => {
disabled=
{
disabled
}
// 禁止
disabled=
{
disabled
}
// 禁止
onPreview=
{
handlePreview
}
// 预览
onPreview=
{
handlePreview
}
// 预览
onRemove=
{
()
=>
{
onRemove=
{
()
=>
{
handRemove
(
index
);
deleteImg
(
index
,
item
.
id
);
}
}
//移除
}
}
//移除
>
>
{
FacilitysList
[
index
].
fileList
.
length
>
0
?
null
:
uploadButton
}
{
FacilitysList
[
index
].
fileList
.
length
>
0
?
null
:
uploadButton
}
</
Upload
>
</
Upload
>
<
div
className=
{
'Facility'
}
key=
{
'pic_'
+
index
}
>
<
div
className=
{
'Facility'
}
key=
{
item
.
id
}
>
<
Form
.
Item
<
Form
.
Item
label=
{
`Facility Name ${index + 1}`
}
label=
{
`Facility Name ${index + 1}`
}
name=
{
'shebei_'
+
i
ndex
}
name=
{
'shebei_'
+
i
tem
.
id
}
rules=
{
[{
required
:
true
,
message
:
'Please input Facility Name!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'Please input Facility Name!'
}]
}
>
>
<
Input
<
Input
...
@@ -192,7 +186,11 @@ const Facilitys = (props: any) => {
...
@@ -192,7 +186,11 @@ const Facilitys = (props: any) => {
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
className=
{
'over'
}
>
<
div
className=
{
'over'
}
>
<
Button
type=
"link"
disabled=
{
disabled
}
onClick=
{
()
=>
deleteImg
(
index
)
}
>
<
Button
type=
"link"
disabled=
{
disabled
}
onClick=
{
()
=>
deleteImg
(
index
,
item
.
id
)
}
>
Delete
Delete
</
Button
>
</
Button
>
</
div
>
</
div
>
...
...
src/components/PictureOptions/PictureOptionsRow.tsx
View file @
c9b23759
...
@@ -115,7 +115,7 @@ const PictureOptionsRow = (props: any) => {
...
@@ -115,7 +115,7 @@ const PictureOptionsRow = (props: any) => {
}
}
return
isJpgOrPng
&&
isLt2M
;
return
isJpgOrPng
&&
isLt2M
;
}
}
console
.
log
(
props
);
//
console.log(props);
return
(
return
(
<
div
>
<
div
>
<
Upload
<
Upload
...
...
src/models/CommunityManagement/Account.ts
View file @
c9b23759
...
@@ -105,6 +105,11 @@ export default {
...
@@ -105,6 +105,11 @@ export default {
// yield put({ type: 'returnResult', Result });
// yield put({ type: 'returnResult', Result });
}
}
break
;
break
;
case
56
:
// 二级账号
{
localStorage
.
setItem
(
'towAccount'
,
JSON
.
stringify
(
resp
.
data
));
}
break
;
}
}
}
}
},
},
...
...
src/pages/AccountManagement/account/Account.tsx
View file @
c9b23759
...
@@ -110,8 +110,8 @@ const Account = (props: any) => {
...
@@ -110,8 +110,8 @@ const Account = (props: any) => {
},
},
{
{
title
:
'Creation Time'
,
title
:
'Creation Time'
,
dataIndex
:
'
cre
ateTime'
,
dataIndex
:
'
upd
ateTime'
,
key
:
'
cre
ateTime'
,
key
:
'
upd
ateTime'
,
render
:
(
text
:
any
)
=>
{
render
:
(
text
:
any
)
=>
{
return
moment
(
text
).
format
(
'YYYY-MM-DD'
);
return
moment
(
text
).
format
(
'YYYY-MM-DD'
);
},
},
...
...
src/pages/AccountManagement/account/AccountAdds.tsx
View file @
c9b23759
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
message
,
Descriptions
,
Spin
,
Tree
,
Radio
}
from
'antd'
;
import
{
Form
,
Input
,
Button
,
message
,
Descriptions
,
Spin
,
Tree
,
Radio
,
Select
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
'./Account.less'
;
import
'./Account.less'
;
import
{
zhCnFaci
,
enUsFaci
}
from
'@/utils/power'
;
import
{
zhCnFaci
,
enUsFaci
}
from
'@/utils/power'
;
...
@@ -27,11 +26,18 @@ const Account = (props: any) => {
...
@@ -27,11 +26,18 @@ const Account = (props: any) => {
// 单选 二级还是三级管理员
// 单选 二级还是三级管理员
const
[
values
,
setvalues
]
=
useState
(
2
);
// 树形菜单展开关闭
const
[
values
,
setvalues
]
=
useState
(
2
);
// 树形菜单展开关闭
const
[
disab
,
setdisab
]
=
useState
(
false
);
// 是否禁止选择二级
const
[
towAccountId
,
settowAccountId
]
=
useState
(
null
);
// 二级账户id
// 表单标识
// 表单标识
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
formRef
=
useRef
(
null
);
const
formRef
=
useRef
(
null
);
const
{
Option
}
=
Select
;
//二级账户列表
const
towAccount
=
JSON
.
parse
(
localStorage
.
getItem
(
'towAccount'
)
||
'[]'
);
// 当前账户权限
// 当前账户权限
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
...
@@ -57,6 +63,23 @@ const Account = (props: any) => {
...
@@ -57,6 +63,23 @@ const Account = (props: any) => {
}
}
}
}
}
}
// 当当前账户是二级以上禁用创建二级菜单
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
>
1
)
{
setvalues
(
3
);
setdisab
(
true
);
settowAccountId
(
user
.
currentUser
.
id
);
// 如果是三级账户,禁用最后两个账户管理
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
==
3
)
{
// 禁用最后两个
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
}
}
else
{
// 如果是一级账户获取挂靠的二级账户名称
RA
(
56
,
{},
module
,
dispatch
);
// 权限上传
}
// 赋值改变
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
...
@@ -101,12 +124,19 @@ const Account = (props: any) => {
...
@@ -101,12 +124,19 @@ const Account = (props: any) => {
// 账号长度
// 账号长度
message
.
error
(
'The Account Password is Greater Than 6 Digits!'
);
message
.
error
(
'The Account Password is Greater Than 6 Digits!'
);
return
false
;
return
false
;
}
else
if
(
values
==
3
&&
towAccountId
==
null
)
{
// 如果创建的是三级账号就要判断是否选择了绑定的二级账户
message
.
error
(
'Please select affiliated account !'
);
return
false
;
}
else
{
}
else
{
value
.
tosUserServiceCellList
=
value
.
community
.
value
;
// 管辖小区
value
.
tosUserServiceCellList
=
value
.
community
.
value
;
// 管辖小区
value
.
tosUserEmail
=
value
.
tosUserName
;
// 邮箱就是账号
value
.
tosUserEmail
=
value
.
tosUserName
;
// 邮箱就是账号
value
.
tosUserLevel
=
values
;
//级别
value
.
tosUserLevel
=
values
;
//级别
value
.
creatorName
=
JSON
.
parse
(
userInfo
).
userModel
.
tosUserName
;
//新建者账号
value
.
creatorName
=
JSON
.
parse
(
userInfo
).
userModel
.
tosUserName
;
//新建者账号
value
.
creatorId
=
id
;
//新建者ID
value
.
creatorId
=
id
;
//新建者ID
if
(
values
==
3
)
{
value
.
userLeader
=
towAccountId
;
}
delete
value
.
community
;
delete
value
.
community
;
// 判断有没有 0 有就删除
// 判断有没有 0 有就删除
...
@@ -177,6 +207,24 @@ const Account = (props: any) => {
...
@@ -177,6 +207,24 @@ const Account = (props: any) => {
//级别切换
//级别切换
const
onRadio
=
(
e
:
any
)
=>
{
const
onRadio
=
(
e
:
any
)
=>
{
setvalues
(
e
.
target
.
value
);
setvalues
(
e
.
target
.
value
);
// 如果是3级,取消后面两个选择
let
treeDatas
=
treeData
;
let
_p
=
treeDatas
[
0
].
children
;
// 所有权限列表
// 禁用最后两个
if
(
e
.
target
.
value
==
3
)
{
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
}
else
{
//否则打开
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
false
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
false
;
settowAccountId
(
null
);
}
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
};
};
//手机号
//手机号
...
@@ -186,7 +234,21 @@ const Account = (props: any) => {
...
@@ -186,7 +234,21 @@ const Account = (props: any) => {
const
keyup_tool
=
(
value
:
any
)
=>
{
const
keyup_tool
=
(
value
:
any
)
=>
{
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
};
};
// 选择小区名字并赋值
// 二级账户
const
listItems
=
towAccount
.
map
((
item
:
any
)
=>
{
return
(
<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
>
{
item
.
tosAccountName
}
-
{
item
.
tosUserEmail
}
</
Option
>
);
});
// 选择哪个二级账号
const
handleChange
=
(
value
:
any
)
=>
{
console
.
log
(
`selected
${
value
}
`
);
settowAccountId
(
value
);
};
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
...
@@ -246,15 +308,27 @@ const Account = (props: any) => {
...
@@ -246,15 +308,27 @@ const Account = (props: any) => {
<
span
className=
"title"
>
Privilege Level:
</
span
>
<
span
className=
"title"
>
Privilege Level:
</
span
>
</
div
>
</
div
>
<
div
className=
"label"
>
<
div
className=
"label"
>
<
Radio
.
Group
defaultV
alue=
{
values
}
onChange=
{
onRadio
}
>
<
Radio
.
Group
v
alue=
{
values
}
onChange=
{
onRadio
}
>
<
Radio
style=
{
radioStyle
}
value=
{
2
}
>
<
Radio
style=
{
radioStyle
}
disabled=
{
disab
}
value=
{
2
}
>
Two Level Administrator
Two Level Administrator
</
Radio
>
</
Radio
>
<
Radio
style=
{
radioStyle
}
value=
{
3
}
>
<
Radio
style=
{
radioStyle
}
value=
{
3
}
>
Three Level Administrator
Three Level Administrator
{
/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */
}
</
Radio
>
</
Radio
>
</
Radio
.
Group
>
</
Radio
.
Group
>
{
/* 选择挂靠的二级菜单 */
}
{
values
===
3
&&
user
.
currentUser
.
userModel
.
tosUserLevel
<=
1
?
(
<
Select
style=
{
{
width
:
260
}
}
onChange=
{
handleChange
}
placeholder=
"Please select affiliated account"
>
{
towAccount
?
listItems
:
''
}
</
Select
>
)
:
(
''
)
}
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/pages/AccountManagement/account/AccountEdit copy.tsx
0 → 100644
View file @
c9b23759
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Spin
,
message
,
Descriptions
,
Tree
,
Radio
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
'./Account.less'
;
import
{
zhCnFaci
,
enUsFaci
}
from
'@/utils/power'
;
import
{
AccountTip
}
from
'@/utils/tip'
;
import
SelectCommunity
from
'@/components/SelectCommunity'
;
import
{
getNumber
}
from
'@/utils/string'
;
// 正则
import
{
RA
}
from
'@/utils/method'
;
const
Account
=
(
props
:
any
)
=>
{
const
module
=
'Account'
;
const
{
dispatch
,
Data
,
DataSave
,
DataSaveDetail
,
SubResult
,
loading
,
Permission
,
user
}
=
props
;
// 权限列表
const
treeData
=
enUsFaci
||
zhCnFaci
;
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
string
[]
>
([]);
// 展开栏目
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
<
string
[]
>
([]);
// 默认已选栏目
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
<
string
[]
>
([]);
// 设置选中的树大节点
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
<
boolean
>
(
true
);
// 树形菜单展开关闭
// 单选 二级还是三级管理员
const
[
values
,
setvalues
]
=
useState
(
2
);
// 树形菜单展开关闭
const
[
disab
,
setdisab
]
=
useState
(
false
);
// 是否禁止选择二级
// 表单标识
const
[
form
]
=
Form
.
useForm
();
const
formRef
=
useRef
(
null
);
// 数据
useEffect
(()
=>
{
if
(
DataSave
!=
null
)
{
// 赋值
form
.
setFieldsValue
({
tosUserName
:
DataSave
.
tosUserName
,
tosUserPhone
:
DataSave
.
tosUserPhone
,
tosAccountName
:
DataSave
.
tosAccountName
,
});
setvalues
(
DataSave
.
tosUserLevel
);
// 等级
// 发起获取权限请求
RA
(
54
,
{
tosUserName
:
DataSave
.
tosUserName
},
module
,
dispatch
);
// 发起获取权限请求
}
},
[
DataSave
]);
// 当前账户权限
useEffect
(()
=>
{
if
(
user
!=
null
)
{
let
treeDatas
=
treeData
;
let
_a
=
user
.
currentUser
.
permission
;
// 当前账户权限
let
_p
=
treeDatas
[
0
].
children
;
// 所有权限列表
let
arr
:
any
=
[];
// 一级栏目权限
let
erArr
:
any
=
[];
// 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
for
(
let
i
of
_a
)
{
for
(
let
j
in
_p
)
{
if
(
_p
[
j
].
key
==
i
)
{
arr
.
push
(
_p
[
j
].
key
);
_p
[
j
].
disabled
=
false
;
}
// 二级权限
for
(
let
k
in
_p
[
j
].
children
)
{
if
(
_p
[
j
].
children
[
k
].
key
==
i
)
{
erArr
.
push
(
_p
[
j
].
children
[
k
].
key
);
_p
[
j
].
children
[
k
].
disableCheckbox
=
false
;
}
}
}
}
// 当当前账户是二级以上禁用创建二级菜单
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
>
1
)
{
setvalues
(
user
.
currentUser
.
userModel
.
tosUserLevel
);
setdisab
(
true
);
// 禁用最后两个
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
// 如果是三级账户,删除最后两个账户管理
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
==
3
)
{
console
.
log
(
treeData
);
}
}
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
}
},
[
user
]);
// 已选权限
useEffect
(()
=>
{
if
(
Permission
!=
null
)
{
let
newPer
=
eval
(
'('
+
Permission
+
')'
);
let
data
:
any
=
[];
// 编辑的账户的权限
for
(
let
i
in
newPer
)
{
data
[
i
]
=
newPer
[
i
]
+
''
;
}
// console.log(data); // 编辑的账户的权限
let
_p
=
treeData
[
0
].
children
;
// 所有权限列表
// console.log(_p); // 所有权限列表
for
(
let
i
in
_p
)
{
let
arr
=
_p
[
i
].
children
;
// 每个权限
let
newArr
=
[];
// 每个权限下的子权限列表
for
(
let
j
in
arr
)
{
newArr
.
push
(
arr
[
j
].
key
);
}
// console.log(newArr);
if
(
!
newArr
.
every
((
val
)
=>
data
.
includes
(
val
)))
{
// 判断数组是否包含另一个数组
// console.log('不包含' + _p[i].key);
// 不全部包含就删除数组的元素
var
index
=
data
.
indexOf
(
_p
[
i
].
key
);
if
(
index
>
-
1
)
{
data
.
splice
(
index
,
1
);
}
}
else
{
// console.log('包含' + _p[i].key);
}
}
// console.log(data);
// 再赋值给列表
setCheckedKeys
(
data
);
}
},
[
Permission
]);
// 监听改变状态提交结果
useEffect
(()
=>
{
// 提交信息结果
if
(
SubResult
!=
null
)
{
if
(
SubResult
.
statr
==
0
&&
SubResult
.
desc
==
0
)
{
// 保存成功, 清掉原来数据 并且跳转
message
.
success
(
'Submitted Successfully !'
);
dispatch
({
type
:
module
+
'/ReData'
});
dispatch
({
type
:
module
+
'/AccountClear'
});
history
.
go
(
-
1
);
}
}
},
[
SubResult
]);
// 保存提交
const
onFinishContract
=
async
(
value
:
any
)
=>
{
const
userInfo
=
localStorage
.
getItem
(
'userInfo'
)
||
''
;
const
id
=
JSON
.
parse
(
userInfo
).
userModel
.
id
;
if
(
value
.
tosAccountName
.
length
<=
2
&&
value
.
tosUserPhone
.
length
!=
8
&&
value
.
tosUserPhone
.
length
!=
11
)
{
// 姓名联系方式
message
.
error
(
'Please enter the correct name and contact information!'
);
return
false
;
}
else
if
(
checkedKeys
.
length
==
0
)
{
// 权限
message
.
error
(
'Please Select Permission!'
);
return
false
;
}
else
if
(
value
.
community
.
value
==
null
||
value
.
community
.
value
.
length
==
0
)
{
// 小区
message
.
error
(
'Please Select The Jurisdiction Area!'
);
return
false
;
}
else
if
(
value
.
tosUserName
.
length
<
6
)
{
// 账号长度
message
.
error
(
'The Account Password is Greater Than 6 Digits!'
);
return
false
;
}
else
{
value
.
tosUserServiceCellList
=
value
.
community
.
value
;
// 管辖小区
value
.
tosUserEmail
=
value
.
tosUserName
;
// 邮箱就是账号
value
.
tosUserLevel
=
values
;
//级别
value
.
creatorName
=
getCookie
(
'name'
);
//新建者账号
value
.
creatorId
=
id
;
//新建者ID
delete
value
.
community
;
value
.
id
=
DataSave
.
id
;
// 判断有没有 0 有就删除
for
(
var
i
in
checkedKeys
)
{
checkedKeys
[
i
]
==
'0'
?
checkedKeys
.
splice
(
i
as
any
,
1
)
:
''
;
}
// 追加到上级id
let
Obj
=
treeData
[
0
].
children
;
console
.
log
(
Obj
);
for
(
let
i
in
Obj
)
{
for
(
let
j
in
checkedKeys
)
{
if
(
JSON
.
stringify
(
Obj
[
i
].
children
).
indexOf
(
JSON
.
stringify
(
checkedKeys
[
j
]))
!=
-
1
)
{
// 提取出上级id 并且追加
checkedKeys
.
push
(
Obj
[
i
].
key
);
}
}
}
// 去重后在排序
let
newData
=
Array
.
from
(
new
Set
(
checkedKeys
)).
sort
((
n1
:
any
,
n2
:
any
)
=>
{
return
parseInt
(
n1
)
-
parseInt
(
n2
);
});
// 另传权限
let
obj
=
{
userName
:
value
.
tosUserName
,
userPassword
:
value
.
tosUserPwd
,
permissionArray
:
newData
,
};
RA
(
38
,
value
,
module
,
dispatch
);
// 信息上传
RA
(
42
,
obj
,
module
,
dispatch
);
// 权限上传
}
};
//goToReturn
const
goToReturn
=
()
=>
{
history
.
go
(
-
1
);
};
// 全选
const
onCheckAllChange
=
(
e
:
any
)
=>
{};
// 展开/收起树形菜单触发
const
onExpand
=
(
expandedKeys
:
any
)
=>
{
setExpandedKeys
(
expandedKeys
);
setAutoExpandParent
(
false
);
};
// 点击单个触发
const
onCheck
=
(
checkedKeys
:
any
)
=>
{
console
.
log
(
'onCheck'
,
checkedKeys
);
setCheckedKeys
(
checkedKeys
);
};
// 点击树节点触发 - 大栏目
const
onSelect
=
(
selectedKeys
:
any
,
info
:
any
)
=>
{
console
.
log
(
'onSelect'
,
info
);
setSelectedKeys
(
selectedKeys
);
};
// 管理员级别样式
const
radioStyle
=
{
display
:
'block'
,
height
:
'30px'
,
lineHeight
:
'30px'
,
marginBottom
:
'15px'
,
};
//级别切换
const
onRadio
=
(
e
:
any
)
=>
{
setvalues
(
e
.
target
.
value
);
};
//手机号
const
keyup_communityManagerFee
=
(
e
:
any
)
=>
{
e
.
target
.
value
=
keyup_tool
(
e
.
target
.
value
);
};
const
keyup_tool
=
(
value
:
any
)
=>
{
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
};
return
(
<
Spin
spinning=
{
loading
}
>
<
div
className=
"contop"
style=
{
{
padding
:
'12px 20px'
}
}
>
<
h3
className=
"capi"
>
<
EditOutlined
/>
Edit Account
<
div
className=
"back"
>
<
Button
onClick=
{
goToReturn
}
>
<
LeftOutlined
/>
Back
</
Button
>
</
div
>
</
h3
>
<
hr
></
hr
>
<
Form
ref=
{
formRef
}
form=
{
form
}
autoComplete=
"off"
// layout="inline"
layout=
"horizontal"
name=
"contract"
onFinish=
{
onFinishContract
}
>
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosUserName"
label=
"Account ID"
rules=
{
AccountTip
[
0
]
as
any
}
>
<
Input
placeholder=
"Login Account"
className=
"input"
disabled
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
>
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
.
Item
>
<
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
]
as
any
}
>
<
Input
placeholder=
"Contact Information"
className=
"input"
maxLength=
{
11
}
onKeyUp=
{
keyup_communityManagerFee
}
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
>
<
Form
.
Item
name=
"community"
label=
"Community"
>
<
SelectCommunity
checklist=
{
DataSave
==
null
?
null
:
DataSave
.
tosUserServiceCell
.
split
(
','
)
}
/>
</
Form
.
Item
>
<
div
className=
"diy"
style=
{
{
marginBottom
:
'14px'
}
}
>
<
div
className=
"label"
>
<
span
className=
"title"
>
Privilege Level:
</
span
>
</
div
>
<
div
className=
"label"
>
<
Radio
.
Group
value=
{
values
}
onChange=
{
onRadio
}
>
<
Radio
style=
{
radioStyle
}
disabled=
{
disab
}
value=
{
2
}
>
Two Level Administrator
</
Radio
>
<
Radio
style=
{
radioStyle
}
value=
{
3
}
>
Three Level Administrator
{
/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */
}
</
Radio
>
</
Radio
.
Group
>
</
div
>
</
div
>
<
div
className=
"diy"
style=
{
{
marginBottom
:
'24px'
}
}
>
<
div
className=
"label"
>
<
span
className=
"title"
>
Permission List:
</
span
>
</
div
>
<
div
className=
"label"
>
<
Tree
checkable
onExpand=
{
onExpand
}
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
onCheck=
{
onCheck
}
checkedKeys=
{
checkedKeys
}
onSelect=
{
onSelect
}
selectedKeys=
{
selectedKeys
}
treeData=
{
treeData
}
// checkStrictly={true}
/>
</
div
>
</
div
>
<
div
className=
"diy"
>
<
div
className=
"label"
></
div
>
<
div
className=
"label"
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
Submit
</
Button
>
</
div
>
</
div
>
</
Form
>
</
div
>
</
Spin
>
);
};
const
AccountProps
=
(
state
:
any
)
=>
{
const
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
Permission
,
SubResult
}
=
state
.
Account
;
const
loading
=
state
.
loading
.
models
.
Account
||
false
;
const
{
user
}
=
state
;
return
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
loading
,
Permission
,
user
,
SubResult
,
};
};
export
default
connect
(
AccountProps
)(
Account
);
src/pages/AccountManagement/account/AccountEdit.tsx
View file @
c9b23759
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Spin
,
message
,
Descriptions
,
Tree
,
Radio
}
from
'antd'
;
import
{
Form
,
Input
,
Button
,
message
,
Descriptions
,
Spin
,
Tree
,
Radio
,
Select
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
'./Account.less'
;
import
'./Account.less'
;
import
{
zhCnFaci
,
enUsFaci
}
from
'@/utils/power'
;
import
{
zhCnFaci
,
enUsFaci
}
from
'@/utils/power'
;
...
@@ -15,47 +14,31 @@ import { RA } from '@/utils/method';
...
@@ -15,47 +14,31 @@ import { RA } from '@/utils/method';
const
Account
=
(
props
:
any
)
=>
{
const
Account
=
(
props
:
any
)
=>
{
const
module
=
'Account'
;
const
module
=
'Account'
;
const
{
dispatch
,
Data
,
DataSave
,
DataSaveDetail
,
SubResult
,
loading
,
Permission
,
user
}
=
props
;
const
{
dispatch
,
SubResult
,
CommunityList
,
loading
,
user
,
DataSave
,
Permission
}
=
props
;
// 权限列表
// 权限列表
const
treeData
=
enUsFaci
||
zhCnFaci
;
const
treeData
=
enUsFaci
||
zhCnFaci
;
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
string
[]
>
([]);
// 展开栏目
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
<
string
[]
>
([]);
// 展开栏目
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
<
string
[]
>
([]
);
// 默认已选栏目
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]
as
any
);
// 默认已选栏目
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
<
string
[]
>
([]);
// 设置选中的树
大
节点
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
<
string
[]
>
([]);
// 设置选中的树节点
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
<
boolean
>
(
true
);
// 树形菜单展开关闭
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
<
boolean
>
(
true
);
// 树形菜单展开关闭
// 单选 二级还是三级管理员
// 单选 二级还是三级管理员
const
[
values
,
setvalues
]
=
useState
(
2
);
// 树形菜单展开关闭
const
[
values
,
setvalues
]
=
useState
(
2
);
// 树形菜单展开关闭
const
[
disab
,
setdisab
]
=
useState
(
false
);
// 是否禁止选择二级
const
[
towAccountId
,
settowAccountId
]
=
useState
(
null
);
// 二级账户id
// 表单标识
// 表单标识
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
formRef
=
useRef
(
null
);
const
formRef
=
useRef
(
null
);
// // 数据
const
{
Option
}
=
Select
;
useEffect
(()
=>
{
if
(
DataSave
!=
null
)
{
// 赋值
form
.
setFieldsValue
({
tosUserName
:
DataSave
.
tosUserName
,
tosUserPhone
:
DataSave
.
tosUserPhone
,
tosAccountName
:
DataSave
.
tosAccountName
,
});
setvalues
(
DataSave
.
tosUserLevel
);
// 等级
//二级账户列表
const
towAccount
=
JSON
.
parse
(
localStorage
.
getItem
(
'towAccount'
)
||
'[]'
);
// 发起获取权限请求
// 登录账户权限
RA
(
54
,
{
tosUserName
:
DataSave
.
tosUserName
},
module
,
dispatch
);
// 发起获取权限请求
}
// let a = [];
// for (var i = 0; i <= 66; i++) {
// a.push(i);
// }
// console.log(a);
},
[
DataSave
]);
// 当前账户权限
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
let
treeDatas
=
treeData
;
let
treeDatas
=
treeData
;
...
@@ -80,12 +63,71 @@ const Account = (props: any) => {
...
@@ -80,12 +63,71 @@ const Account = (props: any) => {
}
}
}
}
}
}
// 当当前账户是二级以上禁用创建二级菜单
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
>
1
)
{
setvalues
(
3
);
setdisab
(
true
);
settowAccountId
(
user
.
currentUser
.
id
);
// 如果是三级账户,禁用最后两个账户管理
if
(
user
.
currentUser
.
userModel
.
tosUserLevel
==
3
)
{
// 禁用最后两个
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
}
}
else
{
// 如果是一级账户获取挂靠的二级账户名称
RA
(
56
,
{},
module
,
dispatch
);
// 权限上传
}
// 赋值改变
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
}
}
},
[
user
]);
},
[
user
]);
// 当前编辑账户的数据
useEffect
(()
=>
{
if
(
DataSave
!=
null
)
{
// 赋值
form
.
setFieldsValue
({
tosUserName
:
DataSave
.
tosUserName
,
tosUserPhone
:
DataSave
.
tosUserPhone
,
tosAccountName
:
DataSave
.
tosAccountName
,
});
settowAccountId
(
DataSave
.
userLeader
);
// 二级账户id
setvalues
(
DataSave
.
tosUserLevel
);
// 等级
// 如果是3级,取消后面两个选择
if
(
DataSave
.
tosUserLevel
==
3
)
{
let
treeDatas
=
treeData
;
let
_p
=
treeDatas
[
0
].
children
;
// 所有权限列表
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
}
// 发起获取权限请求
RA
(
54
,
{
tosUserName
:
DataSave
.
tosUserName
},
module
,
dispatch
);
// 发起获取权限请求
}
},
[
DataSave
]);
// 提交信息结果
useEffect
(()
=>
{
if
(
SubResult
!=
null
)
{
if
(
SubResult
.
statr
==
0
&&
SubResult
.
desc
==
0
)
{
// 保存成功, 清掉原来数据 并且跳转
message
.
success
(
'Submitted Successfully !'
);
dispatch
({
type
:
module
+
'/ReData'
});
dispatch
({
type
:
module
+
'/AccountClear'
});
history
.
go
(
-
1
);
}
}
},
[
SubResult
]);
// 已选权限
// 已选权限
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
Permission
!=
null
)
{
if
(
Permission
!=
null
)
{
...
@@ -94,7 +136,6 @@ const Account = (props: any) => {
...
@@ -94,7 +136,6 @@ const Account = (props: any) => {
for
(
let
i
in
newPer
)
{
for
(
let
i
in
newPer
)
{
data
[
i
]
=
newPer
[
i
]
+
''
;
data
[
i
]
=
newPer
[
i
]
+
''
;
}
}
// console.log(data); // 编辑的账户的权限
let
_p
=
treeData
[
0
].
children
;
// 所有权限列表
let
_p
=
treeData
[
0
].
children
;
// 所有权限列表
// console.log(_p); // 所有权限列表
// console.log(_p); // 所有权限列表
...
@@ -119,26 +160,11 @@ const Account = (props: any) => {
...
@@ -119,26 +160,11 @@ const Account = (props: any) => {
// console.log('包含' + _p[i].key);
// console.log('包含' + _p[i].key);
}
}
}
}
// console.log(data);
// 再赋值给列表
// 再赋值给列表
setCheckedKeys
(
data
);
setCheckedKeys
(
data
);
}
}
},
[
Permission
]);
},
[
Permission
]);
// 监听改变状态提交结果
useEffect
(()
=>
{
// 提交信息结果
if
(
SubResult
!=
null
)
{
if
(
SubResult
.
statr
==
0
&&
SubResult
.
desc
==
0
)
{
// 保存成功, 清掉原来数据 并且跳转
message
.
success
(
'Submitted Successfully !'
);
dispatch
({
type
:
module
+
'/ReData'
});
dispatch
({
type
:
module
+
'/AccountClear'
});
history
.
go
(
-
1
);
}
}
},
[
SubResult
]);
// 保存提交
// 保存提交
const
onFinishContract
=
async
(
value
:
any
)
=>
{
const
onFinishContract
=
async
(
value
:
any
)
=>
{
const
userInfo
=
localStorage
.
getItem
(
'userInfo'
)
||
''
;
const
userInfo
=
localStorage
.
getItem
(
'userInfo'
)
||
''
;
...
@@ -151,7 +177,8 @@ const Account = (props: any) => {
...
@@ -151,7 +177,8 @@ const Account = (props: any) => {
// 姓名联系方式
// 姓名联系方式
message
.
error
(
'Please enter the correct name and contact information!'
);
message
.
error
(
'Please enter the correct name and contact information!'
);
return
false
;
return
false
;
}
else
if
(
checkedKeys
.
length
==
0
)
{
}
else
if
(
checkedKeys
[
0
].
key
)
{
// 如果存在key 就是没有选择
// 权限
// 权限
message
.
error
(
'Please Select Permission!'
);
message
.
error
(
'Please Select Permission!'
);
return
false
;
return
false
;
...
@@ -163,19 +190,25 @@ const Account = (props: any) => {
...
@@ -163,19 +190,25 @@ const Account = (props: any) => {
// 账号长度
// 账号长度
message
.
error
(
'The Account Password is Greater Than 6 Digits!'
);
message
.
error
(
'The Account Password is Greater Than 6 Digits!'
);
return
false
;
return
false
;
}
else
if
(
values
==
3
&&
towAccountId
==
null
)
{
// 如果创建的是三级账号就要判断是否选择了绑定的二级账户
message
.
error
(
'Please select affiliated account !'
);
return
false
;
}
else
{
}
else
{
value
.
tosUserServiceCellList
=
value
.
community
.
value
;
// 管辖小区
value
.
tosUserServiceCellList
=
value
.
community
.
value
;
// 管辖小区
value
.
tosUserEmail
=
value
.
tosUserName
;
// 邮箱就是账号
value
.
tosUserEmail
=
value
.
tosUserName
;
// 邮箱就是账号
value
.
tosUserLevel
=
values
;
//级别
value
.
tosUserLevel
=
values
;
//级别
value
.
creatorName
=
getCookie
(
'name'
)
;
//新建者账号
value
.
creatorName
=
JSON
.
parse
(
userInfo
).
userModel
.
tosUserName
;
//新建者账号
value
.
creatorId
=
id
;
//新建者ID
value
.
creatorId
=
id
;
//新建者ID
if
(
values
==
3
)
{
value
.
userLeader
=
towAccountId
;
}
delete
value
.
community
;
delete
value
.
community
;
DataSave
?
(
value
.
id
=
DataSave
.
id
)
:
''
;
value
.
id
=
DataSave
.
id
;
// 判断有没有 0 有就删除
// 判断有没有 0 有就删除
for
(
var
i
in
checkedKeys
)
{
for
(
var
i
in
checkedKeys
)
{
checkedKeys
[
i
]
==
'0'
?
checkedKeys
.
splice
(
i
as
any
,
1
)
:
''
;
checkedKeys
[
i
]
==
'0'
?
checkedKeys
.
splice
(
i
,
1
)
:
''
;
}
}
// 追加到上级id
// 追加到上级id
...
@@ -203,6 +236,7 @@ const Account = (props: any) => {
...
@@ -203,6 +236,7 @@ const Account = (props: any) => {
RA
(
38
,
value
,
module
,
dispatch
);
// 信息上传
RA
(
38
,
value
,
module
,
dispatch
);
// 信息上传
RA
(
42
,
obj
,
module
,
dispatch
);
// 权限上传
RA
(
42
,
obj
,
module
,
dispatch
);
// 权限上传
return
true
;
}
}
};
};
...
@@ -211,9 +245,6 @@ const Account = (props: any) => {
...
@@ -211,9 +245,6 @@ const Account = (props: any) => {
history
.
go
(
-
1
);
history
.
go
(
-
1
);
};
};
// 全选
const
onCheckAllChange
=
(
e
:
any
)
=>
{};
// 展开/收起树形菜单触发
// 展开/收起树形菜单触发
const
onExpand
=
(
expandedKeys
:
any
)
=>
{
const
onExpand
=
(
expandedKeys
:
any
)
=>
{
setExpandedKeys
(
expandedKeys
);
setExpandedKeys
(
expandedKeys
);
...
@@ -222,13 +253,13 @@ const Account = (props: any) => {
...
@@ -222,13 +253,13 @@ const Account = (props: any) => {
// 点击单个触发
// 点击单个触发
const
onCheck
=
(
checkedKeys
:
any
)
=>
{
const
onCheck
=
(
checkedKeys
:
any
)
=>
{
console
.
log
(
'onCheck'
,
checkedKeys
);
//
console.log('onCheck', checkedKeys);
setCheckedKeys
(
checkedKeys
);
setCheckedKeys
(
checkedKeys
);
};
};
// 点击树节点触发 - 大栏目
// 点击树节点触发 - 大栏目
const
onSelect
=
(
selectedKeys
:
any
,
info
:
any
)
=>
{
const
onSelect
=
(
selectedKeys
:
any
,
info
:
any
)
=>
{
console
.
log
(
'onSelect'
,
info
);
//
console.log('onSelect', info);
setSelectedKeys
(
selectedKeys
);
setSelectedKeys
(
selectedKeys
);
};
};
...
@@ -243,6 +274,24 @@ const Account = (props: any) => {
...
@@ -243,6 +274,24 @@ const Account = (props: any) => {
//级别切换
//级别切换
const
onRadio
=
(
e
:
any
)
=>
{
const
onRadio
=
(
e
:
any
)
=>
{
setvalues
(
e
.
target
.
value
);
setvalues
(
e
.
target
.
value
);
// 如果是3级,取消后面两个选择
let
treeDatas
=
treeData
;
let
_p
=
treeDatas
[
0
].
children
;
// 所有权限列表
// 禁用最后两个
if
(
e
.
target
.
value
==
3
)
{
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
true
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
true
;
}
else
{
//否则打开
_p
[
_p
.
length
-
1
].
children
[
2
].
disableCheckbox
=
false
;
_p
[
_p
.
length
-
1
].
children
[
3
].
disableCheckbox
=
false
;
settowAccountId
(
null
);
}
// 赋值改变
treeDatas
[
0
].
children
=
_p
;
setCheckedKeys
(
treeDatas
as
any
);
// 可勾选列表
};
};
//手机号
//手机号
...
@@ -253,6 +302,21 @@ const Account = (props: any) => {
...
@@ -253,6 +302,21 @@ const Account = (props: any) => {
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
return
getNumber
(
value
.
replace
(
/
[^\d
^
\.]
+/g
,
''
));
};
};
// 二级账户
const
listItems
=
towAccount
.
map
((
item
:
any
)
=>
{
return
(
<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
>
{
item
.
tosAccountName
}
-
{
item
.
tosUserEmail
}
</
Option
>
);
});
// 选择哪个二级账号
const
handleChange
=
(
value
:
any
)
=>
{
// console.log(`selected ${value}`);
settowAccountId
(
value
);
};
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
div
className=
"contop"
style=
{
{
padding
:
'12px 20px'
}
}
>
<
div
className=
"contop"
style=
{
{
padding
:
'12px 20px'
}
}
>
...
@@ -267,7 +331,6 @@ const Account = (props: any) => {
...
@@ -267,7 +331,6 @@ const Account = (props: any) => {
</
div
>
</
div
>
</
h3
>
</
h3
>
<
hr
></
hr
>
<
hr
></
hr
>
<
Form
<
Form
ref=
{
formRef
}
ref=
{
formRef
}
form=
{
form
}
form=
{
form
}
...
@@ -280,7 +343,7 @@ const Account = (props: any) => {
...
@@ -280,7 +343,7 @@ const Account = (props: any) => {
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
column=
{
{
xs
:
1
,
sm
:
2
,
md
:
3
}
}
>
<
Descriptions
.
Item
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosUserName"
label=
"Account ID"
rules=
{
AccountTip
[
0
]
as
any
}
>
<
Form
.
Item
name=
"tosUserName"
label=
"Account ID"
rules=
{
AccountTip
[
0
]
as
any
}
>
<
Input
placeholder=
"Login Account"
className=
"input"
disabled
/>
<
Input
placeholder=
"Login Account"
className=
"input"
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
>
</
Descriptions
>
...
@@ -304,9 +367,7 @@ const Account = (props: any) => {
...
@@ -304,9 +367,7 @@ const Account = (props: any) => {
</
Descriptions
>
</
Descriptions
>
<
Form
.
Item
name=
"community"
label=
"Community"
>
<
Form
.
Item
name=
"community"
label=
"Community"
>
<
SelectCommunity
<
SelectCommunity
checklist=
{
CommunityList
==
null
?
null
:
CommunityList
}
/>
checklist=
{
DataSave
==
null
?
null
:
DataSave
.
tosUserServiceCell
.
split
(
','
)
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
className=
"diy"
style=
{
{
marginBottom
:
'14px'
}
}
>
<
div
className=
"diy"
style=
{
{
marginBottom
:
'14px'
}
}
>
...
@@ -314,15 +375,28 @@ const Account = (props: any) => {
...
@@ -314,15 +375,28 @@ const Account = (props: any) => {
<
span
className=
"title"
>
Privilege Level:
</
span
>
<
span
className=
"title"
>
Privilege Level:
</
span
>
</
div
>
</
div
>
<
div
className=
"label"
>
<
div
className=
"label"
>
<
Radio
.
Group
defaultValue=
{
DataSave
?
DataSave
.
tosUserLevel
:
2
}
onChange=
{
onRadio
}
>
<
Radio
.
Group
value=
{
values
}
onChange=
{
onRadio
}
>
<
Radio
style=
{
radioStyle
}
value=
{
2
}
>
<
Radio
style=
{
radioStyle
}
disabled=
{
disab
}
value=
{
2
}
>
Two Level Administrator
Two Level Administrator
</
Radio
>
</
Radio
>
<
Radio
style=
{
radioStyle
}
value=
{
3
}
>
<
Radio
style=
{
radioStyle
}
value=
{
3
}
>
Three Level Administrator
Three Level Administrator
{
/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */
}
</
Radio
>
</
Radio
>
</
Radio
.
Group
>
</
Radio
.
Group
>
{
/* 选择挂靠的二级菜单 */
}
{
values
===
3
&&
user
.
currentUser
.
userModel
.
tosUserLevel
<=
1
?
(
<
Select
style=
{
{
width
:
260
}
}
onChange=
{
handleChange
}
placeholder=
"Please select affiliated account"
defaultValue=
{
towAccountId
as
any
}
>
{
towAccount
?
listItems
:
''
}
</
Select
>
)
:
(
''
)
}
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -341,7 +415,6 @@ const Account = (props: any) => {
...
@@ -341,7 +415,6 @@ const Account = (props: any) => {
onSelect=
{
onSelect
}
onSelect=
{
onSelect
}
selectedKeys=
{
selectedKeys
}
selectedKeys=
{
selectedKeys
}
treeData=
{
treeData
}
treeData=
{
treeData
}
// checkStrictly={true}
/>
/>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -361,7 +434,8 @@ const Account = (props: any) => {
...
@@ -361,7 +434,8 @@ const Account = (props: any) => {
};
};
const
AccountProps
=
(
state
:
any
)
=>
{
const
AccountProps
=
(
state
:
any
)
=>
{
const
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
Permission
,
SubResult
}
=
state
.
Account
;
const
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
SubResult
,
Permission
}
=
state
.
Account
;
const
{
CommunityList
}
=
state
.
Init
;
// 小区列表
const
loading
=
state
.
loading
.
models
.
Account
||
false
;
const
loading
=
state
.
loading
.
models
.
Account
||
false
;
const
{
user
}
=
state
;
const
{
user
}
=
state
;
return
{
return
{
...
@@ -371,7 +445,8 @@ const AccountProps = (state: any) => {
...
@@ -371,7 +445,8 @@ const AccountProps = (state: any) => {
Result
,
Result
,
loading
,
loading
,
Permission
,
Permission
,
user
,
CommunityList
,
user
,
// 获取当前账户信息
SubResult
,
SubResult
,
};
};
};
};
...
...
src/pages/CommercialService/CardDetail.tsx
View file @
c9b23759
...
@@ -135,11 +135,16 @@ const CardDetail = (props: any) => {
...
@@ -135,11 +135,16 @@ const CardDetail = (props: any) => {
{
listData
.
apply_status
===
0
?
(
{
listData
.
apply_status
===
0
?
(
<
Form
ref=
{
formRef
}
name=
"basic"
onFinish=
{
onFinish
}
>
<
Form
ref=
{
formRef
}
name=
"basic"
onFinish=
{
onFinish
}
>
<
Row
gutter=
{
8
}
style=
{
{
marginTop
:
16
}
}
>
<
Row
gutter=
{
8
}
style=
{
{
marginTop
:
16
}
}
>
<
Col
span=
{
3
}
>
Examine
:
</
Col
>
<
Col
span=
{
3
}
>
Approval For Application
:
</
Col
>
<
Col
span=
{
5
}
>
<
Col
span=
{
5
}
>
<
Form
.
Item
<
Form
.
Item
name=
"applyStatus"
name=
"applyStatus"
rules=
{
[{
required
:
true
,
message
:
'Please select the reply result!'
}]
}
rules=
{
[
{
required
:
true
,
message
:
'Please choose Approve or Reject for the application!'
,
},
]
}
>
>
<
Radio
.
Group
>
<
Radio
.
Group
>
<
Radio
.
Button
value=
{
'1'
}
>
Approve
</
Radio
.
Button
>
<
Radio
.
Button
value=
{
'1'
}
>
Approve
</
Radio
.
Button
>
...
...
src/pages/CommercialService/RenovationDetail.tsx
View file @
c9b23759
...
@@ -136,7 +136,12 @@ const RenovationDetail = (props: any) => {
...
@@ -136,7 +136,12 @@ const RenovationDetail = (props: any) => {
<
Col
>
<
Col
>
<
Form
.
Item
<
Form
.
Item
name=
"decorationStatus"
name=
"decorationStatus"
rules=
{
[{
required
:
true
,
message
:
'You have to choose an outcome!'
}]
}
rules=
{
[
{
required
:
true
,
message
:
'Please choose Approve or Reject the application! '
,
},
]
}
>
>
<
Radio
.
Group
>
<
Radio
.
Group
>
<
Radio
.
Button
value=
{
'1'
}
>
Approve
</
Radio
.
Button
>
{
' '
}
<
Radio
.
Button
value=
{
'1'
}
>
Approve
</
Radio
.
Button
>
{
' '
}
...
...
src/pages/CommunityManagement/FacilityBookings/Facility.tsx
View file @
c9b23759
...
@@ -45,6 +45,8 @@ const Facility = (props: any) => {
...
@@ -45,6 +45,8 @@ const Facility = (props: any) => {
const
[
ctyName
,
setCtyName
]
=
useState
(
null
);
const
[
ctyName
,
setCtyName
]
=
useState
(
null
);
const
[
soltTime
,
setSoltTime
]
=
useState
([
''
,
''
]);
// 已选时间
const
[
soltTime
,
setSoltTime
]
=
useState
([
''
,
''
]);
// 已选时间
const
[
Cycle
,
setCycle
]
=
useState
(
null
as
any
);
// Appointment Cycle下拉
// 表单标识
// 表单标识
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -102,9 +104,14 @@ const Facility = (props: any) => {
...
@@ -102,9 +104,14 @@ const Facility = (props: any) => {
setFileList
(
sourceData
.
categoriesDetailsImageName
);
//设置图片组名称
setFileList
(
sourceData
.
categoriesDetailsImageName
);
//设置图片组名称
// delete sourceData.categoriesDetailsImageName;
// delete sourceData.categoriesDetailsImageName;
setCycle
(
sourceData
.
periodType
+
''
);
// delete sourceData.periodType;
// 设置表单默认值
// 设置表单默认值
formRef
.
current
.
setFieldsValue
(
sourceData
);
formRef
.
current
.
setFieldsValue
(
sourceData
);
console
.
log
(
Cycle
);
}
else
{
}
else
{
// 新增页面进来 先清一遍 图片列表
// 新增页面进来 先清一遍 图片列表
let
list
:
any
=
[];
let
list
:
any
=
[];
...
@@ -175,6 +182,8 @@ const Facility = (props: any) => {
...
@@ -175,6 +182,8 @@ const Facility = (props: any) => {
result
.
categoriesOpenTime
=
`
${
soltTime
[
0
]}
-
${
soltTime
[
1
]}
`
;
// 预约时间段 二开需要
result
.
categoriesOpenTime
=
`
${
soltTime
[
0
]}
-
${
soltTime
[
1
]}
`
;
// 预约时间段 二开需要
result
.
communityManagerFee
=
result
.
communityManagerFee
?
result
.
communityManagerFee
:
'0.00'
;
// 价格押金没有为0
result
.
communityManagerFee
=
result
.
communityManagerFee
?
result
.
communityManagerFee
:
'0.00'
;
// 价格押金没有为0
result
.
communityMargin
=
result
.
communityMargin
?
result
.
communityMargin
:
'0.00'
;
// 价格押金没有为0
result
.
communityMargin
=
result
.
communityMargin
?
result
.
communityMargin
:
'0.00'
;
// 价格押金没有为0
result
.
periodType
=
Cycle
;
delete
result
.
startTime
;
delete
result
.
startTime
;
delete
result
.
endTime
;
delete
result
.
endTime
;
delete
result
.
picList
;
delete
result
.
picList
;
...
@@ -216,6 +225,11 @@ const Facility = (props: any) => {
...
@@ -216,6 +225,11 @@ const Facility = (props: any) => {
formRef
.
current
.
setFieldsValue
(
tmp
);
formRef
.
current
.
setFieldsValue
(
tmp
);
};
};
//选择周期
function
handleChange
(
value
:
any
)
{
setCycle
(
value
);
}
// 选择小区名字并赋值
// 选择小区名字并赋值
const
opname
=
(
value
:
any
)
=>
{
const
opname
=
(
value
:
any
)
=>
{
console
.
log
(
'选择的小区是:'
+
value
);
console
.
log
(
'选择的小区是:'
+
value
);
...
@@ -455,12 +469,14 @@ const Facility = (props: any) => {
...
@@ -455,12 +469,14 @@ const Facility = (props: any) => {
{
/* 设置次数 */
}
{
/* 设置次数 */
}
<
Input
.
Group
>
<
Input
.
Group
>
<
Form
.
Item
label=
"Appointment Cycle"
name=
"periodType"
rules=
{
NewFaci
[
8
]
}
>
<
Form
.
Item
label=
"Appointment Cycle"
rules=
{
NewFaci
[
8
]
}
>
<
Select
<
Select
placeholder=
"Period"
placeholder=
"Period"
allowClear
allowClear
style=
{
{
width
:
120
}
}
style=
{
{
width
:
120
}
}
disabled=
{
facilityDetail
}
disabled=
{
facilityDetail
}
value=
{
Cycle
?
Cycle
:
''
}
onChange=
{
handleChange
}
>
>
<
Option
value=
"1"
>
Week
</
Option
>
<
Option
value=
"1"
>
Week
</
Option
>
<
Option
value=
"2"
>
Month
</
Option
>
<
Option
value=
"2"
>
Month
</
Option
>
...
...
src/pages/CommunityManagement/FacilityBookings/FacilityBookings.tsx
View file @
c9b23759
...
@@ -392,7 +392,7 @@ const FacilityBookings = (props: any) => {
...
@@ -392,7 +392,7 @@ const FacilityBookings = (props: any) => {
};
};
function
mapStateToProps
(
state
:
any
)
{
function
mapStateToProps
(
state
:
any
)
{
console
.
log
(
state
);
//
console.log(state);
const
{
Data
,
Data2
,
DataSave
,
curString
,
Result
}
=
state
.
FacilityBookings
;
const
{
Data
,
Data2
,
DataSave
,
curString
,
Result
}
=
state
.
FacilityBookings
;
const
{
token
}
=
state
.
login
;
const
{
token
}
=
state
.
login
;
const
loading
=
const
loading
=
...
...
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