后台引用编辑前

This commit is contained in:
@fawn-nine
2023-07-07 10:22:27 +08:00
parent c509b53180
commit 85cc743ba0
7 changed files with 1652 additions and 206 deletions

View File

@@ -92,12 +92,15 @@
<li>
<p>- If you want to discard all references and import a new batch of reference information, please click <el-button type="text" @click="removeAll">Delete and re-import</el-button>.</p>
</li>
<li>
<p>- Please do not forget to recheck all references in the <span class="status ok float" ><i class="el-icon-circle-check"></i></span> status.</p>
</li>
</ul>
</div>
<div class="refenceCentent mt20">
<el-table :data="tableData" ref="multipleTable"
empty-text="New messages (0)" :show-header="false" :stripe="false" :highlight-current-row="false">
<!-- <el-table-column type="index" label="No." width="55" align="center"></el-table-column> -->
<el-table-column type="index" label="No." width="55" align="center"></el-table-column>
<el-table-column label="state" width="55" align="center">
<template slot-scope="scope">
<span class="status ok" v-if="scope.row.refer_doi != '' && scope.row.author != ''" >
@@ -110,14 +113,20 @@
</el-table-column>
<el-table-column label="Title" align="left">
<template slot-scope="scope">
<div style="text-align: left;" v-if="scope.row.refer_doi != '' && scope.row.author != ''">
<!-- journal 形式 -->
<div style="text-align: left;" v-if="scope.row.refer_type == 'journal'">
<p>{{scope.row.author}},{{scope.row.title}}, <em>{{scope.row.joura}}</em> ,{{scope.row.dateno}}<br/></p>
<a class="doiLink" :href="scope.row.doilink" target="_blank">{{scope.row.doilink}}</a>
</div>
<p class="wrongLine" style="text-align: left;" v-else>
{{scope.row.refer_content}}
</p>
<!-- book 形式 -->
<div style="text-align: left;" v-if="scope.row.refer_type == 'book'">
<p>{{scope.row.author}},{{scope.row.title}},{{scope.row.dateno}}<br/></p>
<a class="doiLink" :href="scope.row.isbn" target="_blank">{{scope.row.isbn}}</a>
</div>
<!-- other 形式 -->
<p class="wrongLine" style="text-align: left;" v-if="scope.row.refer_type == 'other'">
{{scope.row.refer_frag}}
</p>
</template>
</el-table-column>
<el-table-column align="center" width="360">
@@ -136,36 +145,87 @@
</div>
</div>
<!-- 修改引用 -->
<el-dialog v-loading="addLoading" :title= "dialogTitle + ' References'" :visible.sync="editboxVisible" width="500px" @close="cancelSave">
<p class="yinyongPre c888">现在您可以添加或者修改您的引用文献信息如果您有引用文献的Doi数据可以直接复制到Doi输入框并提交系统会自动识别您的引用文献如果您没有Doi数据也可以打开Show Content开关直接填写您的引用文献内容</p>
<p v-if="dialogTitle == 'Add'">There is no Doi data: <el-switch v-model="contentVisible"></el-switch></p>
<el-form v-show="!contentVisible" :model="refenceForm" :rules="refenceFormrules" ref="refenceForm" label-width="80px" class="editForm mt10">
<!-- 内容开关 -->
<el-form-item label="Doi:" required prop="refer_doi" >
<el-input v-model="refenceForm.refer_doi" ></el-input>
</el-form-item>
<el-dialog v-loading="addLoading" :title= "dialogTitle + ' References'" :visible.sync="editboxVisible" width="800px" @close="cancelSave">
<p class="yinyongPre c888">Now you are starting to add or modify this reference. If this reference has a DOI, you can directly copy it into the DOI input box and submit it. If this reference doesnt have the DOI, please turn on the No DOI button, and write all details of this reference according to the hints.</p>
<el-form :model="refenceForm" :rules="refenceFormrules" ref="refenceForm" label-width="150px" class="editForm mt10">
<!-- 内容开关 -->
<el-form-item label="Source:" >
<el-select v-model="SourceType" placeholder="please pick">
<el-option
v-for="item in sourceOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- Journal -->
<div v-show="SourceType == 'journal' || SourceType == 'doi'" >
<el-form-item label="Doi:" required prop="doi" >
<el-input v-model="refenceForm.doi" >
<el-button @click="gotoFormate" slot="append" >Formate</el-button>
</el-input>
</el-form-item>
</div>
<el-form-item >
<div class="line"></div>
</el-form-item>
<!-- 中间部分 -->
<div v-show="SourceType !='other'">
<el-form-item label="Author(s):" required prop="author" >
<el-input v-model="refenceForm.author" ></el-input>
<p class="zhushi">Six or less authors are required to list all authors while more than six authors are required to list three of them with et al</p>
</el-form-item>
<el-form-item label="Title:" required prop="title" >
<el-input v-model="refenceForm.title" placeholder="eg: Tradit Med Res"></el-input>
<p class="zhushi">Abbreviated Journal Title</p>
</el-form-item>
<el-form-item label="Publication Details:" required prop="dateno" >
<el-input v-model="refenceForm.dateno" placeholder="eg: 2023;8(9):49-62"></el-input>
<p class="zhushi">Year;Volume(issue):Inclusive page numbers.</p>
</el-form-item>
</div>
<div v-show="SourceType == 'journal'">
<el-form-item label="Joura:" required prop="joura" >
<el-input v-model="refenceForm.joura" placeholder=""></el-input>
</el-form-item>
<el-form-item label="DOI/URL:" required prop="doilink" >
<el-input v-model="refenceForm.doilink" placeholder="eg:https://doi.org/10.1002/cncr.30667"></el-input>
</el-form-item>
</div>
<!-- Book -->
<div v-show="SourceType =='book'">
<el-form-item label="ISBN:" required prop="isbn" >
<el-input v-model="refenceForm.isbn" ></el-input>
</el-form-item>
</div>
<!-- others -->
<div v-show="SourceType =='other'">
<el-form-item label="Content:" required prop="content" >
<el-input type="textarea" rows="5" v-model="refenceForm.content" placeholder="please refer to the AMA manual of style (10th ed.)"></el-input>
</el-form-item>
</div>
</el-form>
<el-form v-show="contentVisible" :model="refenceLinkForm" :rules="refenceLinkFormrules" ref="refenceLinkForm" label-width="80px" class="editForm mt10">
<!-- 内容开关 -->
<!-- <el-form-item label="There is no Doi data" label-width="160px">
<el-switch v-model="contentVisible"></el-switch>
</el-form-item> -->
<el-form-item label="author:" required prop="author" >
<el-input v-model="refenceLinkForm.author" placeholder="eg:Kagabu M, Nagasawa T, Fukagawa D, et al."></el-input>
<!-- <el-form :model="refenceLinkForm" :rules="refenceLinkFormrules" ref="refenceLinkForm" label-width="80px" class="editForm mt10">
<el-form-item label="Author(s):" required prop="author" >
<el-input v-model="refenceLinkForm.author" placeholder=""></el-input>
</el-form-item>
<span>Six or less authors are required to list all authors while more than six authors are required to list three of them with et al</span>
<el-form-item label="title:" required prop="title" >
<el-input v-model="refenceLinkForm.title" placeholder="eg:Immunotherapy for Uterine Cervical Cancer."></el-input>
<el-input v-model="refenceLinkForm.title" placeholder="eg: Tradit Med Res"></el-input>
</el-form-item>
<el-form-item label="joura:" required prop="joura" >
<el-form-item label="Source:" required prop="joura" >
<el-input v-model="refenceLinkForm.joura" placeholder="eg:Healthcare (Basel)."></el-input>
</el-form-item>
<el-form-item label="dateno:" required prop="dateno" >
<el-input v-model="refenceLinkForm.dateno" placeholder="eg:2019 Sep 17;7(3):108."></el-input>
<el-form-item label="Publication Details:" required prop="dateno" >
<el-input v-model="refenceLinkForm.dateno" placeholder="eg: 2023;8(9):49-62"></el-input>
</el-form-item>
<span>Year;Volume(issue):Inclusive page numbers.</span>
<el-form-item label="doilink:" required prop="doilink" >
<el-input v-model="refenceLinkForm.doilink" placeholder="eg:https://doi.org/10.1002/cncr.30667"></el-input>
</el-form-item>
</el-form>
</el-form> -->
<span slot="footer" class="dialog-footer">
<el-button @click="cancelSave">Cancel</el-button>
<el-button type="primary" @click="saveChange" v-if="dialogTitle == 'Edit'">Save</el-button>
@@ -219,7 +279,21 @@
importIoading: false,
baseUrl: this.Common.baseUrl,
addLoading:false,
contentVisible:false,
SourceType:'journal',
sourceOptions:[
{
value: 'journal',
label: 'journal'
},
{
value: 'book',
label: 'book'
},
{
value: 'other',
label: 'other'
},
],
// 引用数据列表
tableData:[
],
@@ -238,39 +312,72 @@
},
// 引用表单
refenceForm:{
refer_doi:'',
doi:'',
article_id:null,
p_refer_id:null, // 当前行一行的引用序号
pre_p_refer_id:null, // 上一行
refer_type:'', // 类型
joura:'',
author:'',
doilink:'',
dateno:'',
isbn:'',
content:'',
title:''
},
refenceFormrules:{
refer_doi:[
doi:[
{ required: true, message: 'The Doi cannot be empty', trigger: 'blur' },
]
},
// 引用表单
refenceLinkForm:{
author:'',
title:'',
joura:'',
dateno:'',
doilink:'',
pre_p_refer_id:null, // 当前行一行的引用序号,
article_id: null,
p_refer_id: null
},
refenceLinkFormrules:{
],
joura:[
{ required: true, message: 'The Joura cannot be empty', trigger: 'blur' },
],
author:[
{ required: true, message: 'The author cannot be empty', trigger: 'blur' },
{ required: true, message: 'The Author(s) cannot be empty', trigger: 'blur' },
],
title:[
{ required: true, message: 'The title cannot be empty', trigger: 'blur' },
],
dateno:[
{ required: true, message: 'The dateno cannot be empty', trigger: 'blur' },
],
doilink:[
{ required: true, message: 'The doilink cannot be empty', trigger: 'blur' },
]
{ required: true, message: 'The doi/url cannot be empty', trigger: 'blur' },
],
dateno:[
{ required: true, message: 'The Publication Details cannot be empty', trigger: 'blur' },
],
isbn:[
{ required: true, message: 'The ISBN cannot be empty', trigger: 'blur' },
],
content:[
{ required: true, message: 'The Content cannot be empty', trigger: 'blur' },
],
},
// 引用表单
// refenceLinkForm:{
// author:'',
// title:'',
// joura:'',
// dateno:'',
// doilink:'',
// pre_p_refer_id:null, // 当前行一行的引用序号,
// article_id: null,
// p_refer_id: null,
// },
// refenceLinkFormrules:{
// author:[
// { required: true, message: 'The author cannot be empty', trigger: 'blur' },
// ],
// title:[
// { required: true, message: 'The title cannot be empty', trigger: 'blur' },
// ],
// dateno:[
// { required: true, message: 'The dateno cannot be empty', trigger: 'blur' },
// ],
// doilink:[
// { required: true, message: 'The doilink cannot be empty', trigger: 'blur' },
// ]
// },
dialogTitle:''
}
},
@@ -280,6 +387,27 @@
this.holeLoading = true
},
methods:{
// 格式化
gotoFormate(){
this.$refs['refenceForm'].validateField('doi', (callback)=>{
if(callback == ''){
this.$api
.post('/api/Preaccept/searchDoi',{'doi': this.refenceForm.doi})
.then(res => {
console.log(res)
if(res.code == 0 ){
//this.tableData = res.data.refers
}else{
this.$message.error(res.msg)
}
this.holeLoading = false
}).catch(()=>{})
}else{
console.log('不合格')
}
})
},
// 全页面加载动画
openFullScreen1() {
this.holeLoading = true;
@@ -349,22 +477,20 @@
change(row, optitle){
this.dialogTitle = optitle
this.editboxVisible = true
this.$nextTick(() => {
if(row.is_web == 0){
// 有doi row.is_web: 00
this.refenceForm.refer_doi = row.refer_doi
this.refenceForm.p_refer_id = row.p_refer_id
}else{
// 无doi row.is_web: 1
this.contentVisible = true
this.refenceLinkForm.article_id = this.$route.query.id
this.refenceLinkForm.p_refer_id = row.p_refer_id
this.refenceLinkForm.author = row.author
this.refenceLinkForm.title = row.title
this.refenceLinkForm.joura = row.joura
this.refenceLinkForm.dateno = row.dateno
this.refenceLinkForm.doilink = row.doilink
}
// console.log(this.refenceForm.content,55555)
this.$nextTick(() => {
console.log(row,'row')
this.refenceForm.doi = row.refer_doi
this.refenceForm.p_refer_id = row.p_refer_id
this.SourceType = row.refer_type
this.refenceForm.author = row.author
this.refenceForm.title = row.title
this.refenceForm.joura = row.joura
this.refenceForm.dateno = row.dateno
this.refenceForm.doilink = row.doilink
this.refenceForm.content = row.refer_frag
this.refenceForm.joura = row.joura
this.refenceForm.isbn = row.isbn
})
},
@@ -376,58 +502,88 @@
this.$refs['refenceForm'].clearValidate();
this.$refs['refenceForm'].resetFields();
this.$refs['refenceLinkForm'].clearValidate();
this.$refs['refenceLinkForm'].resetFields();
// this.$refs['refenceLinkForm'].clearValidate();
// this.$refs['refenceLinkForm'].resetFields();
this.refenceForm.refer_doi = ''
this.refenceForm.doi = ''
this.dialogTitle = ''
},
// 编辑引用
saveChange(){
if(this.contentVisible){ // 无doi形式
this.editNoneDoi()
}else{
this.editHaveDoi()
}
},
// 编辑无doi
editNoneDoi(){
this.$refs.refenceLinkForm.validate((valid) => {
this.addLoading = true
if(valid){
this.$api
.post('api/Preaccept/editReferNotdoi', this.refenceLinkForm)
.then(res => {
if (res.code == 0) {
this.addLoading = false
this.$message.success('successed!')
this.cancelSave()
this.getRefData()
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
}
})
saveChange(){
var journalValid = false
var bookValid = false
var otherValid = false
if(this.SourceType == 'journal') {
// Journal形式
var doi = ''
var author = ''
var title = ''
var dateno = ''
var joura = ''
var doilink = ''
this.$refs['refenceForm'].validateField('doi',(callback)=>{
doi = callback
})
this.$refs['refenceForm'].validateField('author',(callback)=>{
author = callback
})
this.$refs['refenceForm'].validateField('title',(callback)=>{
title = callback
})
this.$refs['refenceForm'].validateField('dateno',(callback)=>{
dateno = callback
})
this.$refs['refenceForm'].validateField('joura',(callback)=>{
joura = callback
})
this.$refs['refenceForm'].validateField('doilink',(callback)=>{
doilink = callback
})
doi == '' && author == '' && title == '' && dateno == '' && joura == '' && doilink == '' ? journalValid = true :''
}else if(this.SourceType == 'book'){
// book 形式
var author = ''
var title = ''
var dateno = ''
var isbn = ''
this.$refs['refenceForm'].validateField('author',(callback)=>{
author = callback
})
this.$refs['refenceForm'].validateField('title',(callback)=>{
title = callback
})
this.$refs['refenceForm'].validateField('dateno',(callback)=>{
dateno = callback
})
this.$refs['refenceForm'].validateField('isbn',(callback)=>{
isbn = callback
})
author == '' && title == '' && dateno == '' && isbn == '' ? bookValid = true : ''
}else if(this.SourceType == 'other'){
// others 形式
var content = ''
this.$refs['refenceForm'].validateField('content',(callback)=>{
content = callback
})
content == '' ? otherValid = true : ''
}
// console.log(otherValid,99)
if(journalValid || bookValid || otherValid){ // 有任意一个模式符合验证规则就提交
this.editRefSave()
}
},
// 编辑有doi
editHaveDoi(){
this.$refs.refenceForm.validate((valid) => {
// 提交引用修改
editRefSave(){
this.refenceForm.refer_type = this.SourceType
this.addLoading = true
if(valid){
console.log(this.refenceForm)
this.$api
.post('api/Preaccept/editRefer', {
// 'article_id': this.$route.query.id,
'p_refer_id': this.refenceForm.p_refer_id,
'doi': this.refenceForm.refer_doi
})
.post('api/Preaccept/editRefer', this.refenceForm)
.then(res => {
if (res.code == 0) {
this.addLoading = false
@@ -443,45 +599,78 @@
})
.catch(err => {
this.$message.error(err);
});
}else{
}
})
});
},
// 保存新增
saveAdd(){
if(this.contentVisible){ // 无doi形式
this.$refs.refenceLinkForm.validate((valid) => {
if(valid){
this.addLoading = true
this.$api
.post('api/Preaccept/addReferNotdoi', this.refenceLinkForm)
.then(res => {
if (res.code == 0) {
this.addLoading = false
this.$message.success('successed!')
this.editboxVisible = false
this.getRefData()
this.cancelSave()
}
})
.catch(err => {
this.$message.error(err);
});
}
saveAdd(){
var journalValid = false
var bookValid = false
var otherValid = false
if(this.SourceType == 'journal') {
// Journal形式
var doi = ''
var author = ''
var title = ''
var dateno = ''
var joura = ''
var doilink = ''
this.$refs['refenceForm'].validateField('doi',(callback)=>{
doi = callback
})
this.$refs['refenceForm'].validateField('author',(callback)=>{
author = callback
})
this.$refs['refenceForm'].validateField('title',(callback)=>{
title = callback
})
this.$refs['refenceForm'].validateField('dateno',(callback)=>{
dateno = callback
})
}else{ // 有doi形式
this.$refs.refenceForm.validate((valid) => {
if(valid){
this.$refs['refenceForm'].validateField('joura',(callback)=>{
joura = callback
})
this.$refs['refenceForm'].validateField('doilink',(callback)=>{
doilink = callback
})
doi == '' && author == '' && title == '' && dateno == '' && joura == '' && doilink == '' ? journalValid = true :''
}else if(this.SourceType == 'book'){
// book 形式
var author = ''
var title = ''
var dateno = ''
var isbn = ''
this.$refs['refenceForm'].validateField('author',(callback)=>{
author = callback
})
this.$refs['refenceForm'].validateField('title',(callback)=>{
title = callback
})
this.$refs['refenceForm'].validateField('dateno',(callback)=>{
dateno = callback
})
this.$refs['refenceForm'].validateField('isbn',(callback)=>{
isbn = callback
})
author == '' && title == '' && dateno == '' && isbn == '' ? bookValid = true : ''
}else if(this.SourceType == 'other'){
// others 形式
var content = ''
this.$refs['refenceForm'].validateField('content',(callback)=>{
content = callback
})
content == '' ? otherValid = true : ''
}
// console.log(otherValid,99)
if(journalValid || bookValid || otherValid){ // 有任意一个模式符合验证规则就提交
this.refenceForm.refer_type = this.SourceType
// console.log(this.refenceForm,99)
this.addLoading = true
this.$api
.post('api/Preaccept/addRefer', {
'article_id': this.$route.query.id,
'pre_p_refer_id': this.refenceForm.p_refer_id,
'doi': this.refenceForm.refer_doi
})
.post('api/Preaccept/addRefer', this.refenceForm)
.then(res => {
if (res.code == 0) {
this.addLoading = false
@@ -501,12 +690,13 @@
.catch(err => {
this.$message.error(err);
});
}else{
this.$message.error('error submit!!');
return false;
}
})
}
}else{
return false
}
},
beforeupload_manuscirpt(file) {
let flieArr = file.name.split(".")
@@ -595,17 +785,18 @@
},
// 添加一行
addLine(row, optitle){
//console.log(row)
// console.log(row)
this.dialogTitle = optitle
// this.$refs['refenceForm'].clearValidate()
this.editboxVisible = true
this.refenceForm.p_refer_id = row.p_refer_id
this.refenceForm.pre_p_refer_id = row.p_refer_id
this.refenceForm.article_id = this.$route.query.id
this.refenceLinkForm.pre_p_refer_id = row.p_refer_id
this.refenceLinkForm.article_id = this.$route.query.id
// this.refenceLinkForm.pre_p_refer_id = row.p_refer_id
//this.refenceLinkForm.article_id = this.$route.query.id
this.$nextTick(()=>{
this.$refs['refenceForm'].clearValidate(['refer_doi']);
this.$refs['refenceForm'].clearValidate(['doi']);
})
},
@@ -678,11 +869,13 @@
},
},
watch: {
contentVisible: {
SourceType : {
handler(newVal, oldVal) {
this.$nextTick(()=>{
this.$refs['refenceLinkForm'].clearValidate()
this.$refs['refenceForm'].clearValidate()
this.$nextTick(()=>{
// console.log('清空验证信息')
// this.$refs['refenceLinkForm'].clearValidate()
this.$refs['refenceForm'].clearValidate()
// this.$refs['refenceForm'].resetFields() // 表单重置
})
},
// immediate: true,
@@ -693,6 +886,7 @@
</script>
<style scoped>
.line{border: 1px dashed #ebebeb; margin: 15px 0;}
.tip{background: #e6effb; padding: 2px; font-style: normal; border-radius:10px ;}
.wrongLine{ color: #f15f44;}
.doiLink{color: #409EFF;}
@@ -721,7 +915,7 @@
.noneData{ margin:30px 0; padding: 20px; border:3px dashed #F8F8F8; }
.noneData img{display: block; margin: 10px auto; opacity: .5; width: 100px;}
.nodatatext{color: #666; text-align: center;}
.inlinebutton{}
.zhushi{color: #999; font-size: 12px;}
.whoDo{background: #EEF7F9; padding: 30px;}
.whoDo ul{padding-left: 20px;}