Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 bd2440c7
authored
Mar 12, 2021
by
qiyeqing
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
会话下载文件
1 parent
2069bb0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
linkwe-ui/src/views/conversation/page/employeeTest.vue
linkwe-ui/src/views/conversation/page/employeeTest.vue
View file @
bd2440c
...
@@ -98,8 +98,8 @@
...
@@ -98,8 +98,8 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"action"
label=
"操作"
>
<el-table-column
prop=
"action"
label=
"操作"
>
<
template
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"text"
size=
"small"
>
下载
</el-button>
<el-button
type=
"text"
size=
"small"
@
click=
"downloadFile(scope.row)"
>
下载
</el-button>
<el-button
type=
"text"
size=
"small"
>
查看
</el-button>
<el-button
type=
"text"
size=
"small"
>
查看
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
content
content
}
from
'@/api/content.js'
}
from
'@/api/content.js'
import
{
import
{
yearMouthDay
yearMouthDay
,
download
}
from
'@/utils/common.js'
}
from
'@/utils/common.js'
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -197,6 +197,16 @@
...
@@ -197,6 +197,16 @@
this
.
getTree
()
this
.
getTree
()
},
},
methods
:
{
methods
:
{
downloadFile
(
e
){
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
e
.
file
.
attachment
],{
type
:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
}))
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
url
link
.
setAttribute
(
'download'
,
e
.
file
.
filename
)
// 下载文件的名称及文件类型后缀
document
.
body
.
appendChild
(
link
)
link
.
click
()
document
.
body
.
removeChild
(
link
);
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
url
);
// 释放掉blob对象
},
filterSize
(
size
)
{
filterSize
(
size
)
{
if
(
!
size
)
return
''
;
if
(
!
size
)
return
''
;
if
(
size
<
this
.
pow1024
(
1
))
return
size
+
' B'
;
if
(
size
<
this
.
pow1024
(
1
))
return
size
+
' B'
;
...
...
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