文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 89a9b233 by 郭婉茹

bug in table

parent 1a21ec3b
...@@ -39,16 +39,9 @@ ...@@ -39,16 +39,9 @@
</div> </div>
</el-aside> </el-aside>
<!-- 文本界面 --> <!-- 文本界面 -->
<el-main <el-main class="filter-container1" style="background-color: #FFFFFF">
class="filter-container1"
style="background-color: #FFFFFF"
>
<div style="overflow-y:auto;height:100%;"> <div style="overflow-y:auto;height:100%;">
<div <div class="content1" @mouseup="select()" v-html="content"></div>
class="content1"
@mouseup="select()"
v-html="content"
></div>
<div class="content_left"> <div class="content_left">
<div <div
class="tokenList1" class="tokenList1"
...@@ -63,10 +56,7 @@ ...@@ -63,10 +56,7 @@
:disable-transitions="false" :disable-transitions="false"
@close="deleteToken(it)" @close="deleteToken(it)"
> >
<a <a class="token1" v-html="it.word"></a>
class="token1"
v-html="it.word"
></a>
</el-tag> </el-tag>
</div> </div>
</div> </div>
...@@ -117,7 +107,7 @@ export default { ...@@ -117,7 +107,7 @@ export default {
children: "children", children: "children",
label: "label", label: "label",
}, },
treeToArray : [], treeToArray: [],
}; };
}, },
beforeMount() { beforeMount() {
...@@ -250,7 +240,10 @@ export default { ...@@ -250,7 +240,10 @@ export default {
// 属性 // 属性
this.treeData = res.result.entityList; this.treeData = res.result.entityList;
for (var i = 0; i < this.treeData.length; i++) { for (var i = 0; i < this.treeData.length; i++) {
this.treeToArray.push({ "id": this.treeData[i].id, "label": this.treeData[i].label }); // 属性 this.treeToArray.push({
id: this.treeData[i].id,
label: this.treeData[i].label,
}); // 属性
if (this.treeData[i].children != []) { if (this.treeData[i].children != []) {
this.transfer(this.treeData[i].children); this.transfer(this.treeData[i].children);
} }
...@@ -266,6 +259,15 @@ export default { ...@@ -266,6 +259,15 @@ export default {
// 定位原文token // 定位原文token
select() { select() {
if (window.getSelection().toString() != "") { if (window.getSelection().toString() != "") {
for (var i = 0; i < this.tokenList.length; i++) {
if (window.getSelection().toString() == this.tokenList[i].word) {
this.$message({
message: "“" + window.getSelection().toString() + "”已标注",
type: "info",
});
return;
}
}
//console.log(" token select" + JSON.stringify(this.token)); //console.log(" token select" + JSON.stringify(this.token));
this.token.tokenId = "0"; this.token.tokenId = "0";
this.token.word = window.getSelection().toString(); this.token.word = window.getSelection().toString();
...@@ -410,10 +412,9 @@ export default { ...@@ -410,10 +412,9 @@ export default {
this.$refs.tree.setCheckedNodes(res); this.$refs.tree.setCheckedNodes(res);
}, },
transfer(children) { transfer(children) {
if (children == []) if (children == []) return;
return;
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
this.treeToArray.push({ "id": children[i].id, "label": children[i].label }); this.treeToArray.push({ id: children[i].id, label: children[i].label });
if (children[i] != []) { if (children[i] != []) {
this.transfer(children[i].children); this.transfer(children[i].children);
} }
......
...@@ -60,13 +60,12 @@ ...@@ -60,13 +60,12 @@
<el-main class="filter-container2" style="background-color: #FFFFFF"> <el-main class="filter-container2" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;"> <div style="overflow-y:auto;height:100%;">
<!-- 表格界面 --> <!-- 表格界面 -->
<div class="content2"> <div class="content2" @mouseup="select()">
<el-table <el-table
:data="nowContent.tableData" :data="nowContent.tableData"
:cell-style="cellStyle" :cell-style="cellStyle"
border border
style="width: 100%,height:200px" style="width: 100%,height:200px"
@cell-click="select"
:cell-class-name="getCellIndex" :cell-class-name="getCellIndex"
> >
<el-table-column <el-table-column
...@@ -175,7 +174,7 @@ export default { ...@@ -175,7 +174,7 @@ export default {
method: "post", method: "post",
url: "/textAnnotation/insertDocument", url: "/textAnnotation/insertDocument",
data: { data: {
templateId: this.piece.template, // TODO 模板id templateId: this.piece.template,
annotatorId: this.$store.state.userInfo.userId, annotatorId: this.$store.state.userInfo.userId,
creatorId: this.task.creator_id, creatorId: this.task.creator_id,
relationId: this.relationId, relationId: this.relationId,
...@@ -290,27 +289,17 @@ export default { ...@@ -290,27 +289,17 @@ export default {
} }
}, },
// 定位原文token // 定位原文token
select: function (row, column) { select() {
this.row = row; if (window.getSelection().toString() != "") {
this.column = column; //console.log(" token select" + JSON.stringify(this.token));
this.token.tokenId = "0"; this.token.tokenId = "0";
this.token.word = row[column.property]; this.token.word = window.getSelection().toString();
this.token.begin = row.index; this.token.begin = window.getSelection().anchorOffset; //开始位置
this.token.end = column.index; this.token.end = window.getSelection().focusOffset; //结束位置
for (var i = 0; i < this.tokenList.length; i++) { this.$refs.tree.setCheckedNodes([]);
if ( //console.log(" token select" + JSON.stringify(this.token));
this.token.begin == this.tokenList[i].begin && //console.log(" tokenList select" + JSON.stringify(this.tokenList));
this.token.end == this.tokenList[i].end
) {
this.$message({
message: "选中单元格已标记",
type: "info",
});
return;
}
} }
console.log(" token select" + JSON.stringify(this.token));
console.log(" tokenList select" + JSON.stringify(this.tokenList));
}, },
getCellIndex: function ({ row, column, rowIndex, columnIndex }) { getCellIndex: function ({ row, column, rowIndex, columnIndex }) {
row.index = rowIndex; row.index = rowIndex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment