协调L3页面,新增合同证书的文件上传逻辑

This commit is contained in:
2025-12-23 15:56:15 +08:00
parent 9f423b26f9
commit 04eace18c4
11 changed files with 577 additions and 67 deletions

View File

@@ -48,6 +48,11 @@ export default {
props: {
// 值
value: [String, Object, Array],
// 额外的自定义校验函数,返回 false 阻止上传
beforeValidate: {
type: Function,
default: null,
},
// 数量限制
limit: {
type: Number,
@@ -127,6 +132,15 @@ export default {
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 额外自定义校验
if (this.beforeValidate) {
const pass = this.beforeValidate(file);
if (pass === false) {
// 防止残留文件
this.resetUpload();
return false;
}
}
// 校检文件类型
if (this.fileType) {
const fileName = file.name.split('.');
@@ -189,6 +203,17 @@ export default {
this.$modal.closeLoading();
}
},
// 重置上传状态(外部可调用)
resetUpload() {
this.number = 0;
this.uploadList = [];
this.fileList = [];
this.$emit("input", "");
if (this.$refs.fileUpload) {
this.$refs.fileUpload.clearFiles();
}
this.$modal.closeLoading();
},
// 获取文件名称
getFileName(name) {
// 如果是url那么取最后的名字 如果不是直接返回