上传文件

This commit is contained in:
徐哼唧L
2024-02-08 09:15:38 +08:00
parent a5110e7c16
commit 9fdafcb949
8 changed files with 820 additions and 500 deletions

View File

@@ -76,7 +76,7 @@
<el-option v-for="item in journal_type" :key="item.value" :label="item.name"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Major :" :required="true" prop="major_a">
<el-select v-model="form.major_a" placeholder="Please select major" @change="majorChange(1)"
@@ -100,14 +100,32 @@
<el-form-item label="Manuscript Title :" prop="title">
<el-input v-model="form.title" placeholder="Please enter title"></el-input>
</el-form-item>
<el-form-item label="Whether ethical approval was obtained ?" v-show="form.type == 'A'"
<el-form-item label="Whether ethical approval was obtained ?" prop="approval"
label-width="300px">
<el-switch v-model="form.approval" active-text="yes" inactive-text="no"></el-switch>
<p v-show="form.approval == true"
style="display: inline-block;width: 440px;margin-left: 60px;vertical-align: top;line-height: 22px;color: #999;font-size: 12px;">
For authors who selected 'Yes', please provide the approval number and name of the
ethics committee or institutional review board that approved the study.
</p>
<el-radio-group v-model="form.approval">
<el-radio :label="1">Yes</el-radio>
<el-radio :label="0">No</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Ethical approval file :" prop="approval_file" v-if="form.approval == 1"
label-width="300px">
<el-upload ref="uploadFile" class="upload-demo up_newstyle" :action="upload_articleApproval"
accept=".pdf" name="articleApproval" :before-upload="beforeupload_articleApproval"
:on-error="uperr_coverLetter" :on-success="upSuccess_articleApproval" :limit="1"
:on-exceed="alertlimit" :on-remove="removefilearticleApproval" :file-list="fileL_articleApproval"
:on-preview="dowloadFile">
<div class="el-upload__text" @click="clearUploadedFile">
<em>Upload</em>
</div>
<div class="el-upload__tip" slot="tip">
Only Word and compressed files can be uploaded (file format: .pdf).
</div>
</el-upload>
</el-form-item>
<el-form-item label="Explain the reason clearly :" prop="approval_content"
v-if="form.approval === 0" label-width="300px">
<el-input type="textarea" rows="2" v-model="form.approval_content"
placeholder="Please enter"></el-input>
</el-form-item>
<el-form-item label="Abstract :" prop="abstrart">
<el-input type="textarea" rows="5" v-model="form.abstrart"
@@ -326,7 +344,7 @@
Only Word and compressed files can be uploaded (file format: .docx).
</div>
</el-upload>
</el-form-item>
<el-form-item label="Supplementary Material :" label-width="200px">
<el-upload class="upload-demo up_newstyle" :action="upload_supplementary" accept=".zip"
@@ -488,7 +506,7 @@
</el-form-item>
<el-form-item label="Major :" prop="major_all">
<el-cascader :options="step4MajorList" v-model="item.major_all" :props="default4Params"
placeholder="Please select major" style="width: 270px;" clearable ></el-cascader>
placeholder="Please select major" style="width: 270px;" clearable></el-cascader>
</el-form-item>
<el-button :disabled="tuiJianForm.length==1" @click="onDeleteTuijian(item, index)"
type="danger" icon="el-icon-delete" class="shanchu_tj"></el-button>
@@ -653,7 +671,7 @@
checkedjours: [],
abstrart: '',
type: '',
approval: false,
approval: '',
istransfer: false,
becomeRev: false,
keyWords: '',
@@ -664,6 +682,8 @@
totalpage: '',
manuscirpt: '',
supplementary: '',
approval_file:'',
approval_content:'',
code: '',
// topics:null
},
@@ -756,6 +776,7 @@
major_all: ''
}],
countrys: [],
fileL_articleApproval: [],
fileL_coverLetter: [],
fileL_picturesAndTables: [],
fileL_manuscirpt: [],
@@ -857,6 +878,21 @@
message: 'Please select major',
trigger: 'blur'
}],
approval: [{
required: true,
message: 'Please select whether ethical approval was obtained',
trigger: 'blur'
}],
approval_content: [{
required: true,
message: 'Please enter reason',
trigger: 'blur'
}],
approval_file: [{
required: true,
message: 'Please upload ethical approva file',
trigger: 'blur'
}],
},
activeNames: [1],
keywordsList: [{
@@ -874,22 +910,22 @@
companyList: [],
countrys: [],
majorList: [],
step4MajorList:[], // 第四步的major数据
step4MajorList: [], // 第四步的major数据
jl_major: [],
defaultParams: {
label: 'title',
value: 'major_id',
children: 'children'
},
default4Params:{
default4Params: {
label: 'major_title',
value: 'major_id',
children: 'children'
},
mj_jour: [],
jour_name: '',
topicsList:null, // 话题列表
topicsProps:{
topicsList: null, // 话题列表
topicsProps: {
multiple: true,
emitPath: false, // 只返回该节点的值
value: "journal_topic_id", // 自定义要映射的键名
@@ -917,6 +953,9 @@
}
},
computed: {
upload_articleApproval: function() {
return this.baseUrl + 'api/Article/up_approval_file';
},
upload_coverLetter: function() {
return this.baseUrl + 'api/Article/up_file/type/coverLetter';
},
@@ -1030,14 +1069,15 @@
if (vali) {
tuijian_yanzheng += 0
//this.tuiJianForm[i].major = this.tuiJianForm[i].major_all[0]
this.tuiJianForm[i].major = this.tuiJianForm[i].major_all[this.tuiJianForm[i].major_all.length - 1]
this.tuiJianForm[i].major = this.tuiJianForm[i].major_all[this
.tuiJianForm[i].major_all.length - 1]
//this.tuiJianForm[i].cmajor = this.tuiJianForm[i].major_all[1]
} else {
tuijian_yanzheng += 1
}
})
}
this.form.reviewers = this.tuiJianForm
this.form.reviewers = this.tuiJianForm
} else {
this.form.reviewers = []
}
@@ -1192,21 +1232,20 @@
'value': res.data.companys[i].title
})
}
});
});
this.$api
.post('/api/Reviewer/getMajorForReviewer', {
username: localStorage.getItem('U_name'),
}).then(res => {
}).then(res => {
if (res.data.major != 0) {
this.$api
.post('api/User/getMajorList')
.then(res => {
this.majorList = res.data;
})
}
})
this.$api
.post('api/Reviewer/getAllMajor')
.then(res => {
@@ -1219,12 +1258,12 @@
this.checkReviewer()
this.$api
.post('api/Major/getMajorList')
.then(res => {
console.log(res,99)
this.step4MajorList = res.data.majors;
})
.post('api/Major/getMajorList')
.then(res => {
console.log(res, 99)
this.step4MajorList = res.data.majors;
})
},
@@ -1396,6 +1435,17 @@
document.body.removeChild(downloadElement);
},
//检验上传文件的格式
beforeupload_articleApproval(file) {
// const ismau =
// file.type === 'application/msword' ||
// file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
// file.type === 'application/x-zip-compressed' ||
// file.name.split('.')[1] === 'rar';
// if (!ismau) {
// this.$message.error('Only word and compressed files(.doc,.docx,.rar,.zip)');
// }
// return ismau;
},
beforeupload_coverLetter(file) {
// const isWORd =
// file.type === 'application/msword' ||
@@ -1451,6 +1501,17 @@
// return ismau;
},
//文件上传成功后的操作
upSuccess_articleApproval(res, file) {
if (res.code == 0) {
this.form.approval_file = 'articleApproval/' + res.upurl;
this.fileL_articleApproval = [{}];
this.fileL_articleApproval[0].name = "Ethical approval File";
this.fileL_articleApproval[0].url = 'articleApproval/' + res.upurl;
} else {
this.$message.error('service error: ' + res.msg);
}
console.log(this.form)
},
upSuccess_coverLetter(res, file) {
if (res.code == 0) {
this.form.coverLetter = 'coverLetter/' + res.upurl;
@@ -1510,6 +1571,10 @@
this.$message.error('The maximum number of uploaded files has been exceeded');
},
//清除文件时的事件
removefilearticleApproval(file, fileList) {
this.form.approval_file = '';
this.fileL_articleApproval = [];
},
removefilecoverLetter(file, fileList) {
this.form.coverLetter = '';
this.fileL_coverLetter = []
@@ -1709,9 +1774,15 @@
}
}
},
showFiles() {
// 文件显示出来
this.fileL_articleApproval = [];
if (this.form.approval_file != '') {
this.fileL_articleApproval = [{}]
this.fileL_articleApproval[0].name = "Ethical approval file";
this.fileL_articleApproval[0].url = this.form.approval_file;
}
this.fileL_coverLetter = [];
if (this.form.coverLetter != '') {
this.fileL_coverLetter = [{}]
@@ -1965,8 +2036,10 @@
this.form.type = res.data.base.type
this.form.title = res.data.base.title
this.form.approval = res.data.base.approval
this.form.approval_content = res.data.base.approval_content
this.form.abstrart = res.data.base.abstrart
this.form.fund = res.data.base.fund
console.log(res.data.base)
// this.form.topics = res.data.base.topics
// 领域
this.$api
@@ -2034,6 +2107,10 @@
// 文件
if (res.data.files.length > 0) {
for (let i = 0; i < res.data.files.length; i++) {
if (res.data.files[i].type_name == 'articleApprova') {
this.form.approval_file = res.data.files[i].file_url
this.form.approval_fileId = res.data.files[i].file_id
}
if (res.data.files[i].type_name == 'coverLetter') {
this.form.coverLetter = res.data.files[i].file_url
this.form.coverLetterId = res.data.files[i].file_id
@@ -2065,20 +2142,22 @@
},
// 获取话题
getTopics(){
this.$api
.post('api/Article/getJournalTopics', {'journal_id': this.Reviewerof.journal})
.then((res) => {
if (res.code == 0) {
this.topicsList = res.data.topics
// console.log(res.data.topics,'话题')
} else {
this.$message.error(res.msg);
}
});
getTopics() {
this.$api
.post('api/Article/getJournalTopics', {
'journal_id': this.Reviewerof.journal
})
.then((res) => {
if (res.code == 0) {
this.topicsList = res.data.topics
// console.log(res.data.topics,'话题')
} else {
this.$message.error(res.msg);
}
});
},
// 选中值变化
topicsChange(e){
topicsChange(e) {
// console.log(this.form.topics,'选中的话题id')
}
@@ -2087,7 +2166,7 @@
</script>
<style scoped>
.formTopics{
.formTopics {
width: 100%;
}
</style>
@@ -2343,7 +2422,7 @@
.jour_ku_all {
font-size: 12px;
float: left;
width: 210px;
width: 265px;
padding-left: 10px;
cursor: pointer;
color: #666;
@@ -2351,11 +2430,11 @@
}
.jour_ku_all:nth-child(3n+1) {
width: 270px;
width: 230px;
}
.jour_ku_all:nth-child(3n+2) {
width: 240px;
width: 220px;
}
.jour_ku_all.B_style {
@@ -2419,4 +2498,4 @@
word-break: break-word;
text-align: left;
}
</style>
</style>