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