案例管理的文件下载

This commit is contained in:
xiezhijun
2021-03-06 00:15:27 +08:00
parent 0f96ebf0f2
commit f1adbb041f
7 changed files with 112 additions and 67 deletions

View File

@ -71,12 +71,8 @@ export function uploadCseFile(data) {
}
// 下载案例文件
export function downCaseFile(data) {
return request({
url: '/custom/customerCase/downCaseFile',
method: 'post',
data: data
})
export function downCaseFile(downUrl) {
window.location.href = downUrl;
}

View File

@ -12,7 +12,7 @@
size="mini"
type="text"
icon="el-icon-download"
@click=""
@click="downloadFile(scope.row)"
>下载</el-button>
</template>
</el-table-column>
@ -66,7 +66,7 @@ export default {
this.fileList = [];
},
downloadFile(file){
downCaseFile(file);
downCaseFile(file.downUrl);
}
},
};

View File

@ -17,7 +17,7 @@
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">每个案例最多上传5个文件且每个文件不超过50M</div>
<div class="el-upload__tip" slot="tip">每个案例最多上传5个文件且每个文件不超过10M</div>
</el-upload>
</template>
<script>
@ -43,7 +43,7 @@ export default {
//同时上传文件上限
limit: 5,
//每个文件大小
fileSize: 1024 * 1024 * 50,
fileSize: 1024 * 1024 * 10,
//是否支持同时选择多张
multiple: true
},

View File

@ -217,7 +217,8 @@
keywordArray: [
{ required: true, message: "案例关键词不能为空", trigger: "blur" },
],
}
},
submitFlag: false
};
},
components: {
@ -303,17 +304,26 @@
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.keyword = this.form.keywordArray.join(",");
if (this.form.id != null) {
updateCustomerCase(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
if(this.submitFlag){
this.$message({
message: "正在上传提交中,请勿重复提交",
type: "warning",
});
return;
}
});
this.submitFlag = true;
this.form.keyword = this.form.keywordArray.join(",");
if (this.form.id != null) {
updateCustomerCase(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
this.submitFlag = false;
});
} else {
this.$refs["uploadCaseFile"].uploadFile();
this.$refs["uploadCaseFile"].uploadFile();
}
}
});
@ -323,6 +333,7 @@
this.form.caseFileUrl = fileResult.fileUrl;
if(this.form.caseFileUrl.length == 0){
this.$message.error('请至少选择一个文件上传');
this.submitFlag = false;
return;
}
addCustomerCase(this.form).then(response => {
@ -332,6 +343,7 @@
this.$refs["uploadCaseFile"].uploadReset();
this.getList();
}
this.submitFlag = false;
});
},
selectCustomer(){