| | |
| | | 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) |
| | | } |
| | | |
| | | if (ptbs.length) { |
| | | ptbs.forEach((item, i) => { |
| | |
| | | |
| | | if (result.tb_list) { |
| | | result.tb_list.sort((a, b) => a.tbname > b.tbname ? 1 : -1) |
| | | let length = result.tb_list.length |
| | | result.tb_list.forEach((item, i) => { |
| | | let cell = { |
| | | label: item.tbname, |
| | |
| | | id: 'table' + i, |
| | | direction: 'right', |
| | | color: '#1890ff', |
| | | collapsed: false, |
| | | collable: true, |
| | | children: [] |
| | | } |
| | | |
| | |
| | | id: item.tbname + 'menu' + i, |
| | | direction: 'right', |
| | | color: '#1890ff', |
| | | type: 'dice-mind-map-leaf', |
| | | param: _param |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (cell.children.length > 5 && length > 1) { |
| | | cell.collapsed = true |
| | | } else if (cell.children.length === 0) { |
| | | cell.collable = false |
| | | } |
| | | |
| | | data.children.push(cell) |
| | |
| | | const stroke = cfg.style.stroke || '#096dd9'; |
| | | |
| | | return ` |
| | | <group> |
| | | <rect draggable="true" style={{width: ${width}, height: 30, stroke: ${stroke}, radius: 4}} keyshape> |
| | | <text style={{ fontSize: 14, marginLeft: 6, marginTop: 6 }}>${cfg.label}</text> |
| | | </rect> |
| | | </group> |
| | | `; |
| | | <group> |
| | | <rect draggable="true" style={{width: ${width}, height: 30, stroke: ${stroke}, radius: 4}} keyshape> |
| | | <text style={{ fontSize: 14, marginLeft: 6, marginTop: 6 }}>${cfg.label}</text> |
| | | </rect> |
| | | </group> |
| | | `; |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | |
| | | const color = cfg.color; |
| | | |
| | | return ` |
| | | <group> |
| | | <rect draggable="true" style={{width: ${width}, height: 26, fill: 'transparent' }}> |
| | | <text style={{ fontSize: 12, fill: ${cfg.fontcolor ? cfg.fontcolor : 'black'}, marginLeft: 12, marginTop: 6 }}>${cfg.label}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${color}, width: ${width}, height: 2, x: 0, y: 32 }} /> |
| | | </group> |
| | | `; |
| | | <group> |
| | | <rect draggable="true" style={{width: ${width}, cursor: ${cfg.collable ? 'pointer' : 'default'}, height: 26, fill: 'transparent' }}> |
| | | <text style={{ fontSize: 12, fill: ${cfg.fontcolor ? cfg.fontcolor : 'black'}, cursor: ${cfg.collable ? 'pointer' : 'default'}, marginLeft: 12, marginTop: 6 }}>${cfg.label} ${cfg.collable ? '+' : ''}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${color}, width: ${width}, cursor: ${cfg.collable ? 'pointer' : 'default'}, height: 2, x: 0, y: 32 }} /> |
| | | </group> |
| | | `; |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | |
| | | }, |
| | | 'single-node', |
| | | ); |
| | | |
| | | G6.registerBehavior('scroll-canvas', { |
| | | getEvents: function getEvents() { |
| | | return { |
| | |
| | | data.color = color; |
| | | } |
| | | |
| | | if (d.children) { |
| | | if (d.children && !d.collapsed) { |
| | | data.children = d.children.map((child) => changeData(child, level + 1, data.color)); |
| | | } |
| | | |
| | | return data; |
| | | }; |
| | | return changeData(data); |
| | |
| | | lineWidth: 2, |
| | | }, |
| | | }, |
| | | minZoom: 0.5, |
| | | minZoom: 0.3, |
| | | modes: { |
| | | default: ['drag-canvas', 'zoom-canvas'], |
| | | default: [ |
| | | { |
| | | type: 'collapse-expand', |
| | | trigger: 'click', |
| | | shouldBegin: (e, self) => { |
| | | if (e.item && e.item.getModel().collable) return true; |
| | | return false; |
| | | }, |
| | | }, |
| | | 'drag-canvas', |
| | | 'zoom-canvas' |
| | | ], |
| | | }, |
| | | }); |
| | | |
| | |
| | | </div> |
| | | <div className="footer"> |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>关闭</Button> |
| | | <span className="tip">注:点击表名可展开/收起菜单</span> |
| | | </div> |
| | | </Modal> |
| | | </div> |