|
@@ -35,6 +35,7 @@
|
|
|
:disabled="loading"
|
|
|
:auto-upload="false"
|
|
|
:multiple="false"
|
|
|
+ :before-remove="beforeRemove"
|
|
|
style="text-align: center"
|
|
|
>
|
|
|
<i class="el-icon-upload"></i>
|
|
@@ -83,7 +84,9 @@
|
|
|
<!-- <p v-if="filename" class="tips-info">{{ filename }}</p> -->
|
|
|
<p v-if="!res.success" class="tips-info tips-error">{{ res.message }}</p>
|
|
|
<div slot="footer">
|
|
|
- <el-button type="primary" @click="submitUpload">确认</el-button>
|
|
|
+ <el-button type="primary" @click="submitUpload" :disabled="!filename"
|
|
|
+ >确认</el-button
|
|
|
+ >
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -178,17 +181,22 @@ export default {
|
|
|
? this.format.some((item) => item.toLowerCase() === _file_format)
|
|
|
: true;
|
|
|
},
|
|
|
+ beforeRemove() {
|
|
|
+ this.dialogClose();
|
|
|
+ return true;
|
|
|
+ },
|
|
|
fileChange(fileObj, fileList) {
|
|
|
- // if (fileObj.status === "ready") {
|
|
|
- this.handleBeforeUpload(fileObj.raw).catch(() => {});
|
|
|
- if (fileList.length > 1) {
|
|
|
- fileList[0] = fileList[1];
|
|
|
- fileList.splice(1, 1);
|
|
|
+ if (fileObj.status === "ready") {
|
|
|
+ this.handleBeforeUpload(fileObj.raw).catch(() => {});
|
|
|
+ if (fileList.length > 1) {
|
|
|
+ fileList[0] = fileList[1];
|
|
|
+ fileList.splice(1, 1);
|
|
|
+ }
|
|
|
}
|
|
|
- // }
|
|
|
},
|
|
|
async handleBeforeUpload(file) {
|
|
|
this.res = {};
|
|
|
+ console.log("handleBeforeUpload");
|
|
|
this.filename = file.name;
|
|
|
this.uploadDataDict = {
|
|
|
...this.uploadData,
|
|
@@ -232,6 +240,7 @@ export default {
|
|
|
success: false,
|
|
|
message: error.response.data.message,
|
|
|
};
|
|
|
+ console.log("err", error.response);
|
|
|
this.uploadDataDict = {};
|
|
|
this.filename = "";
|
|
|
this.fileValid = false;
|