完善
This commit is contained in:
@@ -48,7 +48,12 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 临时 -->
|
||||
<p style="text-indent: 2em;"><el-button type="text" @click="showDialogSpecial">Special way to add</el-button></p>
|
||||
</div>
|
||||
|
||||
<!-- end -->
|
||||
<div class="chanFerAll">
|
||||
<div v-if="showB_step ==1">
|
||||
<el-input v-model="refAarray" type="textarea" rows="20" style="width: 100%;"
|
||||
@@ -71,7 +76,7 @@
|
||||
</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 != ''" >
|
||||
<span class="status ok" v-if="scope.row.refer_doi != '' || scope.row.doilink != '' || scope.row.isbn != '' || scope.row.refer_frag != ''" >
|
||||
<i class="el-icon-circle-check"></i>
|
||||
</span>
|
||||
<span class="status warn" v-else >
|
||||
@@ -222,14 +227,33 @@
|
||||
<el-button type="primary" @click="saveAdd" v-else>Save</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 复制word添加引用 -->
|
||||
<el-dialog :title= "dialogTitle + ' References'" :visible.sync="showEditor" width="800px" @close="showEditor= false">
|
||||
<div style="height: 500px;">
|
||||
<vue-ueditor-wrap v-model="wordText" :config="editorConfig" editor-id="editor-demo-01"></vue-ueditor-wrap>
|
||||
</div>
|
||||
<span slot="footer">
|
||||
<el-button type="primary" plain @click="wordTextOp">Submit</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueUeditorWrap from 'vue-ueditor-wrap'; // ES6 Module
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
ue: null,
|
||||
wordText:'',
|
||||
editorConfig: {
|
||||
// 访问 UEditor 静态资源的根路径,可参考 https://hc199421.gitee.io/vue-ueditor-wrap/#/faq
|
||||
UEDITOR_HOME_URL: "/UEditor/",
|
||||
|
||||
},
|
||||
wordTextArr:[], // 识别出的word引用数组
|
||||
showEditor:false,
|
||||
dialogTitle:'',
|
||||
showB_step: 1,
|
||||
baseUrl: this.Common.baseUrl,
|
||||
@@ -255,7 +279,7 @@ export default {
|
||||
// 引用表单
|
||||
refenceForm:{
|
||||
doi:'',
|
||||
article_id:null,
|
||||
p_article_id:null,
|
||||
p_refer_id:null, // 当前行一行的引用序号
|
||||
pre_p_refer_id:null, // 上一行
|
||||
refer_type:'', // 类型
|
||||
@@ -265,7 +289,7 @@ export default {
|
||||
dateno:'',
|
||||
isbn:'',
|
||||
content:'',
|
||||
title:''
|
||||
title:'',
|
||||
|
||||
},
|
||||
refenceFormrules:{
|
||||
@@ -319,14 +343,94 @@ export default {
|
||||
this.bijiao()
|
||||
//console.log('更新更新')
|
||||
},
|
||||
wordTextOp(){
|
||||
//console.log(this.wordText)
|
||||
// 数据处理
|
||||
var pp = this.wordText.split('</p>')
|
||||
var ss = []
|
||||
var re = /<[^>]+>/gi;
|
||||
var nbsp = / /gi;
|
||||
pp.forEach(element => {
|
||||
element = element.replace(re, "")
|
||||
element = element.replace(nbsp,"")
|
||||
ss.push(element)
|
||||
});
|
||||
// 去掉最后一个数据
|
||||
// console.log(pp,ss.slice(0,-1))
|
||||
this.wordTextArr = ss.slice(0,-1)
|
||||
this.wordTextArr.length > 0 ? this.wordSubmit() : this.$message.error('Please enter content in the editor before submitting!');
|
||||
},
|
||||
// 发送后台
|
||||
wordSubmit(){
|
||||
this.$api
|
||||
.post('api/Publish/addRefersByWord', {
|
||||
'contents': this.wordTextArr,
|
||||
'p_article_id': this.p_article_id
|
||||
}).then((res)=>{
|
||||
if (res.code == 0) {
|
||||
this.showEditor = false
|
||||
this.wordTextArr = []
|
||||
this.wordText = ''
|
||||
this.$message.success('successed!');
|
||||
this.changeRefer()
|
||||
this.showB_step = 2
|
||||
}else{
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
showDialogSpecial(){
|
||||
// 拷贝文本方式添加
|
||||
this.showEditor = true
|
||||
|
||||
},
|
||||
bijiao(){
|
||||
if(this.chanFerForm.length > 0 ){ // 如果有值,则默认展示第二步的内容
|
||||
this.showB_step = 2
|
||||
}
|
||||
},
|
||||
StepBNext(e) {
|
||||
if(e == 1){
|
||||
this.$confirm('This will clear the current reference information, are you sure you want to do this?', 'Prompt', {
|
||||
confirmButtonText: 'Sure',
|
||||
cancelButtonText: 'Cancle',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.clearRefences()
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
}else{
|
||||
this.showB_step = e
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
},
|
||||
// 清空引用数据
|
||||
clearRefences(){
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'please wait',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
this.$api
|
||||
.post('api/Preaccept/discardRefersByParticleid', {
|
||||
'p_article_id': this.p_article_id
|
||||
})
|
||||
.then(res => {
|
||||
loading.close();
|
||||
if (res.code == 0) {
|
||||
this.showB_step = 1
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
loading.close();
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
StepBOper(e) {
|
||||
if (e == 1) {
|
||||
@@ -629,10 +733,10 @@ export default {
|
||||
if(journalValid || bookValid || otherValid){ // 有任意一个模式符合验证规则就提交
|
||||
|
||||
this.refenceForm.refer_type = this.SourceType
|
||||
// console.log(this.refenceForm,99)
|
||||
// console.log(this.refenceForm,99)
|
||||
this.addLoading = true
|
||||
this.$api
|
||||
.post('api/Preaccept/addRefer', this.refenceForm)
|
||||
.post('api/Preaccept/addReferByParticleid', this.refenceForm)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.addLoading = false
|
||||
@@ -708,7 +812,7 @@ export default {
|
||||
// this.$refs['refenceForm'].clearValidate()
|
||||
this.editboxVisible = true
|
||||
this.refenceForm.pre_p_refer_id = row.p_refer_id
|
||||
this.refenceForm.article_id = this.$route.query.id
|
||||
this.refenceForm.p_article_id = this.p_article_id
|
||||
|
||||
// this.refenceLinkForm.pre_p_refer_id = row.p_refer_id
|
||||
//this.refenceLinkForm.article_id = this.$route.query.id
|
||||
@@ -782,6 +886,9 @@ export default {
|
||||
// }).catch(()=>{});
|
||||
}
|
||||
},
|
||||
components:{
|
||||
VueUeditorWrap
|
||||
},
|
||||
watch: {
|
||||
SourceType : {
|
||||
handler(newVal, oldVal) {
|
||||
@@ -800,6 +907,8 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 编辑器高度 */
|
||||
/deep/ #edui1_iframeholder{ height: 350px;}
|
||||
|
||||
/* .itemIndex{position: relative;} */
|
||||
.itemChanged{position: absolute; display: inline-block; background: #006699; color: #fff; padding: 7px; border-radius: 0 0 7px 7px; left: 0; top: 0;}
|
||||
@@ -1064,11 +1173,7 @@ export default {
|
||||
font-size: 14px;
|
||||
letter-spacing: -0.5px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.chanSelLef>div>h3:hover {
|
||||
/* text-decoration: underline; */
|
||||
}
|
||||
}
|
||||
|
||||
.chanSelLef>div>h3>span {
|
||||
color: #fff;
|
||||
|
||||
Reference in New Issue
Block a user