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
1e0e1b61
Commit
1e0e1b61
authored
Apr 22, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加模型索引
parent
5736f07a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
18 deletions
+71
-18
AssetBin.jsx
src/view/Manage/AssetManage/components/AssetBin.jsx
+0
-0
AssetTable.jsx
src/view/Manage/AssetManage/components/AssetTable.jsx
+6
-2
ImportElement.jsx
src/view/Manage/AssetManage/components/ImportElement.jsx
+1
-1
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+48
-6
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+0
-0
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+15
-8
ImportModal.jsx
src/view/Manage/Model/Component/ImportModal.jsx
+1
-1
No files found.
src/view/Manage/AssetManage/components/AssetBin.jsx
deleted
100644 → 0
View file @
5736f07a
src/view/Manage/AssetManage/components/AssetTable.jsx
View file @
1e0e1b61
...
@@ -9,7 +9,7 @@ import AssetModal from "./AssetModal"
...
@@ -9,7 +9,7 @@ import AssetModal from "./AssetModal"
import
AssetDetail
from
"./AssetDetail"
import
AssetDetail
from
"./AssetDetail"
import
AssetItem
from
'./AssetItem'
;
import
AssetItem
from
'./AssetItem'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../../util'
;
import
"./AssetTable.less"
;
import
"./AssetTable.less"
;
...
@@ -205,8 +205,12 @@ const AssetTable = (props) =>{
...
@@ -205,8 +205,12 @@ const AssetTable = (props) =>{
refresh
&&
getTable
();
refresh
&&
getTable
();
}
}
const
onImportElementVisibleChange
=
(
visible
=
false
)
=>
{
const
onImportElementVisibleChange
=
(
visible
=
false
,
tip
=
''
)
=>
{
setImportElementVisible
(
visible
);
setImportElementVisible
(
visible
);
if
(
tip
&&
tip
!==
''
)
{
showNotifaction
(
'导入提示'
,
tip
,
5
);
}
}
}
const
onFilterElementVisibleChange
=
(
visible
=
false
,
refresh
=
false
)
=>
{
const
onFilterElementVisibleChange
=
(
visible
=
false
,
refresh
=
false
)
=>
{
...
...
src/view/Manage/AssetManage/components/ImportElement.jsx
View file @
1e0e1b61
...
@@ -46,7 +46,7 @@ const ImportElement = (props) => {
...
@@ -46,7 +46,7 @@ const ImportElement = (props) => {
callback
:
data
=>
{
callback
:
data
=>
{
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
reset
();
reset
();
onCancel
&&
onCancel
();
onCancel
&&
onCancel
(
false
,
data
);
},
},
error
:
()
=>
{
error
:
()
=>
{
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
1e0e1b61
...
@@ -3,7 +3,7 @@ import { Select } from 'antd';
...
@@ -3,7 +3,7 @@ import { Select } from 'antd';
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
{
dispatchLatest
,
dispatch
}
from
'../../../../model'
;
import
{
dispatchLatest
,
dispatch
}
from
'../../../../model'
;
...
@@ -82,8 +82,11 @@ const ImportAction = (props) => {
...
@@ -82,8 +82,11 @@ const ImportAction = (props) => {
data
data
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setModelerData
({...
modelerData
,
easyDataModelerDataModelAttributes
:
[...
data
.
easyDataModelerDataModelAttributes
]
})
let
newModelerData
=
{...(
data
||
{})};
onChange
&&
onChange
(
data
||
{});
newModelerData
=
{
...
newModelerData
,
easyDataModelerIndices
:
getIndicesWhenTableChange
(
newModelerData
)
}
setModelerData
(
newModelerData
)
onChange
&&
onChange
(
newModelerData
);
}
}
})
})
}
}
...
@@ -149,6 +152,7 @@ const ImportAction = (props) => {
...
@@ -149,6 +152,7 @@ const ImportAction = (props) => {
});
});
const
newModelerData
=
{...
modelerData
,
easyDataModelerModelingTemplate
:
currentTemplate
};
const
newModelerData
=
{...
modelerData
,
easyDataModelerModelingTemplate
:
currentTemplate
};
setModelerData
(
newModelerData
)
setModelerData
(
newModelerData
)
onChange
&&
onChange
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
...
@@ -168,8 +172,10 @@ const ImportAction = (props) => {
...
@@ -168,8 +172,10 @@ const ImportAction = (props) => {
//validate 是否需要对字段进行校验
//validate 是否需要对字段进行校验
const
onTableChange
=
(
data
,
validate
=
false
)
=>
{
const
onTableChange
=
(
data
,
validate
=
false
)
=>
{
const
newModelerData
=
{...
modelerData
,
easyDataModelerDataModelAttributes
:
data
};
let
newModelerData
=
{...
modelerData
,
...{
easyDataModelerDataModelAttributes
:
data
}
};
newModelerData
=
{
...
newModelerData
,
easyDataModelerIndices
:
getIndicesWhenTableChange
(
newModelerData
)
};
setModelerData
(
newModelerData
);
setModelerData
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
...
@@ -190,6 +196,35 @@ const ImportAction = (props) => {
...
@@ -190,6 +196,35 @@ const ImportAction = (props) => {
})
})
}
}
const
onIndexChange
=
(
data
)
=>
{
const
newModelerData
=
{...
modelerData
,
easyDataModelerIndices
:
data
};
setModelerData
(
newModelerData
);
onChange
&&
onChange
(
newModelerData
);
}
const
getIndicesWhenTableChange
=
(
newModelerData
)
=>
{
const
newEasyDataModelerIndices
=
[...(
newModelerData
.
easyDataModelerIndices
||
[])];
(
newModelerData
.
easyDataModelerIndices
||
[]).
forEach
((
easyDataModelerIndex
,
index
)
=>
{
const
newIndexedEasyDataModelAttributes
=
[],
newIndexedAttributeOrders
=
[];
(
easyDataModelerIndex
.
indexedEasyDataModelAttributes
||
[]).
forEach
((
indexedEasyDataModelAttribute
,
_index
)
=>
{
const
__index
=
(
newModelerData
.
easyDataModelerDataModelAttributes
||
[]).
findIndex
(
item
=>
item
.
iid
===
indexedEasyDataModelAttribute
.
iid
);
if
(
__index
!==
-
1
)
{
newIndexedEasyDataModelAttributes
.
push
({...
newModelerData
.
easyDataModelerDataModelAttributes
[
__index
]});
newIndexedAttributeOrders
.
push
(
easyDataModelerIndex
.
indexedAttributeOrders
[
_index
]);
}
})
const
item
=
newEasyDataModelerIndices
[
index
];
newEasyDataModelerIndices
.
splice
(
index
,
1
,
{...
item
,
...{
indexedEasyDataModelAttributes
:
newIndexedEasyDataModelAttributes
,
indexedAttributeOrders
:
newIndexedAttributeOrders
}}
)
})
return
newEasyDataModelerIndices
.
filter
(
item
=>
(
item
.
indexedEasyDataModelAttributes
||
[]).
length
>
0
);
}
return
(
return
(
<>
<>
{
{
...
@@ -219,8 +254,15 @@ const ImportAction = (props) => {
...
@@ -219,8 +254,15 @@ const ImportAction = (props) => {
validateReports=
{
validateReports
}
validateReports=
{
validateReports
}
supportedDatatypes=
{
supportedDatatypes
}
supportedDatatypes=
{
supportedDatatypes
}
onChange=
{
onTableChange
}
onChange=
{
onTableChange
}
editable=
{
action
!==
'detail'
}
/>
editable=
{
action
!==
'detail'
}
{
/* <ImportActionIndex data={indexData} fileds={fileds} onChange={onIndexChange} editable={action!=='detail'} /> */
}
/>
<
ImportActionIndex
modelerData=
{
modelerData
||
{}
}
constraint=
{
constraint
}
template=
{
template
}
onChange=
{
onIndexChange
}
editable=
{
action
!==
'detail'
}
/>
</>
</>
);
);
};
};
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
1e0e1b61
This diff is collapsed.
Click to expand it.
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
1e0e1b61
...
@@ -220,7 +220,7 @@ const DragableBodyRow = ({ index, moveRow, className, style, ...restProps }) =>
...
@@ -220,7 +220,7 @@ const DragableBodyRow = ({ index, moveRow, className, style, ...restProps }) =>
const
ImportActionTable
=
(
props
)
=>
{
const
ImportActionTable
=
(
props
)
=>
{
const
{
modelerData
,
onChange
,
editable
,
supportedDatatypes
,
constraint
,
template
,
validateReports
}
=
props
;
const
{
modelerData
,
onChange
,
editable
,
supportedDatatypes
,
constraint
,
template
,
validateReports
}
=
props
;
const
data
=
modelerData
.
easyDataModelerDataModelAttributes
||
[]
;
const
[
data
,
setData
]
=
useState
([])
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
editingKey
,
setEditingKey
]
=
useState
(
''
);
const
[
editingKey
,
setEditingKey
]
=
useState
(
''
);
...
@@ -228,6 +228,9 @@ const ImportActionTable = (props) => {
...
@@ -228,6 +228,9 @@ const ImportActionTable = (props) => {
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
[
filterData
,
setFilterData
]
=
useState
([]);
const
onChangeRef
=
useRef
();
onChangeRef
.
current
=
onChange
;
//规则改变的时候 数据表为可编辑状态
//规则改变的时候 数据表为可编辑状态
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -236,6 +239,7 @@ const ImportActionTable = (props) => {
...
@@ -236,6 +239,7 @@ const ImportActionTable = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
setData
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]);
setFilterData
((
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
));
setFilterData
((
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
filter
(
item
=>
(
item
.
name
||
''
).
indexOf
(
keyword
)
!==-
1
||
(
item
.
cnName
).
indexOf
(
keyword
)
!==-
1
));
},
[
modelerData
,
keyword
])
},
[
modelerData
,
keyword
])
...
@@ -287,14 +291,17 @@ const ImportActionTable = (props) => {
...
@@ -287,14 +291,17 @@ const ImportActionTable = (props) => {
try
{
try
{
const
row
=
await
form
.
validateFields
();
const
row
=
await
form
.
validateFields
();
if
((
row
.
datatype
.
name
||
''
)
===
''
)
{
form
.
setFields
([{
name
:
'datatype'
,
errors
:
[
'必须选择类型'
]
}]);
return
;
}
(
row
.
datatype
.
parameterNames
||
[]).
forEach
((
parameterName
,
index
)
=>
{
(
row
.
datatype
.
parameterNames
||
[]).
forEach
((
parameterName
,
index
)
=>
{
if
(
!
row
.
datatype
.
parameterValues
[
index
]
||
row
.
datatype
.
parameterValues
[
index
]
===
''
)
{
if
(
!
row
.
datatype
.
parameterValues
[
index
]
||
row
.
datatype
.
parameterValues
[
index
]
===
''
)
{
row
.
datatype
.
parameterValues
[
index
]
=
0
;
row
.
datatype
.
parameterValues
[
index
]
=
0
;
}
}
})
})
// console.log('row', row);
const
newData
=
[...
data
];
const
newData
=
[...
data
];
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
const
index
=
newData
.
findIndex
((
item
)
=>
editingKey
===
item
.
iid
);
...
@@ -392,7 +399,7 @@ const ImportActionTable = (props) => {
...
@@ -392,7 +399,7 @@ const ImportActionTable = (props) => {
dataIndex
:
'nullable'
,
dataIndex
:
'nullable'
,
editable
:
true
,
editable
:
true
,
render
:
(
nullable
,
record
,
index
)
=>
{
render
:
(
nullable
,
record
,
index
)
=>
{
if
(
nullable
===
fals
e
)
{
if
(
!
nullabl
e
)
{
return
'否'
;
return
'否'
;
}
else
if
(
nullable
===
true
)
{
}
else
if
(
nullable
===
true
)
{
return
'是'
;
return
'是'
;
...
@@ -407,7 +414,7 @@ const ImportActionTable = (props) => {
...
@@ -407,7 +414,7 @@ const ImportActionTable = (props) => {
dataIndex
:
'partOfPrimaryKey'
,
dataIndex
:
'partOfPrimaryKey'
,
editable
:
true
,
editable
:
true
,
render
:
(
partOfPrimaryKey
,
record
,
index
)
=>
{
render
:
(
partOfPrimaryKey
,
record
,
index
)
=>
{
if
(
partOfPrimaryKey
===
false
)
{
if
(
!
partOfPrimaryKey
)
{
return
'否'
;
return
'否'
;
}
else
if
(
partOfPrimaryKey
===
true
)
{
}
else
if
(
partOfPrimaryKey
===
true
)
{
return
'是'
;
return
'是'
;
...
@@ -422,7 +429,7 @@ const ImportActionTable = (props) => {
...
@@ -422,7 +429,7 @@ const ImportActionTable = (props) => {
dataIndex
:
'partOfDistributionKey'
,
dataIndex
:
'partOfDistributionKey'
,
editable
:
true
,
editable
:
true
,
render
:
(
partOfDistributionKey
,
record
,
index
)
=>
{
render
:
(
partOfDistributionKey
,
record
,
index
)
=>
{
if
(
partOfDistributionKey
===
false
)
{
if
(
!
partOfDistributionKey
)
{
return
'否'
;
return
'否'
;
}
else
if
(
partOfDistributionKey
===
true
)
{
}
else
if
(
partOfDistributionKey
===
true
)
{
return
'是'
;
return
'是'
;
...
@@ -574,7 +581,7 @@ const ImportActionTable = (props) => {
...
@@ -574,7 +581,7 @@ const ImportActionTable = (props) => {
],
],
});
});
onChange
&&
onChange
(
newData
);
onChange
Ref
.
current
&&
onChangeRef
.
current
(
newData
);
},
},
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
[
data
],
...
@@ -665,7 +672,7 @@ const ImportActionTable = (props) => {
...
@@ -665,7 +672,7 @@ const ImportActionTable = (props) => {
</>
</>
),
),
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
{
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
{
return
<></>
;
return
null
;
},
},
rowExpandable
:
record
=>
(
editingKey
!==
''
&&
(
suggests
||
[]).
length
>
0
),
rowExpandable
:
record
=>
(
editingKey
!==
''
&&
(
suggests
||
[]).
length
>
0
),
expandedRowKeys
:
[
editingKey
]
expandedRowKeys
:
[
editingKey
]
...
...
src/view/Manage/Model/Component/ImportModal.jsx
View file @
1e0e1b61
...
@@ -110,7 +110,7 @@ const ImportModal = (props) => {
...
@@ -110,7 +110,7 @@ const ImportModal = (props) => {
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
reset
();
reset
();
onCancel
&&
onCancel
(
true
);
onCancel
&&
onCancel
();
}
}
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