Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
e87fdc08
Commit
e87fdc08
authored
Mar 08, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分支新增模型
parent
a4e80d92
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
180 additions
and
6 deletions
+180
-6
branch-add-model.jsx
src/view/Manage/Model/Component/branch-add-model.jsx
+142
-0
index.jsx
src/view/Manage/Model/index.jsx
+38
-6
No files found.
src/view/Manage/Model/Component/branch-add-model.jsx
0 → 100644
View file @
e87fdc08
import
React
from
"react"
import
{
Modal
,
Button
,
Tree
,
Spin
,
}
from
"antd"
import
produce
from
"immer"
import
{
dispatch
}
from
'../../../../model'
const
FC
=
({
visible
,
onCancel
})
=>
{
const
basicRef
=
React
.
useRef
()
const
close
=
(
val
=
null
)
=>
{
onCancel
?.(
val
)
}
const
save
=
()
=>
{
}
const
footer
=
React
.
useMemo
(()
=>
{
return
[
<
Button
key=
'cancel'
onClick=
{
()
=>
close
()
}
>
取消
</
Button
>,
<
Button
key=
'save'
type=
'primary'
onClick=
{
()
=>
save
()
}
>
保存
</
Button
>
]
},
[
close
,
save
])
return
(
<
Modal
title=
'选择物理平台'
visible=
{
visible
}
footer=
{
footer
}
width=
{
400
}
bodyStyle=
{
{
padding
:
'15px'
,
overflowX
:
'auto'
,
height
:
'80vh'
}
}
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
>
<
Basic
ref=
{
basicRef
}
/>
</
Modal
>
)
}
export
default
FC
const
Basic
=
React
.
forwardRef
(
function
({},
ref
)
{
const
[
loadingTreeData
,
setLoadingTreeData
]
=
React
.
useState
(
false
)
const
[
treeData
,
setTreeData
]
=
React
.
useState
()
const
[
expandedKeys
,
setExpandedKeys
]
=
React
.
useState
([])
const
[
autoExpandParent
,
setAutoExpandParent
]
=
React
.
useState
(
false
)
const
[
node
,
setNode
]
=
React
.
useState
()
React
.
useEffect
(()
=>
{
getTreeData
()
},
[])
const
treeData1
=
React
.
useMemo
(()
=>
{
if
(
treeData
)
{
const
newTreeData
=
produce
(
treeData
,
draft
=>
{
const
setNode
=
(
g
)
=>
{
g
.
key
=
g
.
id
;
g
.
title
=
g
.
name
;
g
.
children
=
[];
(
g
.
subCatalogs
??[]).
forEach
((
child
)
=>
{
setNode
(
child
)
g
.
children
.
push
(
child
)
});
}
draft
.
forEach
((
child
)
=>
{
setNode
(
child
)
})
})
return
newTreeData
}
return
undefined
},
[
treeData
])
const
getTreeData
=
()
=>
{
setLoadingTreeData
(
true
)
dispatch
({
type
:
'datamodel.refreshDataModelCatalog'
,
callback
:
(
data
)
=>
{
setLoadingTreeData
(
false
)
const
newTreeData
=
produce
(
data
?.
subCatalogs
??[],
draft
=>
{
const
setNode
=
(
g
)
=>
{
g
.
key
=
g
.
id
;
g
.
title
=
g
.
name
;
g
.
children
=
[];
(
g
.
subCatalogs
??[]).
forEach
((
child
)
=>
{
setNode
(
child
)
g
.
children
.
push
(
child
)
});
}
draft
.
forEach
((
child
)
=>
{
setNode
(
child
)
})
})
setTreeData
(
newTreeData
)
},
error
:
()
=>
{
setLoadingTreeData
(
false
)
}
})
}
const
onTreeExpand
=
(
expandedKeys
)
=>
{
setExpandedKeys
(
expandedKeys
)
setAutoExpandParent
(
false
)
}
const
onTreeSelect
=
(
selectedKeys
,
{
selectedNodes
})
=>
{
if
(
selectedKeys
.
length
===
0
||
selectedNodes
.
length
===
0
)
{
return
}
setNode
(
selectedNodes
[
0
])
}
return
(
<
Spin
spinning=
{
loadingTreeData
}
>
<
Tree
className=
'tree'
showLine
showIcon=
{
false
}
autoExpandParent=
{
autoExpandParent
}
treeData=
{
treeData1
}
selectedKeys=
{
node
?[
node
.
id
]:[]
}
expandedKeys=
{
expandedKeys
}
onSelect=
{
onTreeSelect
}
onExpand=
{
onTreeExpand
}
/>
</
Spin
>
)
})
\ No newline at end of file
src/view/Manage/Model/index.jsx
View file @
e87fdc08
...
@@ -23,6 +23,7 @@ import ColSettingModal from './Component/ColSettingModal';
...
@@ -23,6 +23,7 @@ import ColSettingModal from './Component/ColSettingModal';
import
PermissionButton
from
'../../../util/Component/PermissionButton'
;
import
PermissionButton
from
'../../../util/Component/PermissionButton'
;
import
SelectSearchProperties
from
'./Component/select-search-properties'
;
import
SelectSearchProperties
from
'./Component/select-search-properties'
;
import
{
TagSelect
,
TagSelectPopup
}
from
'./Component/tag-help'
;
import
{
TagSelect
,
TagSelectPopup
}
from
'./Component/tag-help'
;
import
BranchAddModel
from
'./Component/branch-add-model'
import
'./index.less'
;
import
'./index.less'
;
...
@@ -77,6 +78,9 @@ class Model extends React.Component {
...
@@ -77,6 +78,9 @@ class Model extends React.Component {
},
},
batchAddTagChange
:
false
,
batchAddTagChange
:
false
,
rootNode
:
undefined
,
rootNode
:
undefined
,
branchAddParams
:
{
visible
:
false
,
},
}
}
}
}
...
@@ -657,7 +661,17 @@ class Model extends React.Component {
...
@@ -657,7 +661,17 @@ class Model extends React.Component {
<Space>
<Space>
<PermissionButton
<PermissionButton
defaultPermission={canAdd}
defaultPermission={canAdd}
onClick={() => { this.setState({ importModalVisible: true }); }}
onClick={() => {
if (currentView === 'branch') {
this.setState({
branchAddParams: {
visible: true,
}
});
} else {
this.setState({ importModalVisible: true });
}
}}
>
>
新建
新建
</PermissionButton>
</PermissionButton>
...
@@ -680,7 +694,8 @@ class Model extends React.Component {
...
@@ -680,7 +694,8 @@ class Model extends React.Component {
送审
送审
</PermissionButton>
</PermissionButton>
<PermissionButton
{
currentView !== 'branch' && <PermissionButton
defaultPermission={canChangeCatalog}
defaultPermission={canChangeCatalog}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onRecatalogBtnClick}
onClick={this.onRecatalogBtnClick}
...
@@ -688,6 +703,7 @@ class Model extends React.Component {
...
@@ -688,6 +703,7 @@ class Model extends React.Component {
>
>
变更目录
变更目录
</PermissionButton>
</PermissionButton>
}
<PermissionButton
<PermissionButton
defaultPermission={canDelete}
defaultPermission={canDelete}
...
@@ -698,7 +714,8 @@ class Model extends React.Component {
...
@@ -698,7 +714,8 @@ class Model extends React.Component {
删除
删除
</PermissionButton>
</PermissionButton>
<Tooltip title={this.state.canBatchAddTag?((selectModelerIds||[]).length===0?'请先选择已发布的模型':''):'只有已发布的模型才能打标签'}>
{
currentView !== 'branch' && <Tooltip title={this.state.canBatchAddTag?((selectModelerIds||[]).length===0?'请先选择已发布的模型':''):'只有已发布的模型才能打标签'}>
<Button
<Button
onClick={() => {
onClick={() => {
this.setState({
this.setState({
...
@@ -713,25 +730,29 @@ class Model extends React.Component {
...
@@ -713,25 +730,29 @@ class Model extends React.Component {
添加标签
添加标签
</Button>
</Button>
</Tooltip>
</Tooltip>
}
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</Space>
</Space>
<Space>
<Space>
<TagSelect
{
currentView !== 'branch' && <TagSelect
options={this.state.tagSelectOptions}
options={this.state.tagSelectOptions}
onChange={(val) => {
onChange={(val) => {
this.setState({ tagSelectOptions: val })
this.setState({ tagSelectOptions: val })
}}
}}
/>
/>
}
<InputDebounce
<InputDebounce
placeholder=
"通过模型名称全文搜索"
placeholder=
{currentView==='branch'?'模型关键字':"通过模型名称全文搜索"}
allowClear
allowClear
value={keyword}
value={keyword}
onChange={(value) => { this.onSearchInputChange(value); }}
onChange={(value) => { this.onSearchInputChange(value); }}
style={{ width: inputWidth, marginLeft: 'auto' }}
style={{ width: inputWidth, marginLeft: 'auto' }}
/>
/>
<Button onClick={this.onSearchPropertiesClick}>筛选</Button>
{ currentView !== 'branch' && <Button onClick={this.onSearchPropertiesClick}>筛选</Button> }
</Space>
</Space>
</div>
</div>
...
@@ -824,6 +845,17 @@ class Model extends React.Component {
...
@@ -824,6 +845,17 @@ class Model extends React.Component {
onCancel={this.onSearchPropertiesCancel}
onCancel={this.onSearchPropertiesCancel}
/>
/>
<BranchAddModel
{...this.state.branchAddParams}
onCancel={(val) => {
this.setState({
branchAddParams: {
visible: false,
}
})
}}
/>
<TagSelectPopup
<TagSelectPopup
{...this.state.tagSelectPopupParams}
{...this.state.tagSelectPopupParams}
type='model'
type='model'
...
...
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