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
062d3703
Commit
062d3703
authored
Apr 22, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模型部分问题
parent
12351124
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
21 deletions
+50
-21
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+25
-10
ImportActionIndex.less
src/view/Manage/Model/Component/ImportActionIndex.less
+8
-0
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+15
-9
ImportActionTable.less
src/view/Manage/Model/Component/ImportActionTable.less
+1
-1
ImportModal.jsx
src/view/Manage/Model/Component/ImportModal.jsx
+1
-1
No files found.
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
062d3703
...
@@ -5,7 +5,7 @@ import { DndProvider, useDrag, useDrop } from 'react-dnd';
...
@@ -5,7 +5,7 @@ import { DndProvider, useDrag, useDrop } from 'react-dnd';
import
{
HTML5Backend
}
from
'react-dnd-html5-backend'
;
import
{
HTML5Backend
}
from
'react-dnd-html5-backend'
;
import
update
from
'immutability-helper'
;
import
update
from
'immutability-helper'
;
import
'./ImportAction
Table
.less'
;
import
'./ImportAction
Index
.less'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -292,10 +292,10 @@ const ImportActionIndex = (props) => {
...
@@ -292,10 +292,10 @@ const ImportActionIndex = (props) => {
const
onAddClick
=
()
=>
{
const
onAddClick
=
()
=>
{
const
new
Data
=
[{
name
:
''
},
...
d
ata
];
const
new
FilterData
=
[{
name
:
''
},
...
filterD
ata
];
onChange
&&
onChange
(
new
Data
);
setFilterData
(
newFilter
Data
);
edit
(
newData
[
0
]);
edit
(
new
Filter
Data
[
0
]);
}
}
const
edit
=
(
record
)
=>
{
const
edit
=
(
record
)
=>
{
...
@@ -319,14 +319,15 @@ const ImportActionIndex = (props) => {
...
@@ -319,14 +319,15 @@ const ImportActionIndex = (props) => {
}
}
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
const
newData
=
[...
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
name
);
const
newFilterData
=
[...
filterData
];
const
index
=
newFilterData
.
findIndex
((
item
)
=>
editingKey
===
item
.
name
);
const
item
=
newData
[
index
];
const
item
=
new
Filter
Data
[
index
];
if
(
!
item
.
name
||
item
.
name
===
''
)
{
if
(
!
item
.
name
||
item
.
name
===
''
)
{
newData
.
splice
(
index
,
1
);
new
Filter
Data
.
splice
(
index
,
1
);
onChange
&&
onChange
(
new
Data
);
setFilterData
(
newFilter
Data
);
}
}
setEditingKey
(
null
);
setEditingKey
(
null
);
...
@@ -342,9 +343,14 @@ const ImportActionIndex = (props) => {
...
@@ -342,9 +343,14 @@ const ImportActionIndex = (props) => {
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
name
);
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
name
);
//判断索引名称是否唯一
//判断索引名称是否唯一
let
_index
;
if
(
index
===
-
1
)
{
_index
=
(
data
||
[]).
findIndex
(
item
=>
item
.
name
===
row
.
name
);
}
else
{
const
newDataExcludeSelf
=
[...
data
];
const
newDataExcludeSelf
=
[...
data
];
newDataExcludeSelf
.
splice
(
index
,
1
);
newDataExcludeSelf
.
splice
(
index
,
1
);
const
_index
=
(
newDataExcludeSelf
||
[]).
findIndex
(
item
=>
item
.
name
===
row
.
name
);
_index
=
(
newDataExcludeSelf
||
[]).
findIndex
(
item
=>
item
.
name
===
row
.
name
);
}
if
(
_index
!==
-
1
)
{
if
(
_index
!==
-
1
)
{
form
.
setFields
([{
name
:
'name'
,
errors
:
[
'索引名称不能重复'
]
}]);
form
.
setFields
([{
name
:
'name'
,
errors
:
[
'索引名称不能重复'
]
}]);
...
@@ -369,12 +375,21 @@ const ImportActionIndex = (props) => {
...
@@ -369,12 +375,21 @@ const ImportActionIndex = (props) => {
return
;
return
;
}
}
if
(
index
===
-
1
)
{
newData
.
splice
(
0
,
0
,
{
name
:
row
.
name
,
unique
:
row
.
unique
,
indexedEasyDataModelAttributes
:
_indexedEasyDataModelAttributes
,
indexedAttributeOrders
:
_indexedAttributeOrders
,
});
}
else
{
newData
.
splice
(
index
,
1
,
{...{
newData
.
splice
(
index
,
1
,
{...{
name
:
row
.
name
,
name
:
row
.
name
,
unique
:
row
.
unique
,
unique
:
row
.
unique
,
indexedEasyDataModelAttributes
:
_indexedEasyDataModelAttributes
,
indexedEasyDataModelAttributes
:
_indexedEasyDataModelAttributes
,
indexedAttributeOrders
:
_indexedAttributeOrders
,
indexedAttributeOrders
:
_indexedAttributeOrders
,
}});
}});
}
onChange
&&
onChange
(
newData
,
true
);
onChange
&&
onChange
(
newData
,
true
);
...
...
src/view/Manage/Model/Component/ImportActionIndex.less
0 → 100644
View file @
062d3703
.model-import-action-index {
.yy-table {
max-height: 200px !important;
overflow: auto !important;
}
}
\ No newline at end of file
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
062d3703
...
@@ -129,7 +129,7 @@ const EditableCell = ({
...
@@ -129,7 +129,7 @@ const EditableCell = ({
valuePropName=
{
(
inputType
===
'check'
)?
'checked'
:
'value'
}
valuePropName=
{
(
inputType
===
'check'
)?
'checked'
:
'value'
}
rules=
{
[
rules=
{
[
{
{
required
:
(
inputType
===
'text'
&&
dataIndex
!==
'remark'
),
required
:
(
inputType
===
'text'
),
message
:
`请输入${colTitle}!`
,
message
:
`请输入${colTitle}!`
,
},
},
]
}
]
}
...
@@ -249,10 +249,10 @@ const ImportActionTable = (props) => {
...
@@ -249,10 +249,10 @@ const ImportActionTable = (props) => {
const
onAddClick
=
()
=>
{
const
onAddClick
=
()
=>
{
const
new
Data
=
[{
iid
:
generateUUID
()},
...
d
ata
];
const
new
FilterData
=
[{
iid
:
generateUUID
()},
...
filterD
ata
];
onChange
&&
onChange
(
new
Data
);
setFilterData
(
newFilter
Data
);
edit
(
newData
[
0
]);
edit
(
new
Filter
Data
[
0
]);
}
}
const
edit
=
(
record
)
=>
{
const
edit
=
(
record
)
=>
{
...
@@ -274,14 +274,14 @@ const ImportActionTable = (props) => {
...
@@ -274,14 +274,14 @@ const ImportActionTable = (props) => {
}
}
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
const
new
Data
=
[...
d
ata
];
const
new
FilterData
=
[...
filterD
ata
];
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
const
index
=
new
Filter
Data
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
const
item
=
newData
[
index
];
const
item
=
new
Filter
Data
[
index
];
if
(
!
item
.
name
||
item
.
name
===
''
)
{
if
(
!
item
.
name
||
item
.
name
===
''
)
{
newData
.
splice
(
index
,
1
);
new
Filter
Data
.
splice
(
index
,
1
);
onChange
&&
onChange
(
new
Data
);
setFilterData
(
newFilter
Data
);
}
}
setEditingKey
(
''
);
setEditingKey
(
''
);
...
@@ -307,8 +307,14 @@ const ImportActionTable = (props) => {
...
@@ -307,8 +307,14 @@ const ImportActionTable = (props) => {
const
newData
=
[...
data
];
const
newData
=
[...
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
if
(
index
===
-
1
)
{
newData
.
splice
(
0
,
0
,
row
);
}
else
{
const
item
=
newData
[
index
];
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
});
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
});
}
onChange
&&
onChange
(
newData
,
true
);
onChange
&&
onChange
(
newData
,
true
);
...
...
src/view/Manage/Model/Component/ImportActionTable.less
View file @
062d3703
.model-import-action-table {
.model-import-action-table {
.yy-table {
.yy-table {
max-height:
5
00px !important;
max-height:
4
00px !important;
overflow: auto !important;
overflow: auto !important;
}
}
...
...
src/view/Manage/Model/Component/ImportModal.jsx
View file @
062d3703
...
@@ -110,7 +110,7 @@ const ImportModal = (props) => {
...
@@ -110,7 +110,7 @@ const ImportModal = (props) => {
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
reset
();
reset
();
onCancel
&&
onCancel
();
onCancel
&&
onCancel
(
false
);
}
}
const
save
=
async
()
=>
{
const
save
=
async
()
=>
{
...
...
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