| | |
| | | <template> |
| | | <div> |
| | | <div class="fa-card-a"> |
| | | |
| | | <div id="containerImg" style="border: 1px solid #EAEBEE;border-radius: 6px; |
| | | box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);height: 100%"> |
| | | <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> |
| | | <el-form-item :label="modelName"></el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="danger" @click="closeDigram()">关闭</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div style="border: 1px solid #EAEBEE;border-radius: 6px;box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);height: calc(100vh - 233px);"> |
| | | <div id="containerImg"></div> |
| | | </div> |
| | | <config-node ref="configNode" v-show="type === 'node'"/> |
| | | <config-edge ref="configEdge" v-show="type === 'edge'"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | this.projectId = this.$route.params.projectId |
| | | console.log(this.$route.params.projectId, 'this.$route.params.projectId') |
| | | console.log(this.$route.params.diagramId, 'this.$route.params.diagramId') |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.type = 'grid' |
| | | }, |
| | | methods: { |
| | | init(row) { |
| | | this.modelName = row.modelName |
| | | this.modelName = row.title |
| | | this.dataForm.id = row.id |
| | | this.collapseTransition = row.collapseTransition |
| | | this.initDigram() |
| | | console.log(this.dataForm, 'init(row){') |
| | | }, |
| | | closeDigram(){ |
| | | this.collapseTransition = 16 |
| | | this.$emit('closeWindow',this.collapseTransition) |
| | | }, |
| | | async getDiagram(modelId) { |
| | | this.isFirstLoad = true; |
| | |
| | | this.isFirstLoad = false; |
| | | console.log(this.diagramJson.cells.length, 'this.diagramJson.cells.length') |
| | | |
| | | this.graph.positionContent('left') |
| | | // this.graph.positionContent('left') |
| | | this.graph.positionContent('left',{ padding: { left: 0 }}) |
| | | // this.graph.centerContent() |
| | | // this.graph.zoomToFit() |
| | | } else { |
| | |
| | | this.graph = new Graph({ |
| | | container: document.getElementById('containerImg'), |
| | | width: document.documentElement.clientWidth, |
| | | height: document.documentElement.clientHeight - 200, |
| | | height: document.documentElement.clientHeight - 240, |
| | | // async: true, |
| | | grid: { |
| | | visible: true, |
| | |
| | | } |
| | | }, |
| | | }, |
| | | scroller: { |
| | | enabled: true, |
| | | pageVisible: true, |
| | | autoResize: true, |
| | | pageBreak: true, |
| | | pannable: true, |
| | | minVisibleWidth: 200, |
| | | minVisibleHeight: 200, |
| | | modifiers: 'shift', |
| | | }, |
| | | mousewheel: { |
| | | enabled: true, |
| | | zoomAtMousePosition: true, |
| | | modifiers: 'ctrl', |
| | | minScale: 0.5, |
| | | maxScale: 3, |
| | | }, |
| | | // scroller: { |
| | | // enabled: true, |
| | | // pageVisible: true, |
| | | // autoResize: true, |
| | | // pageBreak: true, |
| | | // pannable: true, |
| | | // minVisibleWidth: 200, |
| | | // minVisibleHeight: 200, |
| | | // modifiers: 'shift', |
| | | // }, |
| | | connecting: { |
| | | router: { |
| | | name: 'manhattan', |
| | |
| | | }, |
| | | resizing: true, |
| | | rotating: true, |
| | | selecting: { |
| | | enabled: true, |
| | | rubberband: true, |
| | | rubberEdge: true, |
| | | showNodeSelectionBox: true, |
| | | }, |
| | | // selecting: { |
| | | // enabled: true, |
| | | // rubberband: true, |
| | | // rubberEdge: true, |
| | | // showNodeSelectionBox: true, |
| | | // }, |
| | | snapline: true, |
| | | keyboard: true, |
| | | clipboard: true, |
| | |
| | | leftTopY = centerY |
| | | let dragNodeType = dragNode.getData().nodeType |
| | | if (dragNodeType === 'node') { |
| | | width = 60 |
| | | height = 60 |
| | | width = 100 |
| | | height = 70 |
| | | } else if (dragNodeType === 'dashedBox') { |
| | | width = 60 |
| | | height = 40 |
| | |
| | | height = 175 |
| | | } else { |
| | | width = 270 |
| | | height = 60 |
| | | height = 70 |
| | | } |
| | | leftTopX = centerX - width / 2 |
| | | leftTopY = centerY - height / 2 |