附件格式

This commit is contained in:
zyx.net
2023-03-27 13:38:58 +08:00
parent e756b54a96
commit 57b5488310
3 changed files with 14 additions and 3 deletions
+12 -1
View File
@@ -34,7 +34,7 @@
export default {
name: 'file',
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
props: ['disableds', 'disabled', 'thisFileUploadUrl','accept', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
data() {
return {
visible: false,
@@ -88,6 +88,16 @@
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
console.log(file)
this.fileTypeSatus = true
//根据格式拦截
if(this.accept){
let fileNames = file.name.split('.')
let fileType = fileNames[fileNames.length - 1].toLocaleLowerCase()
let extList = this.accept.split(',')
if (!extList.find((item) => item == fileType)) {
this.$message.error(this.$t('uploadOnly') + this.accept + this.$t('type'))
reject(false)
}
}
if (this.isMultiple) {
if ((this.myfileList && this.myfileList.length == 1) || this.myfileList && this.myfileList.length > 1) {
this.$message.warning(this.$t('onlyOnefileUploaded'))
@@ -121,6 +131,7 @@
// }else{
// this.fileTypeSatus = false;
// }
// }
// }
this.$message.destroy()
},
@@ -45,7 +45,7 @@
:placeholder="$t('PleaseSelect')"
:type="'select'"
:triggerChange="false"
:dictCode="record.dictCode"
:dictCode="'driving_automation_level'"
v-model="record.jszdhjb"/>
</span>
<!-- 技术参数-->
@@ -34,7 +34,7 @@
<a-button type="primary" style='width: 73px;margin-right: 50px' @click="last">{{ $t('last') }}</a-button>
<a-button type="primary" style='width: 73px' @click='next'>{{ $t('next') }}</a-button>
</div>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
<uploadFile ref="uploadFile" :accept="'.doc,.docx,.pdf'" @uploadSuccess="uploadSuccess"></uploadFile>
</div>
</template>