Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
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
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
a0a1bc40
Commit
a0a1bc40
authored
Jun 25, 2020
by
李严凡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建任务上传文件
parent
04bbbd2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
33 deletions
+133
-33
ReleaseTask.vue
DAPlatform-front/src/components/ReleaseTask.vue
+133
-33
No files found.
DAPlatform-front/src/components/ReleaseTask.vue
View file @
a0a1bc40
...
...
@@ -30,7 +30,7 @@
:on-remove=
"handleRemoveF"
:on-success=
"uploadSuccessF"
multiple
:http-request=
"uploadFile"
:http-request=
"uploadFile
F
"
:limit=
"7"
:data=
"'3:'+(index)"
:on-exceed=
"handleExceed"
...
...
@@ -85,11 +85,11 @@
class=
"upload-demo"
action=
"https://jsonplaceholder.typicode.com/posts/"
:on-preview=
"handlePreview"
:on-remove=
"
removeSuccess
"
:on-remove=
"
handleRemoveP
"
:before-remove=
"beforeRemove"
:on-success=
"uploadSuccessP"
:data=
"'3:'+(index)"
:http-request=
"uploadFile"
:http-request=
"uploadFile
P
"
multiple
:limit=
"7"
:on-exceed=
"handleExceed"
...
...
@@ -135,9 +135,9 @@
class=
"upload-demo"
action=
"https://jsonplaceholder.typicode.com/posts/"
:on-preview=
"handlePreview"
:on-remove=
"handleRemove"
:on-remove=
"handleRemove
L
"
:on-success=
"uploadSuccessL"
:http-request=
"uploadFile"
:http-request=
"uploadFile
L
"
multiple
:data=
"'3:'+(index)"
:limit=
"7"
...
...
@@ -356,9 +356,16 @@
}
},
methods
:
{
uploadFile
(
fileObj
){
setIndex
(
index
){
// alert(index);
this
.
Index
=
index
;
},
//上传文件
uploadFileF
(
fileObj
){
let
formData
=
new
window
.
FormData
();
formData
.
set
(
"file"
,
fileObj
.
file
);
var
file
=
formData
.
getAll
(
"file"
);
// console.log(file[0].name);
this
.
axios
.
post
(
"/files/upload"
,
formData
,{
headers
:{
"Content-type"
:
"multipart/form-data"
...
...
@@ -367,44 +374,137 @@
if
(
res
.
code
==
0
)
alert
(
"文件上传失败,请重新上传"
);
else
{
console
(
res
.
data
);
this
.
url
=
res
.
data
;
this
.
dynamicValidateForm
.
domains
[
this
.
Index
].
fileName
.
push
({
name
:
file
[
0
].
name
,
url
:
this
.
url
});
}
})
},
setIndex
(
index
){
this
.
Index
=
index
;
},
//上传文件
uploadSuccessF
(
response
,
file
,
fileList
){
this
.
fName
=
file
.
name
;
this
.
url
=
file
.
url
;
this
.
dynamicValidateForm
.
domains
[
this
.
Index
].
fileName
.
push
({
name
:
this
.
fName
,
url
:
this
.
url
});
//console.log(this.fName);
//console.log(this.taskName);
// console.log(this.dynamicValidateForm.domains[this.Index].fileName);
},
uploadSuccessP
(
response
,
file
,
fileList
){
this
.
fName
=
file
.
name
;
this
.
url
=
file
.
url
;
this
.
dynamicValidateForm
.
pictureDomains
[
this
.
Index
].
fileName
.
push
({
name
:
this
.
fName
,
url
:
this
.
url
});
//console.log(this.fName);
//console.log(this.taskName);
uploadFileP
(
fileObj
){
let
formData
=
new
window
.
FormData
();
formData
.
set
(
"file"
,
fileObj
.
file
);
var
file
=
formData
.
getAll
(
"file"
);
this
.
axios
.
post
(
"/files/upload"
,
formData
,{
headers
:{
"Content-type"
:
"multipart/form-data"
}
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
alert
(
"文件上传失败,请重新上传"
);
else
{
this
.
url
=
res
.
data
;
this
.
dynamicValidateForm
.
pictureDomains
[
this
.
Index
].
fileName
.
push
({
name
:
file
[
0
].
name
,
url
:
this
.
url
});
}
})
},
uploadSuccessL
(
response
,
file
,
fileList
){
this
.
fName
=
file
.
name
;
this
.
url
=
file
.
url
;
this
.
dynamicValidateForm
.
layerDomains
[
this
.
Index
].
fileName
.
push
({
name
:
this
.
fName
,
url
:
this
.
url
});
// console.log(this.fName);
// console.log(this.dynamicValidateForm.layerDoamins[this.Index].fileName);
uploadFileL
(
fileObj
){
let
formData
=
new
window
.
FormData
();
formData
.
set
(
"file"
,
fileObj
.
file
);
var
file
=
formData
.
getAll
(
"file"
);
this
.
axios
.
post
(
"/files/upload"
,
formData
,{
headers
:{
"Content-type"
:
"multipart/form-data"
}
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
alert
(
"文件上传失败,请重新上传"
);
else
{
this
.
url
=
res
.
data
;
this
.
dynamicValidateForm
.
layerDomains
[
this
.
Index
].
fileName
.
push
({
name
:
file
[
0
].
name
,
url
:
this
.
url
});
}
})
},
// //上传文件
// uploadSuccessF(response,file,fileList){
// this.fName=file.name;
// this.url=file.url;
// this.dynamicValidateForm.domains[this.Index ].fileName.push({name:this.fName,url:this.url});
// //console.log(this.fName);
// //console.log(this.taskName);
// // console.log(this.dynamicValidateForm.domains[this.Index].fileName);
// },
// uploadSuccessP(response,file,fileList){
// this.fName=file.name;
// this.url=file.url;
// this.dynamicValidateForm.pictureDomains[this.Index ].fileName.push({name:this.fName,url:this.url});
// //console.log(this.fName);
// //console.log(this.taskName);
// },
// uploadSuccessL(response,file,fileList){
// this.fName=file.name;
// this.url=file.url;
// this.dynamicValidateForm.layerDomains[this.Index ].fileName.push({name:this.fName,url:this.url});
// // console.log(this.fName);
// // console.log(this.dynamicValidateForm.layerDoamins[this.Index].fileName);
// },
//删除上传的文件
handleRemoveF
(
file
,
fileList
){
var
flag
=
0
;
var
url
;
for
(
i
=
0
;
i
<
this
.
dynamicValidateForm
.
domains
.
length
&&
flag
==
0
;
i
++
){
for
(
j
=
0
;
j
<
this
.
dynamicValidateForm
.
domains
[
i
].
fileName
.
length
;
j
++
){
if
(
file
.
name
==
this
.
dynamicValidateForm
.
domains
[
i
].
fileName
[
j
].
name
){
url
=
this
.
dynamicValidateForm
.
domain
[
i
].
fileName
[
j
].
url
;
this
.
dynamicValidateForm
.
domains
[
i
].
fileName
.
splice
(
j
,
1
);
flag
=
1
;
break
;
}
}
}
// this.axios({
// method:'post',
// params:{
// url : url
// },
// url:'/files/del',
// }).then(res=>{
//
// })
},
handleRemoveP
(
file
,
fileList
){
var
flag
=
0
;
var
url
;
for
(
i
=
0
;
i
<
this
.
dynamicValidateForm
.
pictureDomains
.
length
&&
flag
==
0
;
i
++
){
for
(
j
=
0
;
j
<
this
.
dynamicValidateForm
.
pictureDomains
[
i
].
fileName
.
length
;
j
++
){
if
(
file
.
name
==
this
.
dynamicValidateForm
.
pictureDomains
[
i
].
fileName
[
j
].
name
){
url
=
this
.
dynamicValidateForm
.
pictureDomains
[
i
].
fileName
[
j
].
url
;
this
.
dynamicValidateForm
.
pictureDomains
[
i
].
fileName
.
splice
(
j
,
1
);
flag
=
1
;
break
;
}
}
}
// this.axios({
// method:'post',
// params:{
// url : url
// },
// url:'/files/del',
// }).then(res=>{
//
// })
},
handleRemoveL
(
file
,
fileList
){
var
flag
=
0
;
var
url
;
for
(
i
=
0
;
i
<
this
.
dynamicValidateForm
.
layerDomains
.
length
&&
flag
==
0
;
i
++
){
for
(
j
=
0
;
j
<
this
.
dynamicValidateForm
.
layerDomains
[
i
].
fileName
.
length
;
j
++
){
if
(
file
.
name
==
this
.
dynamicValidateForm
.
layerDomains
[
i
].
fileName
[
j
].
name
){
url
=
this
.
dynamicValidateForm
.
layerDomains
[
i
].
fileName
[
j
].
url
;
this
.
dynamicValidateForm
.
layerDomains
[
i
].
fileName
.
splice
(
j
,
1
);
flag
=
1
;
break
;
}
}
}
// this.axios({
// method:'post',
// params:{
// url : url
// },
// url:'/files/del',
// }).then(res=>{
//
// })
},
submitForm
(
formName
)
{
console
.
log
(
this
.
dynamicValidateForm
);
...
...
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