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

Commit cb7b643f by 郭婉茹

Json显示

parent 1591e93f
...@@ -67,8 +67,7 @@ ...@@ -67,8 +67,7 @@
</template> </template>
<script> <script>
import FileSaver from "file-saver";
import FileSaver from 'file-saver';
export default { export default {
data() { data() {
...@@ -88,7 +87,7 @@ export default { ...@@ -88,7 +87,7 @@ export default {
begin: 0, begin: 0,
end: 0, end: 0,
entityId: "", entityId: "",
attribute: [] attribute: [],
}, },
token: { token: {
tokenId: "", tokenId: "",
...@@ -96,7 +95,7 @@ export default { ...@@ -96,7 +95,7 @@ export default {
begin: 0, begin: 0,
end: 0, end: 0,
entityId: "", entityId: "",
attribute: [] attribute: [],
}, },
// 实体属性列表 // 实体属性列表
tokenList: [], tokenList: [],
...@@ -106,8 +105,8 @@ export default { ...@@ -106,8 +105,8 @@ export default {
treeData: [], treeData: [],
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "label",
} },
}; };
}, },
beforeMount() { beforeMount() {
...@@ -128,15 +127,15 @@ export default { ...@@ -128,15 +127,15 @@ 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,
textUrl: this.file.url, textUrl: this.file.url,
type: "text", type: "text",
fileId: this.file.id fileId: this.file.id,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
this.documentId = res.result; this.documentId = res.result;
//console.log("this.documentId: " + this.documentId); //console.log("this.documentId: " + this.documentId);
...@@ -146,7 +145,7 @@ export default { ...@@ -146,7 +145,7 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -160,9 +159,9 @@ export default { ...@@ -160,9 +159,9 @@ export default {
method: "post", method: "post",
url: "/files/getFileContent", url: "/files/getFileContent",
data: { data: {
documentId: this.documentId documentId: this.documentId,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
// console.log(" getContent: " + res.result); // console.log(" getContent: " + res.result);
this.content = res.result; this.content = res.result;
...@@ -173,7 +172,7 @@ export default { ...@@ -173,7 +172,7 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -187,11 +186,11 @@ export default { ...@@ -187,11 +186,11 @@ export default {
method: "post", method: "post",
url: "/textAnnotation/getTokenList", url: "/textAnnotation/getTokenList",
data: { data: {
documentId: this.documentId documentId: this.documentId,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
res.result.forEach(element => { res.result.forEach((element) => {
this.tokenInit = element; this.tokenInit = element;
console.log(" token: " + JSON.stringify(this.tokenInit)); console.log(" token: " + JSON.stringify(this.tokenInit));
this.tokenList.push(this.tokenInit); this.tokenList.push(this.tokenInit);
...@@ -213,7 +212,7 @@ export default { ...@@ -213,7 +212,7 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -225,10 +224,10 @@ export default { ...@@ -225,10 +224,10 @@ export default {
method: "post", method: "post",
url: "/textAnnotation/getOneTemplate", url: "/textAnnotation/getOneTemplate",
data: { data: {
templateId: this.piece.template, // TODO 待沟通,通用那边没给这个接口,还有这个在后端用str包了,这里用int就行,后期改成写了实体再自己取属性列表吧 templateId: this.piece.template,
creatorId: this.task.creator_id creatorId: this.task.creator_id,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
//console.log(res.result) //console.log(res.result)
// 实体 // 实体
...@@ -238,7 +237,7 @@ export default { ...@@ -238,7 +237,7 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -282,13 +281,13 @@ export default { ...@@ -282,13 +281,13 @@ export default {
this.ifAlert = false; this.ifAlert = false;
let res = this.$refs.tree.getCheckedNodes(); let res = this.$refs.tree.getCheckedNodes();
let arr = []; let arr = [];
res.forEach(item => { res.forEach((item) => {
arr.push(item.label); // 属性 arr.push(item.label); // 属性
}); });
if (arr == []) { if (arr == []) {
this.$message({ this.$message({
message: "未选择属性", message: "未选择属性",
type: "info" type: "info",
}); });
} else { } else {
// 保存token // 保存token
...@@ -302,10 +301,10 @@ export default { ...@@ -302,10 +301,10 @@ export default {
begin: this.token.begin, begin: this.token.begin,
end: this.token.end, end: this.token.end,
entityId: this.token.entityId, entityId: this.token.entityId,
attribute: arr attribute: arr,
} },
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
// 渲染文本 // 渲染文本
let replaceReg = new RegExp(this.token.word, "g"); // 匹配关键字正则 let replaceReg = new RegExp(this.token.word, "g"); // 匹配关键字正则
...@@ -328,7 +327,7 @@ export default { ...@@ -328,7 +327,7 @@ export default {
begin: this.token.begin, begin: this.token.begin,
end: this.token.end, end: this.token.end,
entityId: this.token.entityId, entityId: this.token.entityId,
attribute: arr attribute: arr,
}; };
this.tokenList.push(token); this.tokenList.push(token);
console.log(" token uploadToken" + JSON.stringify(token)); console.log(" token uploadToken" + JSON.stringify(token));
...@@ -338,12 +337,12 @@ export default { ...@@ -338,12 +337,12 @@ export default {
); );
this.$message({ this.$message({
message: "已保存", message: "已保存",
type: "success" type: "success",
}); });
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -363,19 +362,19 @@ export default { ...@@ -363,19 +362,19 @@ export default {
url: "/textAnnotation/deleteToken", url: "/textAnnotation/deleteToken",
data: { data: {
documentId: this.documentId, documentId: this.documentId,
tokenId: tag.tokenId tokenId: tag.tokenId,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
this.$message({ this.$message({
type: "info", type: "info",
message: "已删除" message: "已删除",
}); });
this.tokenList.splice(this.tokenList.indexOf(tag), 1); this.tokenList.splice(this.tokenList.indexOf(tag), 1);
this.content = this.contentWithoutColor; this.content = this.contentWithoutColor;
console.log(" this.tokenList: " + JSON.stringify(this.tokenList)); console.log(" this.tokenList: " + JSON.stringify(this.tokenList));
console.log(" this.content: " + this.content); console.log(" this.content: " + this.content);
this.tokenList.forEach(element => { this.tokenList.forEach((element) => {
console.log(" token: " + JSON.stringify(element)); console.log(" token: " + JSON.stringify(element));
let replaceReg = new RegExp(element.word, "g"); // 匹配关键字正则 let replaceReg = new RegExp(element.word, "g"); // 匹配关键字正则
let replaceString = let replaceString =
...@@ -394,7 +393,7 @@ export default { ...@@ -394,7 +393,7 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
...@@ -414,15 +413,15 @@ export default { ...@@ -414,15 +413,15 @@ export default {
url: "/textAnnotation/deleteToken", url: "/textAnnotation/deleteToken",
data: { data: {
documentId: this.documentId, documentId: this.documentId,
tokenId: tag.tokenId tokenId: tag.tokenId,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
this.tokenList.splice(this.tokenList.indexOf(tag), 1); this.tokenList.splice(this.tokenList.indexOf(tag), 1);
this.content = this.contentWithoutColor; this.content = this.contentWithoutColor;
console.log(" this.tokenList: " + JSON.stringify(this.tokenList)); console.log(" this.tokenList: " + JSON.stringify(this.tokenList));
console.log(" this.content: " + this.content); console.log(" this.content: " + this.content);
this.tokenList.forEach(element => { this.tokenList.forEach((element) => {
console.log(" token: " + JSON.stringify(element)); console.log(" token: " + JSON.stringify(element));
let replaceReg = new RegExp(element.word, "g"); // 匹配关键字正则 let replaceReg = new RegExp(element.word, "g"); // 匹配关键字正则
let replaceString = let replaceString =
...@@ -441,42 +440,42 @@ export default { ...@@ -441,42 +440,42 @@ export default {
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
}, },
// 提交已标注文档 // TODO 跳转到我的任务,已标注文档标注按钮消失,然后判定整个任务都标注完成后跳转到已完成任务界面,这个就交给通用的大佬们了 // 提交已标注文档
submit() { submit() {
// console.log("hello" + JSON.stringify(this.task)) // console.log("hello" + JSON.stringify(this.task))
this.axios({ this.axios({
method: "post", method: "post",
url: "/textAnnotation/revDocumentState", url: "/textAnnotation/revDocumentState",
data: { data: {
documentId: this.documentId documentId: this.documentId,
} },
}).then(res => { }).then((res) => {
if (res.return_code == 200) { if (res.return_code == 200) {
this.$message({ this.$message({
message: "已保存", message: "已保存",
type: "success" type: "success",
}); });
} else { } else {
this.$message({ this.$message({
message: res.return_info, message: res.return_info,
type: "error" type: "error",
}); });
} }
}); });
this.$router.replace({ this.$router.replace({
name: "ongoingtaskdetail", name: "ongoingtaskdetail",
params: { task: encodeURIComponent(JSON.stringify(this.task)) } params: { task: encodeURIComponent(JSON.stringify(this.task)) },
}); });
}, },
}, },
mounted: function() { mounted: function () {
this.insertDocument(); this.insertDocument();
} },
}; };
</script> </script>
......
...@@ -18,6 +18,7 @@ import Table from '../components/textAnnotation/Table' ...@@ -18,6 +18,7 @@ import Table from '../components/textAnnotation/Table'
import Tabled from '../components/textAnnotation/Tabled' import Tabled from '../components/textAnnotation/Tabled'
import SelectedCheck from '../components/textAnnotation/SelectedCheck' import SelectedCheck from '../components/textAnnotation/SelectedCheck'
import TabledCheck from '../components/textAnnotation/TabledCheck' import TabledCheck from '../components/textAnnotation/TabledCheck'
import Json from '../components/textAnnotation/Json'
import imageAnnotiation from '../components/imageAnnotation/imageAnnotiation' import imageAnnotiation from '../components/imageAnnotation/imageAnnotiation'
import layerAnnotation from '../components/imageAnnotation/layerAnnotation' import layerAnnotation from '../components/imageAnnotation/layerAnnotation'
import layerShow from '../components/imageAnnotation/layerShow' import layerShow from '../components/imageAnnotation/layerShow'
...@@ -119,6 +120,11 @@ export default new Router({ ...@@ -119,6 +120,11 @@ export default new Router({
component: TabledCheck component: TabledCheck
}, },
{ {
path: '/Json',
name: 'json',
component: Json
},
{
path: '/image/:file/:task/:relationId/:piece', path: '/image/:file/:task/:relationId/:piece',
name: 'image', name: 'image',
component: imageAnnotiation component: imageAnnotiation
......
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