From 4bb583879504f3af5e2e1ee1e7a8824c7faf3830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=90=A6=E9=92=A7?= Date: Sun, 8 Aug 2021 01:10:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/src/components/NER/index.vue | 40 ++++++++++++++++++++++++++++---- fe/src/components/home/index.vue | 1 + 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue index 638f301..27f7a55 100644 --- a/fe/src/components/NER/index.vue +++ b/fe/src/components/NER/index.vue @@ -25,7 +25,7 @@
选择标签:
- { + if (ner.type === type) { + typeIdx = idx + return ner.type === type + } + }) + if (typeIdx === -1) { + this.ners.push({type}) + } else { + this.ners.splice(typeIdx, 1) + } + this.$set(this, 'nowType', type) + this.save() + } }, delType: function (type, ev) { if (!this.configCanCtlType) return false @@ -419,6 +436,7 @@ export default { this.$set(this, 'wordsOutType', this.wordsOutType) }, startSelect: function (idx, event) { + if (this.projectType !== '命名实体识别') return; if (event.which === 3) { event.preventDefault() // 右键删除对应的图标 @@ -506,7 +524,10 @@ export default { outAllNers () { if (!isLocal) { // 非单机版,就直接通过url下载 - window.open(`/v1/files/get_json?projectName=${this.projectName}`, '_self') + if (this.projectType === '命名实体识别') + window.open(`/v1/files/get_json?projectName=${this.projectName}`, '_self') + if (this.projectType === '文本分类') + window.open(`/v1/files/get_labels?projectName=${this.projectName}`, '_self') return true } this.nersCache[this.nowFile] = this.ners @@ -549,6 +570,15 @@ export default { console.log(tarType, ev.target.value) that.$set(that.types[tarType], 'color', ev.target.value) updateType2Server(that.projectName, that.typeList, that.types) + }, + // 判断标签按钮是否需要被显示成按下 + isTypeSelected: function(type) { + if (this.projectType === '命名实体识别') + return this.nowType === type; + if (this.projectType === '文本分类') + return this.ners.some((ner)=>{ + return ner.type === type + }) } }, watch: { @@ -584,8 +614,8 @@ export default { return entityType.type }) that.types = types - // 进入时默认选择第一个标签,防止弹出请选择标签的提示 - if (that.typeList && that.typeList[0]) that.nowType = that.typeList[0] + // 进入命名实体识别时默认选择第一个标签,防止弹出请选择标签的提示 + if (that.typeList && that.typeList[0] && projectType === '命名实体识别') that.nowType = that.typeList[0] get(`/v1/files/query?projectName=${projectName}&pageNumber=${that.pageNumber}&pageSize=${that.pageSize}`, function (info) { that.$set(that, 'files', info.map((item) => { if (typeof item === 'string') return item diff --git a/fe/src/components/home/index.vue b/fe/src/components/home/index.vue index 5d4ba7a..724fd1f 100644 --- a/fe/src/components/home/index.vue +++ b/fe/src/components/home/index.vue @@ -26,6 +26,7 @@

类型: