[update] 文件上传展示上传格式和大小

This commit is contained in:
lideqin
2024-07-09 10:06:25 +08:00
parent ba2f572d9f
commit c181b4dc17
5 changed files with 23 additions and 5 deletions
+3
View File
@@ -205,6 +205,9 @@ module.exports = {
designEngineer: 'Design engineer', designEngineer: 'Design engineer',
pleaseUpload: 'Please upload', pleaseUpload: 'Please upload',
supportingMaterial: 'Supporting material', supportingMaterial: 'Supporting material',
support: 'You can upload files in ',
formatUpload: ' formats. ',
theSizeIs: 'The size is ',
// 树右键 // 树右键
treeRight: { treeRight: {
addFolder: 'Create New Folder', addFolder: 'Create New Folder',
+3
View File
@@ -222,6 +222,9 @@ module.exports = {
designEngineer: '设计工程师', designEngineer: '设计工程师',
pleaseUpload: '请上传', pleaseUpload: '请上传',
supportingMaterial: '佐证材料', supportingMaterial: '佐证材料',
support: '支持',
formatUpload: '格式上传,',
theSizeIs: '大小为',
// 标准字段 // 标准字段
standardField: { standardField: {
standardEnglishName: '标准英文名称', standardEnglishName: '标准英文名称',
+10 -2
View File
@@ -36,6 +36,7 @@
<p class="ant-upload-text"> <p class="ant-upload-text">
{{ $t('uploadFile.clickOrDragUpload') }} {{ $t('uploadFile.clickOrDragUpload') }}
</p> </p>
<p class="tips">{{ tips }}</p>
</a-upload-dragger> </a-upload-dragger>
<div id="images"> <div id="images">
@@ -62,7 +63,7 @@ const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
// 本系统限制可以上传的文件格式 // 本系统限制可以上传的文件格式
const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,jpg,jpeg,png,avi,wmv,mov,rm,mp4,cad' const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,jpg,jpeg,png'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
@@ -138,7 +139,7 @@ export default {
fileMaxSize: { fileMaxSize: {
type: Number, type: Number,
required: false, required: false,
default: 500 default: 20
} }
}, },
data () { data () {
@@ -165,6 +166,9 @@ export default {
}, },
complistType () { complistType () {
return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text' return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text'
},
tips () {
return this.$t('support') + this.fileType.split(',').map(item => '.'+item).join('、') + this.$t('formatUpload') + this.$t('theSizeIs') + this.fileMaxSize + 'MB'
} }
}, },
methods: { methods: {
@@ -454,4 +458,8 @@ export default {
} }
} }
} }
.tips {
word-break: break-word;
}
</style> </style>
+1 -1
View File
@@ -66,7 +66,7 @@
:backDepart="true" :backDepart="true"
:treeOpera="true" /> :treeOpera="true" />
<!-- 8, 上传文件 --> <!-- 8, 上传文件 -->
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" class="button-text" <a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" ghost class="button-text"
@click="clickButtonToUpload(item)"> @click="clickButtonToUpload(item)">
{{ {{
(formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === '' (formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === ''
+6 -2
View File
@@ -27,6 +27,7 @@
<a-icon type="upload" /> <a-icon type="upload" />
{{ text ? text : $t('clickToUpload') }} {{ text ? text : $t('clickToUpload') }}
</a-button> </a-button>
<p>{{ tips }}</p>
</slot> </slot>
</template> </template>
</a-upload> </a-upload>
@@ -64,7 +65,7 @@ const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
// 本系统限制可以上传的文件格式 // 本系统限制可以上传的文件格式
const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,jpg,jpeg,png,avi,wmv,mov,rm,mp4,cad' const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,jpg,jpeg,png'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
@@ -165,7 +166,7 @@ export default {
fileMaxSize: { fileMaxSize: {
type: Number, type: Number,
required: false, required: false,
default: 500 default: 20
} }
}, },
watch: { watch: {
@@ -202,6 +203,9 @@ export default {
}, },
complistType () { complistType () {
return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text' return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text'
},
tips () {
return this.$t('support') + this.fileType.split(',').map(item => '.'+item).join('、') + this.$t('formatUpload') + this.$t('theSizeIs') + this.fileMaxSize + 'MB'
} }
}, },
created () { created () {