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
11de4519
Commit
11de4519
authored
Aug 03, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
word导入逻辑修改
parent
72e477cb
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
44 deletions
+87
-44
datamodeler.js
src/service/datamodeler.js
+1
-1
constant.js
src/util/constant.js
+3
-2
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+11
-5
ExportDDLModal.jsx
src/view/Manage/Model/Component/ExportDDLModal.jsx
+3
-3
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+25
-19
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+1
-1
ImportWordModal.jsx
src/view/Manage/Model/Component/ImportWordModal.jsx
+1
-1
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+27
-4
ModelTable.less
src/view/Manage/Model/Component/ModelTable.less
+1
-1
index.jsx
src/view/Manage/Model/index.jsx
+14
-7
No files found.
src/service/datamodeler.js
View file @
11de4519
...
...
@@ -130,7 +130,7 @@ export function uploadWordTemplate(payload) {
}
export
function
importWordGenerateModel
(
payload
)
{
return
PostFile
(
"/datamodeler/easyDataModelerExport/word"
,
payload
);
return
PostFile
(
"/datamodeler/easyDataModelerExport/word
/draft
"
,
payload
);
}
export
function
validateDataModel
(
payload
)
{
...
...
src/util/constant.js
View file @
11de4519
...
...
@@ -6,4 +6,5 @@ export const AnchorTimestamp = 'timestamp';
export
const
Action
=
'action'
;
export
const
CatalogId
=
'cid'
;
export
const
ModelerId
=
'mid'
;
export
const
Hints
=
'hints'
;
\ No newline at end of file
export
const
Hints
=
'hints'
;
export
const
ModelerData
=
'mdata'
;
\ No newline at end of file
src/view/Manage/Model/Component/EditModel.jsx
View file @
11de4519
...
...
@@ -4,17 +4,17 @@ import { Form, Button } from 'antd';
import
ImportAction
from
'./ImportAction'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
getQueryParam
,
showMessage
}
from
'../../../../util'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
}
from
'../../../../util/constant'
;
const
EditModel
=
(
props
)
=>
{
const
[
actionData
,
setActionData
]
=
useState
({
action
:
''
,
catalogId
:
''
,
modelerId
:
''
,
hints
:
[]
});
const
[
actionData
,
setActionData
]
=
useState
({
action
:
''
,
catalogId
:
''
,
modelerId
:
''
,
hints
:
[]
,
roughModelerData
:
{}
});
const
[
modelerData
,
setModelerData
]
=
useState
({});
const
[
terms
,
setTerms
]
=
useState
([]);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
{
action
,
catalogId
,
modelerId
,
hints
}
=
actionData
;
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
}
=
actionData
;
const
[
form
]
=
Form
.
useForm
();
...
...
@@ -23,13 +23,19 @@ const EditModel = (props) => {
const
_catalogId
=
getQueryParam
(
CatalogId
,
props
.
location
.
search
);
const
_modelerId
=
getQueryParam
(
ModelerId
,
props
.
location
.
search
);
const
_hintsStr
=
getQueryParam
(
Hints
,
props
.
location
.
search
);
const
_modelerDataStr
=
getQueryParam
(
ModelerData
,
props
.
location
.
search
)
let
_hints
=
[];
if
((
_hintsStr
||
''
)
!==
''
)
{
_hints
=
_hintsStr
.
split
(
','
);
}
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
});
let
_roughModelerData
=
{};
if
((
_modelerDataStr
||
''
)
!==
''
)
{
_roughModelerData
=
JSON
.
parse
(
_modelerDataStr
);
}
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
,
roughModelerData
:
_roughModelerData
});
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
...
...
@@ -141,7 +147,7 @@ const EditModel = (props) => {
</
div
>
<
div
className=
'position-absolute'
style=
{
{
top
:
64
,
width
:
'100%'
}
}
>
<
div
className=
'position-relative'
style=
{
{
margin
:
15
}
}
>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
/>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
roughModelerData=
{
roughModelerData
}
/>
</
div
>
</
div
>
</
div
>
...
...
src/view/Manage/Model/Component/ExportDDLModal.jsx
View file @
11de4519
...
...
@@ -98,7 +98,7 @@ class ExportDDLModal extends React.Component {
this
.
setState
({
loadingDatabases
:
false
,
databases
:
data
,
filterDatabases
:
_filterData
,
currentDatabaseId
:
((
_filterData
||
[]).
length
>
0
)?
_filterData
[
0
].
_id
:
''
},
()
=>
{
if
((
_filterData
||
[]).
length
>
0
)
{
this
.
getSchemas
(
_filterData
[
0
]);
this
.
getSchemas
(
_filterData
[
0
]
?.
_id
);
}
else
{
this
.
setState
({
schemas
:
[],
currentSchemaId
:
''
});
}
...
...
@@ -111,12 +111,12 @@ class ExportDDLModal extends React.Component {
})
}
getSchemas
=
(
db
)
=>
{
getSchemas
=
(
db
Id
)
=>
{
this
.
setState
({
loadingSchemas
:
true
},
()
=>
{
dispatch
({
type
:
'datamodel.getSchemasByDatasourceId'
,
payload
:
{
parentId
:
db
.
_i
d
||
''
parentId
:
db
I
d
||
''
},
callback
:
data
=>
{
this
.
setState
({
loadingSchemas
:
false
,
schemas
:
data
,
currentSchemaId
:
(
data
||
[]).
length
>
0
?
data
[
0
].
_id
:
''
});
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
11de4519
...
...
@@ -8,7 +8,7 @@ import ImportActionIndex from './ImportActionIndex';
import
{
dispatch
}
from
'../../../../model'
;
const
ImportAction
=
(
props
)
=>
{
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
,
ddl
}
=
props
;
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
,
ddl
,
roughModelerData
}
=
props
;
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
constraint
,
setConstraint
]
=
useState
({});
...
...
@@ -21,7 +21,7 @@ const ImportAction = (props) => {
useEffect
(()
=>
{
if
((
action
||
''
)
===
''
||
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
&&
(
ddl
||
''
).
length
===
0
&&
(
modelerId
||
''
)
===
''
))
return
;
if
((
action
||
''
)
===
''
||
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
&&
(
ddl
||
''
).
length
===
0
&&
(
modelerId
||
''
)
===
''
&&
roughModelerData
===
{}
))
return
;
//初始化form状态
if
(
action
===
'add'
||
action
===
'edit'
)
{
...
...
@@ -50,6 +50,8 @@ const ImportAction = (props) => {
getDraftUsingDDL
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
{}
,
ddl
);
}
else
if
((
modelerId
||
''
)
!==
''
)
{
getCurrentDataModel
();
}
else
if
(
roughModelerData
!==
{})
{
getExtraData
(
roughModelerData
);
}
}
else
if
(
action
===
'edit'
||
action
===
'detail'
)
{
getCurrentDataModel
();
...
...
@@ -144,23 +146,7 @@ const ImportAction = (props) => {
callback
:
data
=>
{
setLoading
(
false
);
setModelerData
(
data
||
{});
setConstraint
(
data
.
easyDataModelerModelingConstraint
||
{});
setTemplate
(
data
.
easyDataModelerModelingTemplate
||
{});
onChange
&&
onChange
(
data
||
{});
getSupportedDatatypes
();
if
((
action
===
'add'
&&
((
modelerId
||
''
)
!==
''
))
||
action
===
'edit'
)
{
form
.
setFieldsValue
({
cnName
:
data
.
cnName
||
''
,
name
:
data
.
name
||
''
,
remark
:
data
.
remark
||
''
,
easyDataModelerModelingConstraint
:
data
.
easyDataModelerModelingConstraint
||
''
,
easyDataModelerModelingTemplate
:
data
.
easyDataModelerModelingTemplate
||
''
});
}
validateDataModel
(
data
||
{});
getExtraData
(
data
);
},
error
:
()
=>
{
setLoading
(
false
);
...
...
@@ -168,6 +154,26 @@ const ImportAction = (props) => {
})
}
const
getExtraData
=
(
data
)
=>
{
setModelerData
(
data
||
{});
setConstraint
(
data
.
easyDataModelerModelingConstraint
||
{});
setTemplate
(
data
.
easyDataModelerModelingTemplate
||
{});
onChange
&&
onChange
(
data
||
{});
getSupportedDatatypes
();
if
((
action
===
'add'
&&
((
modelerId
||
''
)
!==
''
))
||
action
===
'edit'
)
{
form
.
setFieldsValue
({
cnName
:
data
.
cnName
||
''
,
name
:
data
.
name
||
''
,
remark
:
data
.
remark
||
''
,
easyDataModelerModelingConstraint
:
data
.
easyDataModelerModelingConstraint
||
''
,
easyDataModelerModelingTemplate
:
data
.
easyDataModelerModelingTemplate
||
''
});
}
validateDataModel
(
data
||
{});
}
const
onConstraintChange
=
(
value
)
=>
{
let
currentConstraint
=
null
;
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
11de4519
...
...
@@ -724,7 +724,7 @@ const ImportActionTable = (props) => {
const
sourceOnClick
=
(
id
)
=>
{
const
timestamp
=
new
Date
().
getTime
();
if
(
id
.
indexOf
(
'Column='
)
)
{
if
(
id
.
split
(
'='
).
length
>=
3
)
{
window
.
open
(
`/center-home/menu/metasearch?id=
${
id
}
×tamp=
${
timestamp
}
`
);
}
else
{
window
.
open
(
`/center-home/menu/datastandard?id=
${
id
}
×tamp=
${
timestamp
}
`
);
...
...
src/view/Manage/Model/Component/ImportWordModal.jsx
View file @
11de4519
...
...
@@ -52,7 +52,7 @@ const ImportWordModal = (props) => {
if
(
reference
===
'stock'
)
{
onCancel
(
true
);
}
else
{
onCancel
(
true
,
data
?.
result
,
data
?.
firstId
);
onCancel
(
false
,
data
||
[]
);
}
}
},
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
11de4519
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
{
Space
,
Button
,
Tooltip
,
Modal
,
Select
,
Input
,
Divider
}
from
'antd'
;
import
{
Space
,
Button
,
Tooltip
,
Modal
,
Select
,
Input
,
Divider
,
Pagination
}
from
'antd'
;
import
{
EditOutlined
,
ReconciliationOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
SmoothScroll
from
'smooth-scroll'
;
import
ProTable
from
"@ant-design/pro-table"
;
import
{
Resizable
}
from
'react-resizable'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
showMessage
,
getQueryParam
,
paginate
}
from
'../../../../util'
;
import
{
AnchorId
,
AnchorTimestamp
}
from
'../../../../util/constant'
;
import
'./ModelTable.less'
;
...
...
@@ -107,6 +107,9 @@ const ModelTable = (props) => {
}
}
]);
const
[
pagination
,
setPagination
]
=
useState
(
{
pageNum
:
1
,
pageSize
:
20
}
);
const
{
pageNum
,
pageSize
}
=
pagination
;
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
...
@@ -117,10 +120,11 @@ const ModelTable = (props) => {
useEffect
(()
=>
{
setPagination
({
pageNum
:
1
,
pageSize
:
20
});
setSelectedRowKeys
([]);
onSelect
&&
onSelect
([]);
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
catalogId
]);
},
[
catalogId
,
keyword
]);
useEffect
(()
=>
{
...
...
@@ -290,6 +294,8 @@ const ModelTable = (props) => {
</
div
>
);
const
_data
=
paginate
(
data
||
[],
pageNum
,
pageSize
);
return
(
<
div
className=
'model-table'
>
<
ProTable
...
...
@@ -301,7 +307,7 @@ const ModelTable = (props) => {
rowSelection=
{
rowSelection
}
columns=
{
columns
||
[]
}
rowKey=
{
'id'
}
dataSource=
{
data
||
[]
}
dataSource=
{
_
data
||
[]
}
pagination=
{
false
}
options=
{
{
density
:
true
,
...
...
@@ -320,6 +326,23 @@ const ModelTable = (props) => {
]
}
sticky
/>
<
Pagination
className=
"text-center mt-3"
showSizeChanger
showQuickJumper
onChange=
{
(
_pageNum
,
_pageSize
)
=>
{
setPagination
({
pageNum
:
_pageNum
,
pageSize
:
_pageSize
||
20
});
}
}
onShowSizeChange=
{
(
_pageNum
,
_pageSize
)
=>
{
setPagination
({
pageNum
:
_pageNum
||
1
,
pageSize
:
_pageSize
});
}
}
current=
{
pageNum
}
pageSize=
{
pageSize
}
defaultCurrent=
{
1
}
total=
{
(
data
||
[]).
length
}
pageSizeOptions=
{
[
10
,
20
]
}
showTotal=
{
total
=>
`共 ${total} 条`
}
/>
{
contextHolder
}
</
div
>
);
...
...
src/view/Manage/Model/Component/ModelTable.less
View file @
11de4519
@import '../../../../variables.less';
.model-table {
.yy-table {
height: calc(100vh - @header-height - @pm-4 - @pm-3 - @pm-3 - 37px - 37px - 48px - @pm-3) !important;
height: calc(100vh - @header-height - @pm-4 - @pm-3 - @pm-3 - 37px - 37px - 48px - @pm-3
- 42px
) !important;
overflow: auto !important;
}
...
...
src/view/Manage/Model/index.jsx
View file @
11de4519
...
...
@@ -13,7 +13,7 @@ import ExportDDLModal from './Component/ExportDDLModal';
import
RecatalogModal
from
'./Component/RecatalogModal'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
}
from
'../../../util/constant'
;
import
{
AppContext
}
from
'../../../App'
;
import
'./index.less'
;
...
...
@@ -344,19 +344,26 @@ class Model extends React.Component {
});
}
onImportWordModalCancel
=
(
refresh
=
false
,
result
=
''
,
id
=
''
)
=>
{
onImportWordModalCancel
=
(
refresh
=
false
,
datas
=
[])
=>
{
const
{
catalogId
}
=
this
.
state
;
this
.
setState
({
importWordModalVisible
:
false
});
refresh
&&
this
.
onTableChange
();
if
((
result
||
''
)
!==
''
)
{
showMessage
(
'info'
,
result
);
}
if
((
datas
||
[]).
length
>
0
)
{
if
((
datas
||
[]).
length
>
5
)
{
showMessage
(
'info'
,
'最多只能同时编辑5条信息'
);
}
if
((
id
||
''
)
!==
''
)
{
setTimeout
(()
=>
{
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=add&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerId
}
=
${
id
}
`
);
datas
.
slice
(
0
,
5
).
forEach
(
data
=>
{
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=add&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerData
}
=
${
JSON
.
stringify
(
data
)}
`
,
'_blank'
);
})
},
1000
);
}
}
...
...
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