Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-science-front
Project
Project
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
徐俊
yn-science-front
Commits
e15e46d6
Commit
e15e46d6
authored
Dec 10, 2024
by
wangxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
667777
parent
dfeb92bf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
16 deletions
+87
-16
textTemplate.docx
public/downloadFile/textTemplate.docx
+0
-0
fileLoad.vue
src/views/components/common/fileLoad.vue
+0
-1
upload.vue
src/views/components/common/upload.vue
+70
-13
projectEdit.vue
src/views/report/project/components/projectEdit.vue
+17
-2
No files found.
public/downloadFile/textTemplate.docx
0 → 100644
View file @
e15e46d6
File added
src/views/components/common/fileLoad.vue
View file @
e15e46d6
...
...
@@ -78,7 +78,6 @@ export default {
item
.
fileName
=
files
[
0
].
name
item
.
downloadUrl
=
data
.
downloadUrl
item
.
downloadId
=
data
.
id
console
.
log
(
item
,
data
)
}
else
this
.
$message
.
error
(
'上传失败'
)
}).
catch
(()
=>
{
...
...
src/views/components/common/upload.vue
View file @
e15e46d6
...
...
@@ -2,8 +2,8 @@
<div
class=
"upload-layout"
>
<div
v-if=
"file.downloadUrl"
class=
"file-box"
>
<div>
<a-icon
type=
"file"
style=
"margin-right:
8
px"
/>
<span
class=
"hover-pointer"
@
click=
"downloadfile"
>
{{
file
.
fileName
}}
</span>
<a-icon
type=
"file"
style=
"margin-right:
6
px"
/>
<span
class=
"hover-pointer"
style=
"color:blue;text-decoration:underline;font-size: 16px;"
@
click=
"downloadfile"
>
{{
file
.
fileName
}}
</span>
</div>
<a-icon
type=
"delete"
class=
"hover-pointer"
@
click=
"deletefile"
style=
"margin-left: 8px"
/>
</div>
...
...
@@ -21,23 +21,33 @@ export default {
name
:
"FileUpload"
,
data
()
{
return
{
file
:
{
...
File
},
};
},
props
:
{
value
:
{
type
:
String
,
file
:
{
type
:
Object
,
default
:
()
=>
{
return
{
...
File
}
}
},
isUpload
:
{
type
:
Boolean
,
default
()
{
return
null
return
false
}
},
format
:
{
type
:
Array
,
default
()
{
return
[]
}
},
},
created
()
{
this
.
fileLoad
(
this
.
value
)
console
.
log
(
this
.
format
)
},
methods
:
{
fileLoad
(
value
)
{
},
fileSelect
()
{
let
fileElem
=
this
.
$refs
[
'fileElem'
]
if
(
fileElem
)
{
...
...
@@ -51,16 +61,60 @@ export default {
this
.
$message
.
error
(
'未选中文件,请尝试重新选择'
)
return
}
if
(
!
this
.
fileCheck
(
files
[
0
]))
return
if
(
this
.
isUpload
)
{
this
.
$api
.
base
.
asyncUpload
(
this
.
uploadHandle
(
files
[
0
],
files
[
0
].
name
)).
then
(({
data
=
{}
})
=>
{
if
(
data
)
{
this
.
file
.
fileName
=
files
[
0
].
name
this
.
file
.
downloadId
=
data
.
id
this
.
file
.
downloadUrl
=
data
.
downloadUrl
}
else
this
.
$message
.
error
(
'上传失败'
)
}).
catch
(()
=>
{
this
.
$message
.
error
(
'上传失败'
)
})
}
else
{
this
.
file
.
fileName
=
files
[
0
].
name
this
.
file
.
downloadUrl
=
'/'
+
files
[
0
].
name
this
.
$emit
(
"beforeUpload"
,
files
[
0
]);
}
},
downloadfile
()
{
fileCheck
(
file
)
{
//判断是否小于1M
let
isLtSize
=
file
.
size
<
1024
*
1024
*
15
;
if
(
!
isLtSize
)
{
this
.
$message
.
error
(
'文件大小不能超过15M!'
);
return
false
}
var
fileNames
=
file
.
name
.
split
(
'.'
)
var
fileType
=
fileNames
[
fileNames
.
length
-
1
].
toLocaleLowerCase
()
if
(
!!
this
.
format
&&
this
.
format
.
length
>
0
)
{
var
extList
=
this
.
format
if
(
!
extList
.
find
((
item
)
=>
item
==
fileType
))
{
this
.
$message
.
error
(
'文件格式错误!'
)
return
false
}
}
return
true
},
deletefile
()
{
this
.
file
=
{
...
File
}
this
.
$emit
(
"cancel"
);
if
(
this
.
isUpload
)
{
this
.
$api
.
base
.
deletefile
({
id
:
this
.
file
.
downloadId
}).
then
(({
data
=
{}
})
=>
{
if
(
data
)
{
this
.
file
.
fileName
=
null
this
.
file
.
downloadUrl
=
null
this
.
file
.
downloadId
=
null
}
}).
catch
(()
=>
{
this
.
$message
.
error
(
'删除失败'
)
})
}
else
{
this
.
file
.
fileName
=
null
this
.
file
.
downloadUrl
=
null
this
.
file
.
downloadId
=
null
}
},
uploadHandle
(
file
,
fileName
)
{
let
formData
=
new
FormData
()
...
...
@@ -68,11 +122,14 @@ export default {
formData
.
append
(
'fileName'
,
fileName
)
return
formData
},
downloadfile
()
{
},
},
watch
:
{
value
:
{
handler
(
value
)
{
this
.
selected
=
value
},
}
}
...
...
src/views/report/project/components/projectEdit.vue
View file @
e15e46d6
...
...
@@ -447,12 +447,27 @@
</div>
</a-col>
</a-row>
<a-row>
<a-row
type=
"flex"
>
<a-col
:span=
"24"
class=
"bg-gray"
>
<div
class=
"special-middle"
style=
"font-weight: bold;text-align: center;"
>
<span
style=
"color: red;margin-left: 42px;"
>
注:正文部分需要下载模版,填写完成后上传到系统中,格式 .doc,.docx。
</span>
</div>
</a-col>
</a-row>
<a-row
type=
"flex"
>
<a-col
:span=
"24"
>
<div>
<div
style=
"height:42px;line-height: 42px;text-align: center;"
>
<a
:href=
"'/downloadFile/textTemplate.docx'"
download=
"申请书正文.docx"
>
<a-icon
type=
"download"
></a-icon>
<span
style=
"color:green;text-decoration:underline;font-size: 16px;"
>
正文模板下载
</span>
</a>
<up-load
:isUpload=
"true"
:file
.
sync=
"formData"
:format=
"['doc', 'docx']"
/>
</div>
</a-col>
</a-row>
<a-row
type=
"flex"
>
<a-col
:span=
"24"
>
</a-col>
</a-row>
<!-- 附件 -->
<file-edit
:fileList
.
sync=
"formData.fileList"
/>
...
...
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