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
985c0a48
Commit
985c0a48
authored
Jan 19, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型基本信息修改
parent
39be76d3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
110 deletions
+101
-110
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+70
-84
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+0
-0
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+31
-26
No files found.
src/view/Manage/Model/Component/ImportAction.jsx
View file @
985c0a48
...
@@ -5,7 +5,6 @@ import LocalStorage from 'local-storage';
...
@@ -5,7 +5,6 @@ import LocalStorage from 'local-storage';
import
ImportActionHeader
from
'./ImportActionHeader'
;
import
ImportActionHeader
from
'./ImportActionHeader'
;
import
ImportActionTable
from
'./ImportActionTable'
;
import
ImportActionTable
from
'./ImportActionTable'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
ImportActionPartition
from
'./ImportActionPartition'
;
import
{
getQueryParam
}
from
'../../../../util'
;
import
{
getQueryParam
}
from
'../../../../util'
;
import
{
Action
}
from
'../../../../util/constant'
;
import
{
Action
}
from
'../../../../util/constant'
;
...
@@ -127,9 +126,7 @@ const ImportAction = (props) => {
...
@@ -127,9 +126,7 @@ const ImportAction = (props) => {
},
},
callback
:
data
=>
{
callback
:
data
=>
{
let
newModelerData
=
{...(
data
||
{})};
let
newModelerData
=
{...(
data
||
{})};
newModelerData
=
{
...
newModelerData
,
...{
easyDataModelerIndices
:
getIndicesAfterTableChange
(
newModelerData
),
partition
:
getPartitionAfterTableChange
(
newModelerData
)
}
};
newModelerData
=
{
...
newModelerData
,
...
getAllNewKeysAfterTableChange
(
newModelerData
)
};
newModelerData
=
{...
onPartitionChangeByNewModelerData
(
newModelerData
)};
setModelerData
(
newModelerData
)
setModelerData
(
newModelerData
)
onChange
&&
onChange
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
...
@@ -288,12 +285,27 @@ const ImportAction = (props) => {
...
@@ -288,12 +285,27 @@ const ImportAction = (props) => {
}
}
const
onHeaderChange
=
(
changedValues
,
allValues
)
=>
{
const
onHeaderChange
=
(
changedValues
,
allValues
)
=>
{
let
newModelerData
=
{...
modelerData
,
...
allValues
};
let
newModelerData
=
{...
modelerData
,
...
allValues
};
if
(
newModelerData
.
easyDataModelerModelingTemplate
===
''
||
newModelerData
.
easyDataModelerModelingTemplate
===
{})
{
if
(
newModelerData
.
easyDataModelerModelingTemplate
===
''
||
newModelerData
.
easyDataModelerModelingTemplate
===
{})
{
newModelerData
.
easyDataModelerModelingTemplate
=
null
;
newModelerData
.
easyDataModelerModelingTemplate
=
null
;
}
}
//主键不允许为空
if
(
changedValues
.
hasOwnProperty
(
'easyDataModelerPrimaryKey'
))
{
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
forEach
(
attribute
=>
{
let
ownPrimaryKey
=
false
;
if
(
newModelerData
?.
easyDataModelerPrimaryKey
)
{
ownPrimaryKey
=
(
newModelerData
.
easyDataModelerPrimaryKey
.
filter
(
item
=>
item
.
name
===
attribute
.
name
).
length
>
0
);
}
if
(
ownPrimaryKey
)
{
attribute
.
nullable
=
false
;
}
})
}
setModelerData
(
newModelerData
);
setModelerData
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
...
@@ -307,9 +319,7 @@ const ImportAction = (props) => {
...
@@ -307,9 +319,7 @@ const ImportAction = (props) => {
let
newModelerData
=
{...
modelerData
,
...{
easyDataModelerDataModelAttributes
:
data
}};
let
newModelerData
=
{...
modelerData
,
...{
easyDataModelerDataModelAttributes
:
data
}};
newModelerData
=
{
...
newModelerData
,
...{
easyDataModelerIndices
:
getIndicesAfterTableChange
(
newModelerData
),
partition
:
getPartitionAfterTableChange
(
newModelerData
)
}
};
newModelerData
=
{
...
newModelerData
,
...
getAllNewKeysAfterTableChange
(
newModelerData
)
};
newModelerData
=
{...
onPartitionChangeByNewModelerData
(
newModelerData
)};
setModelerData
(
newModelerData
);
setModelerData
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
...
@@ -345,54 +355,59 @@ const ImportAction = (props) => {
...
@@ -345,54 +355,59 @@ const ImportAction = (props) => {
}
}
}
}
const
onPartitionChangeByNewModelerData
=
(
newModelerData
)
=>
{
const
getAllNewKeysAfterTableChange
=
(
newModelerData
)
=>
{
//
数据表分区内容回填到基本信息分区键中
//
分布键
let
new
PartitionDesc
=
''
;
let
new
Distribution
=
{...
newModelerData
.
easyDataModelerDistributionKey
}
;
if
((
newModelerData
?.
partition
?.
keys
||
[]).
length
>
0
)
{
(
newDistribution
||
[]).
forEach
((
item
,
index
)
=>
{
(
newModelerData
?.
partition
?.
keys
||
[]).
forEach
((
item
,
index
)
=>
{
const
_index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
_item
=>
item
.
name
===
_item
.
name
);
if
(
index
>
0
)
{
newPartitionDesc
+=
','
}
newPartitionDesc
+=
item
.
name
||
''
;
if
(
_index
!==
-
1
)
{
})
newDistribution
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
}
})
newPartitionDesc
+=
'/'
+
newModelerData
?.
partition
?.
partitionType
?.
name
||
''
;
if
((
newDistribution
||
[]).
length
===
0
)
{
newDistribution
=
null
;
}
}
newModelerData
.
partitionsDescription
=
newPartitionDesc
;
//主键
let
newPrimary
=
{...
newModelerData
.
easyDataModelerPrimaryKey
};
return
newModelerData
;
}
const
onPartitionChange
=
(
data
,
validate
=
false
)
=>
{
(
newPrimary
||
[]).
forEach
((
item
,
index
)
=>
{
const
newModelerData
=
{...
modelerData
,
partition
:
data
};
const
_index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
_item
=>
item
.
name
===
_item
.
name
);
if
(
_index
!==
-
1
)
{
newPrimary
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
}
})
if
((
newPrimary
||
[]).
length
===
0
)
{
newPrimary
=
null
;
}
//数据表分区内容回填到基本信息分区键中
//分区
let
newPartitionDesc
=
''
;
let
newPartition
=
{...
newModelerData
.
partition
};
(
data
?.
keys
||
[]).
forEach
((
item
,
index
)
=>
{
if
(
index
>
0
)
{
newPartitionDesc
+=
','
}
newPartitionDesc
+=
item
.
name
||
''
;
const
newKeys
=
[];
})
newPartitionDesc
+=
'/'
+
data
?.
partitionType
?.
name
||
''
;
(
newPartition
.
keys
||
[]).
forEach
((
item
,
index
)
=>
{
const
_index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
_item
=>
item
.
name
===
_item
.
name
);
newModelerData
.
partitionsDescription
=
newPartitionDesc
;
if
(
_index
!==
-
1
)
{
setModelerData
(
newModelerData
);
newKeys
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
onChange
&&
onChange
(
newModelerData
);
}
})
if
(
validate
)
{
newPartition
.
keys
=
newKeys
;
validateDataModel
(
newModelerData
);
if
((
newKeys
||
[]).
length
===
0
)
{
newPartition
=
null
;
}
}
}
const
getIndicesAfterTableChange
=
(
newModelerData
)
=>
{
//索引
cons
t
newEasyDataModelerIndices
=
[...(
newModelerData
.
easyDataModelerIndices
||
[])];
le
t
newEasyDataModelerIndices
=
[...(
newModelerData
.
easyDataModelerIndices
||
[])];
(
newModelerData
.
easyDataModelerIndices
||
[]).
forEach
((
easyDataModelerIndex
,
index
)
=>
{
(
newModelerData
.
easyDataModelerIndices
||
[]).
forEach
((
easyDataModelerIndex
,
index
)
=>
{
const
newIndexedEasyDataModelAttributes
=
[],
newIndexedAttributeOrders
=
[];
const
newIndexedEasyDataModelAttributes
=
[],
newIndexedAttributeOrders
=
[];
...
@@ -410,45 +425,26 @@ const ImportAction = (props) => {
...
@@ -410,45 +425,26 @@ const ImportAction = (props) => {
newEasyDataModelerIndices
.
splice
(
index
,
1
,
{...
item
,
...{
indexedEasyDataModelAttributes
:
newIndexedEasyDataModelAttributes
,
indexedAttributeOrders
:
newIndexedAttributeOrders
}}
)
newEasyDataModelerIndices
.
splice
(
index
,
1
,
{...
item
,
...{
indexedEasyDataModelAttributes
:
newIndexedEasyDataModelAttributes
,
indexedAttributeOrders
:
newIndexedAttributeOrders
}}
)
})
})
return
newEasyDataModelerIndices
.
filter
(
item
=>
(
item
.
indexedEasyDataModelAttributes
||
[]).
length
>
0
);
newEasyDataModelerIndices
=
newEasyDataModelerIndices
.
filter
(
item
=>
(
item
.
indexedEasyDataModelAttributes
||
[]).
length
>
0
);
}
const
getPartitionAfterTableChange
=
(
newModelerData
)
=>
{
const
newPartition
=
{...
newModelerData
.
partition
};
const
newKeys
=
[];
(
newPartition
.
keys
||
[]).
forEach
((
item
,
index
)
=>
{
const
_index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
_item
=>
item
.
iid
===
_item
.
iid
);
if
(
_index
!==
-
1
)
{
newKeys
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
}
})
newPartition
.
keys
=
newKeys
;
if
((
newKeys
||
[]).
length
===
0
)
return
null
;
return
{
partition
:
newPartition
,
easyDataModelerDistributionKey
:
newDistribution
,
easyDataModelerPrimaryKey
:
newPrimary
,
easyDataModelerIndices
:
newEasyDataModelerIndices
};
return
newPartition
;
}
}
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
ImportActionHeader
<
ImportActionHeader
form=
{
form
}
form=
{
form
}
editable=
{
action
!==
'detail'
&&
action
!==
'flow'
&&
action
!==
'detail-version'
}
editable=
{
action
!==
'detail'
&&
action
!==
'flow'
&&
action
!==
'detail-version'
}
modelerData=
{
modelerData
||
{}
}
modelerData=
{
modelerData
||
{}
}
constraints=
{
constraints
}
constraints=
{
constraints
}
templates=
{
templates
}
templates=
{
templates
}
validateReports=
{
validateReports
}
validateReports=
{
validateReports
}
onTemplateChange=
{
onTemplateChange
}
onTemplateChange=
{
onTemplateChange
}
onConstraintChange=
{
onConstraintChange
}
onConstraintChange=
{
onConstraintChange
}
onChange=
{
onHeaderChange
}
onChange=
{
onHeaderChange
}
terms=
{
terms
}
terms=
{
terms
}
/>
supportedPartitionTypes=
{
supportedPartitionTypes
}
/>
<
ImportActionTable
<
ImportActionTable
modelerData=
{
modelerData
||
{}
}
modelerData=
{
modelerData
||
{}
}
constraint=
{
constraint
}
constraint=
{
constraint
}
...
@@ -469,16 +465,6 @@ const ImportAction = (props) => {
...
@@ -469,16 +465,6 @@ const ImportAction = (props) => {
editable=
{
action
!==
'detail'
&&
action
!==
'flow'
&&
action
!==
'detail-version'
}
editable=
{
action
!==
'detail'
&&
action
!==
'flow'
&&
action
!==
'detail-version'
}
terms=
{
terms
}
terms=
{
terms
}
/>
/>
<
ImportActionPartition
modelerData=
{
modelerData
||
{}
}
constraint=
{
constraint
}
template=
{
template
}
validateReports=
{
validateReports
}
supportedPartitionTypes=
{
supportedPartitionTypes
}
onChange=
{
onPartitionChange
}
editable=
{
action
!==
'detail'
&&
action
!==
'flow'
&&
action
!==
'detail-version'
}
terms=
{
terms
}
/>
</
Spin
>
</
Spin
>
);
);
};
};
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
985c0a48
This diff is collapsed.
Click to expand it.
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
985c0a48
...
@@ -349,7 +349,7 @@ const ImportActionTable = (props) => {
...
@@ -349,7 +349,7 @@ const ImportActionTable = (props) => {
cnName
:
''
,
cnName
:
''
,
datatype
:
null
,
datatype
:
null
,
nullable
:
null
,
nullable
:
null
,
partOfPrimaryKey
:
null
,
partOfPrimaryKey
Logically
:
null
,
partOfDistributionKey
:
null
,
partOfDistributionKey
:
null
,
needAttention
:
null
,
needAttention
:
null
,
remark
:
''
,
remark
:
''
,
...
@@ -452,6 +452,11 @@ const ImportActionTable = (props) => {
...
@@ -452,6 +452,11 @@ const ImportActionTable = (props) => {
// console.log('changed values', changedValues);
// console.log('changed values', changedValues);
// console.log('all values', allValues);
// console.log('all values', allValues);
let
ownPrimaryKey
=
false
;
if
(
modelerData
?.
easyDataModelerPrimaryKey
)
{
ownPrimaryKey
=
(
modelerData
.
easyDataModelerPrimaryKey
.
filter
(
item
=>
item
.
name
===
allValues
.
name
).
length
>
0
);
}
if
(
changedValues
.
hasOwnProperty
(
'cnName'
)
||
changedValues
.
hasOwnProperty
(
'name'
))
{
if
(
changedValues
.
hasOwnProperty
(
'cnName'
)
||
changedValues
.
hasOwnProperty
(
'name'
))
{
if
(
offset
===
1
)
{
if
(
offset
===
1
)
{
...
@@ -535,12 +540,12 @@ const ImportActionTable = (props) => {
...
@@ -535,12 +540,12 @@ const ImportActionTable = (props) => {
}
}
}
else
if
(
changedValues
.
hasOwnProperty
(
'nullable'
)
)
{
}
else
if
(
changedValues
.
hasOwnProperty
(
'nullable'
)
)
{
if
(
changedValues
.
nullable
&&
allValues
.
partOf
PrimaryKey
)
{
if
(
changedValues
.
nullable
&&
own
PrimaryKey
)
{
showMessage
(
'info'
,
'主键不允许为空'
);
showMessage
(
'info'
,
'主键不允许为空'
);
}
}
}
}
if
(
allValues
.
partOf
PrimaryKey
)
{
if
(
own
PrimaryKey
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
nullable
:
false
nullable
:
false
});
});
...
@@ -667,14 +672,14 @@ const ImportActionTable = (props) => {
...
@@ -667,14 +672,14 @@ const ImportActionTable = (props) => {
{
{
title: '主键',
title: '主键',
width: 50,
width: 50,
dataIndex: 'partOfPrimaryKey',
dataIndex: 'partOfPrimaryKey
Logically
',
editable: (type==='model'?true:false),
editable: (type==='model'?true:false),
render: (partOfPrimaryKey, record, index) => {
render: (partOfPrimaryKey
Logically
, record, index) => {
if (!partOfPrimaryKey) {
if (!partOfPrimaryKey
Logically
) {
return (
return (
<CloseOutlined />
<CloseOutlined />
);
);
} else if (partOfPrimaryKey === true) {
} else if (partOfPrimaryKey
Logically
=== true) {
return (
return (
<CheckOutlined />
<CheckOutlined />
)
)
...
@@ -683,25 +688,25 @@ const ImportActionTable = (props) => {
...
@@ -683,25 +688,25 @@ const ImportActionTable = (props) => {
return '';
return '';
}
}
},
},
{
//
{
title: '分布键',
//
title: '分布键',
width: 60,
//
width: 60,
dataIndex: 'partOfDistributionKey',
//
dataIndex: 'partOfDistributionKey',
editable: (type==='model'?true:false),
//
editable: (type==='model'?true:false),
render: (partOfDistributionKey, record, index) => {
//
render: (partOfDistributionKey, record, index) => {
if (!partOfDistributionKey) {
//
if (!partOfDistributionKey) {
return (
//
return (
<CloseOutlined />
//
<CloseOutlined />
);
//
);
} else if (partOfDistributionKey === true) {
//
} else if (partOfDistributionKey === true) {
return (
//
return (
<CheckOutlined />
//
<CheckOutlined />
)
//
)
}
//
}
return '';
//
return '';
}
//
}
},
//
},
{
{
title: '外键',
title: '外键',
width: 50,
width: 50,
...
@@ -983,7 +988,7 @@ const ImportActionTable = (props) => {
...
@@ -983,7 +988,7 @@ const ImportActionTable = (props) => {
onCell: (record) => ({
onCell: (record) => ({
record,
record,
dataIndex: col.dataIndex,
dataIndex: col.dataIndex,
inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKey' || col.dataIndex==='needAttention' || col.dataIndex==='foreignKey') ? 'check' : 'text',
inputType: (col.dataIndex==='nullable' || col.dataIndex==='partOfDistributionKey' || col.dataIndex==='partOfPrimaryKey
Logically
' || col.dataIndex==='needAttention' || col.dataIndex==='foreignKey') ? 'check' : 'text',
colTitle: col.title,
colTitle: col.title,
editing: isEditing(record),
editing: isEditing(record),
datatypes: supportedDatatypes,
datatypes: supportedDatatypes,
...
...
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