Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0c3578b0
authored
Mar 28, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复导入文件bug
1 parent
89ebfc33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
src/views/user/import.vue
src/views/user/index.vue
src/views/user/select.vue
src/views/user/import.vue
View file @
0c3578b
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<el-button
slot=
"append"
>
选择文件
</el-button>
<el-button
slot=
"append"
>
选择文件
</el-button>
</el-input>
</el-input>
<!-- 隐藏上传文件按钮 开始 -->
<!-- 隐藏上传文件按钮 开始 -->
<el-upload
ref=
"uploadBox"
class=
"upload_box"
:auto-upload=
"false"
:headers=
"uploadHead"
:accept=
"acceptFile"
:data=
"uploadParams"
:action=
"uploadPath"
multiple
:
limit=
"1"
:show-file-list=
"false"
:on-change=
"onChange"
:on-success=
"onSuccess"
:before-upload=
"beforeUpload
"
>
<el-upload
ref=
"uploadBox"
class=
"upload_box"
:auto-upload=
"false"
:headers=
"uploadHead"
:accept=
"acceptFile"
:data=
"uploadParams"
:action=
"uploadPath"
multiple
:
show-file-list=
"false"
:on-change=
"onChange"
:on-success=
"onSuccess"
:before-upload=
"beforeUpload"
:on-error=
"onError"
:file-list=
"fileList
"
>
<el-button
type=
"primary"
>
点击上传
</el-button>
<el-button
type=
"primary"
>
点击上传
</el-button>
</el-upload>
</el-upload>
<!-- 隐藏上传文件按钮 end -->
<!-- 隐藏上传文件按钮 end -->
...
@@ -66,6 +66,7 @@ export default {
...
@@ -66,6 +66,7 @@ export default {
uploadParams
:
{},
uploadParams
:
{},
uploadResult
:
{},
uploadResult
:
{},
acceptFile
:
".xlsx,.xls"
,
acceptFile
:
".xlsx,.xls"
,
fileList
:
[],
};
};
},
},
mounted
()
{
mounted
()
{
...
@@ -78,9 +79,13 @@ export default {
...
@@ -78,9 +79,13 @@ export default {
},
},
methods
:
{
methods
:
{
// 监听文件选择
// 监听文件选择
onChange
(
file
)
{
onChange
(
file
,
fileList
)
{
console
.
log
(
"文件:"
,
file
);
console
.
log
(
file
);
this
.
uploadFile
=
file
;
console
.
log
(
fileList
);
if
(
!
file
.
response
)
{
this
.
uploadFile
=
file
;
this
.
fileList
=
[
file
];
}
},
},
// 下载失败文件
// 下载失败文件
...
@@ -94,6 +99,11 @@ export default {
...
@@ -94,6 +99,11 @@ export default {
this
.
uploadResult
=
{};
this
.
uploadResult
=
{};
},
},
// 文件上传失败
onError
(
err
,
file
,
fileList
)
{
console
.
log
(
err
);
},
// 监听文件上传成功
// 监听文件上传成功
onSuccess
(
response
,
file
,
fileList
)
{
onSuccess
(
response
,
file
,
fileList
)
{
console
.
log
(
response
);
console
.
log
(
response
);
...
@@ -104,6 +114,8 @@ export default {
...
@@ -104,6 +114,8 @@ export default {
showToast
({
showToast
({
message
:
response
.
message
,
message
:
response
.
message
,
});
});
_this
.
uploadFile
=
{};
_this
.
fileList
=
[];
return
false
;
return
false
;
}
}
this
.
uploadResult
=
response
.
data
;
this
.
uploadResult
=
response
.
data
;
...
@@ -113,6 +125,8 @@ export default {
...
@@ -113,6 +125,8 @@ export default {
// 上传文档
// 上传文档
saveInfo
()
{
saveInfo
()
{
let
o
=
this
.
uploadFile
;
let
o
=
this
.
uploadFile
;
console
.
log
(
this
.
fileList
);
console
.
log
(
o
);
if
(
!
o
||
!
o
.
name
)
{
if
(
!
o
||
!
o
.
name
)
{
showToast
({
showToast
({
message
:
"请选择文件"
,
message
:
"请选择文件"
,
...
@@ -121,6 +135,18 @@ export default {
...
@@ -121,6 +135,18 @@ export default {
broadcast
(
"cancel-loading"
);
broadcast
(
"cancel-loading"
);
return
false
;
return
false
;
}
}
let
list
=
o
.
name
.
split
(
'.'
)
let
acceptFile
=
this
.
acceptFile
;
let
_type
=
list
[
list
.
length
-
1
];
let
idx
=
acceptFile
.
includes
(
_type
)
if
(
!
idx
){
showToast
({
message
:
`导入文件只支持
${
acceptFile
}
`
,
});
broadcast
(
"cancel-loading"
);
return
false
;
}
this
.
$refs
.
uploadBox
.
submit
();
this
.
$refs
.
uploadBox
.
submit
();
},
},
...
...
src/views/user/index.vue
View file @
0c3578b
...
@@ -329,7 +329,6 @@ export default {
...
@@ -329,7 +329,6 @@ export default {
let
_this
=
this
;
let
_this
=
this
;
received
(
"assign-success"
,
this
.
closeDialog
);
received
(
"assign-success"
,
this
.
closeDialog
);
received
(
"cancel-loading"
,
function
()
{
received
(
"cancel-loading"
,
function
()
{
console
.
log
(
'进入此处'
)
_this
.
loading
=
false
;
_this
.
loading
=
false
;
});
});
this
.
init
();
this
.
init
();
...
...
src/views/user/select.vue
View file @
0c3578b
...
@@ -209,7 +209,7 @@ export default {
...
@@ -209,7 +209,7 @@ export default {
// 如果是用户
// 如果是用户
if
(
data
.
origin
.
type
==
"u"
)
{
if
(
data
.
origin
.
type
==
"u"
)
{
GET_USER_VEHICLE_LIST
({
uIds
:
data
.
id
}).
then
((
res
)
=>
{
GET_USER_VEHICLE_LIST
({
uIds
:
data
.
id
,
receiverId
:
_this
.
id
}).
then
((
res
)
=>
{
_this
.
ajaxloding
=
false
;
_this
.
ajaxloding
=
false
;
let
list
=
res
.
data
||
[];
let
list
=
res
.
data
||
[];
_this
.
setList
(
data
,
list
,
checked
);
_this
.
setList
(
data
,
list
,
checked
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment