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
c35815e8
Commit
c35815e8
authored
Nov 20, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug修复
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
02608e8a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
339 additions
and
1375 deletions
+339
-1375
config.ts
config/config.ts
+1
-0
Account copy.tsx
src/pages/AccountManagement/account/Account copy.tsx
+0
-388
Account.tsx
src/pages/AccountManagement/account/Account.tsx
+8
-1
AccountDetail.tsx
src/pages/AccountManagement/account/AccountDetail.tsx
+321
-0
AccountEdit copy.tsx
src/pages/AccountManagement/account/AccountEdit copy.tsx
+0
-825
AccountEdit.tsx
src/pages/AccountManagement/account/AccountEdit.tsx
+5
-1
ContractContent.tsx
src/pages/ContractManagement/ContractContent.tsx
+4
-14
ContractDetail copy.tsx
src/pages/ContractManagement/ContractDetail copy.tsx
+0
-146
No files found.
config/config.ts
View file @
c35815e8
...
...
@@ -345,6 +345,7 @@ export default defineConfig({
{
path
:
'./'
,
component
:
'./AccountManagement/account/Account'
},
{
path
:
'./edit'
,
component
:
'./AccountManagement/account/AccountEdit'
},
{
path
:
'./Add'
,
component
:
'./AccountManagement/account/AccountAdds'
},
{
path
:
'./Detail'
,
component
:
'./AccountManagement/account/AccountDetail'
},
{
path
:
'./reset'
,
component
:
'./AccountManagement/account/AccountReset'
},
],
},
...
...
src/pages/AccountManagement/account/Account copy.tsx
deleted
100644 → 0
View file @
02608e8a
import
React
from
'react'
;
import
{
connect
,
routerRedux
}
from
'dva'
;
import
{
Table
,
Button
,
Input
,
DatePicker
,
Select
,
Modal
}
from
'antd'
;
import
styles
from
'./style.less'
;
import
{
ConnectState
}
from
'@/models/connect'
;
import
{
router
}
from
'umi'
;
const
{
RangePicker
}
=
DatePicker
;
class
Account
extends
React
.
Component
{
//构造
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
data
:
[],
total
:
0
,
id
:
''
,
status
:
undefined
,
statusList
:
[
'正常'
,
'关闭'
],
moment
:
[],
delData
:
[],
visible
:
false
,
nowUser
:
''
,
name
:
''
,
};
}
/*----------------- 方法集 ------------------*/
//模态框相关
showModal
=
()
=>
{
let
flag
=
0
;
const
{
delData
}
=
this
.
state
;
const
nowUser
=
this
.
props
.
currentUser
;
if
(
nowUser
.
permission
!=
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
nowUser
.
permission
[
i
]
==
'19'
)
{
flag
=
1
;
}
}
}
if
(
flag
==
0
)
{
alert
(
'缺少用户删除权限!'
);
return
;
}
for
(
let
i
=
0
;
i
<
delData
.
length
;
i
++
)
{
if
(
delData
[
i
].
userID
==
1
)
{
alert
(
'禁止删除超级管理员!'
);
return
;
}
if
(
delData
[
i
].
userID
==
this
.
props
.
currentUser
.
userid
)
{
alert
(
'禁止删除当前用户!'
);
return
;
}
}
this
.
setState
({
visible
:
true
,
});
};
handleOk
=
(
e
)
=>
{
this
.
del
();
this
.
setState
({
visible
:
false
,
});
};
handleCancel
=
(
e
)
=>
{
this
.
setState
({
visible
:
false
,
});
};
//批量删除
del
()
{
const
{
delData
}
=
this
.
state
;
for
(
let
i
=
0
;
i
<
delData
.
length
;
i
++
)
{
if
(
delData
[
i
].
tosUserId
==
1
)
{
alert
(
'禁止删除超级管理员!'
);
return
;
}
if
(
delData
[
i
].
tosUserId
==
this
.
props
.
currentUser
.
userid
)
{
alert
(
'禁止删除当前用户!'
);
return
;
}
}
this
.
props
.
dispatch
({
type
:
'accountModel/delAdccount'
,
payload
:
this
.
state
.
delData
,
callback
:
(
res
)
=>
{
if
(
res
)
{
if
(
res
.
error_code
==
'0000'
)
{
alert
(
res
.
error_msg
);
this
.
setState
({
delData
:
''
,
});
this
.
getData
();
}
else
if
(
res
.
error_code
==
'0001'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
'0002'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
'0008'
)
{
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
alert
(
'删除失败!未知错误!'
);
}
}
},
});
}
//获取所有用户
getData
=
()
=>
{
const
params
=
{
id
:
this
.
state
.
id
,
status
:
this
.
state
.
status
,
moment
:
this
.
state
.
moment
,
name
:
this
.
state
.
name
,
// leaderID: this.props.currentUser.userid,
leaderID
:
'21232f297a57a5a743894a0e4a801fc3'
,
userPhone
:
'18813787835'
,
};
console
.
log
(
params
);
this
.
props
.
dispatch
({
type
:
'accountModel/getAccount'
,
// type: 'tUModel/getTosUser',
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
)
{
console
.
log
(
res
);
/* for (var i = 0; i < res.rows.length; i++) {
var model = res.rows[i];
var updated_date = this.getLocalTime(model.createTime.time);
model.createTime = updated_date;
}*/
this
.
setState
({
data
:
res
.
data
.
rows
,
total
:
res
.
data
.
total
,
/* data: res.rows,
total: res.total,*/
});
}
else
if
(
res
.
error_code
==
'0008'
)
{
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
},
});
};
getLocalTime
(
nS
)
{
return
new
Date
(
parseInt
(
nS
))
.
toLocaleString
(
'chinese'
,
{
hour12
:
false
})
.
replace
(
/:
\d{1,2}
$/
,
' '
);
}
//跳转到编辑页面
edit
=
(
params
)
=>
{
let
flag
=
0
;
const
nowUser
=
this
.
props
.
currentUser
;
let
oneself
=
0
;
if
(
params
==
null
&&
nowUser
.
level
==
1
)
{
// alert("您当前用户等级不允许创建新用户!");
// return;
}
if
(
params
!=
null
&&
params
.
userID
!=
null
&&
params
.
userID
==
this
.
props
.
currentUser
.
userid
)
{
oneself
=
1
;
}
if
(
nowUser
.
permission
!=
null
)
{
for
(
let
i
=
0
;
i
<
nowUser
.
permission
.
length
;
i
++
)
{
if
(
params
!=
null
)
{
if
(
oneself
==
1
)
{
flag
=
1
;
}
if
(
nowUser
.
permission
[
i
]
==
'17'
)
{
flag
=
1
;
}
}
else
{
if
(
nowUser
.
permission
[
i
]
==
'16'
)
{
flag
=
1
;
}
}
}
}
if
(
flag
==
0
)
{
if
(
params
!=
null
)
{
// alert("缺少用户信息编辑权限!");
// return;
}
else
{
// alert("缺少创建用户权限!");
// return;
}
}
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/AccountManagement/account/edit'
,
query
:
params
,
}),
);
};
//用户禁用,启用
changeStatus
=
(
e
)
=>
{
const
params
=
{
userStatus
:
e
.
userStatus
==
'0'
?
1
:
0
,
userID
:
e
.
id
,
};
this
.
props
.
dispatch
({
type
:
'accountModel/quitAndUser'
,
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
.
error_code
==
'0000'
)
{
this
.
getData
();
}
else
if
(
res
.
error_code
==
'0001'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
'0002'
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
'0008'
)
{
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
alert
(
'修改用户状态失败!未知错误!'
);
}
},
});
};
//搜索状态变更
statusChange
=
(
e
)
=>
{
this
.
setState
({
status
:
e
==
undefined
?
undefined
:
e
==
1
?
0
:
1
});
};
//账号名称变更
nameChange
=
(
e
)
=>
{
this
.
setState
({
name
:
e
.
target
.
value
});
};
//日期变更
dateChange
=
(
e
)
=>
{
this
.
setState
({
moment
:
e
});
};
//初始化
componentDidMount
()
{
const
nowUser
=
this
.
props
.
currentUser
.
userid
;
this
.
setState
({
nowUser
:
nowUser
,
});
this
.
getData
();
}
/*--------------------------------------*/
//表格列名
columns
=
[
{
title
:
'Account Name'
,
dataIndex
:
'tosUserName'
,
key
:
'userAccount'
,
},
{
title
:
'Grade'
,
dataIndex
:
'tosuserLevel'
,
key
:
'userLevel'
,
render
:
(
text
,
record
)
=>
(
<
span
>
{
record
.
tosuserLevel
==
5
?
'超级管理员'
:
''
}
{
record
.
tosuserLevel
==
4
?
'一级管理员'
:
''
}
{
record
.
tosuserLevel
==
3
?
'二级管理员'
:
''
}
{
record
.
tosuserLevel
==
2
?
'三级管理员'
:
''
}
{
record
.
tosuserLevel
==
1
?
'一级管理员'
:
''
}
</
span
>
),
},
{
title
:
'Status'
,
dataIndex
:
'userStatus'
,
key
:
'userStatus'
,
render
:
(
text
,
record
)
=>
<
span
>
{
record
.
userStatus
==
0
?
'启用'
:
'禁用'
}
</
span
>,
},
{
title
:
'Created By'
,
dataIndex
:
'tosUserServiceCell'
,
key
:
'createAccount'
,
},
{
title
:
'Creation Time'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
,
},
{
title
:
'Actions'
,
dataIndex
:
'action'
,
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
<
span
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
edit
(
record
)
}
>
Edit
</
Button
>
<
Button
style=
{
{
background
:
'transparent'
,
border
:
0
,
color
:
'#1890FF'
}
}
onClick=
{
()
=>
this
.
changeStatus
(
record
)
}
>
{
' '
}
{
record
.
userStatus
==
1
?
'lock'
:
'unlock'
}
</
Button
>
{
/*{record.userID == 1||record.userID == this.props.currentUser.userid?'':
<Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
onClick={() => this.changeStatus(record)}>
{record.userStatus == 1 ? "lock" : "unlock"}</Button>}*/
}
</
span
>
),
},
];
//行选择
rowSelection
=
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
this
.
setState
({
delData
:
selectedRows
,
});
},
};
//渲染
render
()
{
const
{
data
,
total
,
statusList
}
=
this
.
state
;
const
statusSelect
=
statusList
.
map
((
item
,
index
)
=>
(
<
Select
.
Option
value=
{
index
}
>
{
item
}
</
Select
.
Option
>
));
return
(
<
div
className=
{
styles
.
body
}
>
<
div
className=
{
styles
.
inputBox
}
>
<
Input
id=
"deviceName"
className=
{
styles
.
input
}
placeholder=
"账号名称"
onChange=
{
(
e
)
=>
this
.
nameChange
(
e
)
}
/>
{
/*<Input id="Name" className={styles.input} placeholder="发布人姓名" />*/
}
<
RangePicker
style=
{
{
marginLeft
:
20
}
}
renderExtraFooter=
{
()
=>
''
}
showTime
onChange=
{
(
e
)
=>
this
.
dateChange
(
e
)
}
/>
<
Select
placeholder=
"状态"
onChange=
{
(
e
)
=>
this
.
statusChange
(
e
)
}
allowClear=
{
true
}
>
{
statusSelect
}
</
Select
>
<
Button
onClick=
{
()
=>
this
.
getData
()
}
>
搜索
</
Button
>
</
div
>
<
div
style=
{
{
marginTop
:
10
}
}
>
<
Button
className=
{
styles
.
button2
}
onClick=
{
()
=>
this
.
edit
(
null
)
}
>
新建
</
Button
>
</
div
>
<
div
>
<
Table
rowKey=
{
(
record
)
=>
record
.
userID
}
className=
{
styles
.
table
}
rowSelection=
{
this
.
rowSelection
}
columns=
{
this
.
columns
}
dataSource=
{
data
}
size=
"small"
pagination=
{
{
showQuickJumper
:
true
,
pageSize
:
10
,
total
:
total
}
}
/>
<
Button
className=
{
styles
.
button3
}
onClick=
{
()
=>
this
.
showModal
()
}
>
删除
</
Button
>
</
div
>
<
Modal
title=
"确认删除?"
visible=
{
this
.
state
.
visible
}
onOk=
{
this
.
handleOk
}
onCancel=
{
this
.
handleCancel
}
>
<
div
style=
{
{
textAlign
:
'center'
}
}
>
<
p
style=
{
{
fontSize
:
18
}
}
>
删除信息将不可恢复
</
p
>
</
div
>
</
Modal
>
</
div
>
);
}
}
export
default
connect
(({
user
}:
ConnectState
)
=>
({
currentUser
:
user
.
currentUser
,
}))(
Account
);
src/pages/AccountManagement/account/Account.tsx
View file @
c35815e8
...
...
@@ -127,7 +127,7 @@ const Account = (props: any) => {
<
Button
type=
"link"
onClick=
{
()
=>
{
edit
(
record
);
detail
(
record
);
}
}
>
Detail
...
...
@@ -162,6 +162,13 @@ const Account = (props: any) => {
}
};
// 详情
const
detail
=
(
item
:
any
)
=>
{
let
DataSave
=
item
;
dispatch
({
type
:
'Account/SA'
,
DataSave
});
history
.
push
(
'/AccountManagement/account/Detail'
);
};
// 停用账号弹窗
const
lockS
=
(
item
:
any
)
=>
{
setOver
(
true
);
...
...
src/pages/AccountManagement/account/AccountDetail.tsx
0 → 100644
View file @
c35815e8
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Spin
,
message
,
Descriptions
,
Checkbox
,
Tree
,
Radio
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
SearchOutlined
,
ClearOutlined
,
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'
;
import
moment
from
'moment'
;
const
Account
=
(
props
:
any
)
=>
{
const
module
=
'Account'
;
const
{
dispatch
,
Data
,
DataSave
,
DataSaveDetail
,
Result
,
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
[
ServiceCell
,
setServiceCell
]
=
useState
(
null
as
any
);
// 表单标识
const
[
form
]
=
Form
.
useForm
();
const
formRef
=
useRef
(
null
);
// 拉取数据的条件存储
// const [term, setTerm] = useState({} as any);
// 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
useEffect
(()
=>
{
if
(
DataSave
!=
null
)
{
console
.
log
(
DataSave
);
// 赋值
form
.
setFieldsValue
({
tosUserName
:
DataSave
.
tosUserName
,
tosUserPhone
:
DataSave
.
tosUserPhone
,
tosAccountName
:
DataSave
.
tosAccountName
,
});
setvalues
(
DataSave
.
tosUserLevel
);
// 等级
setServiceCell
(
DataSave
.
tosUserServiceCell
.
split
(
','
));
// 已选小区
// 发起获取权限请求
RA
(
54
,
{
tosUserName
:
DataSave
.
tosUserName
},
module
,
dispatch
);
// 发起获取权限请求
}
let
a
=
[];
for
(
var
i
=
0
;
i
<=
66
;
i
++
)
{
a
.
push
(
i
);
}
console
.
log
(
a
);
},
[
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
;
}
}
}
}
// 赋值改变
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
]
+
''
;
}
setCheckedKeys
(
data
);
}
},
[
Permission
]);
// 保存提交
const
onFinishContract
=
async
(
value
:
any
)
=>
{
// console.log(value);
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
=
getCookie
(
'id'
);
//新建者ID
delete
value
.
community
;
// console.log(value);
// 另传权限
let
obj
=
{
userName
:
value
.
tosUserName
,
userPassword
:
value
.
tosUserPwd
,
permissionArray
:
checkedKeys
.
sort
((
n1
,
n2
)
=>
{
return
parseInt
(
n1
)
-
parseInt
(
n2
);
}),
};
// console.log(obj);
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
/>
Detail 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
]
}
>
<
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
]
}
>
<
Input
placeholder=
"Name Of Administrator"
className=
"input"
disabled
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
>
<
Form
.
Item
name=
"tosUserPhone"
label=
"Phone"
rules=
{
AccountTip
[
2
]
}
>
<
Input
placeholder=
"Contact Information"
className=
"input"
maxLength=
{
11
}
onKeyUp=
{
keyup_communityManagerFee
}
disabled
/>
</
Form
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
>
<
Form
.
Item
name=
"community"
label=
"Community"
>
<
SelectCommunity
/>
</
Form
.
Item
>
<
div
className=
"diy"
style=
{
{
marginBottom
:
'14px'
}
}
>
<
div
className=
"label"
>
<
span
className=
"title"
>
Privilege Level:
</
span
>
</
div
>
<
div
className=
"label"
>
<
Radio
.
Group
defaultValue=
{
values
}
onChange=
{
onRadio
}
disabled
>
<
Radio
style=
{
radioStyle
}
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
}
disabled
/>
</
div
>
</
div
>
<
div
className=
"diy"
>
<
div
className=
"label"
></
div
>
<
div
className=
"label"
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
disabled
>
Submit
</
Button
>
</
div
>
</
div
>
</
Form
>
</
div
>
</
Spin
>
);
};
const
AccountProps
=
(
state
:
any
)
=>
{
const
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
Permission
}
=
state
.
Account
;
const
loading
=
state
.
loading
.
models
.
Account
||
false
;
const
{
user
}
=
state
;
return
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
loading
,
Permission
,
user
,
};
};
export
default
connect
(
AccountProps
)(
Account
);
src/pages/AccountManagement/account/AccountEdit copy.tsx
deleted
100644 → 0
View file @
02608e8a
import
React
from
'react'
;
import
{
connect
,
routerRedux
}
from
'dva'
;
import
{
Button
,
Input
,
Upload
,
Icon
,
Checkbox
,
Row
,
Tooltip
,
List
,
Modal
,
Select
}
from
"antd"
;
import
styles
from
'./style.less'
;
import
{
ConnectState
}
from
"@/models/connect"
;
import
XLSX
from
'./xlsx.core.min'
;
import
{
router
}
from
"umi"
;
import
permission
from
"@/models/permission"
;
import
TitleSearch
from
"@/components/TitleSearch/TitleSearch"
;
let
go
=
0
;
let
deviceData
=
[];
let
checkUser
=
1
;
class
AccountEdit
extends
React
.
Component
{
//构造
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
account
:
''
,
pw
:
''
,
pw2
:
''
,
id
:
''
,
email
:
''
,
phone
:
''
,
status
:
''
,
radio
:
2
,
createUser
:
''
,
userId
:
''
,
defaultLevel
:
''
,
permission
:
[],
targetKeys
:
[],
deviceData
:
[],
visible
:
false
,
visible2
:
false
,
newEdit
:
false
,
level
:
''
,
levelList
:
[{
label
:
'四级管理员'
,
value
:
1
},
{
label
:
'三级管理员'
,
value
:
2
},
{
label
:
'二级管理员'
,
value
:
3
},
{
label
:
'一级管理员'
,
value
:
4
},
{
label
:
'超级管理员'
,
value
:
5
}
],
leaderList
:
[{
userAccount
:
'未选择管理员等级'
}],
adList
:
[
"一级管理员"
,
"二级管理员"
,
"三级管理员"
],
leader
:
''
,
deviceList
:
[],
addDevice
:
''
,
flag
:
1
,
used
:
null
,
newAdd
:
null
,
strList
:
[],
}
}
/*----------------- 方法集 ------------------*/
//显示信息
info
()
{
let
_this
=
this
;
const
{
used
,
newAdd
,
strList
}
=
this
.
state
;
const
strSelect
=
strList
.
map
((
item
,
index
)
=>
(
<
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
>
{
strSelect
}
</
div
>
),
onOk
()
{
_this
.
back
();
},
});
}
//检测是否存在相同用户
checkUser
=
()
=>
{
checkUser
=
1
;
if
(
this
.
state
.
account
==
null
||
this
.
state
.
account
.
trim
()
==
''
||
this
.
state
.
account
==
undefined
){
alert
(
"未输入账号名称!"
);
checkUser
=
0
;
return
;
}
this
.
props
.
dispatch
({
type
:
'accountModel/checkAccountByName'
,
payload
:
{
username
:
this
.
state
.
account
,
},
callback
:
(
res
)
=>
{
if
(
res
)
{
if
(
res
.
error_code
==
"0000"
)
{
checkUser
=
0
;
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
){
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
checkUser
=
1
;
}
}
}
});
};
//跳转到账户页面
back
=
()
=>
{
this
.
props
.
dispatch
(
routerRedux
.
push
({
pathname
:
'/AccountManagement/account'
,
}))
};
//获取所有上级
getAllLeader
=
(
level
)
=>
{
const
params
=
{
userLevel
:
level
,
};
this
.
props
.
dispatch
({
type
:
'accountModel/getAllLeader'
,
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
leaderList
:
res
,
})
}
}
});
};
//两次密码校对
checkPw
=
()
=>
{
if
(
this
.
state
.
pw
==
null
||
this
.
state
.
pw
==
undefined
||
this
.
state
.
pw
.
trim
()
==
''
)
{
alert
(
"未输入密码!"
);
go
=
0
;
}
else
if
(
this
.
state
.
pw2
==
null
||
this
.
state
.
pw2
==
undefined
||
this
.
state
.
pw2
.
trim
()
==
''
)
{
alert
(
"未输入确认密码!"
);
go
=
0
;
}
else
if
(
this
.
state
.
pw
!=
this
.
state
.
pw2
)
{
go
=
0
;
alert
(
"两次输入的密码不同!"
);
}
else
{
go
=
1
;
this
.
onSubmit
();
}
};
//批量导入设备
importUserDeviceListExcel
=
(
id
)
=>
{
if
(
this
.
state
.
deviceList
!=
undefined
&&
this
.
state
.
deviceList
!=
null
&&
this
.
state
.
deviceList
!=
''
)
{
this
.
props
.
dispatch
({
type
:
'deviceModel/importUserDeviceListExcel'
,
payload
:
{
jsonArr
:
this
.
state
.
deviceList
,
userID
:
id
,
},
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
used
:
res
.
data
.
used
,
newAdd
:
res
.
data
.
integer
,
strList
:
res
.
data
.
strList
,
},()
=>
{
this
.
info
();
});
}
}
});
}
else
{
this
.
back
();
}
};
//获取用户拥有的设备
getUserDevice
=
(
userID
)
=>
{
const
params
=
{
userID
:
userID
,
};
this
.
props
.
dispatch
({
type
:
'deviceModel/getTargetKeys'
,
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
targetKeys
:
res
});
}
}
});
};
//获取操作员拥有的设备
getDevice
=
()
=>
{
const
params
=
{
userID
:
this
.
props
.
currentUser
.
userid
,
};
this
.
props
.
dispatch
({
type
:
'deviceModel/getUserDevice'
,
payload
:
params
,
callback
:
(
res
)
=>
{
deviceData
=
[];
if
(
res
)
{
for
(
let
i
=
0
;
i
<
res
.
total
;
i
++
)
{
if
(
res
.
rows
[
i
].
deviceSerialNumber
!=
''
&&
res
.
rows
[
i
].
deviceSerialNumber
!=
null
)
{
deviceData
.
push
({
key
:
res
.
rows
[
i
].
deviceID
,
title
:
res
.
rows
[
i
].
deviceSerialNumber
,
});
}
}
}
}
});
};
//保存权限信息
savePermission
=
(
id
)
=>
{
const
nowUser
=
this
.
props
.
currentUser
;
this
.
props
.
dispatch
({
type
:
'permissionModel/saveAccountPermission'
,
payload
:
{
userName
:
this
.
state
.
account
,
userPassword
:
this
.
state
.
pw
,
permissionArray
:
this
.
state
.
permission
,
},
callback
:
(
res
)
=>
{
if
(
res
){
console
.
log
(
res
);
if
(
id
==
nowUser
.
userid
){
this
.
props
.
currentUser
.
permission
=
this
.
state
.
permission
;
}
alert
(
res
.
error_msg
);
}
}
});
};
//获取权限信息
getPermission
=
(
userID
)
=>
{
const
params1
=
this
.
props
.
location
.
query
;
const
params
=
{
userID
:
params1
.
tosUserName
,
};
this
.
props
.
dispatch
({
type
:
'permissionModel/getAccountPermission'
,
payload
:
params
,
callback
:
(
res
)
=>
{
if
(
res
)
{
this
.
setState
({
permission
:
res
,
})
}
}
});
};
//绑定单个设备
addToDeviceList
()
{
const
oldDeviceList
=
this
.
state
.
deviceList
;
if
(
!
oldDeviceList
.
includes
(
this
.
state
.
addDevice
)
&&
this
.
state
.
addDevice
!=
''
&&
this
.
state
.
addDevice
!=
null
&&
this
.
state
.
addDevice
!=
undefined
)
{
oldDeviceList
.
push
(
this
.
state
.
addDevice
);
}
this
.
setState
({
deviceList
:
oldDeviceList
})
}
//SN变更
addDeviceChange
(
e
)
{
this
.
setState
({
addDevice
:
e
.
target
.
value
,
});
}
//用户名变更
accountChange
=
(
e
)
=>
{
this
.
setState
({
account
:
e
.
target
.
value
});
};
adChange
=
(
e
)
=>
{
this
.
setState
({
level
:
e
==
undefined
?
undefined
:
e
+
1
});
};
//密码变更
pwChange
=
(
e
)
=>
{
this
.
setState
({
pw
:
e
.
target
.
value
});
};
//确认密码变更
pwChange2
=
(
e
)
=>
{
this
.
setState
({
pw2
:
e
.
target
.
value
});
};
//联系电话变更
phoneChange
=
(
e
)
=>
{
this
.
setState
({
phone
:
e
.
target
.
value
});
};
//联系邮箱变更
emailChange
=
(
e
)
=>
{
this
.
setState
({
email
:
e
.
target
.
value
});
};
//提交前验证
onGo
=
()
=>
{
if
(
this
.
state
.
account
==
null
||
this
.
state
.
account
.
trim
()
==
''
||
this
.
state
.
account
==
undefined
){
alert
(
"未输入账号名称!"
);
checkUser
=
0
;
return
;
}
this
.
props
.
dispatch
({
type
:
'accountModel/checkAccountByName'
,
payload
:
{
username
:
this
.
state
.
account
,
},
callback
:
(
res
)
=>
{
if
(
res
)
{
console
.
log
(
res
);
if
(
res
.
error_code
==
"0000"
)
{
checkUser
=
0
;
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
){
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
this
.
checkPw
();
}
}
}
});
};
//提交
onSubmit
=
()
=>
{
if
(
this
.
state
.
account
==
null
||
this
.
state
.
account
.
trim
()
==
''
||
this
.
state
.
account
==
undefined
){
alert
(
"未输入账号名称!"
);
checkUser
=
0
;
return
;
}
this
.
props
.
dispatch
({
type
:
'accountModel/checkAccountByName'
,
//请求一次,通过用户名查表
payload
:
{
username
:
this
.
state
.
account
,
},
callback
:
(
res
)
=>
{
if
(
res
)
{
console
.
log
(
res
);
if
(
res
.
error_code
==
"0000"
)
{
// if(this.state.newEdit==true){
// checkUser = 0;
// alert(res.error_msg);
// }else {
let
oneself
=
0
;
if
(
this
.
state
.
id
!=
null
&&
(
this
.
state
.
id
==
this
.
props
.
currentUser
.
userid
)){
oneself
=
1
;
}
const
params
=
{
/* userAccount: this.state.account,
userID: this.state.id ? this.state.id : null,
userPhone: this.state.phone,
userPassword: this.state.newEdit == true ? this.state.pw : null,
userEmail: this.state.email,
createUser: this.state.createUser != undefined ? this.state.createUser : this.state.userId,
userLevel: this.state.level,*/
userLeader
:
this
.
state
.
leader
,
oneself
:
oneself
,
tosUserName
:
this
.
state
.
account
,
id
:
this
.
state
.
id
?
this
.
state
.
id
:
null
,
tosUserPhone
:
this
.
state
.
phone
,
userStatus
:
this
.
state
.
status
?
this
.
state
.
status
:
1
,
tosUserPwd
:
this
.
state
.
newEdit
==
true
?
this
.
state
.
pw
:
null
,
tosUserEmail
:
this
.
state
.
email
,
tosuserLevel
:
this
.
state
.
level
,
tosUserToCompany
:
this
.
state
.
createUser
!=
undefined
?
this
.
state
.
createUser
:
this
.
state
.
userId
,
tosUserServiceCell
:
this
.
state
.
leader
,
};
this
.
props
.
dispatch
({
type
:
'accountModel/saveAccount'
,
// 第二次请求,查不到用户的时候,保存新的用户
payload
:
params
,
callback
:
(
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
error_code
==
"0000"
)
{
// alert(res.error_msg);
console
.
log
(
"data"
,
res
.
data
);
// this.importUserDeviceListExcel(res.data.userID);
this
.
savePermission
(
res
.
data
.
userID
);
// 第三次请求,插入权限表格
}
else
if
(
res
.
error_code
==
"0001"
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0002"
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
){
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
alert
(
"提交失败!"
);
}
}
});
// }
}
else
if
(
res
.
error_code
==
"0008"
){
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
checkUser
=
1
;
let
oneself
=
0
;
if
(
this
.
state
.
id
!=
null
&&
(
this
.
state
.
id
==
this
.
props
.
currentUser
.
userid
)){
oneself
=
1
;
}
const
params
=
{
tosUserName
:
this
.
state
.
account
,
id
:
this
.
state
.
id
?
this
.
state
.
id
:
null
,
tosUserPhone
:
this
.
state
.
phone
,
userStatus
:
this
.
state
.
status
?
this
.
state
.
status
:
1
,
tosUserPwd
:
this
.
state
.
newEdit
==
true
?
this
.
state
.
pw
:
null
,
tosUserEmail
:
this
.
state
.
email
,
tosuserLevel
:
this
.
state
.
level
,
tosUserToCompany
:
this
.
state
.
createUser
!=
undefined
?
this
.
state
.
createUser
:
this
.
state
.
userId
,
tosUserServiceCell
:
this
.
state
.
leader
,
userLevel
:
this
.
state
.
level
,
userLeader
:
this
.
state
.
leader
,
oneself
:
oneself
,
/* userAccount: this.state.account,
userID: this.state.id ? this.state.id : null,
userPhone: this.state.phone,
userStatus: this.state.status ? this.state.status : 1,
userPassword: this.state.newEdit == true ? this.state.pw : null,
userEmail: this.state.email,
createUser: this.state.createUser != undefined ? this.state.createUser : this.state.userId,
userLevel: this.state.level,
userLeader: this.state.leader,
oneself: oneself,*/
};
this
.
props
.
dispatch
({
type
:
'accountModel/saveAccount'
,
payload
:
params
,
callback
:
(
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
error_code
==
"0000"
)
{
alert
(
res
.
error_msg
);
console
.
log
(
"data"
,
res
.
data
);
this
.
importUserDeviceListExcel
(
res
.
data
.
userID
);
this
.
savePermission
(
res
.
data
.
userID
);
//第三次请求,RPC保存权限表格
}
else
if
(
res
.
error_code
==
"0001"
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0002"
)
{
alert
(
res
.
error_msg
);
}
else
if
(
res
.
error_code
==
"0008"
){
alert
(
res
.
error_msg
);
window
.
location
.
href
=
'/'
;
router
.
replace
(
'/'
);
}
else
{
alert
(
"提交失败!"
);
}
}
});
}
}
}
});
};
//初始化
componentDidMount
()
{
this
.
getDevice
();
const
nowUser
=
this
.
props
.
currentUser
.
userid
;
if
(
this
.
props
.
location
.
query
!=
null
)
{
const
params
=
this
.
props
.
location
.
query
;
if
(
params
.
userID
==
null
||
params
.
userID
==
''
||
params
.
userID
==
undefined
)
{
this
.
setState
({
newEdit
:
true
})
}
this
.
setState
({
level
:
params
.
tosuserLevel
,
account
:
params
.
tosUserName
,
pw
:
params
.
userPassword
,
id
:
params
.
id
,
email
:
params
.
tosUserEmail
,
phone
:
params
.
tosUserPhone
,
status
:
params
.
deleted
,
/* level: params.userLevel,
account: params.userAccount,
pw: params.userPassword,
id: params.userID,
email: params.userEmail,
phone: params.userPhone,
status: params.userStatus,*/
userId
:
nowUser
,
createUser
:
params
.
createUser
,
leader
:
params
.
userLeader
?
params
.
userLeader
.
toString
()
:
params
.
userLeader
,
},()
=>
{
if
(
this
.
props
.
currentUser
.
userid
==
this
.
state
.
id
){
this
.
setState
({
flag
:
0
,
})
}
this
.
setState
({
flag
:
1
,
})
});
if
(
params
.
id
!=
''
&&
params
.
id
!=
null
)
{
this
.
getPermission
(
params
.
account
);
this
.
getUserDevice
(
params
.
account
);
}
if
(
params
.
userLevel
!=
''
&&
params
.
userLevel
!=
null
)
{
this
.
getAllLeader
(
params
.
userLevel
);
}
}
}
//多选框
onChange
(
checkedValues
)
{
this
.
setState
({
permission
:
checkedValues
,
});
}
/*--------------------------------------*/
columns
=
[
{
title
:
'设备串号'
,
dataIndex
:
'deviceName'
,
key
:
'deviceName'
,
},
];
//渲染
render
()
{
const
{
adList
,
defaultLevel
,
level
,
phone
,
email
,
permission
,
account
,
newEdit
,
deviceList
,
pw
,
pw2
,
flag
}
=
this
.
state
;
const
adSelect
=
adList
.
map
((
item
,
index
)
=>
(
<
Select
.
Option
value=
{
index
}
>
{
item
}
</
Select
.
Option
>
));
const
uploadprops
=
{
accept
:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
,
name
:
'file'
,
headers
:
{
authorization
:
'authorization-text'
,
},
showUploadList
:
false
,
beforeUpload
:
(
file
,
fileList
)
=>
{
const
rABS
=
true
;
const
f
=
fileList
[
0
];
const
reader
=
new
FileReader
();
reader
.
onload
=
e
=>
{
let
dataResult
=
e
.
target
.
result
;
if
(
!
rABS
)
dataResult
=
new
Uint8Array
(
dataResult
);
const
workbook
=
XLSX
.
read
(
dataResult
,
{
type
:
rABS
?
'binary'
:
'array'
,
});
const
firstWorksheet
=
workbook
.
Sheets
[
workbook
.
SheetNames
[
0
]];
const
jsonArr
=
XLSX
.
utils
.
sheet_to_json
(
firstWorksheet
,
{
header
:
1
});
const
oldDeviceList
=
this
.
state
.
deviceList
;
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
)
{
oldDeviceList
.
push
(
jsonArr
[
i
][
0
]);
}
}
this
.
setState
({
deviceList
:
oldDeviceList
})
};
if
(
rABS
)
reader
.
readAsBinaryString
(
f
);
else
reader
.
readAsArrayBuffer
(
f
);
return
false
;
},
};
const
CallBackTitleSearch
=
(
comment
:
any
)
=>
{
console
.
log
(
comment
)
}
return
(
<
div
className=
{
styles
.
body
}
>
<
div
style=
{
{
marginTop
:
48
}
}
>
<
div
className=
{
styles
.
detailsBox
}
>
<
div
>
<
span
className=
{
styles
.
detailsContent
}
>
账号
</
span
>
{
newEdit
!=
true
?
<
Input
className=
{
styles
.
input
}
value=
{
account
}
onChange=
{
(
e
)
=>
this
.
accountChange
(
e
)
}
disabled
placeholder=
"请输入账号名"
/>:
''
}
{
newEdit
==
true
?
<
Input
className=
{
styles
.
input
}
value=
{
account
}
onChange=
{
(
e
)
=>
this
.
accountChange
(
e
)
}
placeholder=
"请输入账号名"
/>:
''
}
</
div
>
<
div
>
{
newEdit
==
true
?
<
span
className=
{
styles
.
detailsContent
}
>
密码
</
span
>
:
''
}
{
newEdit
==
true
?
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
Input
.
Password
className=
{
styles
.
input
}
onChange=
{
(
e
)
=>
this
.
pwChange
(
e
)
}
value=
{
pw
}
placeholder=
"请输入密码"
/>
<
Input
.
Password
className=
{
styles
.
input
}
onChange=
{
(
e
)
=>
this
.
pwChange2
(
e
)
}
value=
{
pw2
}
placeholder=
"请再次输入密码"
/>
</
div
>
:
''
}
</
div
>
<
div
>
<
span
className=
{
styles
.
detailsContent
}
>
联系方式
</
span
>
<
Input
className=
{
styles
.
input
}
value=
{
phone
}
onChange=
{
(
e
)
=>
this
.
phoneChange
(
e
)
}
placeholder=
"请输入联系电话"
/>
<
Input
className=
{
styles
.
input
}
value=
{
email
}
onChange=
{
(
e
)
=>
this
.
emailChange
(
e
)
}
placeholder=
"请输入联系邮箱"
/>
</
div
>
{
newEdit
!=
true
?
<
div
>
<
span
className=
{
styles
.
detailsContent
}
>
用户等级:
</
span
>
<
Select
className=
{
styles
.
input
}
disabled
placeholder=
"用户等级"
value=
{
defaultLevel
}
onChange=
{
(
e
)
=>
this
.
adChange
(
e
)
}
allowClear=
{
true
}
>
{
adSelect
}
</
Select
>
</
div
>:
''
}
{
newEdit
==
true
?
<
div
>
<
span
className=
{
styles
.
detailsContent
}
>
用户等级:
</
span
>
<
Select
className=
{
styles
.
input
}
placeholder=
"用户等级"
value=
{
level
}
onChange=
{
(
e
)
=>
this
.
adChange
(
e
)
}
allowClear=
{
true
}
>
{
adSelect
}
</
Select
>
</
div
>:
''
}
<
TitleSearch
listkey=
{
[
"providerName"
]
}
list=
{
[
"Service Provider"
]
}
community=
{
"serviceCommunityList"
}
onSubmit=
{
CallBackTitleSearch
}
/>
<
div
>
<
div
style=
{
{
marginTop
:
20
}
}
>
{
/*<span className={styles.detailsContent}*/
}
{
/* style={{position: "relative", marginTop:20,bottom: 250}}>权限配置</span>*/
}
{
flag
==
0
?
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
Checkbox
.
Group
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
e
)
=>
this
.
onChange
(
e
)
}
value=
{
permission
}
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>我的设备</span>*/
}
<
Checkbox
value=
"1"
disabled
>
数据中心
</
Checkbox
>
<
Checkbox
value=
"2"
disabled
>
查看life用户
</
Checkbox
>
<
Checkbox
value=
"3"
disabled
>
编辑life用户
</
Checkbox
>
<
Checkbox
value=
"4"
disabled
>
添加业主档案
</
Checkbox
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>广告推送</span>*/
}
<
Checkbox
value=
"5"
disabled
>
注销业主档案
</
Checkbox
>
<
Checkbox
value=
"6"
disabled
>
查看服务商
</
Checkbox
>
<
Checkbox
value=
"7"
disabled
>
编辑服务商
</
Checkbox
>
<
Checkbox
value=
"8"
disabled
>
添加服务商
</
Checkbox
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>警报提醒</span>*/
}
<
div
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
>
<
Checkbox
value=
"9"
disabled
>
注销服务商
</
Checkbox
>
<
Checkbox
value=
"10"
disabled
>
查看物业费记录
</
Checkbox
>
<
Checkbox
value=
"11"
disabled
>
添加物业费记录
</
Checkbox
>
<
Checkbox
value=
"12"
disabled
>
查看物业服务
</
Checkbox
>
</
div
>
<
div
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
>
<
Checkbox
value=
"13"
disabled
>
编辑物业服务
</
Checkbox
>
<
Checkbox
value=
"14"
disabled
>
注销物业服务
</
Checkbox
>
<
Checkbox
value=
"15"
disabled
>
查看订单
</
Checkbox
>
<
Checkbox
value=
"16"
disabled
>
编辑订单
</
Checkbox
>
</
div
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>创建后台账号</span>*/
}
<
Checkbox
value=
"17"
disabled
>
查看合同
</
Checkbox
>
<
Checkbox
value=
"18"
disabled
>
编辑合同
</
Checkbox
>
<
Checkbox
value=
"19"
disabled
>
添加合同
</
Checkbox
>
<
Checkbox
value=
"20"
disabled
>
查看小区
</
Checkbox
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>系统更新</span>*/
}
<
Checkbox
value=
"21"
disabled
>
编辑小区
</
Checkbox
>
<
Checkbox
value=
"22"
disabled
>
添加小区
</
Checkbox
>
<
Checkbox
value=
"23"
disabled
>
查看公告
</
Checkbox
>
<
Checkbox
value=
"24"
disabled
>
编辑公告
</
Checkbox
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>系统更新</span>*/
}
<
Checkbox
value=
"25"
disabled
>
添加公告
</
Checkbox
>
<
Checkbox
value=
"26"
disabled
>
查看访客记录
</
Checkbox
>
<
Checkbox
value=
"27"
disabled
>
查看预定服务
</
Checkbox
>
<
Checkbox
value=
"28"
disabled
>
编辑预定服务
</
Checkbox
>
</
Row
>
<
Row
>
{
/*<span className={styles.font} style={{margin: "5px 0px 5px 0px"}}>系统更新</span>*/
}
<
Checkbox
value=
"29"
disabled
>
添加预定服务
</
Checkbox
>
<
Checkbox
value=
"30"
disabled
>
查看后台账号
</
Checkbox
>
<
Checkbox
value=
"31"
disabled
>
配置后台账号
</
Checkbox
>
</
Row
>
</
Checkbox
.
Group
>
</
div
>:
''
}
{
flag
==
1
?
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
Checkbox
.
Group
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
e
)
=>
this
.
onChange
(
e
)
}
value=
{
permission
}
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"1"
>
数据中心
</
Checkbox
>
<
Checkbox
value=
"2"
>
查看life用户
</
Checkbox
>
<
Checkbox
value=
"3"
>
编辑life用户
</
Checkbox
>
<
Checkbox
value=
"4"
>
添加业主档案
</
Checkbox
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"5"
>
注销业主档案
</
Checkbox
>
<
Checkbox
value=
"6"
>
查看服务商
</
Checkbox
>
<
Checkbox
value=
"7"
>
编辑服务商
</
Checkbox
>
<
Checkbox
value=
"8"
>
添加服务商
</
Checkbox
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
div
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
>
<
Checkbox
value=
"9"
>
注销服务商
</
Checkbox
>
<
Checkbox
value=
"10"
>
查看物业费记录
</
Checkbox
>
<
Checkbox
value=
"11"
>
添加物业费记录
</
Checkbox
>
<
Checkbox
value=
"12"
>
查看物业服务
</
Checkbox
>
</
div
>
<
div
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
>
<
Checkbox
value=
"13"
>
编辑物业服务
</
Checkbox
>
<
Checkbox
value=
"14"
>
注销物业服务
</
Checkbox
>
<
Checkbox
value=
"15"
>
查看订单
</
Checkbox
>
<
Checkbox
value=
"16"
>
编辑订单
</
Checkbox
>
</
div
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"17"
>
查看合同
</
Checkbox
>
<
Checkbox
value=
"18"
>
编辑合同
</
Checkbox
>
<
Checkbox
value=
"19"
>
添加合同
</
Checkbox
>
<
Checkbox
value=
"20"
>
查看小区
</
Checkbox
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"21"
>
编辑小区
</
Checkbox
>
<
Checkbox
value=
"22"
>
添加小区
</
Checkbox
>
<
Checkbox
value=
"23"
>
查看公告
</
Checkbox
>
<
Checkbox
value=
"24"
>
编辑公告
</
Checkbox
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"25"
>
添加公告
</
Checkbox
>
<
Checkbox
value=
"26"
>
查看访客记录
</
Checkbox
>
<
Checkbox
value=
"27"
>
查看预定服务
</
Checkbox
>
<
Checkbox
value=
"28"
>
编辑预定服务
</
Checkbox
>
</
Row
>
<
Row
>
<
span
className=
{
styles
.
font
}
style=
{
{
margin
:
"5px 0px 5px 0px"
}
}
></
span
>
<
Checkbox
value=
"29"
>
添加预定服务
</
Checkbox
>
<
Checkbox
value=
"30"
>
查看后台账号
</
Checkbox
>
<
Checkbox
value=
"31"
>
配置后台账号
</
Checkbox
>
</
Row
>
</
Checkbox
.
Group
>
</
div
>:
''
}
</
div
>
</
div
>
{
/* <div>
<span className={styles.detailsContent}>绑定设备</span>
<div style={{position: "relative", left: 110, bottom: 50}}>
<Input
className={styles.input}
onChange={(e) => this.addDeviceChange(e)}
placeholder="请输入设备串号"/>
<Button className={styles.button1}
onClick={() => this.addToDeviceList()}>添加</Button>
<Upload {...uploadprops}>
<Tooltip title="">
<Button className={styles.button1}
style={{margin: 5, width: 120}}>
<Icon type="upload"/>批量导入
</Button>
</Tooltip>
</Upload>
<br/>
<List
style={{width: 240}}
size="small"
header={<div>设备串号</div>}
bordered
dataSource={deviceList}
renderItem={item => <List.Item>{item}</List.Item>}
/>
</div>
</div>*/
}
<
div
>
{
newEdit
==
false
?
<
Button
className=
{
styles
.
button1
}
onClick=
{
()
=>
this
.
onSubmit
()
}
>
提交
</
Button
>
:
''
}
{
newEdit
==
true
?
<
Button
className=
{
styles
.
button1
}
// onClick=
{()
=
>
this.onGo()}
>
提交
</
Button
>
:
''
}
onClick=
{
()
=>
this
.
onSubmit
()
}
>
提交
</
Button
>
: ''}
<
Button
className=
{
styles
.
button1
}
onClick=
{
()
=>
this
.
back
()
}
>
返回
</
Button
>
</
div
>
</
div
>
</
div
>
<
/
div
>
);
}
}
export default connect((
{
user
}
: ConnectState) =
>
(
{
currentUser
:
user
.
currentUser
,
}
))(AccountEdit);
src/pages/AccountManagement/account/AccountEdit.tsx
View file @
c35815e8
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Spin
,
message
,
Descriptions
,
Checkbox
,
Tree
,
Radio
}
from
'antd'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
SearchOutlined
,
Clear
Outlined
,
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
SearchOutlined
,
Poweroff
Outlined
,
EditOutlined
,
LeftOutlined
}
from
'@ant-design/icons'
;
import
{
getCookie
}
from
'@/utils/method'
;
import
'./Account.less'
;
...
...
@@ -204,6 +204,10 @@ const Account = (props: any) => {
<
EditOutlined
/>
Edit Account
<
div
className=
"back"
>
<
Button
type=
"primary"
danger
style=
{
{
marginRight
:
15
}
}
>
<
PoweroffOutlined
/>
Close Account
</
Button
>
<
Button
onClick=
{
goToReturn
}
>
<
LeftOutlined
/>
Back
...
...
src/pages/ContractManagement/ContractContent.tsx
View file @
c35815e8
...
...
@@ -167,13 +167,13 @@ const ContractContent = (props: any) => {
action
:
'/tos/image/upload'
,
data
:
{
imageType
:
'tosContract'
,
extends
:
comtyName
},
fileList
:
fileList
,
onChange
:
({
file
,
fileList
}:
{
file
:
any
;
fileList
:
any
})
=>
{
onChange
:
({
file
}:
{
file
:
any
})
=>
{
if
(
file
.
status
===
'uploading'
)
{
setimgLoad
(
true
);
}
if
(
file
.
status
==
'done'
)
{
message
.
success
(
file
.
name
);
setFileList
(
fileList
);
message
.
success
(
file
.
name
+
' Upload Successful !'
);
setFileList
(
[...
fileList
,
file
]
);
// 添加到表单
form
.
setFieldsValue
({
upload
:
'ok'
,
...
...
@@ -253,32 +253,22 @@ const ContractContent = (props: any) => {
// 文件上传判断
function
beforeUpload
(
file
:
any
)
{
// 文件类型判断
const
isJpgOrPng
=
file
.
type
===
'image/jpeg'
||
file
.
type
===
'image/png'
||
file
.
type
===
'image/jpg'
;
if
(
!
isJpgOrPng
)
{
message
.
error
(
'You can only upload JPG/PNG file!'
);
return
false
;
}
// 文件大小判断
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
;
if
(
!
isLt2M
)
{
message
.
error
(
'Image must smaller than 2MB!'
);
return
false
;
}
return
is
JpgOrPng
&&
is
Lt2M
;
return
isLt2M
;
}
// 移除文件
const
onRemove
=
async
(
file
:
any
)
=>
{
console
.
log
(
'点击'
);
let
fileListArr
=
fileList
;
for
(
let
i
in
fileListArr
)
{
if
(
fileListArr
[
i
].
uid
==
file
.
uid
)
{
fileListArr
.
splice
(
i
,
1
);
}
}
console
.
log
(
fileListArr
);
setFileList
([...
fileListArr
]);
};
...
...
src/pages/ContractManagement/ContractDetail copy.tsx
deleted
100644 → 0
View file @
02608e8a
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
Spin
,
Descriptions
}
from
'antd'
;
import
{
LeftOutlined
}
from
'@ant-design/icons'
;
import
moment
from
'moment'
;
import
'./ContractContent.less'
;
import
PreView
from
'@/components/PreView/PreViewTow'
;
const
ContractDetail
=
(
props
:
any
)
=>
{
const
{
Contract
,
dispatch
,
FileImg
,
loading
}
=
props
;
const
{
DataSaveDetail
}
=
Contract
;
const
RA
=
(
index
:
any
,
values
:
any
)
=>
{
dispatch
({
type
:
'Contract/RA'
,
playload
:
{
index
:
index
,
body
:
values
}
});
};
const
goToReturn
=
()
=>
{
history
.
go
(
-
1
);
};
const
[
fileList
,
setFileList
]
=
useState
([]
as
any
);
// 图片列表
const
[
tipTime
,
setTipTime
]
=
useState
([
'previous month'
,
'two months'
]
as
any
);
//提示时间
// 带来信息
useEffect
(()
=>
{
if
(
DataSaveDetail
==
null
)
{
history
.
push
(
'/ContractManagement'
);
}
else
{
// 请求
let
objData
=
{
type
:
'tosContractPreview'
,
fileName
:
DataSaveDetail
.
contractFileName
,
extends
:
DataSaveDetail
.
communityName
,
};
RA
(
47
,
objData
);
// 设置提示时间
let
a1
=
moment
(
DataSaveDetail
.
contractValidEndDate
)
.
subtract
(
2
,
'month'
)
.
format
(
'YYYY-MM-DD'
);
let
a2
=
moment
(
DataSaveDetail
.
contractValidEndDate
)
.
subtract
(
1
,
'month'
)
.
format
(
'YYYY-MM-DD'
);
setTipTime
([
a1
,
a2
]);
}
},
[
DataSaveDetail
]);
// 监听图片列表
useEffect
(()
=>
{
if
(
FileImg
!=
null
)
{
let
obj
=
new
Array
();
for
(
var
i
in
FileImg
)
{
let
a
=
{
uid
:
i
,
name
:
FileImg
[
i
].
fileName
,
status
:
'done'
,
type
:
FileImg
[
i
].
fileName
.
match
(
/
\.([^\.]
+
)
$/
)[
1
].
toLowerCase
(),
url
:
FileImg
[
i
].
fileUrl
,
};
obj
.
push
(
a
);
}
setFileList
([...
obj
]);
}
else
{
setFileList
([]);
}
},
[
FileImg
]);
return
(
<
Spin
spinning=
{
loading
}
>
{
DataSaveDetail
?
(
<
div
className=
"base"
>
{
/* 头部组件 */
}
<
div
className=
"box"
>
<
div
className=
"item1"
>
Detail Contract
</
div
>
<
button
className=
"item3"
onClick=
{
goToReturn
}
>
<
LeftOutlined
/>
Back
</
button
>
</
div
>
<
div
className=
""
>
<
Descriptions
title=
""
bordered
layout=
"vertical"
>
<
Descriptions
.
Item
label=
"Contract Number :"
>
{
DataSaveDetail
.
contractNumber
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Party A :"
>
{
DataSaveDetail
.
contractPartyA
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Party B :"
>
{
DataSaveDetail
.
contractPartyB
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Contract Title :"
span=
{
2
}
>
{
DataSaveDetail
.
contractTitle
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Community Name :"
>
{
DataSaveDetail
.
communityName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Date :"
>
<
p
>
{
DataSaveDetail
.
contractValidStartDate
}
~
{
DataSaveDetail
.
contractValidEndDate
}
</
p
>
<
p
style=
{
{
marginBottom
:
0
,
color
:
'#999'
}
}
>
The system will send e-mail notification in the
{
' '
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
tipTime
[
0
]
}
</
span
>
and
{
' '
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
tipTime
[
1
]
}
</
span
>
that the contract is about to
expire !
</
p
>
{
/* <p style={{ marginBottom: 0 }}>
<span style={{ color: 'red' }}>*</span> If the time has passed, it will not be
sent
</p> */
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Contacts :"
>
{
DataSaveDetail
.
communityAccount
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Phone :"
>
{
DataSaveDetail
.
communityPhone
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Contract Annex :"
span=
{
3
}
>
{
fileList
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
<
PreView
OpenUrl=
{
item
}
key=
{
index
}
></
PreView
>;
})
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"Contract Remarks :"
>
{
DataSaveDetail
.
contractRemindContent
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
div
>
</
div
>
)
:
(
''
)
}
</
Spin
>
);
};
function
mapStateToProps
(
state
:
any
)
{
const
{
Contract
}
=
state
;
const
{
FileImg
}
=
Contract
;
const
loading
=
state
.
loading
.
models
.
Contract
||
false
;
return
{
Contract
,
FileImg
,
loading
,
};
}
export
default
connect
(
mapStateToProps
)(
ContractDetail
);
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