|
|
|
@ -55,12 +55,14 @@ |
|
|
|
<el-upload ref="uploadRef" class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview" |
|
|
|
:headers="headers" |
|
|
|
:before-remove="beforeRemove" |
|
|
|
:before-upload="beforeUpload" |
|
|
|
:on-remove="handleRemove" multiple :limit="10" |
|
|
|
:on-success="handleSuccess" |
|
|
|
:on-change="handleChange" |
|
|
|
:on-exceed="handleExceed" :file-list="fileList" |
|
|
|
:auto-upload="false"> |
|
|
|
<el-button :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" size="small" type="primary">点击上传</el-button> |
|
|
|
<span v-if="error" class = "atta-tips">请上传附件</span> |
|
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg,文件大小不超过2MB</div> |
|
|
|
</el-upload> |
|
|
|
</template> |
|
|
|
@ -255,10 +257,13 @@ export default { |
|
|
|
this.selectRegentInfo = data; |
|
|
|
console.log(data,"yq") |
|
|
|
}, |
|
|
|
// 删除前确认 |
|
|
|
beforeRemove(file) { |
|
|
|
return this.$confirm(`确定移除 ${file.name} ?`) |
|
|
|
beforeUpload(file){ |
|
|
|
return false; |
|
|
|
}, |
|
|
|
// // 删除前确认 |
|
|
|
// beforeRemove(file) { |
|
|
|
// return this.$confirm(`确定移除 ${file.name} ?`) |
|
|
|
// }, |
|
|
|
// 文件状态改变时的钩子,添加文件、上传成功、上传失败时都会被调用 |
|
|
|
handleChange(file, fileList) { |
|
|
|
// 如果是新添加的文件(status为ready),进行验证 |
|
|
|
@ -350,8 +355,10 @@ export default { |
|
|
|
this.$message.success(`文件 ${file.name} 已移除`); |
|
|
|
}, |
|
|
|
handlePreview(file) { |
|
|
|
if (file.url) { |
|
|
|
window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank'); |
|
|
|
console.log(file) |
|
|
|
const url = file.url || file.response?.data?.url; |
|
|
|
if (url) { |
|
|
|
window.open(process.env.VUE_APP_FILE_DOMAIN + url, '_blank'); |
|
|
|
} |
|
|
|
}, |
|
|
|
handleExceed(files, fileList) { |
|
|
|
@ -472,7 +479,7 @@ export default { |
|
|
|
preFill: "blue-border",//预填写的边框颜色 |
|
|
|
} |
|
|
|
// 如果有错误状态,返回红色边框样式,覆盖原有的边框颜色 |
|
|
|
if (this.error) { |
|
|
|
if (this.error && this.type !== "attachment") { |
|
|
|
return "error-border"; |
|
|
|
} |
|
|
|
return typeObj[fillType] || "" |
|
|
|
@ -1123,7 +1130,6 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.error-border { |
|
|
|
|
|
|
|
.el-input-group__prepend, |
|
|
|
@ -1267,4 +1273,9 @@ export default { |
|
|
|
display: flex; |
|
|
|
justify-content: flex-end; |
|
|
|
} |
|
|
|
.atta-tips { |
|
|
|
color: #ff5d5d; |
|
|
|
font-size: 12px; |
|
|
|
margin-left: 5px; |
|
|
|
} |
|
|
|
</style> |