| | |
| | | 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, Tooltip } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import G6 from "@antv/g6" |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import './index.scss' |
| | | |
| | | const { Search } = Input |
| | |
| | | let { tbs, ptbs } = this.getTbs(config) |
| | | |
| | | ptbs = Array.from(new Set(ptbs)) |
| | | ptbs = ptbs.filter(tb => tb.length > 1 && tb !== 'dbo') |
| | | ptbs.sort() |
| | | if (ptbs.length && sessionStorage.getItem('mk_tb_names')) { |
| | | let names = sessionStorage.getItem('mk_tb_names') |
| | | ptbs = ptbs.filter(tb => names.indexOf(',' + tb.toLowerCase() + ',') > -1) |
| | | } else { |
| | | ptbs = ptbs.filter(tb => tb.length > 1) |
| | | } |
| | | |
| | | if (ptbs.length) { |
| | | ptbs.forEach((item, i) => { |
| | |
| | | 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' |
| | | ], |
| | | }, |
| | | }); |
| | |
| | | const { config } = this.props |
| | | const { visible, loading, empty, debug } = this.state |
| | | |
| | | if (window.GLOB.mkHS || window.GLOB.systemType === 'production' || !debug || window.GLOB.sysType === 'cloud') return null |
| | | |
| | | return ( |
| | | <div className={'page-message-wrap ' + (debug && options.sysType !== 'cloud' ? 'exist' : '')}> |
| | | {debug && options.sysType !== 'cloud' ? <Button |
| | | icon="fork" |
| | | shape="circle" |
| | | className="page-message" |
| | | onClick={this.trigger} |
| | | /> : null} |
| | | <div className="tool-wrap"> |
| | | <Tooltip placement="left" title="表关系图"> |
| | | <Button icon="fork" shape="circle" onClick={this.trigger}/> |
| | | </Tooltip> |
| | | <Modal |
| | | title="" |
| | | wrapClassName="view-table-modal" |