Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
9053926b
提交
9053926b
编写于
9月 24, 2020
作者:
lzlhxj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改下载时文件名中文乱码
上级
e8095860
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
103 行增加
和
51 行删除
+103
-51
disk-file-upload.vue
app_web/src/components/disk-file-upload/disk-file-upload.vue
+52
-25
disk-image-upload.vue
...eb/src/components/disk-image-upload/disk-image-upload.vue
+51
-26
未找到文件。
app_web/src/components/disk-file-upload/disk-file-upload.vue
浏览文件 @
9053926b
...
...
@@ -68,6 +68,8 @@
<!-- 自定义弹框 -->
<div
class=
"dialogDiv"
>
<el-dialog
:title=
"dialogTitle"
center
width=
"70%"
top=
"5vh"
:visible=
"showDialog"
...
...
@@ -245,23 +247,40 @@
*/
public
isCreate
:
boolean
=
true
;
/**
* 自定义弹框标题
*
* @type {*}
* @memberof DiskFileUpload
*/
public
dialogTitle
:
any
=
''
;
/**
* 是否显示自定义弹框
*
* @type {boolean}
* @memberof DiskFileUpload
*/
public
showDialog
=
false
;
public
showDialog
:
boolean
=
false
;
/**
* 嵌入自定义弹框中iframe的url
*
* @type {*}
* @memberof DiskFileUpload
*/
public
iframeUrl
:
any
=
''
;
/**
* 关闭自定义弹框
*
* @memberof DiskFileUpload
*/
public
dialogClose
()
{
this
.
dialogTitle
=
''
;
this
.
showDialog
=
false
;
this
.
iframeUrl
=
''
;
let
iframe
:
any
=
document
.
getElementById
(
"fileIframe"
);
let
iframe
:
any
=
document
.
getElementById
(
"fileIframe"
);
iframe
.
parentNode
.
removeChild
(
"fileIframe"
);
}
...
...
@@ -302,7 +321,7 @@
}
/**
*
*
vue创建
*
* @memberof DiskFileUpload
*/
...
...
@@ -334,7 +353,7 @@
if
(
Object
.
is
(
$event
.
type
,
'save'
))
{
// 批量更新文件表中的ownerid
if
(
this
.
isUpdateBatch
==
true
&&
this
.
uploadFileList
.
length
>
0
)
{
this
.
updateFileBatch
(
this
.
uploadFileList
,
'update'
);
this
.
updateFileBatch
(
this
.
uploadFileList
);
}
}
});
...
...
@@ -355,7 +374,7 @@
ownertype
:
this
.
getOwnertype
(),
ownerid
:
this
.
getOwnerid
(),
},
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.getFileFailure'
)
+
'!'
);
return
;
...
...
@@ -367,7 +386,7 @@
this
.
uploadFileList
.
push
.
apply
(
this
.
uploadFileList
,
files
);
}
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.getFileFailure'
)
+
':'
+
error
);
});
}
...
...
@@ -388,7 +407,7 @@
// 拼接url
const
uploadUrl
=
this
.
getAction
();
// 发送post请求
Axios
.
post
(
uploadUrl
,
formData
,
{
timeout
:
2000
}).
then
(
response
=>
{
Axios
.
post
(
uploadUrl
,
formData
,
{
timeout
:
2000
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.loadFailure'
)
+
'!'
);
}
...
...
@@ -406,8 +425,8 @@
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
formItemName
,
value
:
value
});
}
}
}).
catch
(
err
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.loadFailure'
)
+
':'
+
err
);
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.loadFailure'
)
+
':'
+
err
or
);
})
}
...
...
@@ -426,10 +445,10 @@
// 发送get请求
Axios
.
get
(
downloadUrl
,
{
headers
:
{
'authcode'
:
item
.
authcode
'authcode'
:
item
.
authcode
,
},
responseType
:
'arraybuffer'
,
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.downloadFile'
)
+
'!'
);
return
;
...
...
@@ -440,13 +459,17 @@
const
disposition
=
response
.
headers
[
'content-disposition'
];
const
filename
=
disposition
.
split
(
'filename='
)[
1
];
// 用blob对象获取文件流
var
blob
=
new
Blob
([
response
.
data
],
{
type
:
response
.
headers
[
'content-type'
]});
// 创建下载链接
let
blob
=
new
Blob
([
response
.
data
],
{
type
:
response
.
headers
[
'content-type'
]});
//
通过文件流
创建下载链接
var
href
=
URL
.
createObjectURL
(
blob
);
// 创建一个a元素并设置相关属性
var
a
=
document
.
createElement
(
'a'
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
href
;
a
.
download
=
filename
;
if
(
name
)
{
a
.
download
=
name
;
}
else
{
a
.
download
=
filename
;
}
// 添加a元素到当前网页
document
.
body
.
appendChild
(
a
);
// 触发a元素的点击事件,实现下载
...
...
@@ -458,7 +481,7 @@
}
else
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.downloadFile1'
));
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.downloadFile'
)
+
':'
+
error
);
});
}
...
...
@@ -475,6 +498,7 @@
const
name
=
typeof
item
.
name
==
"string"
?
item
.
name
:
JSON
.
stringify
(
item
.
name
);
const
previewUrl
=
'/net-disk/preview/'
+
this
.
getFolder
()
+
'/'
+
id
+
'/'
+
name
+
'?authcode='
+
item
.
authcode
;
// 自定义弹框打开url
this
.
dialogTitle
=
name
;
this
.
showDialog
=
true
;
this
.
iframeUrl
=
previewUrl
;
}
...
...
@@ -506,6 +530,7 @@
const
name
=
typeof
item
.
name
==
"string"
?
item
.
name
:
JSON
.
stringify
(
item
.
name
);
const
ocrUrl
=
'/net-disk/ocrview/'
+
this
.
getFolder
()
+
'/'
+
id
+
'/'
+
name
+
'?authcode='
+
item
.
authcode
;
// 自定义弹框打开url
this
.
dialogTitle
=
name
;
this
.
showDialog
=
true
;
this
.
iframeUrl
=
ocrUrl
;
}
...
...
@@ -528,7 +553,7 @@
// 拼接url
const
deleteUrl
=
'/net-disk/files/'
+
item
.
id
;
// 发送delete请求
Axios
.
delete
(
deleteUrl
).
then
(
response
=>
{
Axios
.
delete
(
deleteUrl
).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.deleteFileFailure'
)
+
'!'
);
}
...
...
@@ -539,7 +564,7 @@
const
value
=
JSON
.
stringify
(
this
.
uploadFileList
);
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
formItemName
,
value
:
value
});
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
// 提示删除失败
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.deleteFileFailure'
)
+
':'
+
error
);
});
...
...
@@ -552,7 +577,7 @@
*
* @memberof DiskFileUpload
*/
public
updateFileBatch
(
files
:
any
,
opt
:
any
)
{
public
updateFileBatch
(
files
:
any
)
{
let
_this
:
any
=
this
;
// 拼接url
const
updateUrl
=
'/net-disk/files/'
+
this
.
getFolder
()
+
'?ownertype='
+
this
.
getOwnertype
()
+
"&ownerid="
+
this
.
getOwnerid
();
...
...
@@ -567,12 +592,12 @@
"Content-Type"
:
"application/json;charset=UTF-8"
},
timeout
:
2000
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.updateFailure'
)
+
'!'
);
return
;
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskFileUpload.updateFailure'
)
+
':'
+
error
);
});
}
...
...
@@ -629,11 +654,12 @@
margin-left: 10px;
}
.dialogDiv{
.dialogDiv
{
// el-dialog头部
.el-dialog__header{
height:40px;
.el-dialog__header
{
height:
40px;
}
// el-dialog面板
.el-dialog__wrapper {
height: 90vh;
...
...
@@ -649,7 +675,8 @@
.el-dialog__body {
height: inherit;
}
#fileIframe{
#fileIframe {
height: calc(100% - 40px);
}
}
...
...
app_web/src/components/disk-image-upload/disk-image-upload.vue
浏览文件 @
9053926b
...
...
@@ -45,6 +45,8 @@
<!-- 自定义弹框 -->
<div
class=
"dialogDiv"
>
<el-dialog
:title=
"dialogTitle"
center
width=
"70%"
top=
"5vh"
:visible=
"showDialog"
...
...
@@ -231,23 +233,40 @@
*/
public
imageFileids
:
Array
<
any
>
=
[];
/**
* 自定义弹框标题
*
* @type {*}
* @memberof DiskImageUplaod
*/
public
dialogTitle
:
any
=
''
;
/**
* 是否显示自定义弹框
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
public
showDialog
=
false
;
public
showDialog
:
boolean
=
false
;
/**
* 嵌入自定义弹框中iframe的url
*
* @type {*}
* @memberof DiskImageUplaod
*/
public
iframeUrl
:
any
=
''
;
/**
* 关闭自定义弹框
*
* @memberof DiskImageUplaod
*/
public
dialogClose
()
{
this
.
dialogTitle
=
''
;
this
.
showDialog
=
false
;
this
.
iframeUrl
=
''
;
let
iframe
:
any
=
document
.
getElementById
(
"fileIframe"
);
let
iframe
:
any
=
document
.
getElementById
(
"fileIframe"
);
iframe
.
parentNode
.
removeChild
(
"fileIframe"
);
}
...
...
@@ -288,7 +307,7 @@
}
/**
* vue
生命周期create
* vue
创建
*
* @memberof DiskImageUplaod
*/
...
...
@@ -344,7 +363,7 @@
ownertype
:
this
.
getOwnertype
(),
ownerid
:
this
.
getOwnerid
(),
},
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.getImageFailure'
)
+
"!"
);
return
;
...
...
@@ -361,7 +380,7 @@
});
}
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.getImageFailure'
)
+
':'
+
error
);
});
}
...
...
@@ -382,14 +401,14 @@
'authcode'
:
fileData
.
authcode
},
responseType
:
'blob'
,
}).
then
(
res
=>
{
if
(
!
res
||
res
.
status
!=
200
)
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
res
ponse
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure'
)
+
'!'
);
}
// 请求成功,后台返回的是一个文件流
if
(
res
.
data
)
{
if
(
res
ponse
.
data
)
{
// 用blob对象获取文件流
var
blob
=
new
Blob
([
res
.
data
],
{
type
:
res
.
headers
[
'content-type'
]});
var
blob
=
new
Blob
([
res
ponse
.
data
],
{
type
:
response
.
headers
[
'content-type'
]});
// 通过文件流创建下载链接
var
href
=
URL
.
createObjectURL
(
blob
);
// 将下载链接保存到图片中
...
...
@@ -408,7 +427,7 @@
}
else
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure1'
));
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure'
)
+
':'
+
error
);
});
}
...
...
@@ -442,7 +461,7 @@
// 拼接url
const
uploadUrl
=
this
.
getAction
();
// 发送post请求
Axios
.
post
(
uploadUrl
,
formData
,
{
timeout
:
2000
}).
then
(
response
=>
{
Axios
.
post
(
uploadUrl
,
formData
,
{
timeout
:
2000
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.uploadImageFailure'
)
+
"!"
);
}
...
...
@@ -457,15 +476,15 @@
'authcode'
:
returnData
.
authcode
},
responseType
:
'blob'
,
}).
then
(
res
=>
{
if
(
!
res
||
res
.
status
!=
200
)
{
}).
then
(
(
response2
)
=>
{
if
(
!
res
ponse2
||
response2
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure'
)
+
"!"
);
return
;
}
// 请求成功,后台返回的是一个文件流
if
(
res
.
data
)
{
if
(
res
ponse2
.
data
)
{
// 用blob对象获取文件流
var
blob
=
new
Blob
([
res
.
data
],
{
type
:
res
.
headers
[
'content-type'
]});
var
blob
=
new
Blob
([
res
ponse2
.
data
],
{
type
:
response2
.
headers
[
'content-type'
]});
// 通过文件流创建下载链接
var
href
=
URL
.
createObjectURL
(
blob
);
// 将下载链接保存到本次上传成功后返回的jsonobject中
...
...
@@ -493,12 +512,12 @@
}
else
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure1'
));
}
}).
catch
(
error
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure'
)
+
':'
+
error
);
}).
catch
(
(
error2
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure'
)
+
':'
+
error
2
);
});
}
}).
catch
(
err
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.uploadImageFailure'
)
+
':'
+
err
);
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.uploadImageFailure'
)
+
':'
+
err
or
);
});
}
...
...
@@ -529,6 +548,7 @@
const
name
=
typeof
file
.
name
==
"string"
?
file
.
name
:
JSON
.
stringify
(
file
.
name
);
const
ocrUrl
=
'/net-disk/ocrview/'
+
this
.
getFolder
()
+
'/'
+
id
+
'/'
+
name
+
'?authcode='
+
file
.
authcode
;
// 自定义弹框打开url
this
.
dialogTitle
=
name
;
this
.
showDialog
=
true
;
this
.
iframeUrl
=
ocrUrl
;
}
...
...
@@ -550,7 +570,7 @@
'authcode'
:
file
.
authcode
},
responseType
:
'blob'
,
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure2'
)
+
'!'
);
return
;
...
...
@@ -567,7 +587,11 @@
// 创建一个a元素并设置相关属性
var
a
=
document
.
createElement
(
'a'
);
a
.
href
=
href
;
a
.
download
=
filename
;
if
(
name
)
{
a
.
download
=
name
;
}
else
{
a
.
download
=
filename
;
}
// 添加a元素到当前网页
document
.
body
.
appendChild
(
a
);
// 触发a元素的点击事件,实现下载
...
...
@@ -579,7 +603,7 @@
}
else
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure3'
));
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.loadImageFailure2'
)
+
':'
+
error
);
});
}
...
...
@@ -604,7 +628,7 @@
// 拼接url
const
deleteUrl
=
'/net-disk/files/'
+
file
.
id
;
// 发送delete请求
Axios
.
delete
(
deleteUrl
).
then
(
response
=>
{
Axios
.
delete
(
deleteUrl
).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.deleteImageFailure'
)
+
'!'
);
}
...
...
@@ -617,7 +641,7 @@
const
value
=
JSON
.
stringify
(
this
.
imageList
);
this
.
$emit
(
'formitemvaluechange'
,
{
name
:
this
.
formItemName
,
value
:
value
});
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
// 提示删除失败
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.deleteImageFailure'
)
+
':'
+
error
);
});
...
...
@@ -647,12 +671,12 @@
"Content-Type"
:
"application/json;charset=UTF-8"
},
timeout
:
2000
}).
then
(
response
=>
{
}).
then
(
(
response
:
any
)
=>
{
if
(
!
response
||
response
.
status
!=
200
)
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.updateFailure'
)
+
'!'
);
return
;
}
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
any
)
=>
{
Message
.
error
(
_this
.
$t
(
'components.diskImageUpload.updateFailure'
)
+
':'
+
error
);
});
}
...
...
@@ -684,6 +708,7 @@
height: inherit;
}
// iframe
#fileIframe {
height: calc(100% - 40px);
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录