|
@@ -0,0 +1,183 @@
|
|
|
+<template>
|
|
|
+ <div :loading="loading">
|
|
|
+ <el-row>
|
|
|
+ <span>
|
|
|
+ <el-col :span="6" class="center-span">
|
|
|
+ <el-button v-show="!readonly" type="primary" plain icon="el-icon-check" size="mini" @click="createPage()">新建页</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" class="center-span">
|
|
|
+ <el-button type="primary" plain icon="el-icon-check" size="mini" @click="previousPage()">上一页</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" class="center-span">
|
|
|
+ <el-button type="primary" plain icon="el-icon-check" size="mini" @click="nextPage()">下一页</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" class="center-span">
|
|
|
+ <el-button v-show="!readonly" type="primary" plain icon="el-icon-check" size="mini" @click="handleApprove()" :loading="loading">提交</el-button>
|
|
|
+ </el-col>
|
|
|
+ </span>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-card style="margin:10px">
|
|
|
+ <el-form ref="form" :model="extractByHands[pageNum]" label-width="80px">
|
|
|
+ <div v-for="(entityClass, detailIndex) in extractByHands[pageNum].details" :key="'entityClass'+pageNum+detailIndex" style="margin:5px">
|
|
|
+ <el-row>{{ entityClass.entityClassName }}</el-row>
|
|
|
+ <el-row v-for="(entity,index) in entityClass.entityList" :key="'entity'+pageNum+index" style="margin:5px">
|
|
|
+ <el-col :span="23">
|
|
|
+ <el-input v-model="entityClass.entityList[index]"/>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1">
|
|
|
+ <el-button @click="remove(detailIndex,index)" icon="el-icon-minus" circle type="primary" size="mini"/>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin:5px" class="center-span"><el-button @click="add(detailIndex)" type="primary" icon="el-icon-plus" size="mini" /></el-row>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getExtractByHandBySubtaskId, submitBySubTask } from "@/api/suport/hand";
|
|
|
+import { getEntityClassOption } from '@/api/neo4j/class'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "ClassCreateResult",
|
|
|
+ props:{
|
|
|
+ subTask: {
|
|
|
+ type: Object,
|
|
|
+ },
|
|
|
+ readonly: {
|
|
|
+ type: Boolean,
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ pageNum:0,
|
|
|
+ maxPageNum:0,
|
|
|
+ extractByHands:[
|
|
|
+ {
|
|
|
+ id:null,
|
|
|
+ subTaskId:this.subTask.id,
|
|
|
+ pageNo:0,
|
|
|
+ details:[]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ classes:[],
|
|
|
+ classMap: new Map()
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getClass()
|
|
|
+ },
|
|
|
+
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getResult(){
|
|
|
+ this.loading = true
|
|
|
+ getExtractByHandBySubtaskId(this.subTask.id).then(resp =>{
|
|
|
+ this.extractByHands = resp.data
|
|
|
+ for(let extractByHand of this.extractByHands) {
|
|
|
+ for(let detail of extractByHand.details) {
|
|
|
+ detail.entityClassName = this.classMap.get(detail.entityClassId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ getClass() {
|
|
|
+ getEntityClassOption().then(resp => {
|
|
|
+ this.classes = resp.data
|
|
|
+ let classMap = new Map()
|
|
|
+ for(let clazz of this.classes){
|
|
|
+ classMap.set(clazz.id,clazz.name)
|
|
|
+ }
|
|
|
+ this.classMap = classMap
|
|
|
+ if(this.readonly){
|
|
|
+ this.getResult()
|
|
|
+ } else {
|
|
|
+ this.extractByHands[this.pageNum].details = this.getNewDetails();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getNewDetails() {
|
|
|
+ let details = []
|
|
|
+ if(this.classes && this.classes.length >0){
|
|
|
+ for(let clazz of this.classes) {
|
|
|
+ let detail = {
|
|
|
+ id:null,
|
|
|
+ entityClassId: clazz.id,
|
|
|
+ entityClassName: clazz.name,
|
|
|
+ entityList:['']
|
|
|
+ }
|
|
|
+ details.push(detail)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return details;
|
|
|
+ },
|
|
|
+ handleApprove() {
|
|
|
+ this.loading = true
|
|
|
+ submitBySubTask(this.extractByHands).then(resp => {
|
|
|
+ let message ='提交成功'
|
|
|
+ this.$message({
|
|
|
+ message,
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.loading = false
|
|
|
+ this.$emit("closeInfo")
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDelete(index) {
|
|
|
+ this.entityClassRelationList.splice(index, 1);
|
|
|
+ },
|
|
|
+ remove(classIndex, entityIndex){
|
|
|
+ this.extractByHands[this.pageNum].details[classIndex].entityList.splice(entityIndex,1)
|
|
|
+ },
|
|
|
+ add(classIndex){
|
|
|
+ this.extractByHands[this.pageNum].details[classIndex].entityList.push('')
|
|
|
+ },
|
|
|
+ createPage(){
|
|
|
+ this.maxPageNum = this.maxPageNum+1
|
|
|
+ let extractByHand = {
|
|
|
+ id:null,
|
|
|
+ subTaskId: this.subTask.id,
|
|
|
+ pageNo: this.maxPageNum,
|
|
|
+ details: this.getNewDetails()
|
|
|
+ }
|
|
|
+ this.extractByHands.push(extractByHand)
|
|
|
+ this.pageNum = this.extractByHands.length-1
|
|
|
+ },
|
|
|
+ previousPage(){
|
|
|
+ if(this.pageNum === 0){
|
|
|
+ this.$message.error('已经是第一页了');
|
|
|
+ } else {
|
|
|
+ this.pageNum--
|
|
|
+ }
|
|
|
+ },
|
|
|
+ nextPage(){
|
|
|
+ if(this.pageNum === this.extractByHands.length - 1){
|
|
|
+ this.$message.error('已经是最后一页了');
|
|
|
+ } else {
|
|
|
+ this.pageNum++
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+.center-span {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+</style>
|