Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
黄庭坚
jinfa-platform
Commits
9b974642
Commit
9b974642
authored
Jun 01, 2021
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: merge丢失的文件
parent
ebf66e97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
283 additions
and
0 deletions
+283
-0
index.less
src/components/AntTree/index.less
+0
-0
index.tsx
src/components/AntTree/index.tsx
+0
-0
index.less
src/components/FieldHeader/index.less
+19
-0
index.tsx
src/components/FieldHeader/index.tsx
+22
-0
publicContainerProps.ts
src/components/publicContainerProps.ts
+0
-0
useLeavePage.ts
src/hooks/useLeavePage.ts
+36
-0
useTreeData.ts
src/hooks/useTreeData.ts
+131
-0
orgModal.less
src/pages/authConfig/memberSystem/orgModal.less
+10
-0
orgModal.tsx
src/pages/authConfig/memberSystem/orgModal.tsx
+65
-0
No files found.
src/components/AntTree/index.less
0 → 100644
View file @
9b974642
src/components/AntTree/index.tsx
0 → 100644
View file @
9b974642
This diff is collapsed.
Click to expand it.
src/components/FieldHeader/index.less
0 → 100644
View file @
9b974642
.field-header_container {
display: flex;
justify-content: space-between;
font-size: 14px;
margin-bottom: 18px;
}
.field-header_title {
display: flex;
align-items: center;
font-weight: 700;
&::before {
content: "";
width: 2px;
height: 14px;
background: #00B37A;
margin-right: 6px;
}
}
src/components/FieldHeader/index.tsx
0 → 100644
View file @
9b974642
import
React
,
{
ReactNode
}
from
'react'
import
mixinsClassName
from
'classnames'
import
'./index.less'
export
interface
FieldHeaderProps
extends
React
.
HTMLAttributes
<
HTMLDivElement
>
{
renderTitle
:
ReactNode
,
extra
?:
ReactNode
,
}
const
FieldHeader
:
React
.
FC
<
FieldHeaderProps
>
=
(
props
)
=>
{
const
{
renderTitle
,
extra
,
className
,
...
restDivProps
}
=
props
return
(
<
div
className=
{
mixinsClassName
(
'field-header_container'
,
className
)
}
{
...
restDivProps
}
>
<
div
className=
'field-header_title'
>
{
renderTitle
}
</
div
>
<
div
>
{
extra
}
</
div
>
</
div
>
)
}
FieldHeader
.
defaultProps
=
{}
export
default
FieldHeader
src/components/publicContainerProps.ts
0 → 100644
View file @
9b974642
src/hooks/useLeavePage.ts
0 → 100644
View file @
9b974642
import
{
Modal
}
from
"antd"
import
{
ReactNode
,
useCallback
,
useEffect
,
useState
}
from
"react"
export
interface
leaveOptions
{
title
?:
ReactNode
,
onSave
:
any
,
onModalOk
(
resolve
:
any
),
onModalCancel
(
reject
:
any
),
}
/**
* 对即将离开某个操作时, 发出提示弹窗
*/
export
const
useLeavePage
=
(
options
:
leaveOptions
):
[
React
.
Dispatch
<
React
.
SetStateAction
<
boolean
>>
,
any
]
=>
{
const
{
title
,
onSave
,
onModalOk
,
onModalCancel
}
=
options
const
[
saveStatus
,
setSaveStatus
]
=
useState
<
boolean
>
(
true
)
const
validateSaveStatus
=
useCallback
(()
=>
{
if
(
saveStatus
)
{
return
Promise
.
resolve
()
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
Modal
.
confirm
({
content
:
title
||
'确认要离开当前页面吗,您提交的数据尚未保存'
,
onOk
()
{
onModalOk
(
resolve
)
},
onCancel
()
{
onModalCancel
(
reject
)
}
})
})
}
},
[
saveStatus
])
return
[
setSaveStatus
,
validateSaveStatus
]
}
src/hooks/useTreeData.ts
0 → 100644
View file @
9b974642
import
{
useMap
}
from
'@umijs/hooks'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Modal
}
from
'antd'
import
{
TabTreeActions
}
from
'@/components/TabTree'
import
{
ISchemaFormActions
}
from
'@formily/antd'
import
{
isObject
}
from
'@/utils'
export
enum
FormState
{
FREE
,
// 空闲状态
EDIT
,
// 编辑状态
ADD
,
// 新增状态
}
export
interface
useTreeTabOptions
{
selectCallback
?(
selectKey
?,
node
?),
fetchMenuData
?(),
fetchItemDetailData
?(
id
),
// 重置右侧详情
resetDetail
?(),
// 对树形工具栏做render扩展
extendsToolsRender
?:
any
,
// 树形的实例操作方法
treeActions
?:
TabTreeActions
// 右侧表单的实例操作方法
formActions
?:
ISchemaFormActions
// 删除菜单时调用的API
deleteMenu
?:
any
}
export
interface
treeNodeResponse
{
/**
* 该节点是否选中
*/
selected
:
boolean
,
/**
* 节点信息
*/
node
:
any
}
export
const
useTreeData
=
(
options
:
useTreeTabOptions
=
{})
=>
{
const
{
selectCallback
,
fetchMenuData
,
treeActions
,
formActions
,
extendsToolsRender
,
deleteMenu
}
=
options
const
[
treeExtraMaps
,
{
set
,
get
}]
=
useMap
<
any
,
any
>
()
const
[
treeData
,
setTreeData
]
=
useState
<
any
[]
>
([])
const
[
treeStatus
,
setTreeStatus
]
=
useState
<
FormState
>
(
FormState
.
FREE
)
const
[
nodeRecord
,
setNodeRecord
]
=
useState
<
any
>
(
null
)
const
[
isEditForm
,
setIsEditForm
]
=
useState
<
boolean
>
(
false
)
useEffect
(()
=>
{
resetMenu
()
},
[])
const
resetMenu
=
async
()
=>
{
if
(
fetchMenuData
)
{
const
res
=
await
fetchMenuData
()
setTreeData
(
res
.
data
||
[])
}
}
const
handleSelect
=
(
selectKey
?,
node
?)
=>
{
return
new
Promise
<
treeNodeResponse
>
((
resolve
,
reject
)
=>
{
if
(
selectCallback
)
{
// 完全自定义点击节点事件
selectCallback
(
selectKey
,
node
)
return
;
}
resolve
({
selected
:
true
,
node
:
node
||
null
})
})
}
const
handleDeleteMenu
=
(
id
)
=>
{
deleteMenu
({
id
:
isObject
(
id
)
?
nodeRecord
.
key
:
id
}).
then
(()
=>
{
setTreeStatus
(
FormState
.
FREE
)
setNodeRecord
(
undefined
)
resetMenu
()
})
}
// 新增整合树形操作菜单
// 树形工具栏
const
toolsRender
=
{
addNode
(
node
)
{
const
activeParentId
=
treeActions
&&
treeActions
.
getParent
(
node
.
key
||
node
.
id
)?.
id
setNodeRecord
({
...
node
,
parentId
:
activeParentId
,
// 添加同级的时候 使用上一级的id作为parentId
})
formActions
&&
formActions
.
reset
({
validate
:
false
})
setTreeStatus
(
FormState
.
ADD
)
},
addChildNode
(
node
)
{
setNodeRecord
({
...
node
,
parentId
:
node
.
key
||
node
.
id
})
formActions
&&
formActions
.
reset
({
validate
:
false
})
set
(
node
.
key
||
node
.
id
,
null
)
setTreeStatus
(
FormState
.
ADD
)
},
deleteNode
(
node
)
{
const
id
=
node
.
key
||
node
.
id
handleDeleteMenu
(
id
)
},
...
extendsToolsRender
}
return
{
handleSelect
,
treeStatus
,
setTreeStatus
,
treeData
,
setTreeData
,
nodeRecord
,
setNodeRecord
,
isEditForm
,
setIsEditForm
,
treeExtraMaps
,
setTreeMaps
:
set
,
getTreeMaps
:
get
,
resetMenu
,
toolsRender
,
handleDeleteMenu
}
}
src/pages/authConfig/memberSystem/orgModal.less
0 → 100644
View file @
9b974642
.org-tag-container {
margin-bottom: 8px;
.ant-tag-has-color, .ant-tag-has-color a, .ant-tag-has-color a:hover, .ant-tag-has-color .anticon-close, .ant-tag-has-color .anticon-close:hover {
color: #606266;
}
}
.org-tag {
color: #606266;
}
src/pages/authConfig/memberSystem/orgModal.tsx
0 → 100644
View file @
9b974642
import
TabTree
,
{
createTreeActions
}
from
'@/components/TabTree'
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
import
{
PublicApi
}
from
'@/services/api'
import
{
Button
,
Drawer
,
Row
}
from
'antd'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
'./orgModal.less'
export
interface
OrgModalProps
{
visible
:
boolean
,
handleSyncSelect
:
any
,
plateformTreeData
:
any
,
fetchOrgsTreeData
:
any
,
selectKeys
:
any
[],
onSuccess
(
selectKeys
:
any
[]),
onCancel
(),
}
const
syncTreeActions
=
createTreeActions
()
const
OrgModal
:
React
.
FC
<
OrgModalProps
>
=
(
props
)
=>
{
const
{
visible
,
onSuccess
,
onCancel
,
plateformTreeData
,
handleSyncSelect
,
fetchOrgsTreeData
,
selectKeys
}
=
props
const
[
resetSearch
,
setResetSearch
]
=
useState
(
false
)
const
[
customPlateformExpandkeys
,
setCustomPlateformExpandkeys
]
=
useState
<
any
>
()
const
handleSuccess
=
()
=>
{
onSuccess
(
syncTreeActions
.
getSelectKeys
())
}
useEffect
(()
=>
{
syncTreeActions
.
setSelectKeys
(
selectKeys
)
},
[
selectKeys
])
return
(
<
Drawer
visible=
{
visible
}
closable=
{
false
}
placement=
'right'
width=
{
600
}
>
<
TabTree
fetchData
=
{
params
=
>
fetchOrgsTreeData()}
treeData=
{
plateformTreeData
}
handleSelect=
{
handleSyncSelect
}
actions=
{
syncTreeActions
}
customKey="id"
enableSearch
searchPlaceholder="组织机构名称"
checkStrictly
resetSearch=
{
resetSearch
}
customExpandkeys=
{
customPlateformExpandkeys
}
checkable=
{
true
}
/
>
<
Row
justify=
'end'
>
<
Button
onClick=
{
onCancel
}
style=
{
{
marginRight
:
8
}
}
>
关闭
</
Button
>
<
Button
onClick=
{
handleSuccess
}
type=
'primary'
>
确认
</
Button
>
</
Row
>
</
Drawer
>
)
}
OrgModal.defaultProps =
{}
export default OrgModal
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