mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
perf: 优化远程应用上传弹窗
This commit is contained in:
@@ -1330,6 +1330,7 @@
|
||||
},
|
||||
"terminal": {
|
||||
"Author": "Author",
|
||||
"Uploading": "File uploading",
|
||||
"UploadSucceed": "Upload succeed",
|
||||
"UploadFailed": "Upload failed",
|
||||
"Applets": "Remote apps",
|
||||
|
||||
@@ -1325,6 +1325,7 @@
|
||||
},
|
||||
"terminal": {
|
||||
"Author": "作者",
|
||||
"Uploading": "ファイルのアップロード",
|
||||
"UploadSucceed": "アップロード成功",
|
||||
"UploadFailed": "アップロードに失敗しました",
|
||||
"Applets": "リモートアプリケーション",
|
||||
|
||||
@@ -1320,6 +1320,7 @@
|
||||
"Author": "作者",
|
||||
"BasePort": "监听端口",
|
||||
"DatabasePort": "数据库协议端口",
|
||||
"Uploading": "文件上传中",
|
||||
"UploadSucceed": "上传成功",
|
||||
"UploadFailed": "上传失败",
|
||||
"Applets": "远程应用",
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<Dialog
|
||||
:show-cancel="false"
|
||||
:title="$tc('common.OfflineUpload')"
|
||||
:before-close="handleClose"
|
||||
:loading-status="!isFinished"
|
||||
v-bind="$attrs"
|
||||
@cancel="onCancel"
|
||||
@confirm="onSubmit"
|
||||
@@ -53,7 +55,8 @@ export default {
|
||||
return {
|
||||
hasFileFormatOrSizeError: false,
|
||||
renderError: '',
|
||||
file: null
|
||||
file: null,
|
||||
isFinished: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -65,6 +68,13 @@ export default {
|
||||
},
|
||||
beforeUpload(file) {
|
||||
},
|
||||
handleClose(done) {
|
||||
if (this.isFinished) {
|
||||
done()
|
||||
} else {
|
||||
this.$message.warning(this.$tc('terminal.Uploading'))
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
@@ -72,6 +82,7 @@ export default {
|
||||
if (!this.file) {
|
||||
return
|
||||
}
|
||||
this.isFinished = false
|
||||
const form = new FormData()
|
||||
form.append('file', this.file.raw)
|
||||
this.$axios.post(
|
||||
@@ -82,10 +93,12 @@ export default {
|
||||
disableFlashErrorMsg: true
|
||||
}
|
||||
).then(res => {
|
||||
this.isFinished = true
|
||||
this.$message.success(this.$tc('terminal.UploadSucceed'))
|
||||
this.$emit('update:visible', false)
|
||||
this.$emit('upload-event', res)
|
||||
}).catch(err => {
|
||||
this.isFinished = true
|
||||
const error = err.response.data
|
||||
const msg = error?.message || error?.detail || error?.error || JSON.stringify(error)
|
||||
this.$message.error(msg)
|
||||
|
||||
Reference in New Issue
Block a user