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
5a981862
Commit
5a981862
authored
Nov 12, 2020
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复设施、公告、合同bug ,重做权限管理页面
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
7ba2ef55
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
611 additions
and
352 deletions
+611
-352
Account.ts
src/models/CommunityManagement/Account.ts
+34
-33
Account copy.tsx
src/pages/AccountManagement/account/Account copy.tsx
+388
-0
Account.less
src/pages/AccountManagement/account/Account.less
+13
-0
Account.tsx
src/pages/AccountManagement/account/Account.tsx
+154
-310
Contract.tsx
src/pages/ContractManagement/Contract.tsx
+0
-2
ContractContent.tsx
src/pages/ContractManagement/ContractContent.tsx
+22
-7
No files found.
src/models/CommunityManagement/Account.ts
View file @
5a981862
...
...
@@ -2,7 +2,7 @@ import * as service from '../../services/tos';
import
{
message
}
from
'antd'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
{
routerRedux
}
from
'dva/router'
import
{
routerRedux
}
from
'dva/router'
;
import
{
printf
}
from
'@/utils/log'
;
...
...
@@ -12,63 +12,64 @@ export default {
Data
:
null
,
Result
:
null
,
DataSave
:
null
,
DataSaveDetail
:
null
,
DataSaveDetail
:
null
,
},
reducers
:
{
returnPage
(
state
,
{
Data
})
{
returnPage
(
state
,
{
Data
})
{
return
{
...
state
,
Data
};
},
returnResult
(
state
,
{
Result
})
{
return
{
...
state
,
Result
};
returnResult
(
state
,
{
Result
})
{
return
{
...
state
,
Result
};
},
returnDataSave
(
state
,
{
DataSave
})
{
return
{
...
state
,
DataSave
}
return
{
...
state
,
DataSave
};
},
returnDataSaveDetail
(
state
,
{
DataSaveDetail
})
{
return
{
...
state
,
DataSaveDetail
}
return
{
...
state
,
DataSaveDetail
};
},
},
effects
:
{
//标准请求
*
RA
({
playload
},
{
call
,
put
})
{
const
resp
=
yield
call
(
service
.
RA
,
playload
);
console
.
log
(
resp
)
if
(
resp
.
code
==
500
||
resp
.
error_code
!=
"0000"
)
{
console
.
log
(
resp
)
;
if
(
resp
.
code
==
500
||
resp
.
error_code
!=
'0000'
)
{
}
if
(
resp
.
error_code
!=
"0000"
)
{
printf
(
playload
,
resp
)
}
else
{
if
(
resp
.
error_code
!=
'0000'
)
{
printf
(
playload
,
resp
);
}
else
{
switch
(
playload
.
index
)
{
case
41
:
{
// let Data = resp.data;
// yield put({ type: 'returnPage', Data });
}
break
;
case
42
:
{
history
.
go
(
-
1
)
}
break
;
case
45
:
{
let
Data
=
resp
;
yield
put
({
type
:
'returnPage'
,
Data
});
}
break
;
case
41
:
{
// let Data = resp.data;
// yield put({ type: 'returnPage', Data });
}
break
;
case
42
:
{
history
.
go
(
-
1
);
}
break
;
case
45
:
{
let
Data
=
resp
.
data
;
yield
put
({
type
:
'returnPage'
,
Data
});
}
break
;
}
}
},
*
ResultClear
({
},
{
put
})
{
var
tmp
=
null
yield
put
({
type
:
'returnResult'
,
tmp
}
)
*
ResultClear
({},
{
put
})
{
var
tmp
=
null
;
yield
put
({
type
:
'returnResult'
,
tmp
});
},
*
SA
({
playload
},
{
call
,
put
})
{
var
DataSave
=
playload
yield
put
({
type
:
'returnDataSave'
,
DataSave
}
)
var
DataSave
=
playload
;
yield
put
({
type
:
'returnDataSave'
,
DataSave
});
},
},
};
src/pages/AccountManagement/account/Account copy.tsx
0 → 100644
View file @
5a981862
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.less
0 → 100644
View file @
5a981862
.contop {
background: #fff;
padding: 20px;
border-right: 4px;
margin-bottom: 15px;
.pages {
text-align: right;
padding: 10px;
}
}
.contop2 {
padding: 0 10px 20px;
}
src/pages/AccountManagement/account/Account.tsx
View file @
5a981862
import
React
from
'react'
;
import
{
connect
,
routerRedux
}
from
'dva
'
;
import
{
Table
,
Button
,
Input
,
DatePicker
,
Select
,
Modal
}
from
"antd"
;
import
styles
from
'./style.les
s'
;
import
{
ConnectState
}
from
"@/models/connect"
;
import
{
router
}
from
"umi"
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Pagination
}
from
'antd
'
;
import
{
connect
,
history
}
from
'umi'
;
import
{
SearchOutlined
,
ClearOutlined
,
PlusOutlined
}
from
'@ant-design/icon
s'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
{
getCookie
}
from
'@/utils/method'
;
const
{
RangePicker
,}
=
DatePicker
;
import
'./Account.less'
;
class
Account
extends
React
.
Component
{
import
moment
from
'moment'
;
//构造
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
(
"删除失败!未知错误!"
);
}
}
}
});
const
Account
=
(
props
:
any
)
=>
{
const
{
dispatch
,
Data
,
DataSave
,
DataSaveDetail
,
Result
,
loading
}
=
props
;
const
RA
=
(
index
:
any
,
values
:
any
)
=>
{
dispatch
({
type
:
'Account/RA'
,
playload
:
{
index
:
index
,
body
:
values
}
});
};
//获取所有用户
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
,
// 数据
useEffect
(()
=>
{
let
obj
=
{
leaderID
:
getCookie
(
'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
});
};
RA
(
45
,
obj
);
},
[
1
]);
//页面进来执行一次
// 数据
useEffect
(()
=>
{
if
(
Data
==
null
)
{
let
obj
=
{
leaderID
:
getCookie
(
'id'
),
};
RA
(
45
,
obj
);
}
},
[
Data
]);
//页面进来执行一次
//初始化
componentDidMount
()
{
const
nowUser
=
this
.
props
.
currentUser
.
userid
;
this
.
setState
({
nowUser
:
nowUser
});
this
.
getData
();
}
// 表单标识
const
[
form
]
=
Form
.
useForm
();
/*--------------------------------------*/
//表格列名
columns
=
[
// 表头
const
columns
=
[
{
title
:
'Account Name'
,
dataIndex
:
'tosUserName'
,
...
...
@@ -253,24 +47,22 @@ class Account extends React.Component {
title
:
'Grade'
,
dataIndex
:
'tosuserLevel'
,
key
:
'userLevel'
,
render
:
(
text
,
record
)
=>
(
render
:
(
text
:
any
)
=>
(
<
span
>
{
record
.
tosuserLevel
==
5
?
"超级管理员"
:
""
}
{
record
.
tosuserLevel
==
4
?
"一级管理员"
:
""
}
{
record
.
tosuserLevel
==
3
?
"二级管理员"
:
""
}
{
record
.
tosuserLevel
==
2
?
"三级管理员"
:
""
}
{
record
.
tosuserLevel
==
1
?
"一级管理员"
:
""
}
{
text
==
5
||
text
==
0
?
'超级管理员'
:
''
}
{
text
==
4
?
'一级管理员'
:
''
}
{
text
==
3
?
'二级管理员'
:
''
}
{
text
==
2
?
'三级管理员'
:
''
}
{
text
==
1
?
'一级管理员'
:
''
}
</
span
>
)
)
,
},
{
title
:
'Status'
,
dataIndex
:
'userStatus'
,
key
:
'userStatus'
,
render
:
(
text
,
record
)
=>
(
<
span
>
{
record
.
userStatus
==
0
?
"启用"
:
"禁用"
}
</
span
>
)
render
:
(
text
:
any
)
=>
<
span
>
{
text
==
0
?
'启用'
:
'禁用'
}
</
span
>,
},
{
title
:
'Created By'
,
...
...
@@ -281,20 +73,33 @@ class Account extends React.Component {
title
:
'Creation Time'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
,
render
:
(
text
:
any
)
=>
{
return
moment
(
text
.
time
).
format
(
'YYYY-MM-DD'
);
},
},
{
title
:
'Actions'
,
dataIndex
:
'action'
,
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
render
:
(
record
:
any
)
=>
(
<
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
>
<
Button
type=
"link"
onClick=
{
()
=>
{
edit
(
record
);
}
}
>
Edit
</
Button
>
<
Button
type=
"link"
onClick=
{
()
=>
{
lockS
(
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)}>
...
...
@@ -303,65 +108,104 @@ class Account extends React.Component {
),
},
];
//行选择
rowSelection
=
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
this
.
setState
({
delData
:
selectedRows
});
},
};
//渲染
render
()
{
const
{
data
,
total
,
statusList
}
=
this
.
state
;
const
edit
=
(
item
:
any
)
=>
{
history
.
push
(
'./account/edit'
);
}
;
const
statusSelect
=
statusList
.
map
((
item
,
index
)
=>
(
<
Select
.
Option
value=
{
index
}
>
{
item
}
</
Select
.
Option
>
));
const
lockS
=
(
item
:
any
)
=>
{};
return
(
<>
<
div
className=
"contop"
>
<
Form
autoComplete=
"off"
layout=
"inline"
form=
{
form
}
name=
"contract"
// onFinish={onFinishContract}
>
<
Form
.
Item
name=
"username"
>
<
Input
allowClear
placeholder=
"Account Name"
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"creator"
>
<
Input
allowClear
placeholder=
"Account Creator"
/>
</
Form
.
Item
>
<
Form
.
Item
>
<
Button
type=
"primary"
htmlType=
"submit"
icon=
{
<
SearchOutlined
/>
}
loading=
{
loading
}
>
Search
{
' '
}
</
Button
>
<
Button
htmlType=
"button"
// onClick={onReset}
style=
{
{
marginLeft
:
'15px'
}
}
icon=
{
<
ClearOutlined
/>
}
loading=
{
loading
}
>
{
' '
}
Reset
</
Button
>
</
Form
.
Item
>
</
Form
>
</
div
>
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
)
}
<
div
className=
"contop contop2"
>
<
ProTable
// request={requestHeadl}
rowKey=
{
'id'
}
dataSource=
{
Data
?
Data
.
rows
:
null
}
columns=
{
columns
}
pagination=
{
false
}
// 隐藏默认分页
search=
{
false
}
loading=
{
loading
}
toolBarRender=
{
()
=>
[
<
Button
type=
"primary"
loading=
{
loading
}
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
// Jump(0, 'Add');
}
}
>
Add Account
</
Button
>,
]
}
options=
{
{
density
:
false
,
fullScreen
:
false
,
reload
:
()
=>
{
edit
;
},
setting
:
false
,
}
}
headerTitle=
"Account list"
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
<
div
className=
"pages"
>
<
Pagination
// onShowSizeChange={pageSizeHandler}
// current={Data.total}
total=
{
Data
?
Data
.
total
:
0
}
pageSize=
{
Data
?
Data
.
total
:
0
}
/>
<
Select
className=
{
styles
.
input
}
placeholder=
"状态"
onChange=
{
(
e
)
=>
this
.
statusChange
(
e
)
}
allowClear=
{
true
}
>
{
statusSelect
}
</
Select
>
<
Button
className=
{
styles
.
button1
}
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
>
);
}
}
</>
);
};
const
AccountProps
=
(
styte
:
any
)
=>
{
console
.
log
(
styte
);
const
{
Data
,
DataSave
,
DataSaveDetail
,
Result
}
=
styte
.
Account
;
const
loading
=
styte
.
loading
.
models
.
Account
||
false
;
return
{
Data
,
DataSave
,
DataSaveDetail
,
Result
,
loading
,
};
};
export
default
connect
(({
user
}:
ConnectState
)
=>
({
currentUser
:
user
.
currentUser
,
}))(
Account
);
export
default
connect
(
AccountProps
)(
Account
);
src/pages/ContractManagement/Contract.tsx
View file @
5a981862
...
...
@@ -16,8 +16,6 @@ const Contract = (props: any) => {
dispatch
({
type
:
'Contract/RA'
,
playload
:
{
index
:
index
,
body
:
values
}
});
};
console
.
log
(
userListLoading
);
// 把请求装在一个地方
function
requst
(
payload
:
any
)
{
dispatch
({
type
:
'ContractModel/getList'
,
payload
:
payload
});
...
...
src/pages/ContractManagement/ContractContent.tsx
View file @
5a981862
...
...
@@ -18,6 +18,8 @@ import locale from 'antd/es/date-picker/locale/en_US';
import
SearchOptionsCommnity
from
'@/components/SearchOptions/SearchOptionsCommnity'
;
import
{
tipList
}
from
'@/utils/tip'
;
import
FileViewer
from
'react-file-viewer'
;
const
ContractContent
=
(
props
:
any
)
=>
{
const
{
ContractModel
,
dispatch
}
=
props
;
const
{
RangePicker
}
=
DatePicker
;
// 日期组件
...
...
@@ -33,7 +35,9 @@ const ContractContent = (props: any) => {
const
startTime
=
moment
().
format
(
'YYYY-MM-DD'
);
// 开始默认事件
const
overTime
=
moment
().
add
(
1
,
'month'
).
format
(
'YYYY-MM-DD'
);
// 结束默认事件
const
[
fileList
,
setFileList
]
=
useState
([]
as
any
);
const
[
fileList
,
setFileList
]
=
useState
([]
as
any
);
// 图片列表
const
[
uploadUp
,
setUploadUp
]
=
useState
(
true
);
// 禁止上传 直到选择了小区后
const
[
comtyName
,
setComtyName
]
=
useState
(
null
);
// 小区名字
console
.
log
(
tipList
);
...
...
@@ -44,13 +48,17 @@ const ContractContent = (props: any) => {
}
else
if
(
ContractModel
.
record
===
0
)
{
form
.
resetFields
();
}
else
{
// 发起请求
RA
(
47
,
ContractModel
.
record
.
contractFileName
);
let
arr
=
ContractModel
.
record
.
contractFileName
.
split
(
','
);
let
obj
=
new
Array
();
for
(
var
i
in
arr
)
{
let
a
=
{
uid
:
arr
[
i
]
,
uid
:
i
,
name
:
arr
[
i
],
url
:
'http://'
,
status
:
'done'
,
url
:
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
,
};
obj
.
push
(
a
);
}
...
...
@@ -99,7 +107,7 @@ const ContractContent = (props: any) => {
const
uploadProps
=
{
accept
:
'.doc,.docx,.jpg,.png,.pdf'
,
action
:
'/tos/image/upload'
,
data
:
{
imageType
:
'tosContract'
},
data
:
{
imageType
:
'tosContract'
,
extends
:
comtyName
},
fileList
:
fileList
,
onChange
({
file
,
fileList
}:
{
file
:
any
;
fileList
:
any
})
{
setFileList
(
fileList
);
...
...
@@ -128,6 +136,13 @@ const ContractContent = (props: any) => {
};
// 选择小区名字并赋值
const
opname
=
(
value
:
any
)
=>
{
// 打开上传 如果选择了 小区就打开 否则 禁止上传
value
?
setUploadUp
(
false
)
:
setUploadUp
(
true
);
// 如果切换了 清掉上传的图片
if
(
value
!=
comtyName
)
{
setFileList
([]);
}
setComtyName
(
value
);
// 赋值小区名字 给到上传
form
.
setFieldsValue
({
communityName
:
value
,
});
...
...
@@ -238,7 +253,7 @@ const ContractContent = (props: any) => {
label=
"Contract Annex"
rules=
{
[{
required
:
true
,
message
:
`${tipList[6]}`
}]
}
>
<
Upload
{
...
uploadProps
}
listType=
{
'picture-card'
}
>
<
Upload
{
...
uploadProps
}
listType=
{
'picture-card'
}
disabled=
{
uploadUp
}
>
{
fileList
.
length
>=
3
?
null
:
<
PlusOutlined
/>
}
</
Upload
>
</
Form
.
Item
>
...
...
@@ -259,7 +274,7 @@ const ContractContent = (props: any) => {
></
TextArea
>
</
Form
.
Item
>
</
div
>
<
div
className=
{
styles
.
box8item2x2
}
>
<
div
className=
{
styles
.
box8item2x2
}
style=
{
{
marginLeft
:
150
}
}
>
The system will send out reminders of contract expiration on 25 .
{
/* <span style={{color:'#f00'}}> {stateTime}</span> */
}
</
div
>
...
...
@@ -268,7 +283,7 @@ const ContractContent = (props: any) => {
<
div
>
<
LINE
/>
<
Button
type=
"primary"
htmlType=
"submit"
>
Conserve
Submit
</
Button
>
</
div
>
</
div
>
...
...
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