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
f5619136
Commit
f5619136
authored
Sep 26, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型版本
parent
b2a56000
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
28 deletions
+68
-28
data-govern0926.zip
data-govern0926.zip
+0
-0
datamodel.js
src/model/datamodel.js
+4
-0
datamodeler.js
src/service/datamodeler.js
+4
-0
constant.js
src/util/constant.js
+4
-0
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+10
-7
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+11
-4
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+31
-13
index.jsx
src/view/Manage/Model/index.jsx
+4
-4
No files found.
data-govern0926.zip
0 → 100644
View file @
f5619136
File added
src/model/datamodel.js
View file @
f5619136
...
...
@@ -162,6 +162,10 @@ export function* getDataModelWithRecommendedDefinitionAndTermDiscovery(payload)
return
yield
call
(
datamodelerService
.
getDataModelWithRecommendedDefinitionAndTermDiscovery
,
payload
);
}
export
function
*
getCheckOutDataModel
(
payload
)
{
return
yield
call
(
datamodelerService
.
getCheckOutDataModel
,
payload
);
}
export
function
*
getDataModelLocation
(
payload
)
{
return
yield
call
(
datamodelerService
.
getDataModelLocation
,
payload
);
}
...
...
src/service/datamodeler.js
View file @
f5619136
...
...
@@ -117,6 +117,10 @@ export function getDataModelWithRecommendedDefinitionAndTermDiscovery(payload) {
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getDataModelWithRecommendedDefinitionAndTermDiscovery"
,
payload
);
}
export
function
getCheckOutDataModel
(
payload
)
{
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/checkOutDataModel"
,
payload
);
}
export
function
getDataModelLocation
(
payload
)
{
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getDataModelLocation"
,
payload
);
}
...
...
src/util/constant.js
View file @
f5619136
...
...
@@ -8,3 +8,6 @@ export const CatalogId = 'cid';
export
const
ModelerId
=
'mid'
;
export
const
Hints
=
'hints'
;
export
const
ModelerData
=
'mdata'
;
export
const
Editable
=
'editable'
;
export
const
PermitCheckOut
=
'permitCheckOut'
;
export
const
StateId
=
'sid'
;
\ No newline at end of file
src/view/Manage/Model/Component/EditModel.jsx
View file @
f5619136
...
...
@@ -5,18 +5,18 @@ import ImportAction from './ImportAction';
import
CatalogModal
from
'./CatalogModal'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
getQueryParam
,
showMessage
}
from
'../../../../util'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
}
from
'../../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
}
from
'../../../../util/constant'
;
const
EditModel
=
(
props
)
=>
{
const
[
actionData
,
setActionData
]
=
useState
({
action
:
''
,
catalogId
:
''
,
modelerId
:
''
,
hints
:
[],
roughModelerData
:
null
});
const
[
actionData
,
setActionData
]
=
useState
({
action
:
''
,
catalogId
:
''
,
modelerId
:
''
,
hints
:
[],
roughModelerData
:
null
,
permitCheckOut
:
false
,
editable
:
false
,
stateId
:
''
});
const
[
modelerData
,
setModelerData
]
=
useState
({});
const
[
terms
,
setTerms
]
=
useState
([]);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
catalogModalVisible
,
setCatalogModalVisible
]
=
useState
(
false
);
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
}
=
actionData
;
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
,
permitCheckOut
,
editable
,
stateId
}
=
actionData
;
const
[
form
]
=
Form
.
useForm
();
...
...
@@ -26,6 +26,9 @@ const EditModel = (props) => {
const
_modelerId
=
getQueryParam
(
ModelerId
,
props
.
location
.
search
);
const
_hintsStr
=
getQueryParam
(
Hints
,
props
.
location
.
search
);
const
_modelerDataStr
=
getQueryParam
(
ModelerData
,
props
.
location
.
search
)
const
_permitCheckOut
=
getQueryParam
(
PermitCheckOut
,
props
.
location
.
search
);
const
_editable
=
getQueryParam
(
Editable
,
props
.
location
.
search
);
const
_stateId
=
getQueryParam
(
StateId
,
props
.
location
.
search
);
let
_hints
=
[];
if
((
_hintsStr
||
''
)
!==
''
)
{
...
...
@@ -37,7 +40,7 @@ const EditModel = (props) => {
_roughModelerData
=
JSON
.
parse
(
_modelerDataStr
);
}
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
,
roughModelerData
:
_roughModelerData
});
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
,
roughModelerData
:
_roughModelerData
,
permitCheckOut
:
_permitCheckOut
,
editable
:
_editable
,
stateId
:
_stateId
});
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
...
...
@@ -77,7 +80,7 @@ const EditModel = (props) => {
setConfirmLoading
(
false
);
showMessage
(
"success"
,
'新增模型成功'
);
setActionData
({
...
actionData
,
...{
action
:
'detail'
,
modelerId
:
data
.
id
||
''
}
});
setActionData
({
...
actionData
,
...{
action
:
'detail'
,
modelerId
:
data
.
id
||
''
,
editable
:
'true'
,
stateId
:
data
?.
state
?.
id
||
''
}
});
},
error
:
()
=>
{
...
...
@@ -143,7 +146,7 @@ const EditModel = (props) => {
)
}
else
if
(
action
===
'detail'
)
{
actionsBtn
=
(
<
Button
type=
'primary'
onClick=
{
edit
}
>
(
editable
===
'true'
||
permitCheckOut
===
'true'
)
&&
<
Button
type=
'primary'
onClick=
{
edit
}
>
编辑
</
Button
>
);
...
...
@@ -185,7 +188,7 @@ const EditModel = (props) => {
</
div
>
<
div
className=
'position-absolute'
style=
{
{
top
:
64
,
width
:
'100%'
}
}
>
<
div
className=
'position-relative'
style=
{
{
margin
:
15
}
}
>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
roughModelerData=
{
roughModelerData
}
/>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
roughModelerData=
{
roughModelerData
}
permitCheckOut=
{
permitCheckOut
}
stateId=
{
stateId
}
/>
</
div
>
</
div
>
<
CatalogModal
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
f5619136
...
...
@@ -9,7 +9,7 @@ import ImportActionPartition from './ImportActionPartition';
import
{
dispatch
}
from
'../../../../model'
;
const
ImportAction
=
(
props
)
=>
{
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
,
ddl
,
roughModelerData
}
=
props
;
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
,
ddl
,
roughModelerData
,
permitCheckOut
,
stateId
}
=
props
;
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
constraint
,
setConstraint
]
=
useState
({});
...
...
@@ -127,17 +127,24 @@ const ImportAction = (props) => {
const
getCurrentDataModel
=
()
=>
{
let
type
=
'datamodel.getDataModel'
;
let
params
=
{
id
:
modelerId
||
''
};
if
(
action
===
'add'
)
{
type
=
'datamodel.modelCopy'
;
}
else
if
(
action
===
'flow'
)
{
type
=
'datamodel.getDataModelWithRecommendedDefinitionAndTermDiscovery'
;
}
else
if
(
action
===
'edit'
&&
permitCheckOut
===
'true'
)
{
type
=
'datamodel.getCheckOutDataModel'
;
}
else
{
params
.
stateId
=
stateId
||
''
;
}
dispatch
({
type
,
payload
:
{
id
:
modelerId
||
''
},
payload
:
params
,
callback
:
data
=>
{
setLoading
(
false
);
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
f5619136
...
...
@@ -4,7 +4,7 @@ import { EditOutlined, DeleteOutlined, DownOutlined, UpOutlined, HistoryOutlined
import
SmoothScroll
from
'smooth-scroll'
;
import
classnames
from
'classnames'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatchLatest
,
dispatch
}
from
'../../../../model'
;
import
{
showMessage
,
getQueryParam
,
paginate
}
from
'../../../../util'
;
import
{
AnchorId
,
AnchorTimestamp
}
from
'../../../../util/constant'
;
...
...
@@ -12,9 +12,11 @@ import './ModelTable.less';
const
ModelTable
=
(
props
)
=>
{
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
onHistory
,
catalogId
,
keyword
,
onAutoCreateTable
,
offset
=
null
,
modelId
=
null
}
=
props
;
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
onHistory
,
catalogId
,
keyword
,
onAutoCreateTable
,
offset
=
null
,
modelId
=
null
}
=
props
;
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
subData
,
setSubData
]
=
useState
([]);
const
columns
=
[
{
title
:
'序号'
,
...
...
@@ -83,14 +85,14 @@ const ModelTable = (props) => {
{
<
React
.
Fragment
>
<
Tooltip
placement=
'bottom'
title=
{
'修改'
}
>
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
disabled=
{
!
record
.
editable
}
onClick=
{
()
=>
{
editItem
(
record
);
}
}
/>
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
disabled=
{
!
record
.
editable
&&!
record
.
permitCheckOut
}
onClick=
{
()
=>
{
editItem
(
record
);
}
}
/>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
{
'删除'
}
>
<
Button
icon=
{
<
DeleteOutlined
/>
}
size=
'small'
disabled=
{
!
record
.
edi
table
}
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
/>
<
Button
icon=
{
<
DeleteOutlined
/>
}
size=
'small'
disabled=
{
!
record
.
dele
table
}
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
/>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
{
'版本历史'
}
>
{
/*
<Tooltip placement='bottom' title={'版本历史'}>
<Button icon={<HistoryOutlined />} size='small' onClick={() => { historyItem(record); }} />
</
Tooltip
>
</Tooltip>
*/
}
</
React
.
Fragment
>
}
{
...
...
@@ -98,7 +100,7 @@ const ModelTable = (props) => {
return
(
<
React
.
Fragment
>
{
record
.
editable
&&
index
===
0
&&
<
Divider
type=
'vertical'
/>
(
record
.
editable
||
record
.
permitCheckOut
||
record
.
deletable
)
&&
index
===
0
&&
<
Divider
type=
'vertical'
/>
}
<
Button
key=
{
index
}
size=
'small'
onClick=
{
()
=>
{
stateAction
(
record
,
item
);
}
}
>
{
item
.
cnName
||
''
}
</
Button
>
</
React
.
Fragment
>
...
...
@@ -133,6 +135,8 @@ const ModelTable = (props) => {
const
_pageNum
=
parseInt
(
offset
/
pageSize
+
((
offset
%
pageSize
===
0
)?
0
:
1
));
setPagination
({...
pagination
,
pageNum
:
_pageNum
});
}
else
if
(
modelId
!==
''
)
{
getDataModel
();
}
else
{
setPagination
({...
pagination
,
pageNum
:
1
});
}
...
...
@@ -166,12 +170,27 @@ const ModelTable = (props) => {
}
})
const
getDataModel
=
()
=>
{
dispatch
({
type
:
'datamodel.getDataModel'
,
payload
:
{
id
:
modelId
},
callback
:
data
=>
{
setSubData
([
data
]);
},
error
:
()
=>
{
}
})
}
const
editItem
=
(
record
)
=>
{
onItemAction
&&
onItemAction
(
record
.
id
||
''
,
'edit'
);
onItemAction
&&
onItemAction
(
record
,
'edit'
);
}
const
detailItem
=
(
record
)
=>
{
onItemAction
&&
onItemAction
(
record
.
id
||
''
,
'detail'
);
onItemAction
&&
onItemAction
(
record
,
'detail'
);
}
const
deployAction
=
(
record
)
=>
{
...
...
@@ -262,7 +281,7 @@ const ModelTable = (props) => {
rowSelection=
{
modelId
?
null
:
rowSelection
}
columns=
{
columns
||
[]
}
rowKey=
{
'id'
}
dataSource=
{
_data
||
[]
}
dataSource=
{
modelId
?(
subData
||
[]):(
_data
||
[])
}
pagination=
{
false
}
onRow=
{
(
record
)
=>
{
return
{
...
...
@@ -276,14 +295,13 @@ const ModelTable = (props) => {
{
...
props
}
/>,
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
{
if
(
modelId
)
return
null
;
if
(
!
record
.
alreadyCheckedOut
)
return
null
;
return
expanded
?
<
UpOutlined
onClick=
{
e
=>
onExpand
(
record
,
e
)
}
/>
:
<
DownOutlined
onClick=
{
e
=>
onExpand
(
record
,
e
)
}
/>
},
rowExpandable
:
record
=>
{
if
(
modelId
)
return
false
;
return
true
;
return
record
.
alreadyCheckedOut
;
}
}
}
sticky=
{
!
modelId
}
...
...
src/view/Manage/Model/index.jsx
View file @
f5619136
...
...
@@ -16,7 +16,7 @@ import RecatalogModal from './Component/RecatalogModal';
import
HistoryAndVersionDrawer
from
'./Component/HistoryAndVersionDrawer'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
}
from
'../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
}
from
'../../../util/constant'
;
import
{
AppContext
}
from
'../../../App'
;
import
'./index.less'
;
...
...
@@ -160,11 +160,11 @@ class Model extends React.Component {
this
.
setState
({
selectModelerIds
:
ids
});
}
onTableItemAction
=
(
i
d
,
action
)
=>
{
this
.
setState
({
importModalAction
:
action
,
modelerId
:
id
},
()
=>
{
onTableItemAction
=
(
recor
d
,
action
)
=>
{
this
.
setState
({
importModalAction
:
action
,
modelerId
:
record
.
id
},
()
=>
{
const
{
catalogId
,
importModalAction
,
modelerId
}
=
this
.
state
;
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=
${
importModalAction
}
&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerId
}
=
${
modelerId
}
`
);
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=
${
importModalAction
}
&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerId
}
=
${
modelerId
}
&
${
PermitCheckOut
}
=
${
record
.
permitCheckOut
||
false
}
&
${
Editable
}
=
${
record
.
editable
||
false
}
&
${
StateId
}
=
${
record
.
state
?.
id
||
''
}
`);
});
}
...
...
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