Merge branch 'liujun-2024-02-04-相关方新流程上线后新提需求' into dev

pet_li_6.6
liujun 2024-02-27 16:43:01 +08:00
commit 92455dc009
2 changed files with 25 additions and 4 deletions

View File

@ -1,6 +1,7 @@
<template> <template>
<div> <div>
<el-dialog <el-dialog
v-loading="loading"
:visible.sync="visible" :visible.sync="visible"
:append-to-body="appendToBody" :append-to-body="appendToBody"
:before-close="beforeClose" :before-close="beforeClose"
@ -50,7 +51,7 @@
:file-list.sync="form.APPOINT_ANNEX" :file-list.sync="form.APPOINT_ANNEX"
:multiple="false" :multiple="false"
:accept="'.pdf,.jpg,.png,doc,docx'" :accept="'.pdf,.jpg,.png,doc,docx'"
:limit="1" :limit="20"
:size="1024" :size="1024"
:upload-type="1"/> :upload-type="1"/>
</el-form-item> </el-form-item>
@ -193,7 +194,10 @@ export default {
Object.keys(this.form).map(key => { Object.keys(this.form).map(key => {
formData.append(key, this.form[key]) formData.append(key, this.form[key])
}) })
formData.append('chenNuoShu', this.form.APPOINT_ANNEX[0].raw) for (let i = 0; i < this.form.APPOINT_ANNEX.length; i++) {
formData.append('chenNuoShu', this.form.APPOINT_ANNEX[i].raw)
}
this.loading = true
upload('/trainingbatch/sendMessage', formData upload('/trainingbatch/sendMessage', formData
).then((data) => { ).then((data) => {
if (data.code !== '0') { if (data.code !== '0') {
@ -203,6 +207,7 @@ export default {
this.visible = false this.visible = false
this.$emit('refresh', '') this.$emit('refresh', '')
this.beforeClose() this.beforeClose()
this.loading = false
} }
}) })
} }

View File

@ -46,7 +46,9 @@ export default {
return { return {
dialogImageUrl: '', dialogImageUrl: '',
dialogVisible: false, dialogVisible: false,
disabled: false disabled: false,
file: {},
file_name: ''
} }
}, },
methods: { methods: {
@ -63,15 +65,29 @@ export default {
const isLt2M = file.size / 1024 / 1024 < this.fileSize const isLt2M = file.size / 1024 / 1024 < this.fileSize
if (!isLt2M) { if (!isLt2M) {
this.$message.error('上传视频大小不能超过 ' + this.fileSize + 'MB!') this.$message.error('上传视频大小不能超过 ' + this.fileSize + 'MB!')
this.$refs.uploadFile.clearFiles() this.$refs.uploadFile.handleRemove(file)
return false return false
} }
let nameNumber = 0
for (let j = 0; j < fileList.length; j++) {
if (fileList[j].name === file.name) {
nameNumber = nameNumber + 1
}
}
if (nameNumber > 1) {
this.$message.error('文件名重复,请重新选择!')
this.$refs.uploadFile.handleRemove(file)
return false
}
this.$emit('update:fileList', fileList) this.$emit('update:fileList', fileList)
}, },
onRemove(file, fileList) { onRemove(file, fileList) {
this.$emit('update:fileList', fileList) this.$emit('update:fileList', fileList)
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
console.log(files, fileList)
this.$message.warning(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`) this.$message.warning(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
} }
} }