diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue index ba5c3d0..92e1324 100644 --- a/fe/src/components/NER/index.vue +++ b/fe/src/components/NER/index.vue @@ -118,7 +118,9 @@ backgroundColor: types[ner.type] ? types[ner.type].color : `#fff`, }" > - {{ ner.name }} + {{ ner.name }} + + @@ -253,6 +255,9 @@ export default { } }, methods: { + log (...args) { + console.log(args) + }, // 获取文件列表 getFiles () { const that = this @@ -484,6 +489,19 @@ export default { } this.$set(this, 'wordsOutType', this.wordsOutType) }, + delIdx: function (idx) { + const ners = this.ners + for (let i = ners.length - 1; i >= 0; i -= 1) { + const ner = ners[i] + if (idx >= ner.start && idx < ner.end) { + ners.splice(i, 1) + this.$set(this, 'ners', ners) + this.flushWordsType() + this.save() // 删除时实时保存 + return true + } + } + }, startSelect: function (idx, event) { if (this.projectType !== '命名实体识别') return let isNeedDel = false @@ -501,17 +519,7 @@ export default { if (isNeedDel) { event.preventDefault() // 右键删除对应的图标 - const ners = this.ners - for (let i = ners.length - 1; i >= 0; i -= 1) { - const ner = ners[i] - if (idx >= ner.start && idx < ner.end) { - ners.splice(i, 1) - this.$set(this, 'ners', ners) - this.flushWordsType() - this.save() // 删除时实时保存 - return true - } - } + this.delIdx(idx) return true } this.setMode('select') @@ -948,6 +956,7 @@ export default { width: 120px; } .result { + position: relative; overflow: hidden; padding: 0 4px; height: 22px; @@ -973,6 +982,20 @@ export default { .result-name { width: calc(100% - 8px); } +.result-name-del { + display: none; + vertical-align: text-bottom; + position: absolute; + right: 0px; + top: 2px; +} +.result-name-del:hover { + cursor: pointer; + opacity: .6; +} +.result-name:hover .result-name-del { + display: inline-block; +} .word-rect-area { position: absolute;