附加文件上传

This commit is contained in:
@fawn-nine
2023-08-17 14:46:51 +08:00
parent 7d52c60dad
commit fb4cd39a76

View File

@@ -374,6 +374,19 @@
<span style="font-size: 12px; color: #aaa;margin-left: 30px;">Only pdf or word files can be
uploaded.</span>
</el-form-item>
<el-form-item label="Original Data Upload :">
<el-upload class="upload-demo"
:action="baseUrl+'api/Production/up_article_file/type/articleOriginal'"
:on-success="handleFileSuccess41" name="articleOriginal" type="articleOriginal"
:on-error="handleFileError" :on-preview="handlePreview" :on-remove="handleRemove"
:before-remove="beforeRemove41" :on-change="handleChange41" accept=".zip"
:on-exceed="handleExceed" :file-list="fileL_sub41" ref="upload">
<el-button type="text" style="font-weight: bolder;"><b class="el-icon-lx-top"
style="font-weight: bolder;"></b>upload</el-button>
</el-upload>
<span style="font-size: 12px; color: #aaa;margin-left: 30px;">Only zip files can be
uploaded.</span>
</el-form-item>
</el-form>
</div>
@@ -1050,6 +1063,7 @@
file_picF: [],
fileL_sub: [],
fileL_sub2: [],
fileL_sub41:[],
fileL_Note: [],
fileL_Tex: [],
fileL_Icm: [],
@@ -1293,6 +1307,12 @@
this.fileL_Icm[0].url = this.mediaUrl + 'articleCDF/' + res.data.production.file_cdf;
}
if (res.data.production.file_original != "") {
this.fileL_sub41 = [{}];
this.fileL_sub41[0].name = 'Original';
this.fileL_sub41[0].url = this.mediaUrl + 'Original/' + res.data.production.file_original;
}
// if (this.detailMes.main != '') {
// this.detailMes.main = JSON.parse(this.detailMes.main)
@@ -2226,6 +2246,11 @@
this.fileL_sub2 = [fileList[fileList.length - 1]]
}
},
handleChange41(file, fileList) {
if (fileList.length > 0) {
this.fileL_sub41 = [fileList[fileList.length - 1]]
}
},
handleChange5(file, fileList) {
if (fileList.length > 0) {
this.fileL_Note = [fileList[fileList.length - 1]]
@@ -2290,6 +2315,30 @@
this.$message.error(res.msg);
}
},
handleFileSuccess41(res, file) {
if (res.code == 0) {
this.$api
.post('api/Production/editArticleFile', {
'p_article_id': this.p_article_id,
'filetype': 'Original',
'fileURL': res.upurl
})
.then(res => {
if (res.code == 0) {
this.$message.success('Original Data File upload succeeded!');
this.getData();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
} else {
this.$message.error(res.msg);
}
},
handleFileSuccess5(res, file) {
if (res.code == 0) {
this.$api
@@ -2393,6 +2442,7 @@
});
});
},
beforeRemove4(file, fileList) {
return this.$confirm(`Are you sure to remove ${ file.name }?`).then(() => {
this.$api
@@ -2414,6 +2464,28 @@
});
});
},
beforeRemove41(file, fileList) {
return this.$confirm(`Are you sure to remove ${ file.name }?`).then(() => {
this.$api
.post('master/Article/editArticleFile', {
'p_article_id': this.p_article_id,
'filetype': 'Original',
'fileURL': ''
})
.then(res => {
if (res.code == 0) {
this.$message.success('Original Data File deleted successfully!');
this.getData();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
// console.log('删除附加文件')
});
},
beforeRemove5(file, fileList) {
return this.$confirm(`Are you sure to remove ${ file.name }?`).then(() => {
this.$api