Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
6
608-pdm-web-5g
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
pdm
608-pdm-web-5g
Commits
2bf39f8d
Commit
2bf39f8d
authored
Oct 12, 2024
by
xioln
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
附件下载
parent
1ddce051
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
10 deletions
+111
-10
file.js
src/api/file.js
+48
-0
index.vue
src/components/tableCell/index.vue
+8
-0
util.js
src/utils/util.js
+18
-8
index.vue
src/views/InfoDetail/components/actionAttachment/index.vue
+36
-2
index.vue
...ews/busniessComponents/workFlowTask/taskDetails/index.vue
+1
-0
No files found.
src/api/file.js
0 → 100644
View file @
2bf39f8d
import
{
get
,
post
,
del
,
downloadFile
}
from
'../utils/http'
// 文件下载
export
function
downPdf
(
params
)
{
return
get
(
'/dfs/fileManager/downloadCipher'
,
params
,
true
)
}
// 分片上传准备
export
function
uploadPartPrepare
(
params
)
{
return
post
(
'/dfs/fileManager/uploadPartPrepare'
,
params
,
true
)
}
// 获取存储库id
export
function
getBucketByAppID
(
params
)
{
return
get
(
'/RepoBucket/getBucketByAppID'
,
params
)
}
// 文件下载
export
function
downloadFileById
(
id
)
{
return
get
(
`/dfs/fileManager/download?fileId=
${
id
}
`
,
null
,
true
)
}
// 查询所有上传记录
export
function
getUploadRecord
(
params
)
{
// return post('/RepoFileUpload/find/recursion', params)
return
post
(
'/RepoFileUpload/findWithCondition'
,
params
)
}
// 删除上传文件
export
function
delUploadFileOrRecord
(
id
)
{
return
del
(
`/RepoFileUpload/
${
id
}
`
)
}
// 修改文件状态
export
function
changeFileStatusByUploadId
(
status
,
uploadId
)
{
return
post
(
`/dfs/fileManager/changeFileStatusByUploadId?status=
${
status
}
&uploadId=
${
uploadId
}
`
,
null
,
true
)
}
// 下载文件
export
function
downFileByFileIdMakerFile
(
objName
,
objId
,
linkId
)
{
return
downloadFile
(
`/ExtAutoTask/downloadMakerFile?objName=
${
objName
}
&objId=
${
objId
}
&linkId=
${
linkId
}
`
)
}
export
function
downFileByFileIdFile
(
fileId
)
{
return
downloadFile
(
`/ExtAutoTask/downloadMakerFile?fileId=
${
fileId
}
`
)
}
export
function
downFileByFileId
(
objName
,
objId
,
linkId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?objName=
${
objName
}
&objId=
${
objId
}
&linkId=
${
linkId
}
`
)
}
export
function
downFileUseFileId
(
fileId
)
{
return
downloadFile
(
`/dfs/fileManager/downloadio?fileId=
${
fileId
}
`
)
}
export
function
downMakerFileByFileId
(
objName
,
objId
,
linkId
)
{
return
downloadFile
(
`/ExtAutoTask/downloadMakerFile?objName=
${
objName
}
&objId=
${
objId
}
&linkId=
${
linkId
}
`
)
}
src/components/tableCell/index.vue
View file @
2bf39f8d
...
...
@@ -27,6 +27,14 @@
{{
getProperty
(
item
,
column
.
key
)
}}
</a>
</
template
>
<
template
v-else-if=
"column.type==='link'"
>
<a
@
click=
"$emit('linkToUrl',item)"
style=
"text-decoration: underline; color: #1b77ea"
>
{{
getProperty
(
item
,
column
.
key
)
}}
</a>
</
template
>
<
template
v-else
>
{{
getProperty
(
item
,
column
.
key
)
||
'—'
}}
</
template
>
...
...
src/utils/util.js
View file @
2bf39f8d
...
...
@@ -359,21 +359,31 @@ export function dynamicIcons (type, rModel, partNumber, model = null, name = '')
return
icon
}
export
function
downLoadFileUrl
(
url
,
fileName
=
null
)
{
// showNotification('下载中,请稍后...', '提示', 'info')
const
name
=
url
.
substring
(
url
.
lastIndexOf
(
'/'
)
+
1
,
url
.
length
)
// export function downLoadFileUrl (url, fileName = null) {
// // showNotification('下载中,请稍后...', '提示', 'info')
// const name = url.substring(url.lastIndexOf('/') + 1, url.length)
// const link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.target = '_blank'
// /* link.setAttribute('id', fileName) */
// link.setAttribute('download', fileName || name)
// document.body.appendChild(link)
// link.click()
// document.body.removeChild(link)
// Notify({ type: 'warning', message: '下载中,请稍后...' })
// }
export
function
downLoadFileUrl
(
url
,
fileName
=
null
)
{
console
.
log
(
'###'
,
url
)
const
link
=
document
.
createElement
(
'a'
)
link
.
style
.
display
=
'none'
link
.
href
=
url
link
.
target
=
'_blank'
/* link.setAttribute('id', fileName) */
link
.
setAttribute
(
'download'
,
fileName
||
name
)
link
.
setAttribute
(
'id'
,
fileName
)
link
.
setAttribute
(
'download'
,
fileName
)
document
.
body
.
appendChild
(
link
)
link
.
click
()
document
.
body
.
removeChild
(
link
)
Notify
({
type
:
'warning'
,
message
:
'下载中,请稍后...'
})
}
export
function
downLoad
(
url
,
label
=
null
)
{
// Notify({ type: 'warning', message: '下载中,请稍后...' })
downloadFile
(
url
).
then
(
res
=>
{
...
...
src/views/InfoDetail/components/actionAttachment/index.vue
View file @
2bf39f8d
...
...
@@ -4,6 +4,7 @@
ref=
"tableCell"
:tableData=
"tableData"
:tableColumns=
"columns"
@
linkToUrl=
"link"
></table-cell>
<van-loading
v-if=
"!tableData"
type=
"spinner"
size=
"24px"
vertical
/>
<van-empty
v-if=
"tableData.length === 0"
description=
"数据为空"
/>
...
...
@@ -12,6 +13,8 @@
<
script
>
import
TableCell
from
'@/components/tableCell'
import
{
downFileByFileIdFile
}
from
'@/api/file'
export
default
{
props
:
{
basicData
:
{
...
...
@@ -25,8 +28,8 @@ export default {
columns
:
[
{
title
:
'文件名'
,
key
:
'originalFileName'
key
:
'originalFileName'
,
type
:
'link'
},
{
title
:
'文件大小'
,
...
...
@@ -68,6 +71,37 @@ export default {
},
computed
:
{},
methods
:
{
link
(
item
)
{
downFileByFileIdFile
(
item
.
id
).
then
(
res
=>
{
this
.
downLoadFileUrl
(
res
)
}).
catch
(
e
=>
{
var
reader
=
new
FileReader
()
reader
.
readAsText
(
e
.
data
,
'utf-8'
)
reader
.
onload
=
(
e
)
=>
{
const
data
=
JSON
.
parse
(
reader
.
result
)
this
.
$message
.
error
(
data
.
message
)
}
})
},
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
.
showMessage
(
message
?
message
.
message
:
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
,
'warning'
)
})
reader
.
readAsText
(
res
.
data
,
'utf-8'
)
}
else
{
const
message
=
res
.
data
&&
res
.
data
.
message
this
.
$utils
.
showMessage
(
message
||
'数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!'
,
'warning'
)
}
}
}
}
}
</
script
>
...
...
src/views/busniessComponents/workFlowTask/taskDetails/index.vue
View file @
2bf39f8d
...
...
@@ -340,6 +340,7 @@ export default {
box-sizing
:
border-box
;
border-bottom
:
1px
solid
#e1e2e4
;
height
:
180px
;
overflow-y
:
auto
;
}
.task
{
margin-top
:
5x
;
...
...
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