|
@@ -68,33 +68,33 @@ export default {
|
|
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
);
|
|
);
|
|
},
|
|
},
|
|
- handleRemove(file, fileList) {
|
|
|
|
|
|
+ async handleRemove(file, fileList) {
|
|
let md5 = "";
|
|
let md5 = "";
|
|
if (file.raw) {
|
|
if (file.raw) {
|
|
- this.$md5(file.raw).then((res) => {
|
|
|
|
|
|
+ await this.$md5(file.raw).then((res) => {
|
|
md5 = res;
|
|
md5 = res;
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
md5 = file.md5;
|
|
md5 = file.md5;
|
|
}
|
|
}
|
|
|
|
+
|
|
let removeIndex = "";
|
|
let removeIndex = "";
|
|
this.attachmentList.forEach((item, index) => {
|
|
this.attachmentList.forEach((item, index) => {
|
|
if (md5 === item.md5) {
|
|
if (md5 === item.md5) {
|
|
removeIndex = index;
|
|
removeIndex = index;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ // if (removeIndex < 0) {
|
|
|
|
+ // this.$message.error("删除失败");
|
|
|
|
+ // }
|
|
|
|
+
|
|
this.attachmentList.splice(removeIndex, 1);
|
|
this.attachmentList.splice(removeIndex, 1);
|
|
this.$emit("attachmentChange", this.attachmentList);
|
|
this.$emit("attachmentChange", this.attachmentList);
|
|
},
|
|
},
|
|
async toUpload(file) {
|
|
async toUpload(file) {
|
|
let _this = this;
|
|
let _this = this;
|
|
- // 获取MD5值
|
|
|
|
- /* await this.$md5(file.file).then((res) => {
|
|
|
|
- _this.defaultParam = {
|
|
|
|
- file: file.file,
|
|
|
|
- md5: res,
|
|
|
|
- };
|
|
|
|
- }); */
|
|
|
|
|
|
+
|
|
return new Promise(async (resolve, reject) => {
|
|
return new Promise(async (resolve, reject) => {
|
|
let formData = new FormData();
|
|
let formData = new FormData();
|
|
await formData.append("name", file.file.name);
|
|
await formData.append("name", file.file.name);
|
|
@@ -114,8 +114,16 @@ export default {
|
|
this.$emit("willUpload");
|
|
this.$emit("willUpload");
|
|
|
|
|
|
let url = this.uploadUrl;
|
|
let url = this.uploadUrl;
|
|
|
|
+ let defaultParam = {};
|
|
if (!url) {
|
|
if (!url) {
|
|
url = this.$api.common.uploadWj;
|
|
url = this.$api.common.uploadWj;
|
|
|
|
+ // 获取MD5值
|
|
|
|
+ await this.$md5(file.file).then((res) => {
|
|
|
|
+ defaultParam = {
|
|
|
|
+ // file: file.file,
|
|
|
|
+ md5: res,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
await axios({
|
|
await axios({
|
|
@@ -132,7 +140,7 @@ export default {
|
|
this.attachmentList.push({
|
|
this.attachmentList.push({
|
|
// attachmentName: file.file.name,
|
|
// attachmentName: file.file.name,
|
|
// attachmentAddress: res.params,
|
|
// attachmentAddress: res.params,
|
|
- // md5: _this.defaultParam.md5,
|
|
|
|
|
|
+ md5: defaultParam.md5,
|
|
// uid: file.file.uid,
|
|
// uid: file.file.uid,
|
|
fileType: file.file.type,
|
|
fileType: file.file.type,
|
|
fileName: res.info.fileName,
|
|
fileName: res.info.fileName,
|