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

Commit fa6fd659 by 李景熙

conflict

parents f9ed0065 a2ceaf15
var baseURL = 'http://47.92.1.107/api'
export {
baseURL
}
var baseURL = 'http://47.92.1.107/api'
export {
baseURL
}
......@@ -310,16 +310,22 @@ export default {
},
beforeRouteLeave: function(to, from , next){
// alert("返回后未保存的标注结果将会消失,请确认已保存!")
let i = 0
this.$confirm('返回后未保存的标注结果将会消失,请确认已保存!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$destroy();
next();
this.$destroy()
next()
}).catch(() => {
i = 1
})
});
if (i == 0) {
this.$destroy()
next()
}
// this.$destroy();
// next();
},
......
......@@ -7,7 +7,7 @@
<div>
<div class="img-list-title1">实体列表</div>
<div class="img-title-list-box1">
<div class="img-title-list1">
<div>
<div
class="tokenList1"
v-for="it in tokenList"
......@@ -23,7 +23,6 @@
>
<a class="token1" v-html="it.word"></a>
</el-tag>
<br />
</div>
</div>
</div>
......@@ -34,7 +33,6 @@
<el-main class="filter-container1" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;">
<div class="content1" @mouseup="select()" v-html="content"></div>
<br />
<div>
<el-button class="button1" type="primary" @click="submit()">提交</el-button>
</div>
......@@ -138,7 +136,6 @@ export default {
this.documentId = res.result;
//console.log("this.documentId: " + this.documentId);
this.getContent();
this.getTokenList();
this.getTemplate();
} else {
this.$message({
......@@ -150,9 +147,9 @@ export default {
},
//获取内容
getContent() {
console.log("getContent");
console.log(" this.file: " + JSON.stringify(this.file));
console.log(" this.documentId: " + this.documentId);
console.log("getContent this.file: " + JSON.stringify(this.file));
console.log("getContent this.documentId: " + this.documentId);
console.log("getContent this.content: " + this.content);
this.axios({
method: "post",
url: "/files/getFileContent",
......@@ -161,9 +158,13 @@ export default {
},
}).then((res) => {
if (res.return_code == 200) {
// console.log(" getContent: " + res.result);
console.log(" getContent: " + res.result);
this.content = res.result;
this.$nextTick(function () {
this.getTokenList();
});
this.contentWithoutColor = this.content;
// console.log(
// " this.contentWithoutColor: " + this.contentWithoutColor
// );
......@@ -526,13 +527,16 @@ export default {
@include whiteBoard;
.content1 {
overflow: auto;
height: calc(100vh - 61px - 100px - 110px);
height: calc(100vh - 61px - 100px - 100px);
text-align: left;
font-size: 20px;
line-height: 30px;
}
.button1 {
overflow: auto;
float: right;
margin-right: 10px;
margin-top: 10px;
}
}
}
......
......@@ -28,7 +28,6 @@
<el-main class="filter-container1" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;">
<div class="content1" @mouseup="select()" v-html="content"></div>
<br />
<!-- 打分 -->
<!--div v-if="this.$route.query.isCheck == '1'"-->
<div class="button1">
......@@ -53,7 +52,7 @@
</template>
<script>
import FileSaver from 'file-saver';
import FileSaver from "file-saver";
export default {
data() {
return {
......@@ -63,7 +62,6 @@ export default {
// 任务
task: null,
// 文章内容
contentWithoutColor: "",
content: "",
//实体属性
tokenInit: {
......@@ -72,7 +70,7 @@ export default {
begin: 0,
end: 0,
entityId: "",
attribute: []
attribute: [],
},
token: {
tokenId: "",
......@@ -80,7 +78,7 @@ export default {
begin: 0,
end: 0,
entityId: "",
attribute: []
attribute: [],
},
// 实体属性列表
tokenList: [],
......@@ -90,15 +88,16 @@ export default {
treeData: [],
defaultProps: {
children: "children",
label: "label"
label: "label",
},
// 这个地方是打分的数据结构
commentScore: false,
scoreForm: {
accuracy: "",
score: ""
score: "",
},
formLabelWidth: "120px"
formLabelWidth: "120px",
executors: [],
};
},
beforeMount() {
......@@ -107,63 +106,67 @@ export default {
this.task = this.$route.params.task;
this.relationId = this.$route.params.relationId;
this.piece = this.$route.params.piece;
this.executors = this.$route.params.executor;
},
methods: {
// 插入数据库
insertDocument() {
// console.log("userId" + this.$store.state.userInfo.userId);
// console.log("insertDocument");
// console.log("userId" + JSON.stringify(this.executors));
// console.log("file" + JSON.stringify(this.file));
// console.log("task" + JSON.stringify(this.task));
// console.log("relationId" + JSON.stringify(this.relationId));
// console.log("piece" + JSON.stringify(this.piece));
this.axios({
method: "post",
url: "/textAnnotation/insertDocument",
data: {
templateId: this.piece.template, // TODO 模板id
annotatorId: this.$store.state.userInfo.userId,
templateId: this.piece.template,
annotatorId: this.executors.id,
creatorId: this.task.creator_id,
relationId: this.relationId,
textUrl: this.file.url,
type: "text",
fileId: this.file.id
}
}).then(res => {
fileId: this.file.id,
},
}).then((res) => {
if (res.return_code == 200) {
this.documentId = res.result;
//console.log("this.documentId: " + this.documentId);
this.getContent();
this.getTokenList();
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
},
//获取内容
getContent() {
console.log("getContent");
console.log(" this.file: " + JSON.stringify(this.file));
console.log(" this.documentId: " + this.documentId);
console.log("getContent this.file: " + JSON.stringify(this.file));
console.log("getContent this.documentId: " + this.documentId);
this.axios({
method: "post",
url: "/files/getFileContent",
data: {
documentId: this.documentId
}
}).then(res => {
documentId: this.documentId,
},
}).then((res) => {
if (res.return_code == 200) {
// console.log(" getContent: " + res.result);
this.content = res.result;
this.contentWithoutColor = this.content;
console.log("getContent this.content: " + this.content);
this.$nextTick(function () {
this.getTokenList();
});
// console.log(
// " this.contentWithoutColor: " + this.contentWithoutColor
// );
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
......@@ -177,11 +180,11 @@ export default {
method: "post",
url: "/textAnnotation/getTokenList",
data: {
documentId: this.documentId
}
}).then(res => {
documentId: this.documentId,
},
}).then((res) => {
if (res.return_code == 200) {
res.result.forEach(element => {
res.result.forEach((element) => {
this.tokenInit = element;
console.log(" token: " + JSON.stringify(this.tokenInit));
this.tokenList.push(this.tokenInit);
......@@ -200,18 +203,19 @@ export default {
this.content = this.content.replace(replaceReg, replaceString);
});
console.log(" this.tokenList: " + JSON.stringify(this.tokenList));
console.log(" this.content: " + this.content);
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
},
// 打分
addScore() {
// alert("Inin")
// console.log(this.$route.params.executor.id)
// alert("Inin")
// console.log(this.$route.params.executor.id)
if (this.scoreForm.accuracy == "" || this.scoreForm.score == "")
this.$message("请输入内容");
else if (
......@@ -231,10 +235,10 @@ export default {
)
this.$message("准确度应在0~100范围内");
else if (
parseInt(this.scoreForm.score) > 100 ||
parseInt(this.scoreForm.score) < 0
parseInt(this.scoreForm.score) > 100 ||
parseInt(this.scoreForm.score) < 0
)
this.$message("得分应该在0~100范围内");
this.$message("得分应该在0~100范围内");
else {
this.commentScore = false;
this.$message("打分成功");
......@@ -249,10 +253,10 @@ export default {
params: {
userId: this.$route.params.executor.id,
fileId: this.file.id,
scoreForm: this.scoreForm
scoreForm: this.scoreForm,
},
url: "task/gradePieces"
}).then(res => {
url: "task/gradePieces",
}).then((res) => {
if (res.code == 0) {
alert("分数提交失败!");
} else if (res.code == 1) {
......@@ -260,11 +264,11 @@ export default {
this.$router.push({ path: "/taskhall" });
}
});
}
},
},
mounted: function() {
mounted: function () {
this.insertDocument();
}
},
};
</script>
......@@ -301,4 +305,65 @@ export default {
margin-top: 3px;
margin-bottom: 3px;
}
@import "@/assets/scss/config.scss";
@import "@/assets/scss/mixin.scss";
.select-container {
height: calc(100vh - 61px);
display: flex;
background-color: #d9ecff;
.sidebar1 {
padding: 0 0 0 0;
margin-left: 50px;
margin-top: 40px;
width: 30%;
display: flex;
.img-list-title1 {
padding: 0 0 0 0;
width: 300px;
height: 40px;
line-height: 40px;
background: #409eff;
color: white;
box-shadow: 0px 0px 10px #dbdbdb;
}
.img-title-list-box1 {
padding: 0 0 0 0;
width: 300px;
height: calc(100vh - 61px - 100px - 40px);
overflow: auto;
background-color: white;
box-shadow: 0px 0px 10px #dbdbdb;
.tokenList1 {
margin: 9px;
}
.token1 {
font-size: 18px;
}
}
}
.filter-container1 {
margin-right: 40px;
margin-left: 20px;
margin-top: 40px;
height: calc(100vh - 61px - 100px);
width: 70%;
//float: center;
width: 100%;
padding: 25px 10px 20px 25px;
@include whiteBoard;
.content1 {
overflow: auto;
height: calc(100vh - 61px - 100px - 100px);
text-align: left;
font-size: 20px;
line-height: 30px;
}
.button1 {
overflow: auto;
float: right;
margin-right: 10px;
margin-top: 10px;
}
}
}
</style>
......@@ -28,7 +28,6 @@
<el-main class="filter-container1" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;">
<div class="content1" @mouseup="select()" v-html="content"></div>
<br />
<div>
<el-button class="button1" type="primary" @click="submit()">提交</el-button>
</div>
......@@ -49,7 +48,6 @@ export default {
// 任务
task: null,
// 文章内容
contentWithoutColor: "",
content: "",
//实体属性
tokenInit: {
......@@ -98,30 +96,30 @@ export default {
insertDocument() {
// console.log("userId" + this.$store.state.userInfo.userId);
// console.log("file" + JSON.stringify(this.file));
// console.log("task" + JSON.stringify(this.task));
//console.log("task" + JSON.stringify(this.task));
// console.log("relationId" + JSON.stringify(this.relationId));
//console.log("piece" + JSON.stringify(this.piece));
this.axios({
method: "post",
url: "/textAnnotation/insertDocument",
data: {
templateId: this.piece.template, // TODO 模板id
templateId: this.piece.template,
annotatorId: this.$store.state.userInfo.userId,
creatorId: this.task.creator_id,
relationId: this.relationId,
textUrl: this.file.url,
type: "text",
fileId: this.file.id
}
}).then(res => {
fileId: this.file.id,
},
}).then((res) => {
if (res.return_code == 200) {
this.documentId = res.result;
//console.log("this.documentId: " + this.documentId);
this.getContent();
this.getTokenList();
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
......@@ -135,20 +133,22 @@ export default {
method: "post",
url: "/files/getFileContent",
data: {
documentId: this.documentId
}
}).then(res => {
documentId: this.documentId,
},
}).then((res) => {
if (res.return_code == 200) {
// console.log(" getContent: " + res.result);
this.content = res.result;
this.contentWithoutColor = this.content;
this.$nextTick(function () {
this.getTokenList();
});
// console.log(
// " this.contentWithoutColor: " + this.contentWithoutColor
// );
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
......@@ -162,11 +162,11 @@ export default {
method: "post",
url: "/textAnnotation/getTokenList",
data: {
documentId: this.documentId
}
}).then(res => {
documentId: this.documentId,
},
}).then((res) => {
if (res.return_code == 200) {
res.result.forEach(element => {
res.result.forEach((element) => {
this.tokenInit = element;
console.log(" token: " + JSON.stringify(this.tokenInit));
this.tokenList.push(this.tokenInit);
......@@ -188,7 +188,7 @@ export default {
} else {
this.$message({
message: res.return_info,
type: "error"
type: "error",
});
}
});
......
<template>
<div class="select-container">
<el-container>
<el-aside class="sidebar">
<el-aside class="sidebar3">
<!-- 实体列表 -->
<div class="sidebar-box">
<div class="sidebar-box3">
<div>
<div class="img-list-title">实体列表</div>
<div class="img-title-list-box">
<div class="img-title-list">
<div class="img-list-title3">实体列表</div>
<div class="img-title-list-box3">
<div>
<div
class="tokenList"
class="tokenList3"
v-for="it in tokenList"
:key="it"
style="user-select:none; float: left;"
......@@ -21,7 +21,7 @@
:disable-transitions="false"
@close="deleteToken(it)"
>
<a class="token" v-html="it.word"></a>
<a class="token3" v-html="it.word"></a>
</el-tag>
<br />
</div>
......@@ -29,12 +29,12 @@
</div>
</div>
</div>
<!-- 文本列表 -->
<div class="sidebar-box">
<!-- 表单列表 -->
<div class="sidebar-box3">
<div>
<div class="img-list-title">表单列表</div>
<div class="img-title-list-box">
<div id="img-title-list" style="user-select:none; float:left; padding: 5px;">
<div class="img-list-title3">表单列表</div>
<div class="img-title-list-box3">
<div style="user-select:none; float:left; padding: 5px;">
<div
v-for="item in allContent"
:key="item.tablename"
......@@ -48,17 +48,17 @@
</div>
</el-aside>
<!-- 文件界面 -->
<el-main class="filter-container" style="background-color: #FFFFFF">
<el-main class="filter-container1" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;">
<!-- 表格界面 -->
<div>
<div class="content1">
<el-table
:data="nowContent.tableData"
:cell-style="cellStyle"
border
style="width: 100%,height:200px"
@cell-click="select"
:row-class-name="tableRowClassName"
:cell-class-name="getCellIndex"
>
<el-table-column
v-for="col in nowContent.name"
......@@ -69,9 +69,8 @@
</el-table>
</div>
<!-- 表格界面 -->
<br />
<div>
<el-button type="primary" @click="submit()">提交</el-button>
<el-button class="button1" type="primary" @click="submit()">提交</el-button>
</div>
<!-- 弹窗-->
......@@ -289,20 +288,20 @@ export default {
}
},
// 定位原文token
select(row, column) {
select: function (row, column) {
this.row = row;
this.column = column;
this.token.word = row[column.property];
this.token.begin = column.property;
this.token.entityId = row[1];
console.log(JSON.stringify(row));
console.log(JSON.stringify(column));
console.log(JSON.stringify(this.token.word));
console.log(this.token.begin);
console.log(JSON.stringify(this.token.entityId));
// 禁止重复标注,沾边的也不行
this.token.begin = row.index;
this.token.end = column.index;
// console.log("select: "+JSON.stringify(row.index));
// console.log("select: "+JSON.stringify(column.index));
// console.log(JSON.stringify(this.token.word));
for (var i = 0; i < this.tokenList.length; i++) {
if (this.token.word == this.tokenList[i].word) {
if (
this.token.begin == this.tokenList[i].begin &&
this.token.end == this.tokenList[i].end
) {
this.$message({
message: "选中单元格已标记",
type: "info",
......@@ -314,16 +313,28 @@ export default {
console.log(" tokenList select" + JSON.stringify(this.tokenList));
this.ifAlert = true; // 打开标注弹窗
},
// tableRowClassName({ row, rowIndex }) {
// if (rowIndex === 0) {
// return "success-row";
// } else if (rowIndex === 3) {
// return "success-row";
// }
// return "";
// },
getCellIndex: function ({ row, column, rowIndex, columnIndex }) {
row.index = rowIndex;
column.index = columnIndex;
},
// 表格标注颜色
cellStyle(row, column, rowIndex, columnIndex) {},
cellStyle: function (row, column, rowIndex, columnIndex) {
for (var i = 0; i < this.tokenList.length; i++) {
// console.log("draw token" + JSON.stringify(this.tokenList[i]));
// console.log("draw rowindex" + JSON.stringify(this.tokenList[i].begin));
// console.log("draw columnindex" + JSON.stringify(this.tokenList[i].end));
// console.log("draw rowindex" + JSON.stringify(row.rowIndex));
// console.log("draw columnindex" + JSON.stringify(row.columnIndex));
if (
row.rowIndex === this.tokenList[i].begin &&
row.columnIndex === this.tokenList[i].end
) {
// console.log("draw token" + JSON.stringify(this.token));
return "background: #d9ecff;";
}
}
return "";
},
// 添加标注
uploadToken() {
this.ifAlert = false;
......@@ -347,7 +358,7 @@ export default {
token: {
word: this.token.word,
begin: this.token.begin,
end: 0,
end: this.token.end,
entityId: this.token.entityId,
attribute: arr,
},
......@@ -359,8 +370,8 @@ export default {
tokenId: res.result,
word: this.token.word,
begin: this.token.begin,
end: 0,
entityId: this.token.entityId,
end: this.token.end,
entityId: this.value,
attribute: arr,
};
this.tokenList.push(token);
......@@ -475,48 +486,35 @@ export default {
<style lang='scss'>
@import "@/assets/scss/config.scss";
@import "@/assets/scss/mixin.scss";
.select-container {
height: calc(100vh - 61px);
display: flex;
flex-direction: column;
background-color: #d9ecff;
.sidebar {
.sidebar3 {
padding: 0 0 0 0;
margin-left: 50px;
margin-top: 40px;
width: 30%;
.img-list-title3 {
padding: 0 0 0 0;
margin-left: 50px;
margin-top: 40px;
width: 30%;
.img-list-title {
padding: 0 0 0 0;
height: 40px;
line-height: 40px;
background: #409eff;
color: white;
box-shadow: 0px 0px 10px #dbdbdb;
}
.img-title-list-box {
padding: 7px;
height: 200px;
overflow: auto;
background-color: white;
//margin-top: 13px;
margin-bottom: 13px;
width: 300px;
height: 40px;
line-height: 40px;
background: #409eff;
color: white;
box-shadow: 0px 0px 10px #dbdbdb;
}
}
.filter-container {
margin-right: 40px;
margin-left: 20px;
margin-top: 40px;
height: calc(100vh - 61px - 100px);
//float: center;
width: 70%;
padding: 25px 10px 20px 25px;
@include whiteBoard;
.content {
text-align: left;
font-size: 20px;
line-height: 30px;
height: calc(100vh - 61px - 100px - 110px);
.img-title-list-box3 {
padding: 0 0 0 0;
width: 300px;
height: 200px;
overflow: auto;
background-color: white;
//margin-top: 13px;
margin-bottom: 13px;
box-shadow: 0px 0px 10px #dbdbdb;
.tokenList3 {
margin: 9px;
}
.token3 {
font-size: 18px;
}
}
}
......@@ -561,11 +559,4 @@ export default {
margin-top: 3px;
margin-bottom: 3px;
}
.tokenList {
margin: 9px;
//margin-bottom: 9px;
}
.token {
font-size: 18px;
}
</style>
</style>
\ No newline at end of file
<template>
<div class="select-container">
<el-container style="margin-top: 40px">
<el-container>
<el-aside
class="sidebar"
style="background-color: rgba(255,255,255,0);box-shadow: 0px 0px 0px rgba(255,255,255,0);padding-right: 20px"
>
class="sidebar3">
<!-- 实体列表 -->
<div class="sidebar-box">
<div class="sidebar-box3">
<div>
<div class="img-list-title">实体列表</div>
<div class="img-title-list-box">
<div class="img-title-list">
<div class="img-list-title3">实体列表</div>
<div class="img-title-list-box3">
<div>
<div
class="tokenList"
class="tokenList2"
v-for="it in tokenList"
:key="it"
style="user-select:none; float: left;"
>
<el-tag
<div
size="small"
@click="changeToken(it)"
closable
:disable-transitions="false"
@close="deleteToken(it)"
>
<a class="token" v-html="it.word"></a>
</el-tag>
<br />
<li class="token2" v-html="it.word"></li>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 文本列表 -->
<div class="sidebar-box">
<div class="sidebar-box3">
<div>
<div class="img-list-title">表单列表</div>
<div class="img-title-list-box">
<div id="img-title-list" style="user-select:none; float:left; padding: 5px;">
<div class="img-list-title3">表单列表</div>
<div class="img-title-list-box3">
<div style="user-select:none; float:left; padding: 5px;">
<div
v-for="item in allContent"
:key="item.tablename"
......@@ -51,10 +48,10 @@
</div>
</el-aside>
<!-- 文件界面 -->
<el-main class="filter-container" style="background-color: #FFFFFF">
<el-main class="filter-container1" style="background-color: #FFFFFF">
<div style="overflow-y:auto;height:100%;">
<!-- 表格界面 -->
<div>
<div class="content1">
<el-table
:data="nowContent.tableData"
:cell-style="cellStyle"
......@@ -72,11 +69,10 @@
</el-table>
</div>
<!-- 表格界面 -->
<br />
<!-- 打分 -->
<!--div v-if="this.$route.query.isCheck == '1'"-->
<div>
<el-button type="primary" @click="submit()">提交</el-button>
<el-button class="button1" type="primary" @click="submit()">提交</el-button>
</div>
</div>
</el-main>
......@@ -244,6 +240,24 @@ export default {
}
});
},
// 表格标注颜色
cellStyle: function (row, column, rowIndex, columnIndex) {
for (var i = 0; i < this.tokenList.length; i++) {
// console.log("draw token" + JSON.stringify(this.tokenList[i]));
// console.log("draw rowindex" + JSON.stringify(this.tokenList[i].begin));
// console.log("draw columnindex" + JSON.stringify(this.tokenList[i].end));
// console.log("draw rowindex" + JSON.stringify(row.rowIndex));
// console.log("draw columnindex" + JSON.stringify(row.columnIndex));
if (
row.rowIndex === this.tokenList[i].begin &&
row.columnIndex === this.tokenList[i].end
) {
// console.log("draw token" + JSON.stringify(this.token));
return "background: #d9ecff;";
}
}
return "";
},
submit() {
this.$router.push({ path: "/taskhall" });
......@@ -258,7 +272,6 @@ export default {
<style lang='scss'>
@import "@/assets/scss/config.scss";
@import "@/assets/scss/mixin.scss";
.el-table .warning-row {
background: oldlace;
}
......@@ -298,11 +311,4 @@ export default {
margin-top: 3px;
margin-bottom: 3px;
}
.tokenList {
margin: 9px;
//margin-bottom: 9px;
}
.token {
font-size: 18px;
}
</style>
......@@ -157,6 +157,7 @@ def findSomeTemplates(collection, condition):
template["templateId"] = i.get("templateId", None)
template["templateName"] = i.get("templateName", None)
template["entityList"] = i.get("entityList", None)
template["templateType"] = i.get("templateType", None)
x.append(template) # 将cursor转化为一个字典
template = {}
return x # 返回这个字典
......
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