Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web
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
INET-TWO
web
Commits
560da690
Commit
560da690
authored
Nov 12, 2024
by
ztf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
行动项附件下载组件
parent
0ae0f6ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
8 deletions
+97
-8
file.js
applications/dee-doc/src/api/file.js
+8
-8
index.vue
...c/privateComponents/components/downloadObjFiles/index.vue
+89
-0
No files found.
applications/dee-doc/src/api/file.js
View file @
560da690
...
@@ -14,14 +14,14 @@ export function downFileByFileCode(fileCode) {
...
@@ -14,14 +14,14 @@ export function downFileByFileCode(fileCode) {
export
function
downFileByFileId
(
fileId
)
{
export
function
downFileByFileId
(
fileId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
}
}
//
//
下载文件
// 下载文件
// export function downFileByFileId
(objName, objId, linkId, disLoadingFlag) {
export
function
downFileByFileIds
(
objName
,
objId
,
linkId
,
disLoadingFlag
)
{
//
let url = `/dfs/fileManager/downloadio?objName=${objName}&objId=${objId}&linkId=${linkId}`
let
url
=
`/dfs/fileManager/downloadio?objName=
${
objName
}
&objId=
${
objId
}
&linkId=
${
linkId
}
`
//
if (disLoadingFlag) {
if
(
disLoadingFlag
)
{
//
url += '&disLoadingFlag=' + disLoadingFlag
url
+=
'&disLoadingFlag='
+
disLoadingFlag
//
}
}
//
return downloadFile(url)
return
downloadFile
(
url
)
//
}
}
export
function
downFileUseFileId
(
fileId
)
{
export
function
downFileUseFileId
(
fileId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
}
}
applications/dee-doc/src/privateComponents/components/downloadObjFiles/index.vue
0 → 100644
View file @
560da690
<
template
>
<div
class=
"downloadObjFiles"
>
<span
v-if=
"ifShow"
ref=
"load"
class=
"content"
:basicData=
"basicData"
@
click=
"downFileByFile"
>
下载
</span>
</div>
</
template
>
<
script
>
import
{
downFileByFileIds
}
from
'@/api/file'
// import { post } from '@/utils/http'
export
default
{
name
:
'DownloadObjFiles'
,
componentName
:
'行动项-附件下载'
,
props
:
{
basicData
:
{
type
:
Object
,
default
:
()
=>
{}
},
form
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
data
()
{
return
{
}
},
computed
:
{
ifShow
()
{
if
(
this
.
form
.
state
!==
'under_reviewing'
||
this
.
form
.
state
!==
'Complete'
)
{
return
true
}
else
{
return
false
}
}
},
mounted
()
{
console
.
log
(
'form44444'
,
this
.
form
)
console
.
log
(
'basicData5555'
,
this
)
},
methods
:
{
downFileByFile
()
{
const
subTypeName
=
this
.
$parent
.
$parent
.
$parent
.
$parent
.
$parent
.
$parent
.
$parent
.
basicData
.
subTypeName
const
obj
=
this
.
form
.
objFileLinks
[
0
]
downFileByFileIds
(
subTypeName
,
obj
.
targetId
,
obj
.
id
,
true
).
then
(
res
=>
{
console
.
log
(
'下载ll'
)
this
.
downLoadFileUrl
(
res
)
})
},
downLoadFileUrl
(
res
)
{
if
(
res
.
headers
[
'content-disposition'
])
{
const
fileName
=
decodeURI
(
res
.
headers
[
'content-disposition'
].
substring
(
res
.
headers
[
'content-disposition'
].
indexOf
(
'='
)
+
1
,
res
.
headers
[
'content-disposition'
].
length
))
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
.
data
],
{
type
:
res
.
headers
[
'content-type'
]
}))
this
.
$utils
.
downLoadFileUrl
(
url
,
decodeURI
(
fileName
))
}
else
{
if
(
res
.
data
instanceof
Blob
)
{
var
reader
=
new
FileReader
()
reader
.
addEventListener
(
'loadend'
,
()
=>
{
const
message
=
reader
.
result
&&
JSON
.
parse
(
reader
.
result
)
this
.
$utils
.
showMessageWarning
(
message
?
message
.
message
:
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
)
})
reader
.
readAsText
(
res
.
data
,
'utf-8'
)
}
else
{
const
message
=
res
.
data
&&
res
.
data
.
message
this
.
$utils
.
showMessageWarning
(
message
||
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
)
}
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.downloadObjFiles
{
text-align
:
center
;
.content
{
color
:
#2363AF
;
cursor
:
pointer
;
}
}
</
style
>
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