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
014578f7
Commit
014578f7
authored
Apr 14, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加模型字段搜索
parent
86b822a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
13 deletions
+41
-13
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+35
-13
ImportActionTable.less
src/view/Manage/Model/Component/ImportActionTable.less
+6
-0
No files found.
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
014578f7
...
...
@@ -217,14 +217,24 @@ const DragableBodyRow = ({ index, moveRow, className, style, ...restProps }) =>
const
ImportActionTable
=
(
props
)
=>
{
const
{
modelerData
,
onChange
,
editable
,
supportedDatatypes
,
constraint
,
template
,
validateReports
}
=
props
;
const
data
=
modelerData
.
easyDataModelerDataModelAttributes
||
[];
const
[
form
]
=
Form
.
useForm
();
const
[
editingKey
,
setEditingKey
]
=
useState
(
''
);
const
[
suggests
,
setSuggests
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
const
[
editingKey
,
setEditingKey
]
=
useState
(
''
);
const
[
suggests
,
setSuggests
]
=
useState
([]);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
filterData
,
setFilterData
]
=
useState
([]);
//规则改变的时候 数据表为可编辑状态
useEffect
(()
=>
{
setEditingKey
(
''
);
},
[
constraint
,
template
])
useEffect
(()
=>
{
setFilterData
((
modelerData
.
easyDataModelerDataModelAttributes
||
[]
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
));
},
[
modelerData
,
keyword
])
const
isEditing
=
(
record
)
=>
record
.
iid
===
editingKey
;
...
...
@@ -518,7 +528,12 @@ const ImportActionTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
);
const
onSearchInputChange
=
(
e
)
=>
{
setEditingKey
(
''
);
setKeyword
(
e
.
target
.
value
||
''
);
}
return
(
<
div
className=
'model-import-action-table'
>
<
Divider
>
...
...
@@ -532,30 +547,37 @@ const ImportActionTable = (props) => {
}
</>
</
Divider
>
{
editable
&&
<
div
className=
'd-flex mb-3'
>
<
Button
type=
"primary"
onClick=
{
onAddClick
}
style=
{
{
marginLeft
:
'auto'
}
}
disabled=
{
editingKey
!==
''
}
>
新增行
</
Button
>
</
div
>
}
<
div
className=
'd-flex mb-3'
>
<
Input
placeholder=
"请输入中文名称或者英文名称"
allowClear
value=
{
keyword
}
onChange=
{
onSearchInputChange
}
style=
{
{
width
:
240
,
marginLeft
:
'auto'
}
}
/>
{
editable
&&
<
Button
className=
'ml-3'
type=
"primary"
onClick=
{
onAddClick
}
disabled=
{
editingKey
!==
''
||
keyword
!==
''
}
>
新增行
</
Button
>
}
</
div
>
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Form
form=
{
form
}
component=
{
false
}
onValuesChange=
{
onValuesChange
}
>
<
Table
components=
{
{
body
:
{
cell
:
EditableCell
,
//编辑状态下不允许拖动
row
:
(
editable
&&
editingKey
===
''
)?
DragableBodyRow
:
null
,
//编辑
或者搜索
状态下不允许拖动
row
:
(
editable
&&
editingKey
===
''
&&
keyword
===
''
)?
DragableBodyRow
:
null
,
},
}
}
onRow=
{
(
record
,
index
)
=>
{
if
(
!
editable
||
editingKey
!==
''
)
return
null
;
if
(
!
editable
||
editingKey
!==
''
||
keyword
.
length
>
0
)
return
null
;
return
{
index
,
moveRow
}
}
}
dataSource=
{
d
ata
||
[]
}
dataSource=
{
filterD
ata
||
[]
}
columns=
{
mergedColumns
()
}
size=
'small'
rowKey=
'iid'
...
...
src/view/Manage/Model/Component/ImportActionTable.less
View file @
014578f7
.model-import-action-table {
.yy-table {
max-height: 500px !important;
overflow: auto !important;
}
.yy-table-expanded-row {
.yy-radio-wrapper {
white-space: normal !important;
...
...
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