diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue
index d175bf8..28003c5 100644
--- a/fe/src/components/NER/index.vue
+++ b/fe/src/components/NER/index.vue
@@ -110,7 +110,7 @@
-
+
@@ -568,6 +568,7 @@ export default {
startSelect: function (idx, event) {
if (this.nerProjectType.indexOf(this.projectType) === -1) return
if (this.nowType.indexOf('关系-') > -1) {
+ if (event.which === 3) return
if (typeof this.relStartIdx === 'number') {
console.log(this.relStartIdx, idx)
this.relDetails.push({
diff --git a/fe/src/components/NLP/rel.vue b/fe/src/components/NLP/rel.vue
index 230d7cc..26404f2 100644
--- a/fe/src/components/NLP/rel.vue
+++ b/fe/src/components/NLP/rel.vue
@@ -1,8 +1,16 @@
@@ -18,53 +26,59 @@ export default ({
},
relDetails: {
type: Array,
- default: undefined,
required: true
},
save: {
type: Function,
required: true
+ },
+ types: {
+ type: Object,
+ required: true
}
},
data () {
return {
points: [],
width: 0,
- height: 0
+ height: 0,
+ relLines: []
}
},
methods: {
log (...args) {
console.log(args)
+ },
+ delRel (e, idx) {
+ e.preventDefault()
+ this.relDetails.splice(idx, 1)
+ this.save()
}
},
watch: {
relDetails: {
handler (val) {
- console.log(val)
+ console.log(this.types)
+ let _relLines = []
+ for (let i = 0; i < val.length; i++) {
+ const item = val[i]
+ let startCharDom = document.getElementById(item.start)
+ let endCharDom = document.getElementById(item.end)
+ let sx = startCharDom.offsetLeft + startCharDom.offsetWidth / 2
+ let sy = startCharDom.offsetTop + 9
+ let ex = endCharDom.offsetLeft + endCharDom.offsetWidth / 2
+ let ey = endCharDom.offsetTop + 9
+ let cx = (sx + ex) / 2
+ let cy = (sy + ey) / 2 - 20
+ _relLines.push(`M${sx} ${sy} Q${cx} ${cy} ${ex} ${ey}`)
+ }
+ console.log(_relLines)
+ this.relLines = _relLines
},
deep: true
},
- delRel: {
- handler (val) {
- if (!val) {
- return
- }
- this.relDetails.splice(this.relDetails.indexOf(val), 1)
- this.save()
- }
- },
nowType: {
handler (val) {
- if (!val) {
- return
- }
- if (this.annoDetails.indexOf(val) === -1) {
- this.annoDetails.push(val)
- } else {
- this.annoDetails.splice(this.annoDetails.indexOf(val), 1)
- }
- this.save()
}
}
}
@@ -72,4 +86,19 @@ export default ({