Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
340ec3ec
Commit
340ec3ec
authored
Jul 06, 2020
by
郭婉茹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文本标注
parent
95703c75
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
42 deletions
+156
-42
SelectText.vue
...atform-front/src/components/textAnnotation/SelectText.vue
+144
-39
SelectedText.vue
...form-front/src/components/textAnnotation/SelectedText.vue
+12
-3
Table.vue
DAPlatform-front/src/components/textAnnotation/Table.vue
+0
-0
Tabled.vue
DAPlatform-front/src/components/textAnnotation/Tabled.vue
+0
-0
No files found.
DAPlatform-front/src/components/textAnnotation/SelectText.vue
View file @
340ec3ec
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<div
<div
class=
"tokenList"
class=
"tokenList"
v-for=
"it in tokenList"
v-for=
"it in tokenList"
:key=
"it
.message
"
:key=
"it"
style=
"user-select:none; float: left;"
style=
"user-select:none; float: left;"
>
>
<el-tag
<el-tag
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
:disable-transitions=
"false"
:disable-transitions=
"false"
@
close=
"handleTokenClose(it)"
@
close=
"handleTokenClose(it)"
>
>
<a
class=
"token"
v-html=
"it"
></a>
<a
class=
"token"
v-html=
"it
.word
"
></a>
</el-tag>
</el-tag>
<br
/>
<br
/>
</div>
</div>
...
@@ -307,9 +307,14 @@ export default {
...
@@ -307,9 +307,14 @@ export default {
label
:
"时间"
label
:
"时间"
}
}
],
],
value
:
""
,
token
:{
search
:
""
,
entityId
:
""
,
tokenId
:
1
,
word
:
""
,
begin
:
0
,
end
:
0
,
attribute
:
""
,
tokenId
:
""
},
tokenList
:
[]
tokenList
:
[]
};
};
},
},
...
@@ -317,10 +322,30 @@ export default {
...
@@ -317,10 +322,30 @@ export default {
handleNodeClick
(
data
)
{
handleNodeClick
(
data
)
{
console
.
log
(
data
);
console
.
log
(
data
);
},
},
//获取文本
getContent
(){
this
.
axios
({
method
:
"post"
,
url
:
"http://127.0.0.1:9100/uploadDownload/getFileContent"
,
data
:
{
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
//改成通用跳转传过来的documentId
}
}).
then
(
res
=>
{
if
(
res
.
return_code
==
200
)
console
.
log
(
"123"
+
res
.
result
);
//res.result就是文本的内容
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
});
},
// 暂时没用
// 暂时没用
handleOption
()
{
handleOption
()
{
console
.
log
(
this
.
value
);
console
.
log
(
this
.
token
.
entityId
);
if
(
this
.
value
)
{
if
(
this
.
token
.
entityId
)
{
this
.
$message
({
this
.
$message
({
message
:
"创建成功!"
,
message
:
"创建成功!"
,
type
:
"success"
type
:
"success"
...
@@ -333,46 +358,61 @@ export default {
...
@@ -333,46 +358,61 @@ export default {
this
.
ifAlert
=
0
;
this
.
ifAlert
=
0
;
let
res
=
this
.
$refs
.
tree
.
getCheckedNodes
();
let
res
=
this
.
$refs
.
tree
.
getCheckedNodes
();
let
arr
=
[];
let
arr
=
[];
let
token
=
{};
res
.
forEach
(
item
=>
{
res
.
forEach
(
item
=>
{
arr
.
push
(
item
.
label
);
arr
.
push
(
item
.
label
);
});
});
console
.
log
(
"111"
+
arr
);
console
.
log
(
"111"
+
arr
);
this
.
token
List
.
push
(
this
.
search
)
;
this
.
token
.
attribute
=
arr
[
0
]
;
this
.
msg
=
this
.
msg
.
map
(
item
=>
{
this
.
msg
=
this
.
msg
.
map
(
item
=>
{
let
replaceReg
=
new
RegExp
(
this
.
search
,
"g"
);
// 匹配关键字正则
let
replaceReg
=
new
RegExp
(
this
.
token
.
word
,
"g"
);
// 匹配关键字正则
let
replaceString
=
let
replaceString
=
'<span class="highlights-text">'
+
'<span class="highlights-text">'
+
this
.
search
+
this
.
token
.
word
+
"</span>"
+
"</span>"
+
'<span class="mark">'
+
'<span class="mark">'
+
"(实体:"
+
"(实体:"
+
this
.
value
+
this
.
token
.
entityId
+
";属性:"
+
";属性:"
+
arr
+
arr
+
")"
+
")"
+
"</span>"
;
// 高亮替换v-html值
"</span>"
;
// 高亮替换v-html值
// 保存实体
// 保存实体
if
(
this
.
value
==
""
&&
this
.
arr
==
[])
{
if
(
this
.
token
.
entityId
==
""
&&
arr
==
[])
{
return
;
return
;
}
}
this
.
axios
({
this
.
axios
({
method
:
"post"
,
method
:
"post"
,
url
:
"/textAnnotation/addToken"
,
url
:
"
http://127.0.0.1:9100
/textAnnotation/addToken"
,
data
:
{
data
:
{
entityId
:
this
.
value
,
// 这里类型似乎是string
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
,
//改成通用跳转传过来的documentId
word
:
this
.
search
,
token
:{
attribute
:
this
.
arr
,
entityId
:
this
.
token
.
entityId
,
// 这里类型似乎是string
// 修改实体时待改正
word
:
this
.
token
.
word
,
tokenId
:
this
.
tokenId
+
1
begin
:
this
.
token
.
begin
,
end
:
this
.
token
.
end
,
attribute
:
arr
[
0
],
}
}
}).
then
(
res
=>
{
if
(
res
.
return_code
==
200
){
this
.
token
.
tokenId
=
res
.
result
token
=
this
.
token
this
.
token
=
{};
this
.
tokenList
.
push
(
token
);
}
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
}
}).
then
(
res
=>
{
console
.
log
(
"123"
+
res
);
});
});
// 不知道为啥有缓存不能清除
// 不知道为啥有缓存不能清除
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
tree
.
setCheckedKeys
([]);
this
.
$refs
.
tree
.
setCheckedKeys
([]);
});
});
this
.
value
=
""
;
this
.
token
.
entityId
=
""
;
return
item
.
replace
(
replaceReg
,
replaceString
);
return
item
.
replace
(
replaceReg
,
replaceString
);
});
});
this
.
$message
({
this
.
$message
({
...
@@ -380,43 +420,96 @@ export default {
...
@@ -380,43 +420,96 @@ export default {
type
:
"success"
type
:
"success"
});
});
},
},
// 修改实体属性
// 修改实体属性
=删除+添加(如果选择属性弹窗没有点提交直接关掉的话会删除)
handleTokenChange
(
tag
)
{
handleTokenChange
(
tag
)
{
console
.
log
(
"123"
+
tag
);
this
.
ifAlert
=
true
;
this
.
ifAlert
=
true
;
this
.
token
=
tag
;
this
.
tokenList
.
splice
(
this
.
tokenList
.
indexOf
(
tag
),
1
);
this
.
axios
({
method
:
"post"
,
url
:
"http://127.0.0.1:9100/textAnnotation/deleteToken"
,
//改成通用跳转传过来的documentId
data
:
{
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
,
tokenId
:
this
.
token
.
tokenId
}
}).
then
(
res
=>
{
if
(
res
.
return_code
==
200
)
console
.
log
(
"123"
+
res
.
return_info
);
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
});
},
},
// 直接调用修改接口(因为选择属性弹窗的提交会触发保存标注操作所以会再次产生一个标注,修改也不会成功)
// handleTokenChange(tag) {
// this.ifAlert = true;
// let token = tag;
// this.token = tag;
// tag = {};
// this.axios({
// method: "post",
// url: "http://127.0.0.1:9100/textAnnotation/revToken",
// data: {
// documentId: "a55a28d4a25811ea93c354e1ad87433a",//改成通用跳转传过来的documentId
// token:{
// entityId: this.token.entityId, // 这里类型似乎是string
// word: this.token.word,
// begin: this.token.begin,
// end: this.token.end,
// attribute: arr[0],
// // 修改实体时待改正
// tokenId: this.token.tokenId
// }
// }
// }).then(res => {
// if(res.return_code == 200){
// console.log("123" + res.return_info);
// this.token.attribute = arr[0];
// arr = [];
// this.tokenList.splice(this.tokenList.indexOf(token), 1);
// this.tokenList.push(this.token);
// }
// });
// },
// 删除实体属性
// 删除实体属性
handleTokenClose
(
tag
)
{
handleTokenClose
(
tag
)
{
this
.
tokenList
.
splice
(
this
.
tokenList
.
indexOf
(
tag
),
1
);
this
.
tokenList
.
splice
(
this
.
tokenList
.
indexOf
(
tag
),
1
);
this
.
search
=
tag
;
this
.
token
=
tag
;
console
.
log
(
"123"
+
tag
);
this
.
msg
=
this
.
msg
.
map
(
item
=>
{
this
.
msg
=
this
.
msg
.
map
(
item
=>
{
let
replaceReg
=
new
RegExp
(
let
replaceReg
=
new
RegExp
(
'<span class="highlights-text">'
+
this
.
search
+
"</span>"
,
'<span class="highlights-text">'
+
this
.
token
.
word
+
"</span>"
,
"g"
"g"
);
// 匹配关键字正则
);
// 匹配关键字正则
let
replaceString
=
this
.
search
;
let
replaceString
=
this
.
token
.
word
;
//
保存实体
//
if
(
this
.
value
==
""
&&
this
.
arr
==
[])
{
if
(
this
.
token
.
entityId
==
""
&&
this
.
token
.
attribute
==
[])
{
return
;
return
;
}
}
this
.
axios
({
this
.
axios
({
method
:
"post"
,
method
:
"post"
,
url
:
"
/textAnnotation/add
Token"
,
url
:
"
http://127.0.0.1:9100/textAnnotation/delete
Token"
,
data
:
{
data
:
{
entityId
:
this
.
value
,
// 这里类型似乎是string
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
,
//改成通用跳转传过来的documentId
word
:
this
.
search
,
tokenId
:
this
.
token
.
tokenId
attribute
:
this
.
arr
,
tokenId
:
this
.
tokenId
+
1
}
}
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
"123"
+
res
);
if
(
res
.
return_code
==
200
)
console
.
log
(
"123"
+
res
.
return_info
);
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
});
});
// 不知道为啥不清除
// 不知道为啥不清除
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
tree
.
setCheckedKeys
([]);
this
.
$refs
.
tree
.
setCheckedKeys
([]);
});
});
this
.
value
=
""
;
this
.
token
.
entityId
=
""
;
return
item
.
replace
(
replaceReg
,
replaceString
);
return
item
.
replace
(
replaceReg
,
replaceString
);
});
});
this
.
$message
({
this
.
$message
({
...
@@ -440,8 +533,10 @@ export default {
...
@@ -440,8 +533,10 @@ export default {
if
(
window
.
getSelection
().
toString
()
!=
""
)
{
if
(
window
.
getSelection
().
toString
()
!=
""
)
{
//console.log("1111"+window.getSelection().toString());
//console.log("1111"+window.getSelection().toString());
this
.
ifAlert
=
true
;
this
.
ifAlert
=
true
;
//var search;
//var word;
this
.
search
=
window
.
getSelection
().
toString
();
this
.
token
.
word
=
window
.
getSelection
().
toString
();
this
.
token
.
begin
=
window
.
getSelection
().
anchorOffset
;
//开始位置
this
.
token
.
end
=
window
.
getSelection
().
focusOffset
;
//结束位置
}
}
},
},
// 提交本次标注
// 提交本次标注
...
@@ -461,7 +556,17 @@ export default {
...
@@ -461,7 +556,17 @@ export default {
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
}
}
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
.
data
);
if
(
res
.
return_code
==
200
){
res
.
result
.
forEach
(
element
=>
{
this
.
tokenList
.
push
(
element
)
});
}
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
});
});
}
}
},
},
...
...
DAPlatform-front/src/components/textAnnotation/SelectedText.vue
View file @
340ec3ec
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
style=
"user-select:none; float: left;"
style=
"user-select:none; float: left;"
>
>
<el-tag
size=
"small"
>
<el-tag
size=
"small"
>
<a
class=
"token"
v-html=
"it"
></a>
<a
class=
"token"
v-html=
"it
.word
"
></a>
</el-tag>
</el-tag>
<br
/>
<br
/>
</div>
</div>
...
@@ -121,7 +121,8 @@ export default {
...
@@ -121,7 +121,8 @@ export default {
score
:
""
score
:
""
},
},
formLabelWidth
:
"120px"
,
formLabelWidth
:
"120px"
,
tokenList
:
[
"2020-05-06"
,
"2019年7月"
,
"雪山"
]
// tokenList: ["2020-05-06", "2019年7月", "雪山"]
tokenList
:
[]
};
};
},
},
methods
:
{
methods
:
{
...
@@ -142,7 +143,15 @@ export default {
...
@@ -142,7 +143,15 @@ export default {
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
documentId
:
"a55a28d4a25811ea93c354e1ad87433a"
}
}
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
.
data
);
if
(
res
.
return_code
==
200
){
this
.
tokenList
=
res
.
result
}
else
{
this
.
$message
({
message
:
res
.
return_info
,
type
:
"error"
});
}
});
});
},
},
addScore
()
{
addScore
()
{
...
...
DAPlatform-front/src/components/textAnnotation/Table.vue
View file @
340ec3ec
This diff is collapsed.
Click to expand it.
DAPlatform-front/src/components/textAnnotation/Tabled.vue
0 → 100644
View file @
340ec3ec
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment