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
e45643b1
Commit
e45643b1
authored
Apr 20, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'derive' into 'master'
Derive See merge request
!10
parents
f1efd2a6
1f0131b3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
607 additions
and
76 deletions
+607
-76
datamodel.js
src/model/datamodel.js
+9
-0
datamodeler.js
src/service/datamodeler.js
+9
-0
ContextManage.jsx
src/view/Manage/Model/Component/ContextManage.jsx
+9
-2
EditInherited.jsx
src/view/Manage/Model/Component/EditInherited.jsx
+58
-0
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+22
-6
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+131
-66
ImportActionInherited.jsx
src/view/Manage/Model/Component/ImportActionInherited.jsx
+160
-0
InheritedPreview.jsx
src/view/Manage/Model/Component/InheritedPreview.jsx
+206
-0
index.tsx
src/view/Manage/VirtualTable/index.tsx
+3
-2
No files found.
src/model/datamodel.js
View file @
e45643b1
...
@@ -316,4 +316,12 @@ export function* dataTypeList() {
...
@@ -316,4 +316,12 @@ export function* dataTypeList() {
export
function
*
bindingLoadRangeList
(
payload
)
{
export
function
*
bindingLoadRangeList
(
payload
)
{
return
yield
call
(
datamodelerService
.
bindingLoadRangeList
,
payload
);
return
yield
call
(
datamodelerService
.
bindingLoadRangeList
,
payload
);
}
export
function
*
getInheritanceTypes
()
{
return
yield
call
(
datamodelerService
.
getInheritanceTypes
);
}
export
function
*
inheriteDataModel
(
payload
)
{
return
yield
call
(
datamodelerService
.
inheriteDataModel
,
payload
);
}
}
\ No newline at end of file
src/service/datamodeler.js
View file @
e45643b1
...
@@ -267,4 +267,12 @@ export function dataTypeList() {
...
@@ -267,4 +267,12 @@ export function dataTypeList() {
export
function
bindingLoadRangeList
(
payload
)
{
export
function
bindingLoadRangeList
(
payload
)
{
return
GetJSON
(
"/datamodeler/easyDataModelerDataType/bindingLoadRangeList"
,
payload
);
return
GetJSON
(
"/datamodeler/easyDataModelerDataType/bindingLoadRangeList"
,
payload
);
}
export
function
getInheritanceTypes
()
{
return
PostJSON
(
"/datamodeler/easyDataModelerInheritance/getInheritanceTypes"
);
}
export
function
inheriteDataModel
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerInheritance/inheriteDataModel"
,
payload
);
}
}
\ No newline at end of file
src/view/Manage/Model/Component/ContextManage.jsx
View file @
e45643b1
...
@@ -3,4 +3,11 @@ import React from 'react';
...
@@ -3,4 +3,11 @@ import React from 'react';
export
const
EditModelContext
=
React
.
createContext
({
export
const
EditModelContext
=
React
.
createContext
({
attrIsEditingFunction
:
null
,
attrIsEditingFunction
:
null
,
indexIsEditingFunction
:
null
,
indexIsEditingFunction
:
null
,
});
});
\ No newline at end of file
export
const
EditInheritedModelContext
=
React
.
createContext
({
createHistoryModel
:
false
,
createZipperModel
:
false
,
setInheriteState
:
null
,
setInheriteData
:
null
,
});
\ No newline at end of file
src/view/Manage/Model/Component/EditInherited.jsx
0 → 100644
View file @
e45643b1
import
React
,
{
useState
,
useEffect
,
useContext
}
from
"react"
;
import
{
Modal
,
Space
,
Button
,
Form
}
from
"antd"
;
import
ImportAction
from
"./ImportAction"
;
import
{
inheritanceHistoricalType
,
inheritanceZipperType
}
from
"./ImportActionInherited"
;
import
{
EditInheritedModelContext
}
from
"./ContextManage"
;
const
FC
=
(
props
)
=>
{
const
{
visible
,
modelerData
,
type
,
onCancel
}
=
props
;
const
[
_modelerData
,
setModelerData
]
=
useState
(
undefined
);
const
[
modifyModelerData
,
setModifyModelerData
]
=
useState
(
undefined
);
const
[
form
]
=
Form
.
useForm
();
const
{
setInheriteData
}
=
useContext
(
EditInheritedModelContext
);
useEffect
(()
=>
{
if
(
visible
)
{
setModelerData
(
modelerData
);
}
else
{
setModelerData
(
undefined
);
}
},
[
visible
])
const
onChange
=
(
newModelerData
)
=>
{
setModifyModelerData
(
newModelerData
);
}
const
onOk
=
()
=>
{
setInheriteData
(
type
,
modifyModelerData
);
onCancel
?.();
}
return
(
<
Modal
title=
'编辑衍生表'
visible=
{
visible
}
onCancel=
{
()
=>
{
onCancel
?.();
}
}
width=
'95%'
footer=
{
<
Space
>
<
Button
onClick=
{
()
=>
{
onCancel
?.();
}
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
onOk
}
>
确定
</
Button
>
</
Space
>
}
maskClosable=
{
false
}
centered=
{
true
}
bodyStyle=
{
{
height
:
'80vh'
,
overflow
:
'auto'
}
}
>
{
visible
&&
_modelerData
&&
<
ImportAction
form=
{
form
}
action=
'edit-inherite-modal'
roughModelerData=
{
_modelerData
}
onChange=
{
onChange
}
/>
}
</
Modal
>
)
}
export
default
FC
;
\ No newline at end of file
src/view/Manage/Model/Component/EditModel.jsx
View file @
e45643b1
...
@@ -10,6 +10,7 @@ import { getQueryParam, showMessage, showNotifaction } from '../../../../util';
...
@@ -10,6 +10,7 @@ import { getQueryParam, showMessage, showNotifaction } from '../../../../util';
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
VersionId
,
Holder
,
DDL
,
ReadOnly
}
from
'../../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
VersionId
,
Holder
,
DDL
,
ReadOnly
}
from
'../../../../util/constant'
;
import
HistoryAndVersionDrawer
from
'./HistoryAndVersionDrawer'
;
import
HistoryAndVersionDrawer
from
'./HistoryAndVersionDrawer'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
{
inheritanceHistoricalType
,
inheritanceZipperType
}
from
'./ImportActionInherited'
;
import
'./EditModel.less'
;
import
'./EditModel.less'
;
...
@@ -24,6 +25,9 @@ const EditModel = (props) => {
...
@@ -24,6 +25,9 @@ const EditModel = (props) => {
const
[
historyAndVersionDrawerVisible
,
setHistoryAndVersionDrawerVisible
]
=
useState
(
false
);
const
[
historyAndVersionDrawerVisible
,
setHistoryAndVersionDrawerVisible
]
=
useState
(
false
);
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
[
createHistoryModel
,
setCreateHistoryModel
]
=
useState
(
false
);
const
[
createZipperModel
,
setCreateZipperModel
]
=
useState
(
false
);
const
actionRef
=
useRef
(
''
);
const
actionRef
=
useRef
(
''
);
const
attrIsEditingRef
=
useRef
(
false
);
const
attrIsEditingRef
=
useRef
(
false
);
const
indexIsEditingRef
=
useRef
(
false
);
const
indexIsEditingRef
=
useRef
(
false
);
...
@@ -217,6 +221,11 @@ const EditModel = (props) => {
...
@@ -217,6 +221,11 @@ const EditModel = (props) => {
}
}
const
editInherite
=
()
=>
{
setActionData
({
...
actionData
,
action
:
'edit-inherite'
});
actionRef
.
current
=
'edit-inherite'
;
}
const
edit
=
()
=>
{
const
edit
=
()
=>
{
setActionData
({
...
actionData
,
action
:
'edit'
});
setActionData
({
...
actionData
,
action
:
'edit'
});
actionRef
.
current
=
'edit'
;
actionRef
.
current
=
'edit'
;
...
@@ -305,15 +314,22 @@ const EditModel = (props) => {
...
@@ -305,15 +314,22 @@ const EditModel = (props) => {
<
Space
>
<
Space
>
<
Button
type=
'primary'
onClick=
{
onHistory
}
danger
>
版本历史
</
Button
>
<
Button
type=
'primary'
onClick=
{
onHistory
}
danger
>
版本历史
</
Button
>
{
{
(
readOnly
!==
'true'
)
&&
<
Tooltip
title=
{
editTip
}
>
readOnly
!==
'true'
&&
<
Space
>
<
Button
type=
'primary'
onClick=
{
edit
}
disabled=
{
(
stateId
===
'4'
)?
!
permitCheckOut
:
!
editable
}
danger
>
{
编辑
!
modelerData
?.
final
&&
<
Button
type=
'primary'
onClick=
{
editInherite
}
danger
>
</
Button
>
编辑历史存储形式
</
Tooltip
>
</
Button
>
}
<
Tooltip
title=
{
editTip
}
>
<
Button
type=
'primary'
onClick=
{
edit
}
disabled=
{
(
stateId
===
'4'
)?
!
permitCheckOut
:
!
editable
}
danger
>
编辑
</
Button
>
</
Tooltip
>
</
Space
>
}
}
</
Space
>
</
Space
>
);
);
}
else
if
(
action
===
'edit'
)
{
}
else
if
(
action
===
'edit'
||
action
===
'edit-inherite'
)
{
actionsBtn
=
(
actionsBtn
=
(
<
Space
>
<
Space
>
<
Button
onClick=
{
cancelEdit
}
>
<
Button
onClick=
{
cancelEdit
}
>
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
e45643b1
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
,
useContext
}
from
'react'
;
import
{
Spin
}
from
'antd'
;
import
{
Spin
}
from
'antd'
;
import
LocalStorage
from
'local-storage'
;
import
LocalStorage
from
'local-storage'
;
import
ImportActionHeader
from
'./ImportActionHeader'
;
import
ImportActionHeader
from
'./ImportActionHeader'
;
import
ImportActionInherited
,
{
inheritanceHistoricalType
,
inheritanceZipperType
}
from
'./ImportActionInherited'
;
import
{
ImportActionTable
}
from
'./ImportActionTable'
;
import
{
ImportActionTable
}
from
'./ImportActionTable'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
{
getQueryParam
}
from
'../../../../util'
;
import
{
getQueryParam
}
from
'../../../../util'
;
import
{
Action
}
from
'../../../../util/constant'
;
import
{
Action
}
from
'../../../../util/constant'
;
import
{
EditInheritedModelContext
}
from
'./ContextManage'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
const
ImportAction
=
(
props
)
=>
{
const
ImportAction
=
(
props
)
=>
{
...
@@ -23,6 +24,8 @@ const ImportAction = (props) => {
...
@@ -23,6 +24,8 @@ const ImportAction = (props) => {
const
[
supportedIndextypes
,
setSupportedIndextypes
]
=
useState
([]);
const
[
supportedIndextypes
,
setSupportedIndextypes
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
createHistoryModel
,
setCreateHistoryModel
]
=
useState
(
false
);
const
[
createZipperModel
,
setCreateZipperModel
]
=
useState
(
false
);
const
mountRef
=
useRef
(
true
);
const
mountRef
=
useRef
(
true
);
const
modelerDataRef
=
useRef
(
null
);
const
modelerDataRef
=
useRef
(
null
);
...
@@ -44,7 +47,7 @@ const ImportAction = (props) => {
...
@@ -44,7 +47,7 @@ const ImportAction = (props) => {
//初始化form状态
//初始化form状态
if
(
action
===
'add'
||
action
===
'edit'
||
action
===
'flow'
)
{
if
(
action
===
'add'
||
action
===
'edit'
||
action
===
'flow'
)
{
form
.
resetFields
();
form
?
.
resetFields
();
}
}
if
(
action
===
'detail'
||
action
===
'flow'
||
action
===
'detail-version'
)
{
if
(
action
===
'detail'
||
action
===
'flow'
||
action
===
'detail-version'
)
{
...
@@ -56,35 +59,42 @@ const ImportAction = (props) => {
...
@@ -56,35 +59,42 @@ const ImportAction = (props) => {
modelerDataRef
.
current
=
newModelerData
;
modelerDataRef
.
current
=
newModelerData
;
}
}
setLoading
(
true
);
if
(
action
!==
'edit-inherite'
)
{
setLoading
(
true
);
dispatch
({
dispatch
({
type
:
'datamodel.getAllConstraints'
,
type
:
'datamodel.getAllConstraints'
,
callback
:
data
=>
{
callback
:
data
=>
{
setConstraints
(
data
);
setConstraints
(
data
);
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
// setConstraint(data?.length>0?data[0]:{});
// setConstraint(data?.length>0?data[0]:{});
// setTemplate({});
// setTemplate({});
if
((
hints
||
[]).
length
>
0
)
{
if
((
hints
||
[]).
length
>
0
)
{
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
hints
);
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
hints
);
}
else
if
((
ddl
||
''
).
length
>
0
)
{
}
else
if
((
ddl
||
''
).
length
>
0
)
{
getDraftUsingDDL
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
ddl
);
getDraftUsingDDL
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
ddl
);
}
else
if
((
modelerId
||
''
)
!==
''
)
{
}
else
if
((
modelerId
||
''
)
!==
''
)
{
getCurrentDataModel
();
}
else
if
(
roughModelerData
)
{
setLoading
(
false
);
getExtraData
(
roughModelerData
);
}
else
{
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,[]);
}
}
else
if
(
action
===
'edit'
||
action
===
'detail'
||
action
===
'flow'
||
action
===
'detail-version'
)
{
getCurrentDataModel
();
getCurrentDataModel
();
}
else
if
(
roughModelerData
)
{
}
else
if
(
action
===
'edit-inherite-modal'
)
{
setLoading
(
false
);
setLoading
(
false
);
getExtraData
(
roughModelerData
);
getExtraData
(
roughModelerData
);
}
else
{
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,[]);
}
}
}
else
if
(
action
===
'edit'
||
action
===
'detail'
||
action
===
'flow'
||
action
===
'detail-version'
)
{
},
getCurrentDataModel
();
error
:
()
=>
{
setLoading
(
false
);
}
}
}
,
}
)
error
:
()
=>
{
}
else
{
setLoading
(
false
);
setCreateHistoryModel
((
modelerData
?.
inherited
?.
historical
)?
true
:
false
);
}
setCreateZipperModel
((
modelerData
?.
inherited
?.
zipper
)?
true
:
false
);
}
)
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
action
,
hints
,
modelerId
,
ddl
]);
},
[
action
,
hints
,
modelerId
,
ddl
]);
...
@@ -181,7 +191,6 @@ const ImportAction = (props) => {
...
@@ -181,7 +191,6 @@ const ImportAction = (props) => {
}
}
const
getCurrentDataModel
=
()
=>
{
const
getCurrentDataModel
=
()
=>
{
if
((
modelerId
||
''
)
===
''
)
{
if
((
modelerId
||
''
)
===
''
)
{
setLoading
(
false
);
setLoading
(
false
);
return
;
return
;
...
@@ -208,7 +217,8 @@ const ImportAction = (props) => {
...
@@ -208,7 +217,8 @@ const ImportAction = (props) => {
}
else
if
(
action
===
'edit'
&&
permitCheckOut
)
{
}
else
if
(
action
===
'edit'
&&
permitCheckOut
)
{
type
=
'datamodel.checkOutDataModel'
;
type
=
'datamodel.checkOutDataModel'
;
}
else
if
(
action
===
'edit'
)
{
}
else
if
(
action
===
'edit'
)
{
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
const
_action
=
getQueryParam
(
Action
,
props
.
location
?.
search
);
if
(
_action
===
'flow'
)
{
if
(
_action
===
'flow'
)
{
params
.
ignoreNamespace
=
true
;
params
.
ignoreNamespace
=
true
;
...
@@ -530,44 +540,99 @@ const ImportAction = (props) => {
...
@@ -530,44 +540,99 @@ const ImportAction = (props) => {
return { partition: newPartition, easyDataModelerDistributionKey: newDistribution, easyDataModelerPrimaryKey: newPrimary, easyDataModelerIndices: newEasyDataModelerIndices, easyDataModelerSemiPrimaryKey: newSemiPrimary};
return { partition: newPartition, easyDataModelerDistributionKey: newDistribution, easyDataModelerPrimaryKey: newPrimary, easyDataModelerIndices: newEasyDataModelerIndices, easyDataModelerSemiPrimaryKey: newSemiPrimary};
}
}
const setInheriteState = (type, value) => {
if (type === inheritanceHistoricalType) {
setCreateHistoryModel(value);
const newModelerData = {...modelerData};
if (newModelerData.inherited) {
newModelerData.inherited = {...newModelerData.inherited, historical: value?modelerData.inherited?.historical:null}
onChange?.(newModelerData);
}
} else if (type === inheritanceZipperType) {
setCreateZipperModel(value);
const newModelerData = {...modelerData};
if (newModelerData.inherited) {
newModelerData.inherited = {...newModelerData.inherited, historical: value?modelerData.inherited?.historical:null}
onChange?.(newModelerData);
}
}
}
const setInheriteData = (type, value) => {
if (type === inheritanceHistoricalType) {
const newModelerData = {...modelerData};
const newRealModelerData = {...modelerData};
if (newModelerData.inherited) {
newModelerData.inherited = {...newModelerData.inherited, historical: value}
newRealModelerData.inherited = {...newRealModelerData.inherited, historical: createHistoryModel?value:null}
setModelerData(newModelerData);
modelerDataRef.current = newModelerData;
onChange?.(newRealModelerData);
}
} else if (type === inheritanceZipperType) {
const newModelerData = {...modelerData};
const newRealModelerData = {...modelerData};
if (newModelerData.inherited) {
newModelerData.inherited = {...newModelerData.inherited, zipper: value}
newRealModelerData.inherited = {...newRealModelerData.inherited, zipper: createZipperModel?value:null}
setModelerData(newModelerData);
modelerDataRef.current = newModelerData;
onChange?.(newRealModelerData);
}
}
}
return (
return (
<Spin spinning={loading}>
<EditInheritedModelContext.Provider value={{
<ImportActionHeader
createHistoryModel,
form={form}
createZipperModel,
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'}
setInheriteState,
modelerData={modelerData||{}}
setInheriteData,
constraints={constraints}
}}>
templates={templates}
<Spin spinning={loading}>
validateReports={validateReports}
<ImportActionHeader
onTemplateChange={onTemplateChange}
form={form}
onConstraintChange={onConstraintChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherite'}
onChange={onHeaderChange}
modelerData={modelerData||{}}
terms={terms}
constraints={constraints}
supportedPartitionTypes={supportedPartitionTypes}
templates={templates}
/>
validateReports={validateReports}
<ImportActionTable
onTemplateChange={onTemplateChange}
modelerData={modelerData||{}}
onConstraintChange={onConstraintChange}
constraint={constraint}
onChange={onHeaderChange}
template={template}
terms={terms}
validateReports={validateReports}
supportedPartitionTypes={supportedPartitionTypes}
supportedDatatypes={supportedDatatypes}
/>
onChange={onTableChange}
<ImportActionInherited modelerData={modelerData} editable={action==='edit-inherite'} />
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'}
<ImportActionTable
action={action}
modelerData={modelerData||{}}
originAction={getQueryParam(Action, props?.location?.search)}
constraint={constraint}
terms={terms}
template={template}
/>
validateReports={validateReports}
<ImportActionIndex
supportedDatatypes={supportedDatatypes}
modelerData={modelerData||{}}
onChange={onTableChange}
constraint={constraint}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherite'}
template={template}
action={action}
types={supportedIndextypes}
originAction={getQueryParam(Action, props?.location?.search)}
validateReports={validateReports}
terms={terms}
onChange={onIndexChange}
/>
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'}
<ImportActionIndex
terms={terms}
modelerData={modelerData||{}}
/>
constraint={constraint}
</Spin>
template={template}
types={supportedIndextypes}
validateReports={validateReports}
onChange={onIndexChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherite'}
terms={terms}
/>
</Spin>
</EditInheritedModelContext.Provider>
);
);
};
};
...
...
src/view/Manage/Model/Component/ImportActionInherited.jsx
0 → 100644
View file @
e45643b1
import
React
,
{
useState
,
useContext
,
useEffect
}
from
"react"
;
import
{
Button
,
Tabs
,
Checkbox
}
from
"antd"
;
import
{
DownOutlined
,
UpOutlined
}
from
"@ant-design/icons"
;
import
Preview
from
'./InheritedPreview'
;
import
{
EditInheritedModelContext
}
from
"./ContextManage"
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
Holder
,
DDL
,
DataModelerRoleReader
,
ReadOnly
}
from
'../../../../util/constant'
;
export
const
inheritanceHistoricalType
=
'historical'
;
export
const
inheritanceZipperType
=
'zipper'
;
const
FC
=
(
props
)
=>
{
const
{
modelerData
,
editable
}
=
props
;
const
[
collapse
,
setCollapse
]
=
useState
(
true
);
const
[
activeKey
,
setActiveKey
]
=
useState
(
inheritanceHistoricalType
);
const
[
relationModelerDatas
,
setRelationModelerDatas
]
=
useState
([]);
const
[
historicalModelerData
,
setHistoricalModelerData
]
=
useState
(
undefined
);
const
[
zipperModelerData
,
setZipperModelerData
]
=
useState
(
undefined
);
const
{
createHistoryModel
,
createZipperModel
,
setInheriteState
,
setInheriteData
}
=
useContext
(
EditInheritedModelContext
);
useEffect
(()
=>
{
if
(
!
editable
)
{
if
(
modelerData
?.
final
)
{
getDataModel
();
}
else
{
const
newRelationModelerDatas
=
[];
if
(
modelerData
?.
inherited
?.
historical
)
{
newRelationModelerDatas
.
push
(
modelerData
?.
inherited
?.
historical
);
}
if
(
modelerData
?.
inherited
?.
zipper
)
{
newRelationModelerDatas
.
push
(
modelerData
?.
inherited
?.
zipper
);
}
setRelationModelerDatas
(
newRelationModelerDatas
);
}
}
else
{
if
(
modelerData
)
{
if
(
modelerData
.
inherited
?.
historical
)
{
setHistoricalModelerData
(
modelerData
.
inherited
?.
historical
);
}
else
{
getInheriteDataModel
(
inheritanceHistoricalType
);
}
if
(
modelerData
.
inherited
?.
zipper
)
{
setZipperModelerData
(
modelerData
.
inherited
?.
zipper
);
}
else
{
getInheriteDataModel
(
inheritanceZipperType
);
}
}
}
},
[
editable
,
modelerData
])
const
getInheriteDataModel
=
(
type
)
=>
{
dispatch
({
type
:
'datamodel.inheriteDataModel'
,
payload
:
{
params
:
{
id
:
modelerData
.
id
,
inheritanceTypeName
:
type
}
},
callback
:
data
=>
{
if
(
type
===
inheritanceHistoricalType
)
{
setHistoricalModelerData
(
data
);
setInheriteData
(
inheritanceHistoricalType
,
data
);
}
else
if
(
type
===
inheritanceZipperType
)
{
setZipperModelerData
(
data
);
setInheriteData
(
inheritanceZipperType
,
data
);
}
}
})
}
const
getDataModel
=
()
=>
{
dispatch
({
type
:
'datamodel.getDataModel'
,
payload
:
{
id
:
modelerData
?.
inheritedFrom
},
callback
:
data
=>
{
const
newRelationModelerDatas
=
[];
newRelationModelerDatas
.
push
(
data
);
if
(
modelerData
?.
inheritedFromType
===
inheritanceHistoricalType
&&
modelerData
?.
othersInheritedFromSameOrigin
?.
zipper
)
{
newRelationModelerDatas
.
push
(
modelerData
?.
othersInheritedFromSameOrigin
?.
zipper
);
}
setRelationModelerDatas
(
newRelationModelerDatas
);
}
})
}
return
(
<
div
className=
'model-import-action-inherited'
>
<
div
className=
'mb-3'
>
{
editable
?
<
Tabs
activeKey=
{
activeKey
}
onChange=
{
(
key
)
=>
{
setActiveKey
(
key
);
}
}
tabBarExtraContent=
{
{
left
:
<
div
className=
'flex mr-6'
style=
{
{
alignItems
:
'center'
}
}
>
<
h2
className=
'mr-3'
style=
{
{
marginBottom
:
0
}
}
>
历史存储形式
</
h2
>
{
collapse
?
<
Button
type=
'primary'
size=
'small'
onClick=
{
()
=>
{
setCollapse
(
!
collapse
);
}
}
>
展开
<
DownOutlined
/>
</
Button
>
:
<
Button
type=
'primary'
size=
'small'
onClick=
{
()
=>
{
setCollapse
(
!
collapse
);
}
}
>
收起
<
UpOutlined
/>
</
Button
>
}
</
div
>
}
}
>
<
Tabs
.
TabPane
tab=
{
<
span
>
<
Checkbox
className=
'mr-2'
value=
{
createHistoryModel
}
onChange=
{
(
e
)
=>
{
setInheriteState
(
inheritanceHistoricalType
,
e
.
target
.
checked
);
}
}
>
</
Checkbox
>
历史表
</
span
>
}
key=
{
inheritanceHistoricalType
}
>
{
!
collapse
&&
<
Preview
modelerData=
{
modelerData
}
type=
{
inheritanceHistoricalType
}
/>
}
</
Tabs
.
TabPane
>
<
Tabs
.
TabPane
tab=
{
<
span
>
<
Checkbox
className=
'mr-2'
value=
{
createZipperModel
}
onChange=
{
(
e
)
=>
{
setInheriteState
(
inheritanceZipperType
,
e
.
target
.
checked
);
}
}
></
Checkbox
>
拉链表
</
span
>
}
key=
{
inheritanceZipperType
}
>
{
!
collapse
&&
<
Preview
modelerData=
{
modelerData
}
type=
{
inheritanceZipperType
}
/>
}
</
Tabs
.
TabPane
>
</
Tabs
>
:
<
div
className=
'flex'
style=
{
{
alignItems
:
'center'
}
}
>
<
h2
className=
'mr-3'
style=
{
{
marginBottom
:
0
}
}
>
历史存储形式
</
h2
>
{
relationModelerDatas
?.
map
((
item
,
index
)
=>
<
a
className=
'mr-3'
key=
{
index
}
onClick=
{
()
=>
{
window
.
open
(
`/data-govern/data-model-action?${Action}=detail&${ModelerId}=${item.id}&${PermitCheckOut}=${item.permitCheckOut||false}&${Editable}=${item.editable||false}&${StateId}=${item.state?.id||''}&${Holder}=${item.holder||''}&${ReadOnly}=false`
);
}
}
>
{
item
.
cnName
}
</
a
>)
}
</
div
>
}
</
div
>
</
div
>
)
}
export
default
FC
;
\ No newline at end of file
src/view/Manage/Model/Component/InheritedPreview.jsx
0 → 100644
View file @
e45643b1
import
React
,
{
useEffect
,
useState
,
useMemo
}
from
"react"
;
import
{
Row
,
Col
,
Tooltip
,
Typography
,
Space
,
Button
}
from
"antd"
;
import
DataGrid
from
'../../VirtualTable'
;
import
EditInherited
from
'./EditInherited'
;
import
{
inheritanceHistoricalType
,
inheritanceZipperType
}
from
"./ImportActionInherited"
;
const
FC
=
(
props
)
=>
{
const
{
modelerData
,
type
}
=
props
;
const
[
editInheritedParams
,
setEditInheritedParms
]
=
useState
({
visible
:
false
,
modelerData
:
undefined
});
return
(
<
Row
>
<
Col
span=
{
12
}
>
<
Basic
modelerData=
{
modelerData
}
/>
</
Col
>
<
Col
span=
{
12
}
>
<
div
className=
'flex'
>
<
div
className=
'mr-3'
style=
{
{
flex
:
1
}
}
>
<
Table
data=
{
modelerData
?.
easyDataModelerDataModelAttributes
}
/>
</
div
>
<
Button
type=
'primary'
size=
'small'
onClick=
{
()
=>
{
setEditInheritedParms
({
visible
:
true
,
modelerData
});
}
}
>
编辑
</
Button
>
</
div
>
</
Col
>
<
EditInherited
visible=
{
editInheritedParams
.
visible
}
type=
{
type
}
modelerData=
{
editInheritedParams
.
modelerData
}
onCancel=
{
()
=>
{
setEditInheritedParms
({
visible
:
false
,
modelerData
:
undefined
});
}
}
/>
</
Row
>
)
}
export
default
FC
;
const
Basic
=
({
modelerData
})
=>
{
const
partitionsDescription
=
useMemo
(()
=>
{
let
newPartitionsDescription
=
''
if
(
modelerData
?.
partition
?.
keys
)
{
(
modelerData
?.
partition
?.
keys
||
[]).
forEach
((
item
,
index
)
=>
{
if
(
index
>
0
)
{
newPartitionsDescription
+=
','
;
}
newPartitionsDescription
+=
item
.
name
||
''
;
})
}
if
(
modelerData
?.
partition
?.
partitionType
?.
cnName
)
{
newPartitionsDescription
+=
'/'
+
modelerData
?.
partition
?.
partitionType
?.
cnName
||
''
;
}
return
newPartitionsDescription
;
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
modelerData
])
const
primaryDescription
=
useMemo
(()
=>
{
let
newPrimaryDescription
=
''
if
(
modelerData
?.
easyDataModelerPrimaryKey
)
{
(
modelerData
?.
easyDataModelerPrimaryKey
||
[]).
forEach
((
item
,
index
)
=>
{
if
(
index
>
0
)
{
newPrimaryDescription
+=
','
;
}
newPrimaryDescription
+=
item
.
name
||
''
;
})
}
return
newPrimaryDescription
;
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
modelerData
])
return
(
<
Row
gutter=
{
10
}
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
中文名称:
<
Typography
.
Text
>
{
modelerData
?.
cnName
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
英文名称:
<
Typography
.
Text
>
{
modelerData
?.
name
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
分区键:
<
Typography
.
Text
>
{
partitionsDescription
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
技术主键:
<
Typography
.
Text
>
{
primaryDescription
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
数据类型:
<
Typography
.
Text
>
{
modelerData
?.
dataType
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
绑定加载范围:
<
Typography
.
Text
>
{
modelerData
?.
bindingLoadRange
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
更新时间:
<
Typography
.
Text
>
{
modelerData
?.
dataUpdatingTiming
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
className=
'mb-4'
span=
{
12
}
>
<
Tooltip
title=
''
>
<
Typography
.
Text
ellipsis=
{
true
}
>
数据情况:
<
Typography
.
Text
>
{
modelerData
?.
dataCircumstances
}
</
Typography
.
Text
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
</
Row
>
)
}
const
Table
=
({
data
})
=>
{
const
cols
=
[
{
name
:
'序号'
,
key
:
'index'
,
width
:
60
,
// resizable: true,
},
{
name
:
'中文名称'
,
key
:
'cnName'
,
resizable
:
true
,
formatter
(
props
)
{
return
(
<
Tooltip
title=
{
props
.
row
.
cnName
||
''
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
{
props
.
row
.
cnName
}
</
Typography
.
Text
>
</
Tooltip
>
)
}
},
{
name
:
'英文名称'
,
key
:
'name'
,
resizable
:
true
,
formatter
(
props
)
{
return
(
<
Tooltip
title=
{
props
.
row
.
name
||
''
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
{
props
.
row
.
name
}
</
Typography
.
Text
>
</
Tooltip
>
)
}
},
{
name
:
'类型'
,
key
:
'datatype'
,
resizable
:
true
,
formatter
(
props
)
{
if
(
props
.
row
.
datatype
)
{
let
datatype
=
props
.
row
.
datatype
;
if
((
datatype
.
name
===
'Char'
||
datatype
.
name
===
'Varchar'
)
&&
datatype
.
parameterValues
?.
length
>
0
)
{
return
`
${
datatype
.
name
||
''
}
(
${(
datatype
.
parameterValues
[
0
]?
datatype
.
parameterValues
[
0
]:
0
)}
)`
;
}
else
if
((
datatype
.
name
===
'Decimal'
||
datatype
.
name
===
'Numeric'
)
&&
datatype
.
parameterValues
?.
length
>
1
)
{
return
`
${
datatype
.
name
||
''
}
(
${(
datatype
.
parameterValues
[
0
]?
datatype
.
parameterValues
[
0
]:
0
)}
,
${(
datatype
.
parameterValues
[
1
]?
datatype
.
parameterValues
[
1
]:
0
)}
)`
;
}
return
datatype
.
name
||
''
;
}
return
''
;
}
},
];
return
(
<
DataGrid
style=
{
{
blockSize
:
146
}
}
columns=
{
cols
}
rows=
{
data
||
[]
}
headerHeight=
{
30
}
rowHeight=
{
36
}
rowClassName=
{
(
row
)
=>
{
return
''
}
}
/>
)
}
\ No newline at end of file
src/view/Manage/VirtualTable/index.tsx
View file @
e45643b1
...
@@ -43,6 +43,7 @@ interface Props<Row> {
...
@@ -43,6 +43,7 @@ interface Props<Row> {
selectedRows
?:
Array
<
any
>
selectedRows
?:
Array
<
any
>
onSelectedRowsChange
?:
(
selectedRows
:
Array
<
any
>
)
=>
void
onSelectedRowsChange
?:
(
selectedRows
:
Array
<
any
>
)
=>
void
rowHeight
?:
number
rowHeight
?:
number
headerHeight
?:
number
rowClassName
?:
(
row
:
RowData
)
=>
string
rowClassName
?:
(
row
:
RowData
)
=>
string
scrollRowIndex
:
number
scrollRowIndex
:
number
}
}
...
@@ -112,7 +113,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
...
@@ -112,7 +113,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
expandable
,
expandable
,
getComparator
,
getComparator
,
loadMoreRows
,
loadMoreRows
,
onSelectedRowsChange
,
columns
,
rows
,
checkable
,
selectedRows
,
rowHeight
=
45
,
rowClassName
,
onContextMenu
,
scrollRowIndex
,
...
rest
}
=
props
onSelectedRowsChange
,
columns
,
rows
,
checkable
,
selectedRows
,
rowHeight
=
45
,
headerHeight
=
38
,
rowClassName
,
onContextMenu
,
scrollRowIndex
,
...
rest
}
=
props
const
rowKeyGetter
=
(
row
:
Row
):
K
=>
{
const
rowKeyGetter
=
(
row
:
Row
):
K
=>
{
return
row
.
id
as
K
;
return
row
.
id
as
K
;
...
@@ -268,7 +269,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
...
@@ -268,7 +269,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
}
}
}
}
onRowsChange=
{
onRowsChange
}
onRowsChange=
{
onRowsChange
}
headerRowHeight=
{
38
}
headerRowHeight=
{
headerHeight
}
rowHeight=
{
(
args
)
=>
(
args
.
type
===
'ROW'
&&
args
.
row
.
__type__
===
RowType
.
Detail
?
(
expandable
?.
expandedRowHeight
||
100
)
:
rowHeight
)
}
rowHeight=
{
(
args
)
=>
(
args
.
type
===
'ROW'
&&
args
.
row
.
__type__
===
RowType
.
Detail
?
(
expandable
?.
expandedRowHeight
||
100
)
:
rowHeight
)
}
// 排序
// 排序
...
...
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