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 @@

类型: