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
2f5cb5db
Commit
2f5cb5db
authored
Jan 22, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
400问题
parent
c7633b3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
38 deletions
+42
-38
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+2
-22
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+40
-16
No files found.
src/view/Manage/Model/Component/ImportAction.jsx
View file @
2f5cb5db
...
@@ -368,10 +368,6 @@ const ImportAction = (props) => {
...
@@ -368,10 +368,6 @@ const ImportAction = (props) => {
}
}
})
})
if
((
newDistribution
||
[]).
length
===
0
)
{
newDistribution
=
null
;
}
//主键
//主键
let
newPrimary
=
[];
let
newPrimary
=
[];
...
@@ -382,10 +378,6 @@ const ImportAction = (props) => {
...
@@ -382,10 +378,6 @@ const ImportAction = (props) => {
newPrimary
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
newPrimary
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
}
}
})
})
if
((
newPrimary
||
[]).
length
===
0
)
{
newPrimary
=
null
;
}
//分区
//分区
let
newPartition
=
{...(
newModelerData
.
partition
||
[])};
let
newPartition
=
{...(
newModelerData
.
partition
||
[])};
...
@@ -407,19 +399,7 @@ const ImportAction = (props) => {
...
@@ -407,19 +399,7 @@ const ImportAction = (props) => {
}
}
//类主键
//类主键
let
newSemiPrimary
=
[];
let
newSemiPrimary
=
[...(
newModelerData
.
easyDataModelerSemiPrimaryKey
||
[])];
(
newModelerData
.
semiPrimaryKey
||
[]).
forEach
((
item
,
index
)
=>
{
const
_index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
_item
=>
item
.
iid
===
_item
.
iid
);
if
(
_index
!==
-
1
)
{
newSemiPrimary
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
_index
]});
}
})
if
((
newSemiPrimary
||
[]).
length
===
0
)
{
newSemiPrimary
=
null
;
}
//索引
//索引
let
newEasyDataModelerIndices
=
[...(
newModelerData
.
easyDataModelerIndices
||
[])];
let
newEasyDataModelerIndices
=
[...(
newModelerData
.
easyDataModelerIndices
||
[])];
...
@@ -442,7 +422,7 @@ const ImportAction = (props) => {
...
@@ -442,7 +422,7 @@ const ImportAction = (props) => {
newEasyDataModelerIndices
=
newEasyDataModelerIndices
.
filter
(
item
=>
(
item
.
indexedEasyDataModelAttributes
||
[]).
length
>
0
);
newEasyDataModelerIndices
=
newEasyDataModelerIndices
.
filter
(
item
=>
(
item
.
indexedEasyDataModelAttributes
||
[]).
length
>
0
);
return
{
partition
:
newPartition
,
easyDataModelerDistributionKey
:
newDistribution
,
easyDataModelerPrimaryKey
:
newPrimary
,
easyDataModelerIndices
:
newEasyDataModelerIndices
,
s
emiPrimaryKey
:
newSemiPrimary
};
return
{
partition
:
newPartition
,
easyDataModelerDistributionKey
:
newDistribution
,
easyDataModelerPrimaryKey
:
newPrimary
,
easyDataModelerIndices
:
newEasyDataModelerIndices
,
easyDataModelerS
emiPrimaryKey
:
newSemiPrimary
};
}
}
return
(
return
(
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
2f5cb5db
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Checkbox
}
from
'antd'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Checkbox
}
from
'antd'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
generateUUID
}
from
'../../../../util'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
'./ImportActionHeader.less'
;
import
'./ImportActionHeader.less'
;
...
@@ -79,10 +79,24 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps })
...
@@ -79,10 +79,24 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps })
)
)
}
}
const
AttributesSelect
=
({
value
=
[],
modelerData
,
onChange
,
...
restProps
})
=>
{
const
AttributesSelect
=
({
value
=
[],
modelerData
,
onChange
,
mode
=
'multiple'
,
...
restProps
})
=>
{
const
onAttributeChange
=
(
value
)
=>
{
const
onAttributeChange
=
(
value
)
=>
{
const
currentAttributes
=
(
modelerData
?.
easyDataModelerDataModelAttributes
||
[]).
filter
(
attribute
=>
(
value
||
[]).
indexOf
(
attribute
.
iid
)
!==-
1
);
let
currentAttributes
=
[];
if
(
mode
===
'multiple'
)
{
currentAttributes
=
(
modelerData
?.
easyDataModelerDataModelAttributes
||
[]).
filter
(
attribute
=>
(
value
||
[]).
indexOf
(
attribute
.
iid
)
!==-
1
);
}
else
{
(
value
||
[]).
forEach
(
item
=>
{
const
filterAttributes
=
(
newAttributes
||
[]).
filter
(
attribute
=>
item
===
attribute
.
iid
);
if
(
filterAttributes
.
length
!==
0
)
{
currentAttributes
=
[...
currentAttributes
,
...
filterAttributes
];
}
else
{
currentAttributes
=
[...
currentAttributes
,
{
name
:
item
,
iid
:
generateUUID
()
}];
}
})
}
triggerChange
(
currentAttributes
);
triggerChange
(
currentAttributes
);
}
}
...
@@ -91,13 +105,23 @@ const AttributesSelect = ({ value = [], modelerData, onChange, ...restProps }) =
...
@@ -91,13 +105,23 @@ const AttributesSelect = ({ value = [], modelerData, onChange, ...restProps }) =
onChange
?.(
changedValue
);
onChange
?.(
changedValue
);
};
};
//value有可能为空
//value有可能为空
value
=
value
?
value
:
[];
value
=
value
?
value
:
[];
let
attributeIds
=
[];
let
attributeIds
=
[];
value
.
forEach
(
attribute
=>
{
let
newAttributes
=
[...(
modelerData
?.
easyDataModelerDataModelAttributes
||
[])];
attributeIds
.
push
(
attribute
.
iid
);
})
value
.
forEach
(
attribute
=>
{
attributeIds
.
push
(
attribute
.
iid
);
if
(
mode
===
'tags'
)
{
const
filterAttributes
=
(
modelerData
?.
easyDataModelerDataModelAttributes
||
[]).
filter
(
_attribute
=>
attribute
.
iid
===
_attribute
.
iid
);
if
(
filterAttributes
.
length
===
0
)
{
newAttributes
=
[...
newAttributes
,
attribute
];
}
}
})
return
(
return
(
<
Select
<
Select
...
@@ -105,13 +129,13 @@ const AttributesSelect = ({ value = [], modelerData, onChange, ...restProps }) =
...
@@ -105,13 +129,13 @@ const AttributesSelect = ({ value = [], modelerData, onChange, ...restProps }) =
value=
{
attributeIds
}
value=
{
attributeIds
}
placeholder=
'请选择字段名称'
placeholder=
'请选择字段名称'
style=
{
{
width
:
300
}
}
style=
{
{
width
:
300
}
}
mode=
'multiple'
mode=
{
mode
}
allowClear=
{
true
}
allowClear=
{
true
}
>
>
{
{
(
modelerData
?.
easyDataModelerDataModel
Attributes
||
[]).
map
((
attribute
,
index
)
=>
{
(
new
Attributes
||
[]).
map
((
attribute
,
index
)
=>
{
return
(
return
(
<
Option
key=
{
index
}
value=
{
attribute
.
iid
||
''
}
>
{
attribute
.
name
||
''
}
</
Option
>
<
Option
key=
{
index
}
value=
{
attribute
.
iid
?
attribute
.
iid
:(
attribute
.
name
||
''
)
}
>
{
attribute
.
name
||
''
}
</
Option
>
);
);
})
})
}
}
...
@@ -440,8 +464,8 @@ const ImportActionHeader = (props) => {
...
@@ -440,8 +464,8 @@ const ImportActionHeader = (props) => {
}
}
//类主键
//类主键
if
(
modelerData
?.
s
emiPrimaryKey
)
{
if
(
modelerData
?.
easyDataModelerS
emiPrimaryKey
)
{
(
modelerData
?.
s
emiPrimaryKey
||
[]).
forEach
((
item
,
index
)
=>
{
(
modelerData
?.
easyDataModelerS
emiPrimaryKey
||
[]).
forEach
((
item
,
index
)
=>
{
if
(
index
>
0
)
{
if
(
index
>
0
)
{
semiPrimaryDescription
+=
','
;
semiPrimaryDescription
+=
','
;
}
}
...
@@ -594,10 +618,10 @@ const ImportActionHeader = (props) => {
...
@@ -594,10 +618,10 @@ const ImportActionHeader = (props) => {
<
Col
span=
{
8
}
>
<
Col
span=
{
8
}
>
<
Form
.
Item
<
Form
.
Item
label=
"类主键"
label=
"类主键"
name=
"
s
emiPrimaryKey"
name=
"
easyDataModelerS
emiPrimaryKey"
labelAlign=
"left"
labelAlign=
"left"
>
>
<
AttributesSelect
modelerData=
{
modelerData
}
/>
<
AttributesSelect
modelerData=
{
modelerData
}
mode=
'tags'
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
...
...
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