This commit is contained in:
2026-04-08 13:03:54 +08:00
parent 36f6c02376
commit 0d35b76c3a
11 changed files with 3866 additions and 589 deletions

View File

@@ -11,10 +11,11 @@
<div
:data-id="`ref-${item.p_refer_id}`"
v-for="(item, index) in chanFerForm"
:key="index"
:key="item.p_refer_id != null ? item.p_refer_id : `ref-row-${index}`"
class="ref-item-row"
:class="{ 'has-change': item.is_change == 1, 'is-repeat': item.is_repeat == 1 }"
>
<div class="ref-content-area">
<div v-if="item.refer_type == 'journal'" class="reference-item">
<b class="ref-number-prefix">{{ index + 1 }}.</b>
@@ -42,12 +43,12 @@
</div>
</div>
<div class="ref-actions-area">
<div class="ref-actions-area" v-if="!isPreview">
<i class="el-icon-edit action-icon primary" @click="change(item, 'Edit')"></i>
<i class="el-icon-circle-plus-outline action-icon success" @click="addLine(item, 'Add')"></i>
<div class="order-icons">
<div v-if="!refOrderFollowsBody" class="order-icons">
<i
class="el-icon-caret-top action-icon"
:class="{ disabled: index === 0 }"
@@ -61,7 +62,7 @@
</div>
<i class="el-icon-delete action-icon danger" @click="deleteLine(item)"></i>
<img v-if="role == 'editor' && item.is_ai_check == 1" src="@/assets/img/ai.png" class="ai-mini-tag" />
</div>
</div>
@@ -312,6 +313,10 @@ export default {
type: null,
required: true
},
isPreview: {
type: Boolean,
default: false
},
chanFerFormRepeatList: {
type: Array,
default: () => []
@@ -327,9 +332,30 @@ export default {
role: {
type: String,
default: () => 'editor'
},
/** 为 true 时顺序由正文引用决定,隐藏手动上下移(与 sortRefer 冲突) */
refOrderFollowsBody: {
type: Boolean,
default: false
}
},
methods: {
/** 与当前 chanFerForm 数组顺序一致:行内 index 置为 1-based 序号(排序/正文重排后同步) */
syncReferenceRowIndices() {
const list = this.chanFerForm;
if (!Array.isArray(list)) return;
list.forEach((row, i) => {
if (row && typeof row === 'object') {
const n = i;
if (row.index !== n) {
this.$set(row, 'index', n);
}
}
});
},
searchTitleByDOI(doi) {
this.$commonJS.searchTitleByDOI(doi);
},
formatTitle(title) {
if (!title) return '';
const reg = /\b(Retracted|Retraction)\b/gi;
@@ -369,11 +395,11 @@ export default {
// 2. 借鉴 EndNote对处理完批注的 HTML 进行引用联动渲染
// 支持 data-id="a,b,c" 单标签 或 多个相邻单 id 标签
const citeGroupRe = /(?:<autocite\s+data-id="([^"]+)"\s*><\/autocite>\s*)+/gi;
const citeGroupRe = /(?:<mycite\s+data-id="([^"]+)"\s*><\/mycite>\s*)+/gi;
return html.replace(citeGroupRe, (groupMatch) => {
const ids = [];
const innerRe = /<autocite\s+data-id="([^"]+)"\s*><\/autocite>/gi;
const innerRe = /<mycite\s+data-id="([^"]+)"\s*><\/mycite>/gi;
let m;
while ((m = innerRe.exec(groupMatch)) !== null) {
m[1].split(',').forEach((part) => {
@@ -1018,6 +1044,15 @@ export default {
}
},
watch: {
chanFerForm: {
handler() {
this.$nextTick(() => {
this.syncReferenceRowIndices();
});
},
immediate: true,
deep: true
},
SourceType: {
handler(newVal, oldVal) {
this.$nextTick(() => {
@@ -1990,9 +2025,12 @@ export default {
.action-icon.success:hover {
color: #67c23a;
}
.action-icon.danger:hover {
.action-icon.danger {
color: #f56c6c;
}
.action-icon.danger:hover {
color: #e85a5a;
}
.action-icon.disabled {
color: #e4e7ed;
cursor: not-allowed;