Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
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
ReactWeb5
CivManage
Commits
05817a55
Commit
05817a55
authored
4 years ago
by
张烨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/test/maintenance
parents
e91c2f3d
643691c7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
469 deletions
+0
-469
AddModal.jsx
src/pages/userCenter/RoleManage/AddModal.jsx
+0
-91
DelModal.jsx
src/pages/userCenter/RoleManage/DelModal.jsx
+0
-59
EditModal.jsx
src/pages/userCenter/RoleManage/EditModal.jsx
+0
-97
RoleManage.jsx
src/pages/userCenter/RoleManage/RoleManage.jsx
+0
-196
RoleManage.less
src/pages/userCenter/RoleManage/RoleManage.less
+0
-26
No files found.
src/pages/userCenter/RoleManage/AddModal.jsx
deleted
100644 → 0
View file @
e91c2f3d
import
React
,
{
useState
}
from
'react'
;
import
{
Form
,
Input
,
notification
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
addStation
}
from
'@/services/userCenter/siteManage/api'
;
const
{
Item
}
=
Form
;
const
AddModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
formLayout
,
setFormLayout
]
=
useState
(
'horizontal'
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
{
confirmModal
}
=
props
;
const
onSubmit
=
()
=>
{
form
.
validateFields
()
.
then
(
res
=>
{
console
.
log
(
res
,
'res'
);
setLoading
(
true
);
addStation
({
stationName
:
res
.
stationName
,
description
:
res
.
description
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
success
)
{
form
.
resetFields
();
notification
.
success
({
message
:
'通知'
,
duration
:
3
,
description
:
'新增成功'
,
});
confirmModal
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
err
,
});
});
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
};
const
onFinish
=
value
=>
{};
return
(
<
SiteModal
{
...
props
}
title=
"新增角色"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认选择"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
layout=
{
formLayout
}
onFinish=
{
onFinish
}
>
<
Item
label=
"角色名称"
name=
"stationName"
rules=
{
[
{
required
:
true
,
message
:
'请输入角色名称'
,
},
]
}
>
<
Input
placeholder=
"请输入角色名称"
/>
</
Item
>
<
Item
label=
"角色类别"
>
all
</
Item
>
<
Item
label=
"角色描述"
name=
"description"
>
<
Input
placeholder=
"请输入角色描述"
/>
</
Item
>
</
Form
>
</
SiteModal
>
);
};
export
default
AddModal
;
This diff is collapsed.
Click to expand it.
src/pages/userCenter/RoleManage/DelModal.jsx
deleted
100644 → 0
View file @
e91c2f3d
import
React
,
{
useState
}
from
'react'
;
import
{
notification
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
deleteStation
}
from
'@/services/userCenter/siteManage/api'
;
const
DelModal
=
props
=>
{
const
{
confirmModal
,
stationId
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
onSubmit
=
props
=>
{
setLoading
(
true
);
deleteStation
({
stationID
:
stationId
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
success
)
{
notification
.
success
({
message
:
'通知'
,
duration
:
3
,
description
:
'删除成功'
,
});
confirmModal
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
err
,
});
});
};
return
(
<
SiteModal
{
...
props
}
title=
"删除角色"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'50px'
}
}
style=
{
{
top
:
200
}
}
width=
"400px"
destroyOnClose
cancelText=
"取消"
okText=
"确认删除"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
是否删除该角色?
</
SiteModal
>
);
};
export
default
DelModal
;
This diff is collapsed.
Click to expand it.
src/pages/userCenter/RoleManage/EditModal.jsx
deleted
100644 → 0
View file @
e91c2f3d
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
notification
}
from
'antd'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
editStation
}
from
'@/services/userCenter/siteManage/api'
;
const
{
Item
}
=
Form
;
const
EditModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
formLayout
,
setFormLayout
]
=
useState
(
'horizontal'
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
flag
=
useRef
();
const
{
confirmModal
,
stationObj
}
=
props
;
const
onSubmit
=
()
=>
{
form
.
validateFields
()
.
then
(
res
=>
{
setLoading
(
true
);
flag
.
current
=
res
;
editStation
({
stationName
:
res
.
stationName
,
description
:
res
.
description
,
stationID
:
stationObj
.
stationID
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
success
)
{
form
.
resetFields
();
notification
.
success
({
message
:
'通知'
,
duration
:
3
,
description
:
'编辑成功'
,
});
confirmModal
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
err
,
});
});
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
};
useEffect
(()
=>
{
form
.
setFieldsValue
({
stationName
:
stationObj
.
text
,
description
:
stationObj
.
description
,
});
},
[
stationObj
]);
return
(
<
SiteModal
{
...
props
}
title=
"编辑角色"
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
200
,
borderRadius
:
'20px'
}
}
width=
"600px"
destroyOnClose
cancelText=
"取消"
okText=
"确认编辑"
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
layout=
{
formLayout
}
>
<
Item
label=
"角色名称"
name=
"stationName"
rules=
{
[
{
required
:
true
,
message
:
'请输入角色名称'
,
},
]
}
>
<
Input
placeholder=
"请输入角色名称"
/>
</
Item
>
<
Item
label=
"角色类别"
>
all
</
Item
>
<
Item
label=
"角色描述"
name=
"description"
>
<
Input
placeholder=
"请输入角色描述"
/>
</
Item
>
</
Form
>
</
SiteModal
>
);
};
export
default
EditModal
;
This diff is collapsed.
Click to expand it.
src/pages/userCenter/RoleManage/RoleManage.jsx
deleted
100644 → 0
View file @
e91c2f3d
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Row
,
Col
,
Tree
,
Card
,
Input
,
Tooltip
,
Button
}
from
'antd'
;
import
{
FileAddTwoTone
,
EditTwoTone
,
DeleteTwoTone
}
from
'@ant-design/icons'
;
import
{
PageContainer
,
GridContent
}
from
'@ant-design/pro-layout'
;
import
{
getWebModuleTree
}
from
'@/services/userCenter/roleManage/api'
;
import
ListCard
from
'@/pages/orgnazation/ListCard'
;
import
styles
from
'@/pages/userCenter/roleManage/RoleManage.less'
;
import
AddModal
from
'./AddModal'
;
import
DelModal
from
'./DelModal'
;
import
EditModal
from
'./EditModal'
;
const
{
Search
}
=
Input
;
const
placeholder
=
'请输入人员姓名'
;
const
SiteManage
=
()
=>
{
const
[
treeData
,
setTreeData
]
=
useState
([]);
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
const
[
ouid
,
setOuid
]
=
useState
(
''
);
const
[
saveTreeId
,
setSaveTreeId
]
=
useState
(
''
);
// 保存点击回调的ird
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
// 新增弹窗
const
[
flag
,
setFlag
]
=
useState
(
1
);
const
[
stationId
,
setStationId
]
=
useState
(
''
);
// 选择的站点
const
[
stationObj
,
setStationObj
]
=
useState
({});
// 选择的站点
const
[
delVisible
,
setDelVisible
]
=
useState
(
false
);
// 删除弹窗
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
// 修改弹窗
// 点击树的回调
const
handleTreeSelect
=
e
=>
{
console
.
log
(
e
);
let
id
=
e
[
0
];
if
(
id
)
{
setSaveTreeId
(
id
);
setOuid
(
id
);
}
else
{
setOuid
(
saveTreeId
);
}
};
useEffect
(()
=>
{
getWebModuleTree
({
userMode
:
'super'
,
select
:
''
,
_version
:
9999
,
_dc
:
Date
.
now
(),
node
:
-
2
,
})
.
then
(
res
=>
{
let
arr
=
[];
if
(
res
)
{
arr
.
push
(
res
.
find
(
item
=>
item
.
id
===
'Web4StationRoot'
));
console
.
log
(
arr
,
'arr'
);
}
let
arr2
=
transTree
(
arr
);
setTreeData
(
arr2
);
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
},
[
flag
]);
const
Title
=
props
=>
{
const
{
text
}
=
props
;
console
.
log
(
props
);
return
(
<
div
className=
{
styles
.
treeTitle
}
>
{
text
}
<
div
className=
{
styles
.
titleBox
}
>
<
Tooltip
title=
"新增角色"
>
<
FileAddTwoTone
onClick=
{
()
=>
{
handleAdd
(
props
);
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"编辑角色"
>
<
EditTwoTone
onClick=
{
()
=>
{
handleEdit
(
props
);
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"删除角色"
>
<
DeleteTwoTone
onClick=
{
()
=>
{
handleDel
(
props
);
}
}
/>
</
Tooltip
>
</
div
>
</
div
>
);
};
const
handleAdd
=
e
=>
{
console
.
log
(
e
);
setModalVisible
(
true
);
};
// 站点删除
const
handleDel
=
e
=>
{
setStationId
(
e
.
stationID
);
setDelVisible
(
true
);
};
// 编辑站点
const
handleEdit
=
e
=>
{
setStationObj
(
e
);
setEditVisible
(
true
);
};
// 树形数据转换
const
transTree
=
val
=>
{
console
.
log
(
val
);
let
arr
=
val
;
return
arr
.
map
((
item
,
index
)
=>
{
item
.
title
=
Title
(
item
)
||
item
.
text
;
item
.
key
=
item
.
stationID
||
''
;
let
obj
=
{};
if
(
Array
.
isArray
(
item
.
children
)
&&
item
.
children
.
length
>
0
)
{
transTree
(
item
.
children
);
obj
=
item
;
return
obj
;
}
return
item
;
});
};
// 获取搜索框的值
const
handleSearch
=
value
=>
{
setSearchWord
(
value
);
};
const
confirmModal
=
e
=>
{
setModalVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
delModal
=
()
=>
{
setDelVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
editModal
=
()
=>
{
setEditVisible
(
false
);
setFlag
(
flag
+
1
);
};
const
valueCallback
=
props
=>
{
console
.
log
(
props
);
};
return
(
<
PageContainer
>
<
GridContent
>
<
Row
gutter=
{
12
}
>
<
Col
lg=
{
6
}
md=
{
24
}
>
<
Card
className=
{
styles
.
cardBox
}
>
<
Tree
showLine=
{
{
showLeafIcon
:
false
}
}
showIcon
onSelect=
{
e
=>
handleTreeSelect
(
e
)
}
treeData=
{
treeData
}
/>
<
AddModal
visible=
{
modalVisible
}
onCancel=
{
()
=>
setModalVisible
(
false
)
}
confirmModal=
{
confirmModal
}
/>
<
DelModal
visible=
{
delVisible
}
stationId=
{
stationId
}
onCancel=
{
()
=>
setDelVisible
(
false
)
}
confirmModal=
{
delModal
}
/>
<
EditModal
visible=
{
editVisible
}
stationObj=
{
stationObj
}
onCancel=
{
()
=>
setEditVisible
(
false
)
}
confirmModal=
{
editModal
}
/>
</
Card
>
</
Col
>
<
Col
lg=
{
18
}
md=
{
24
}
>
<
Card
className=
{
styles
.
cardBox
}
>
<
Row
align=
"middle"
>
<
Col
span=
{
1
}
>
搜索
</
Col
>
<
Col
span=
{
8
}
>
<
Search
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
enterButton
/>
</
Col
>
</
Row
>
{
ouid
&&
(
<
ListCard
ouid=
{
ouid
}
searchWord=
{
searchWord
}
valueCallback=
{
valueCallback
}
/>
)
}
</
Card
>
</
Col
>
</
Row
>
</
GridContent
>
</
PageContainer
>
);
};
export
default
SiteManage
;
This diff is collapsed.
Click to expand it.
src/pages/userCenter/RoleManage/RoleManage.less
deleted
100644 → 0
View file @
e91c2f3d
.cardBox{
min-height: calc(100vh - 200px);
}
.ant-tree-node-content-wrapper-open{
display: flex;
align-items: center;
}
.treeTitle {
display: flex;
span {
display: none;
}
}
.treeTitle:hover {
span {
margin-left: 20px;
display: block;
}
}
.titleBox{
display: flex;
// flex-wrap: wrap;
justify-content: space-around;
align-items: center;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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