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
3ca37456
Commit
3ca37456
authored
Oct 19, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型主页面调整
parent
8bf3bfa0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
214 additions
and
146 deletions
+214
-146
ImportExcel.jsx
src/view/Manage/Model/Component/ImportExcel.jsx
+30
-14
ImportModal.jsx
src/view/Manage/Model/Component/ImportModal.jsx
+94
-36
ImportWord.jsx
src/view/Manage/Model/Component/ImportWord.jsx
+48
-0
ImportWordModal.jsx
src/view/Manage/Model/Component/ImportWordModal.jsx
+0
-91
ModelTable.less
src/view/Manage/Model/Component/ModelTable.less
+4
-0
index.jsx
src/view/Manage/Model/index.jsx
+0
-0
index.less
src/view/Manage/Model/index.less
+38
-5
No files found.
src/view/Manage/Model/Component/ImportExcel.jsx
View file @
3ca37456
import
React
from
'react'
;
import
{
Button
,
Upload
}
from
'antd'
;
import
{
Button
,
Upload
,
Form
,
Row
,
Col
}
from
'antd'
;
import
{
DownloadOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
class
ImportExcel
extends
React
.
Component
{
...
...
@@ -50,20 +50,36 @@ class ImportExcel extends React.Component {
};
return
(
<>
<
div
>
<
Button
icon=
{
<
DownloadOutlined
/>
}
onClick=
{
this
.
downloadTemplate
}
>
模版下载
</
Button
>
</
div
>
<
div
className=
'mt-3'
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
选择文件上传
<
Form
.
Item
name=
'upload'
label=
'文件上传'
>
<
Row
>
<
Col
span=
{
9
}
>
<
Form
.
Item
noStyle
rules=
{
[
{
required
:
true
,
message
:
'请选择文件上传'
,
},
]
}
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
选择文件上传
</
Button
>
</
Upload
>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
6
}
>
<
Button
icon=
{
<
DownloadOutlined
/>
}
onClick=
{
this
.
downloadTemplate
}
>
模版下载
</
Button
>
</
Upload
>
</
div
>
</>
</
Col
>
</
Row
>
</
Form
.
Item
>
)
}
}
...
...
src/view/Manage/Model/Component/ImportModal.jsx
View file @
3ca37456
import
React
,
{
useState
}
from
'react'
;
import
{
Modal
,
Button
}
from
'antd'
;
import
{
Modal
,
Button
,
Form
,
Radio
}
from
'antd'
;
import
ImportWord
from
'./ImportWord'
;
import
ImportExcel
from
'./ImportExcel'
;
import
ImportExcelCopy
from
'./ImportExcelCopy'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
const
importModes
=
[
{
name
:
'Word导入'
,
key
:
'word'
},
{
name
:
'Excel导入'
,
key
:
'excel'
},
{
name
:
'Excel复制粘贴'
,
key
:
'excel-copy'
},
]
const
ImportModal
=
(
props
)
=>
{
const
{
visible
,
onCancel
,
addMode
}
=
props
;
const
{
catalogId
,
visible
,
onCancel
}
=
props
;
const
[
excelFiles
,
setExcelFiles
]
=
useState
([]);
const
[
modeKey
,
setModeKey
]
=
useState
(
''
);
const
[
files
,
setFiles
]
=
useState
([]);
const
[
hints
,
setHints
]
=
useState
([]);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
onOk
=
()
=>
{
if
(
addMode
===
'excel'
)
{
if
((
excelFiles
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先选择文件上传'
);
const
[
form
]
=
Form
.
useForm
();
const
onModeChange
=
(
e
)
=>
{
setModeKey
(
e
.
target
?.
value
);
}
const
onOk
=
async
()
=>
{
if
(
modeKey
===
''
)
{
form
.
setFields
([{
name
:
'mode'
,
errors
:
[
'请选择导入方式'
]
}]);
return
;
}
if
(
modeKey
===
'word'
)
{
if
((
files
||
[]).
length
===
0
)
{
form
.
setFields
([{
name
:
'upload'
,
errors
:
[
'请选择文件上传'
]
}]);
}
else
{
setConfirmLoading
(
true
);
dispatchLatest
({
type
:
'datamodel.importWordGenerateModelDraft'
,
payload
:
{
params
:
{
catalogId
,
},
files
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
reset
();
onCancel
&&
onCancel
(
true
,
[],
data
||
{});
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
});
}
}
else
if
(
modeKey
===
'excel'
)
{
if
((
files
||
[]).
length
===
0
)
{
form
.
setFields
([{
name
:
'upload'
,
errors
:
[
'请选择文件上传'
]
}]);
}
else
{
setConfirmLoading
(
true
);
dispatchLatest
({
type
:
'datamodel.extractExcelContent'
,
payload
:
{
fileList
:
excelF
iles
},
payload
:
{
fileList
:
f
iles
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
onCancel
&&
onCancel
(
data
||
[]);
onCancel
&&
onCancel
(
false
,
data
||
[]);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
...
...
@@ -33,17 +79,14 @@ const ImportModal = (props) => {
})
}
return
;
}
else
if
(
addMode
===
'excel-copy'
)
{
}
else
if
(
modeKey
===
'excel-copy'
)
{
if
((
hints
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先从Excel文件中复制内容'
);
}
else
{
onCancel
&&
onCancel
(
hints
||
[]);
onCancel
&&
onCancel
(
false
,
hints
||
[]);
}
return
;
}
}
...
...
@@ -53,28 +96,24 @@ const ImportModal = (props) => {
}
const
reset
=
()
=>
{
setExcelFiles
([]);
setModeKey
(
''
);
setFiles
([]);
setHints
([]);
setConfirmLoading
(
false
);
}
const
onImportWordChange
=
(
files
)
=>
{
setFiles
(
files
||
[]);
}
const
onImportExcelChange
=
(
files
)
=>
{
set
Excel
Files
(
files
||
[]);
setFiles
(
files
||
[]);
}
const
onImportExcelCopyChange
=
(
data
)
=>
{
setHints
(
data
||
[]);
}
let
title
=
''
;
if
(
addMode
===
'excel'
)
{
title
=
'Excel导入'
;
}
else
if
(
addMode
===
'excel-copy'
)
{
title
=
'Excel复制粘贴导入'
;
}
else
if
(
addMode
===
'ddl'
)
{
title
=
'DDL导入'
;
}
const
footer
=
[
<
Button
key=
"0"
...
...
@@ -97,21 +136,40 @@ const ImportModal = (props) => {
<
Modal
forceRender
visible=
{
visible
}
title=
{
title
}
title=
'模型导入'
width=
{
520
}
onCancel=
{
cancel
}
footer=
{
footer
}
>
{
addMode
===
'excel'
&&
(
<
ImportExcel
onChange=
{
onImportExcelChange
}
{
...
props
}
/>
)
}
{
addMode
===
'excel-copy'
&&
(
<
ImportExcelCopy
onChange=
{
onImportExcelCopyChange
}
{
...
props
}
/>
)
}
<
Form
form=
{
form
}
>
<
Form
.
Item
name=
'mode'
label=
'导入方式'
>
<
Radio
.
Group
onChange=
{
onModeChange
}
value=
{
modeKey
}
>
{
importModes
.
map
((
item
,
index
)
=>
{
return
<
Radio
value=
{
item
.
key
}
key=
{
index
}
>
{
item
.
name
}
</
Radio
>;
})
}
</
Radio
.
Group
>
</
Form
.
Item
>
{
modeKey
===
'word'
&&
(
<
ImportWord
onChange=
{
onImportWordChange
}
{
...
props
}
/>
)
}
{
modeKey
===
'excel'
&&
(
<
ImportExcel
onChange=
{
onImportExcelChange
}
{
...
props
}
/>
)
}
{
modeKey
===
'excel-copy'
&&
(
<
ImportExcelCopy
onChange=
{
onImportExcelCopyChange
}
{
...
props
}
/>
)
}
</
Form
>
</
Modal
>
)
}
...
...
src/view/Manage/Model/Component/ImportWord.jsx
0 → 100644
View file @
3ca37456
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Button
,
Upload
,
Form
}
from
'antd'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
const
ImportWord
=
(
props
)
=>
{
const
{
onChange
,
visible
}
=
props
;
const
[
fileList
,
setFileList
]
=
useState
([]);
useEffect
(()
=>
{
setFileList
([]);
},
[
visible
])
const
uploadProps
=
{
onRemove
:
file
=>
{
const
index
=
fileList
.
indexOf
(
file
);
const
newFileList
=
fileList
.
slice
();
newFileList
.
splice
(
index
,
1
);
onChange
&&
onChange
(
newFileList
);
setFileList
(
newFileList
);
},
beforeUpload
:
file
=>
{
setFileList
([
file
]);
return
false
;
},
fileList
:
fileList
||
[],
accept
:
".doc,.docx"
,
};
return
(
<
Form
.
Item
name=
'upload'
label=
'文件上传'
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
选择文件上传
</
Button
>
</
Upload
>
</
Form
.
Item
>
)
}
export
default
ImportWord
;
\ No newline at end of file
src/view/Manage/Model/Component/ImportWordModal.jsx
deleted
100644 → 0
View file @
8bf3bfa0
import
React
,
{
useState
}
from
'react'
;
import
{
Button
,
Upload
,
Modal
}
from
'antd'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
const
ImportWordModal
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
catalogId
}
=
props
;
const
[
fileList
,
setFileList
]
=
useState
([]);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
uploadProps
=
{
onRemove
:
file
=>
{
const
index
=
fileList
.
indexOf
(
file
);
const
newFileList
=
fileList
.
slice
();
newFileList
.
splice
(
index
,
1
);
setFileList
(
newFileList
);
},
beforeUpload
:
file
=>
{
setFileList
([
file
]);
return
false
;
},
fileList
:
fileList
||
[],
accept
:
".doc,.docx"
,
};
const
handleOk
=
()
=>
{
if
((
fileList
||
[]).
length
===
0
)
{
showMessage
(
'info'
,
'请先选择Word文件上传'
);
return
;
}
setConfirmLoading
(
true
);
dispatchLatest
({
type
:
'datamodel.importWordGenerateModelDraft'
,
payload
:
{
params
:
{
catalogId
,
},
fileList
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
reset
();
if
(
onCancel
)
{
onCancel
(
true
,
data
||
[]);
}
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
}
const
reset
=
()
=>
{
setConfirmLoading
(
false
);
setFileList
([]);
}
return
(
<
Modal
forceRender
visible=
{
visible
}
title=
'Word导入'
width=
{
520
}
confirmLoading=
{
confirmLoading
}
onCancel=
{
()
=>
{
reset
();
onCancel
&&
onCancel
();
}
}
onOk=
{
handleOk
}
>
<
div
className=
'mt-3'
>
<
span
className=
'mr-3'
>
Word上传:
</
span
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
选择文件上传
</
Button
>
</
Upload
>
</
div
>
</
Modal
>
)
}
export
default
ImportWordModal
;
\ No newline at end of file
src/view/Manage/Model/Component/ModelTable.less
View file @
3ca37456
...
...
@@ -5,6 +5,10 @@
overflow: auto !important;
}
.yy-table-thead > tr > th {
background-color: #F2F5FC !important;
}
.yy-pro-table {
.yy-card-body {
padding: 0 !important;
...
...
src/view/Manage/Model/index.jsx
View file @
3ca37456
This diff is collapsed.
Click to expand it.
src/view/Manage/Model/index.less
View file @
3ca37456
.data-model {
display: flex;
background-color: #
F0F2F5
;
background-color: #
fff
;
height: 100%;
.left {
width: 230px;
background-color: #fff;
margin-right: 10px;
border-right: 1px solid #EFEFEF;
overflow: hidden;
}
.tree-toggle-wrap {
position: relative;
width: 20px;
height: calc(100vh - 94px);
.tree-toggle {
display: flex;
justify-content: center;
align-items: center;
left: 0;
right: 0;
background: #f2f5fc;
position: absolute;
top: calc(50% - 40px);
width: 12px;
height: 80px;
border-radius: 0 12px 12px 0;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
cursor: pointer;
}
}
.right {
width: calc(100% - 250px);
}
}
.data-model-collapse {
.left {
width: 0;
}
.right {
width:calc(100% - 240px);
background-color: #fff;
width: calc(100% - 20px);
}
}
\ No newline at end of file
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