Files
tougao_web/src/components/page/publishRefernceEditor.vue
2023-07-07 10:22:27 +08:00

152 lines
4.0 KiB
Vue

<template>
<div>
<!-- publish 引用编辑页面 -->
<editPublicRefRdit ref="editPublicRefRdit" :chanFerForm = 'chanFerForm' :gridData = 'gridData' :p_article_id='p_article_id' @ChanFerMashUp="ChanFerMashUp" @refrashComp="refrashComp" @changeRefer="changeRefer"></editPublicRefRdit>
</div>
</template>
<script>
import editPublicRefRdit from './editPublicRefRdit' // 公共引用编辑页面
import {
Loading
} from 'element-ui';
export default {
data(){
return{
article_id: this.$route.query.id,
chanFerForm: [],
gridData: '',
p_article_id: this.$route.query.pid,
}
},
created(){
this.getData()
},
methods:{
// 获取p_article_id的值
getArtcleDetails(){
// 获得文章详情
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$api
.post('api/Article/getPreacceptArticleDetail', {'article_id': this.article_id})
.then(res => {
loading.close()
this.p_article_id = res.data.production.p_article_id
console.log(this.p_article_id)
// this.chanFerForm = res.data.refers
if(this.p_article_id != null){
this.getData()
//this.getAuthorJG();
//this.getCount();
//this.getWorldPdf();
}
this.$nextTick(()=>{
// 更新引用列表
this.$refs.editPublicRefRdit.init(this.chanFerForm)
})
})
.catch(err => {
//this.$message.error(err);
loading.close()
});
},
getData() {
// this.idform.p_article_id = this.p_article_id;
// this.detailMes.p_article_id = this.p_article_id;
// this.addFomauthor.p_article_id = this.p_article_id;
// this.addFomschool.p_article_id = this.p_article_id;
// this.UpTypeFile.p_article_id = this.p_article_id;
// console.log(this.p_article_id,5555)
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// 获取文章信息
// 获取参考文献
this.$api
.post('api/Production/getReferList', {
'p_article_id': this.p_article_id
})
.then(res => {
this.chanFerForm = res.data.refers
for (var i = 0; i < this.chanFerForm.length; i++) {
this.chanFerForm[i].edit_mark = 1
if (this.chanFerForm[i].refer_frag != '') {
this.showB_step = 2
}
}
this.$nextTick(()=>{
// 更新引用列表
this.$refs.editPublicRefRdit.init(this.chanFerForm)
})
loading.close()
})
.catch(err => {
loading.close()
console.log(err);
});
},
// 5----参考文献向上合并
ChanFerMashUp(e) {
console.log(e)
this.$api
.post('api/Production/referHB', e)
.then(res => {
if (res.code == 0) {
this.changeRefer(e)
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
console.log(err);
});
},
// 刷新引用组件
refrashComp(){
this.$refs.editPublicRefRdit.$forceUpdate()
console.log('editPublicRefRdit')
},
// 5----重新获取加载参考文献
changeRefer(val) {
console.log('重新获取参考文献')
this.$api
.post('api/Production/getReferList', {
'p_article_id': this.p_article_id
})
.then(res => {
this.chanFerForm = res.data.refers
for (var i = 0; i < this.chanFerForm.length; i++) {
this.chanFerForm[i].edit_mark = 1
}
console.log(this.chanFerForm)
})
.catch(err => {
console.log(err);
});
},
},
components:{
editPublicRefRdit
}
}
</script>
<style scoped>
</style>