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
c7d8aaf2
Commit
c7d8aaf2
authored
Jan 22, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bu gbug
parent
2f5cb5db
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
19 deletions
+78
-19
DebounceInput.jsx
src/view/Manage/Model/Component/DebounceInput.jsx
+6
-0
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+5
-1
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+33
-5
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+34
-13
No files found.
src/view/Manage/Model/Component/DebounceInput.jsx
View file @
c7d8aaf2
...
@@ -10,6 +10,12 @@ export default (triggerMs = 0) => {
...
@@ -10,6 +10,12 @@ export default (triggerMs = 0) => {
this
.
state
.
value
=
props
.
value
;
this
.
state
.
value
=
props
.
value
;
}
}
componentDidUpdate
(
preProps
,
preState
)
{
if
(
preProps
.
value
!==
this
.
props
.
value
)
{
this
.
setState
({
value
:
this
.
props
.
value
});
}
}
onChange
=
(()
=>
{
onChange
=
(()
=>
{
let
updb
=
this
.
props
.
onChange
;
let
updb
=
this
.
props
.
onChange
;
if
(
triggerMs
>=
0
)
{
if
(
triggerMs
>=
0
)
{
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
c7d8aaf2
...
@@ -4,11 +4,15 @@ import { Form, Input, Row, Col, Descriptions, Select, AutoComplete, Checkbox } f
...
@@ -4,11 +4,15 @@ import { Form, Input, Row, Col, Descriptions, Select, AutoComplete, Checkbox } f
import
{
highlightSearchContentByTerms
,
generateUUID
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
generateUUID
}
from
'../../../../util'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
DebounceInput
from
'./DebounceInput'
;
import
'./ImportActionHeader.less'
;
import
'./ImportActionHeader.less'
;
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
const
loadOptions
=
[
'append'
,
'refresh'
,
'insert'
,
'update'
,
'full'
,
'chain'
,
'delete'
,
'手工导入'
];
const
loadOptions
=
[
'append'
,
'refresh'
,
'insert'
,
'update'
,
'full'
,
'chain'
,
'delete'
,
'手工导入'
];
const
updateOptions
=
[
const
updateOptions
=
[
'每个交易日早间交易前加载上一交易日数据,历史资料入历史表'
,
'每个交易日早间交易前加载上一交易日数据,历史资料入历史表'
,
...
@@ -501,7 +505,7 @@ const ImportActionHeader = (props) => {
...
@@ -501,7 +505,7 @@ const ImportActionHeader = (props) => {
labelAlign=
"left"
labelAlign=
"left"
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
>
>
<
Input
style=
{
{
width
:
300
}
}
/>
<
Input
Debounce
style=
{
{
width
:
300
}
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
8
}
>
<
Col
span=
{
8
}
>
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
c7d8aaf2
...
@@ -7,6 +7,7 @@ import update from 'immutability-helper';
...
@@ -7,6 +7,7 @@ import update from 'immutability-helper';
import
{
useClickAway
}
from
'ahooks'
;
import
{
useClickAway
}
from
'ahooks'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
DebounceInput
from
'./DebounceInput'
;
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
showMessage
,
highlightSearchContentByTerms
,
inputWidth
}
from
'../../../../util'
;
import
{
showMessage
,
highlightSearchContentByTerms
,
inputWidth
}
from
'../../../../util'
;
...
@@ -15,6 +16,8 @@ const { Option } = Select;
...
@@ -15,6 +16,8 @@ const { Option } = Select;
const
type
=
'DragableIndexBodyRow'
;
const
type
=
'DragableIndexBodyRow'
;
const
MENU_ID
=
'model-index-menu'
;
const
MENU_ID
=
'model-index-menu'
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
const
AttributesInputItem
=
({
indexedAttribute
=
null
,
indexedAttributeOrder
=
null
,
attributes
,
onAttributeChange
,
onOrderChange
,
onDelete
,
className
})
=>
{
const
AttributesInputItem
=
({
indexedAttribute
=
null
,
indexedAttributeOrder
=
null
,
attributes
,
onAttributeChange
,
onOrderChange
,
onDelete
,
className
})
=>
{
return
(
return
(
...
@@ -282,7 +285,8 @@ const ImportActionIndex = (props) => {
...
@@ -282,7 +285,8 @@ const ImportActionIndex = (props) => {
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
editingKey
,
setEditingKey
]
=
useState
(
null
);
const
[
editingKey
,
setEditingKey
]
=
useState
(
null
);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
keywordCondition
,
setKeywordCondition
]
=
useState
({
keyword
:
''
,
needFilter
:
true
});
const
{
keyword
,
needFilter
}
=
keywordCondition
;
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
...
@@ -325,7 +329,24 @@ const ImportActionIndex = (props) => {
...
@@ -325,7 +329,24 @@ const ImportActionIndex = (props) => {
setFilterData
(
__filterData
);
setFilterData
(
__filterData
);
},
[
modelerData
,
keyword
])
},
[
modelerData
])
useEffect
(()
=>
{
if
(
needFilter
)
{
const
_filterData
=
(
modelerData
.
easyDataModelerIndices
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
);
const
__filterData
=
[];
(
_filterData
||
[]).
forEach
(
item
=>
{
__filterData
.
push
({...
item
,
...{
attributesWithOrders
:
{
indexedEasyDataModelAttributes
:
item
.
indexedEasyDataModelAttributes
||
[],
indexedAttributeOrders
:
item
.
indexedAttributeOrders
||
[],
}
}});
})
setFilterData
(
__filterData
);
}
},
[
keywordCondition
])
const
isEditing
=
(
record
)
=>
record
.
name
===
editingKey
;
const
isEditing
=
(
record
)
=>
record
.
name
===
editingKey
;
...
@@ -334,6 +355,9 @@ const ImportActionIndex = (props) => {
...
@@ -334,6 +355,9 @@ const ImportActionIndex = (props) => {
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
const
newData
=
[...
dataRef
.
current
,
{
name
:
''
}];
const
newData
=
[...
dataRef
.
current
,
{
name
:
''
}];
setFilterData
(
newData
);
setFilterData
(
newData
);
...
@@ -347,6 +371,8 @@ const ImportActionIndex = (props) => {
...
@@ -347,6 +371,8 @@ const ImportActionIndex = (props) => {
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
let
newData
=
[...
dataRef
.
current
];
let
newData
=
[...
dataRef
.
current
];
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
name
===
item
.
name
);
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
name
===
item
.
name
);
...
@@ -381,6 +407,8 @@ const ImportActionIndex = (props) => {
...
@@ -381,6 +407,8 @@ const ImportActionIndex = (props) => {
const
insertToBack
=
(
record
)
=>
{
const
insertToBack
=
(
record
)
=>
{
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
const
newData
=
[...
dataRef
.
current
];
const
newData
=
[...
dataRef
.
current
];
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
name
===
item
.
name
);
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
name
===
item
.
name
);
...
@@ -768,9 +796,9 @@ const ImportActionIndex = (props) => {
...
@@ -768,9 +796,9 @@ const ImportActionIndex = (props) => {
[
dataRef
.
current
],
[
dataRef
.
current
],
);
);
const
onSearchInputChange
=
(
e
)
=>
{
const
onSearchInputChange
=
(
valu
e
)
=>
{
setEditingKey
(
null
);
setEditingKey
(
null
);
setKeyword
(
e
.
target
.
value
||
''
);
setKeyword
Condition
({
keyword
:
value
||
''
,
needFilter
:
true
}
);
}
}
const
displayMenu
=
(
e
)
=>
{
const
displayMenu
=
(
e
)
=>
{
...
@@ -805,7 +833,7 @@ const ImportActionIndex = (props) => {
...
@@ -805,7 +833,7 @@ const ImportActionIndex = (props) => {
</
Tooltip
>
</
Tooltip
>
}
}
<
div
className=
'd-flex'
style=
{
{
alignItems
:
'center'
}
}
>
<
div
className=
'd-flex'
style=
{
{
alignItems
:
'center'
}
}
>
<
Input
<
Input
Debounce
placeholder=
"请输入索引名称"
placeholder=
"请输入索引名称"
allowClear
allowClear
value=
{
keyword
}
value=
{
keyword
}
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
c7d8aaf2
...
@@ -249,7 +249,9 @@ const ImportActionTable = (props) => {
...
@@ -249,7 +249,9 @@ const ImportActionTable = (props) => {
const
[
suggestOffset
,
setSuggestOffset
]
=
useState
(
1
);
const
[
suggestOffset
,
setSuggestOffset
]
=
useState
(
1
);
const
[
currentChangedValues
,
setCurrentChangedValues
]
=
useState
({});
const
[
currentChangedValues
,
setCurrentChangedValues
]
=
useState
({});
const
[
englishSuggests
,
setEnglishSuggests
]
=
useState
([]);
const
[
englishSuggests
,
setEnglishSuggests
]
=
useState
([]);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
keywordCondition
,
setKeywordCondition
]
=
useState
({
keyword
:
''
,
needFilter
:
true
});
const
{
keyword
,
needFilter
}
=
keywordCondition
;
const
[
autoTranslate
,
setAutoTranslate
]
=
useState
(
false
);
const
[
autoTranslate
,
setAutoTranslate
]
=
useState
(
false
);
const
[
filterPageCondition
,
setFilterPageCondition
]
=
useState
({
pageNum
:
1
,
pageSize
:
supportMaxAttributeCountPerPage
,
filterData
:
[]
});
const
[
filterPageCondition
,
setFilterPageCondition
]
=
useState
({
pageNum
:
1
,
pageSize
:
supportMaxAttributeCountPerPage
,
filterData
:
[]
});
...
@@ -284,22 +286,17 @@ const ImportActionTable = (props) => {
...
@@ -284,22 +286,17 @@ const ImportActionTable = (props) => {
setFilterPageCondition
({...
filterPageCondition
,
filterData
:
_filterData
});
setFilterPageCondition
({...
filterPageCondition
,
filterData
:
_filterData
});
if
(
_filterData
.
length
>
supportMaxAttributeCountPerPage
)
{
const
_filterPageData
=
paginate
(
_filterData
,
pageNum
,
pageSize
);
setFilterPageData
(
_filterPageData
);
}
else
{
setFilterPageData
(
_filterData
);
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
modelerData
])
},
[
modelerData
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
needFilter
)
{
let
_filterData
=
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
?.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
);
let
_filterData
=
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
?.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
);
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
_filterData
,
pageNum
:
1
}
});
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
_filterData
,
pageNum
:
1
}
});
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
keyword
])
},
[
keyword
Condition
])
useEffect
(()
=>
{
useEffect
(()
=>
{
moveRowRef
.
current
.
pageNum
=
pageNum
;
moveRowRef
.
current
.
pageNum
=
pageNum
;
...
@@ -329,6 +326,9 @@ const ImportActionTable = (props) => {
...
@@ -329,6 +326,9 @@ const ImportActionTable = (props) => {
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
const
iid
=
generateUUID
();
const
iid
=
generateUUID
();
const
newData
=
[...
moveRowRef
.
current
.
data
,
{
iid
}];
const
newData
=
[...
moveRowRef
.
current
.
data
,
{
iid
}];
...
@@ -354,6 +354,8 @@ const ImportActionTable = (props) => {
...
@@ -354,6 +354,8 @@ const ImportActionTable = (props) => {
const
insertToFront
=
(
record
)
=>
{
const
insertToFront
=
(
record
)
=>
{
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
let
newData
=
[...
moveRowRef
.
current
.
data
];
let
newData
=
[...
moveRowRef
.
current
.
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
iid
===
item
.
iid
);
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
iid
===
item
.
iid
);
...
@@ -369,7 +371,13 @@ const ImportActionTable = (props) => {
...
@@ -369,7 +371,13 @@ const ImportActionTable = (props) => {
edit
(
newData
[
index
],
false
);
edit
(
newData
[
index
],
false
);
}
}
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
newData
}});
const
_pageNum
=
parseInt
((
index
+
1
)
/
supportMaxAttributeCountPerPage
)
+
(((
index
+
1
)
%
supportMaxAttributeCountPerPage
===
0
)?
0
:
1
);
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
newData
,
pageNum
:
_pageNum
}});
setTimeout
(()
=>
{
document
.
getElementById
(
`field-
${
iid
}
`
)?.
scrollIntoView
();
},
200
)
}
}
})
})
}
}
...
@@ -377,15 +385,24 @@ const ImportActionTable = (props) => {
...
@@ -377,15 +385,24 @@ const ImportActionTable = (props) => {
const
insertToBack
=
(
record
)
=>
{
const
insertToBack
=
(
record
)
=>
{
save
().
then
(
result
=>
{
save
().
then
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
setKeywordCondition
({
keyword
:
''
,
needFilter
:
false
});
const
newData
=
[...
moveRowRef
.
current
.
data
];
const
newData
=
[...
moveRowRef
.
current
.
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
iid
===
item
.
iid
);
const
index
=
newData
.
findIndex
((
item
)
=>
record
.
iid
===
item
.
iid
);
const
iid
=
generateUUID
();
const
iid
=
generateUUID
();
newData
.
splice
(
index
+
1
,
0
,
{
iid
});
newData
.
splice
(
index
+
1
,
0
,
{
iid
});
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
newData
}});
const
_pageNum
=
parseInt
((
index
+
2
)
/
supportMaxAttributeCountPerPage
)
+
(((
index
+
2
)
%
supportMaxAttributeCountPerPage
===
0
)?
0
:
1
);
setFilterPageCondition
({...
filterPageCondition
,
...{
filterData
:
newData
,
pageNum
:
_pageNum
}});
setInsertIndex
(
index
+
1
);
setInsertIndex
(
index
+
1
);
edit
(
newData
[
index
+
1
],
false
);
edit
(
newData
[
index
+
1
],
false
);
setTimeout
(()
=>
{
document
.
getElementById
(
`field-
${
iid
}
`
)?.
scrollIntoView
();
},
200
)
}
}
})
})
}
}
...
@@ -623,6 +640,7 @@ const ImportActionTable = (props) => {
...
@@ -623,6 +640,7 @@ const ImportActionTable = (props) => {
const
onSuggestChange
=
(
e
)
=>
{
const
onSuggestChange
=
(
e
)
=>
{
form
.
resetFields
();
form
.
setFieldsValue
({
form
.
setFieldsValue
({
...
suggests
[
e
.
target
.
value
]
...
suggests
[
e
.
target
.
value
]
});
});
...
@@ -1074,7 +1092,8 @@ const ImportActionTable = (props) => {
...
@@ -1074,7 +1092,8 @@ const ImportActionTable = (props) => {
const onSearchInputChange = (value) => {
const onSearchInputChange = (value) => {
setEditingKey('');
setEditingKey('');
setKeyword(value||'');
setKeywordCondition({ keyword: value||'', needFilter: true });
}
}
const sourceOnClick = (id) => {
const sourceOnClick = (id) => {
...
@@ -1098,7 +1117,9 @@ const ImportActionTable = (props) => {
...
@@ -1098,7 +1117,9 @@ const ImportActionTable = (props) => {
}
}
}
}
const loadMoreSuggests = () => {
const loadMoreSuggests = (event) => {
event.stopPropagation();
onValuesChange(currentChangedValues, form.getFieldsValue(), suggestOffset);
onValuesChange(currentChangedValues, form.getFieldsValue(), suggestOffset);
}
}
...
...
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