| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Button, notification, Spin, Input, Typography } from 'antd' |
| | | import { Modal, Button, notification, Spin, Input, Typography, message } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import G6 from "@antv/g6" |
| | |
| | | id: 'par' + i, |
| | | direction: 'left', |
| | | color: '#5AD8A6', |
| | | node: 'table', |
| | | children: [] |
| | | } |
| | | |
| | |
| | | ev.preventDefault(); |
| | | }, |
| | | }); |
| | | |
| | | G6.registerBehavior('dice-mindmap', { |
| | | getEvents() { |
| | | return { |
| | | 'node:dblclick': 'editNode', |
| | | }; |
| | | }, |
| | | editNode(evt) { |
| | | const item = evt.item; |
| | | const model = item.get('model'); |
| | | |
| | | // 选中节点 |
| | | this.graph.getNodes().forEach(node => { |
| | | let _model = node.get('model') |
| | | if (_model.fontcolor === '#1890ff') { |
| | | _model.fontcolor = '' |
| | | this.graph.updateItem(node, _model, false) |
| | | } |
| | | }) |
| | | |
| | | if (model.direction === 'left') { |
| | | if (model.node === 'table') { |
| | | model.fontcolor = '#1890ff' |
| | | this.graph.updateItem(item, model, false) |
| | | |
| | | let oInput = document.createElement('input') |
| | | oInput.value = model.label |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | |
| | | message.success('表名复制成功。') |
| | | } |
| | | return |
| | | } |
| | | } |
| | | }); |
| | | |
| | | const dataTransform = (data) => { |
| | | const changeData = (d, level = 0, color) => { |
| | |
| | | }, |
| | | }, |
| | | 'drag-canvas', |
| | | 'zoom-canvas' |
| | | 'zoom-canvas', |
| | | 'dice-mindmap' |
| | | ], |
| | | }, |
| | | }); |