文件上传

This commit is contained in:
Your Name
2023-09-27 15:49:08 +08:00
parent 9aa60f4900
commit d0bf9a1c73
2 changed files with 97 additions and 23 deletions
@@ -119,6 +119,7 @@
ref="fileupload"
:action="UploadUrl()"
:on-success="handlSuccess"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:data="filedata"
:headers="headers"
@@ -137,9 +138,17 @@
<el-col :span="12">
<el-form-item
label="申请人案件证据资料:"
v-if="flag == '0' && caseAttachList.length > 0"
v-if="
flag == '0' &&
caseAttachList.length > 0 &&
applicateArr.length > 0
"
>
<a href=""></a>
<div v-for="(item, index) in applicateArr" :key="index">
<a href="#" @click="toFile(item, index)" style="color: blue">
{{ item }}
</a>
</div>
</el-form-item>
</el-col>
<!-- 仅详情展示 案件质证环节以后显示被申请人证据-->
@@ -147,11 +156,16 @@
<el-form-item
label="被申请人案件证据资料:"
prop="respondentEvidence"
v-if="flag == '0' && caseAttachList.length > 0"
v-if="
flag == '0' && caseAttachList.length > 0 && quiltArr.length > 0
"
>
<a href="#" @click="toFile" style="color: blue">{{
caseAttachList[0].annexName
}}</a>
<div v-for="(item, index) in quiltArr" :key="index">
<a href="#" @click="toFile(item, index)" style="color: blue">
{{ item }}
</a>
</div>
<!-- <el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
@@ -762,7 +776,11 @@ export default {
},
],
},
// annexId: '',
caseAttachListArr: [],
fileList: [],
applicateArr: [],
quiltArr: [],
};
},
watch: {
@@ -774,6 +792,15 @@ export default {
setTimeout(() => {
this.form2.paymentArr = this.initpaymentArr;
this.form3.paymentArr1 = this.initpaymentArr1;
console.log(this.caseAttachList, "caseAttachList");
this.caseAttachList.forEach((item) => {
if (item.annexType == 2) {
this.applicateArr.push(item.annexName);
}
if (item.annexType == 6) {
this.quiltArr.push(item.annexName);
}
});
}, 1000);
}
if (this.flag == "2") {
@@ -817,7 +844,9 @@ export default {
},
// 文件上传成功
handlSuccess(res, file) {
console.log(res, file);
this.caseAttachListArr.push({
annexId: res.data.annexId,
});
},
// 文件超出个数限制时的钩子
handleExceed(files, fileList) {
@@ -831,6 +860,12 @@ export default {
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`);
},
handleRemove(file, fileList) {
(this.caseAttachListArr = []),
fileList.forEach((item) => {
this.caseAttachListArr.push({ annexId: item.response.data.annexId });
});
},
// 取消
cancel() {
this.$emit("cancel");
@@ -918,11 +953,7 @@ export default {
...this.form2.paymentArr,
...this.form3.paymentArr1,
];
this.formData.caseAttachList = [
{
annexId: 106,
},
];
this.formData.caseAttachList = [...this.caseAttachListArr];
if (this.formData.id) {
editCaseApply({
...this.formData,
@@ -954,9 +985,9 @@ export default {
});
},
// 详情显示,展示案件文件
toFile() {
toFile(item, index) {
window.open(
window.location.origin + "/API" + this.caseAttachList[0].annexPath,
window.location.origin + "/API" + this.caseAttachList[index].annexPath,
"_black"
);
},