案例文件下载上传优化
This commit is contained in:
parent
728b93cbdc
commit
4b58e1b6bc
stdiet-ui/src
@ -56,7 +56,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
uploadFile(){
|
||||
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length != this.upload.fileList.length){
|
||||
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
|
||||
this.$refs.upload.submit();
|
||||
}else{
|
||||
this.$emit('callbackMethod', this.uploadResult);
|
||||
@ -106,19 +106,21 @@ export default {
|
||||
}else{
|
||||
this.upload.fileList = fileList.pop();
|
||||
this.$message.error('文件上传失败,请检查文件格式');
|
||||
this.$emit('changeSubmitFlag', false);
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList){
|
||||
this.$message.error('文件上传失败,请检查文件格式');
|
||||
this.upload.fileList = fileList.pop();
|
||||
this.$emit('changeSubmitFlag', false);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
created() {
|
||||
this.uploadReset();
|
||||
//this.uploadReset();
|
||||
},
|
||||
|
||||
};
|
||||
|
@ -134,12 +134,14 @@ export default {
|
||||
}else{
|
||||
this.upload.fileList = fileList.pop();
|
||||
this.$message.error('文件上传失败,请检查文件格式');
|
||||
this.$emit('changeSubmitFlag', false);
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList){
|
||||
this.$message.error('文件上传失败,请检查文件格式');
|
||||
this.upload.fileList = fileList.pop();
|
||||
this.$emit('changeSubmitFlag', false);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -153,6 +155,12 @@ export default {
|
||||
created() {
|
||||
|
||||
},
|
||||
watch : {
|
||||
caseFileList:function(newVal, oldVal) {
|
||||
//console.log(newVal.length);
|
||||
this.oldCaseFileList = newVal;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
@ -170,8 +170,8 @@
|
||||
<span style="margin-left: 10px"> <el-button type="primary" @click="selectCustomer">选择所属客户</el-button></span>
|
||||
</el-form-item>
|
||||
<el-form-item label="案例文件" prop="file" >
|
||||
<DragUpload v-if="form.id == null || form.id <= 0" @callbackMethod="addOrEditCustomerCase" ref="uploadCaseFile"></DragUpload>
|
||||
<DragUploadEdit v-else @callbackMethod="addOrEditCustomerCase" :caseFileList="form.caseFileList" ref="editUploadCaseFile"></DragUploadEdit>
|
||||
<DragUpload v-show="form.id == null || form.id <= 0" @changeSubmitFlag="changeSubmitFlag" @callbackMethod="addOrEditCustomerCase" ref="uploadCaseFile"></DragUpload>
|
||||
<DragUploadEdit v-show="form.id != null || form.id > 0" @callbackMethod="addOrEditCustomerCase" @changeSubmitFlag="changeSubmitFlag" :caseFileList="form.caseFileList" ref="editUploadCaseFile"></DragUploadEdit>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@ -264,8 +264,8 @@
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
//this.$refs["uploadCaseFile"].uploadReset();
|
||||
//this.$refs["editUploadCaseFile"].uploadReset();
|
||||
this.$refs["uploadCaseFile"].uploadReset();
|
||||
this.$refs["editUploadCaseFile"].uploadReset();
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
@ -363,15 +363,18 @@
|
||||
console.log(this.form.caseFileName.length);
|
||||
updateCustomerCase(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$refs["editUploadCaseFile"].uploadReset();
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
this.submitFlag = false;
|
||||
|
||||
});
|
||||
}else{
|
||||
addCustomerCase(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$refs["uploadCaseFile"].uploadReset();
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@ -380,6 +383,9 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
changeSubmitFlag(flag){
|
||||
this.submitFlag = flag;
|
||||
},
|
||||
selectCustomer(){
|
||||
this.$refs['selectCustomerRef'].showDialog("选择案例所属客户");
|
||||
},
|
||||
@ -405,8 +411,8 @@
|
||||
return delCustomerCase(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user