|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- title="上传文档"
|
|
|
|
|
|
|
+ :title="$t('上传文档')"
|
|
|
:visible.sync="visible"
|
|
:visible.sync="visible"
|
|
|
width="620px"
|
|
width="620px"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
@@ -9,7 +9,7 @@
|
|
|
>
|
|
>
|
|
|
<el-form ref="uploadForm" :model="form" :rules="rules" label-width="90px" size="small">
|
|
<el-form ref="uploadForm" :model="form" :rules="rules" label-width="90px" size="small">
|
|
|
<!-- 文件选择 -->
|
|
<!-- 文件选择 -->
|
|
|
- <el-form-item label="选择文件" prop="files">
|
|
|
|
|
|
|
+ <el-form-item :label="$t('选择文件')" prop="files">
|
|
|
<el-upload
|
|
<el-upload
|
|
|
ref="upload"
|
|
ref="upload"
|
|
|
action="#"
|
|
action="#"
|
|
@@ -22,8 +22,8 @@
|
|
|
drag
|
|
drag
|
|
|
>
|
|
>
|
|
|
<i class="el-icon-upload"></i>
|
|
<i class="el-icon-upload"></i>
|
|
|
- <div class="dt-upload-text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
- <div class="dt-upload-tip" slot="tip">支持 PDF、Word、Excel、PPT、TXT,单个文件不超过 20MB</div>
|
|
|
|
|
|
|
+ <div class="dt-upload-text">{{ $t('将文件拖到此处,或') }}<em>{{ $t('点击上传') }}</em></div>
|
|
|
|
|
+ <div class="dt-upload-tip" slot="tip">{{ $t('支持文件格式') }}TXT,单个文件不超过 20MB</div>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
@@ -85,7 +85,7 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<span slot="footer">
|
|
<span slot="footer">
|
|
|
- <el-button size="small" @click="closeDialog">取 消</el-button>
|
|
|
|
|
|
|
+ <el-button size="small" @click="closeDialog">{{ $t('取消') }}</el-button>
|
|
|
<el-button size="small" type="primary" :disabled="fileList.length === 0" @click="submitUpload">开始上传</el-button>
|
|
<el-button size="small" type="primary" :disabled="fileList.length === 0" @click="submitUpload">开始上传</el-button>
|
|
|
</span>
|
|
</span>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
- files: [{ required: true, message: '请选择文件', trigger: 'change' }]
|
|
|
|
|
|
|
+ files: [{ required: true, message: this.$t(this.$t('请选择文件')), trigger: 'change' }]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -118,7 +118,7 @@ export default {
|
|
|
beforeUpload(file) {
|
|
beforeUpload(file) {
|
|
|
const maxSize = 20 * 1024 * 1024
|
|
const maxSize = 20 * 1024 * 1024
|
|
|
if (file.size > maxSize) {
|
|
if (file.size > maxSize) {
|
|
|
- this.$message.error(`文件 ${file.name} 超过 20MB 限制`)
|
|
|
|
|
|
|
+ this.$message.error(this.$t('文件超过限制', { name: file.name }))
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
|
|
|
|
|
submitUpload() {
|
|
submitUpload() {
|
|
|
if (this.fileList.length === 0 && this.form.files.length === 0) {
|
|
if (this.fileList.length === 0 && this.form.files.length === 0) {
|
|
|
- this.$message.warning('请选择文件')
|
|
|
|
|
|
|
+ this.$message.warning(this.$t(this.$t('请选择文件')))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
this.$emit('submit', {
|
|
this.$emit('submit', {
|
|
@@ -187,4 +187,4 @@ export default {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
margin-top: 8px;
|
|
margin-top: 8px;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|