Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
524995ac
Commit
524995ac
authored
Apr 16, 2021
by
FE-安焕焕
👣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
附件上传逻辑修改
parent
f3126363
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
index.jsx
src/pages/settleManage/uploadModal/index.jsx
+35
-18
No files found.
src/pages/settleManage/uploadModal/index.jsx
View file @
524995ac
...
...
@@ -14,20 +14,17 @@ export default props => {
const
picUpload
=
useRef
();
const
uploadProps
=
{
name
:
'
file
'
,
async
customRequest
({
file
,
onSuccess
})
{
const
result
=
await
uploadFile
(
file
,
settlementNo
);
if
(
result
.
businessCode
===
'
0000
'
)
{
notification
.
success
({
message
:
'
导入成功
'
});
onSuccess
(
file
);
setFileList
([...
fileList
,
file
]);
}
},
accept
:
'
.xlsx
'
,
showUploadList
:
{
showRemoveIcon
:
false
,
beforeUpload
(
file
)
{
setFileList
([
file
]);
return
false
;
},
accept
:
'
.xlsx,.xls,.csv
'
,
showUploadList
:
true
,
maxCount
:
1
,
fileList
,
onRemove
()
{
setFileList
([]);
},
};
const
initPicUpload
=
()
=>
{
if
(
picUpload
?.
current
?.
clearFileList
)
{
...
...
@@ -38,9 +35,13 @@ export default props => {
initPicUpload
();
setFileList
([]);
},
[
visible
]);
const
uploadFn
=
async
()
=>
{
const
upload
Pic
Fn
=
async
()
=>
{
// 上传图片的接口
const
upLoadFileList
=
picUpload
?.
current
?.
getFileList
?.();
if
(
!
upLoadFileList
.
length
)
{
notification
.
warning
({
message
:
'
请先上传图片
'
});
return
;
}
const
data
=
await
uploadPic
({
imgUrl
:
upLoadFileList
.
join
(
'
,
'
),
settlementNo
,
...
...
@@ -50,6 +51,24 @@ export default props => {
initPicUpload
();
}
};
const
uploadFileFn
=
async
()
=>
{
if
(
!
fileList
.
length
)
{
notification
.
warning
({
message
:
'
请先上传附件
'
});
return
;
}
const
result
=
await
uploadFile
(
fileList
[
0
],
settlementNo
);
if
(
result
.
businessCode
===
'
0000
'
)
{
notification
.
success
({
message
:
'
导入成功
'
});
setFileList
([]);
}
};
const
uploadFn
=
()
=>
{
if
(
tabValue
===
'
1
'
)
{
uploadPicFn
();
}
else
{
uploadFileFn
();
}
};
const
changeTab
=
tabV
=>
{
setTabValue
(
tabV
);
};
...
...
@@ -57,7 +76,7 @@ export default props => {
<
Modal
title=
"上传发票"
visible=
{
visible
}
footer=
{
null
}
onCancel=
{
props
.
onCancel
}
width=
"700px"
>
<
Tabs
defaultActiveKey=
"1"
className=
{
styles
.
tab
}
onChange=
{
changeTab
}
activeKey=
{
tabValue
}
>
<
TabPane
tab=
"上传凭证"
key=
"1"
>
<
UploadC
ref=
{
picUpload
}
accept=
".png,.jpg"
/>
<
UploadC
ref=
{
picUpload
}
accept=
".png,.jpg
,.jpeg,.pdf
"
/>
</
TabPane
>
<
TabPane
tab=
"上传附件"
key=
"2"
>
<
a
...
...
@@ -74,11 +93,9 @@ export default props => {
</
Dragger
>
</
TabPane
>
</
Tabs
>
{
tabValue
===
'
1
'
&&
(
<
Button
type=
"primary"
onClick=
{
uploadFn
}
className=
{
styles
.
logBtn
}
>
确定上传
</
Button
>
)
}
<
Button
type=
"primary"
onClick=
{
uploadFn
}
className=
{
styles
.
logBtn
}
>
{
tabValue
===
'
1
'
?
'
确定上传图片
'
:
'
确定上传附件
'
}
</
Button
>
</
Modal
>
);
};
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