| | |
| | | type: 'radio', |
| | | field: 'click', |
| | | label: '点击事件', |
| | | initval: card.click || '', |
| | | initval: card.click || 'switch', |
| | | tooltip: '点击节点时触发的事件。', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '数据切换'}, |
| | | {value: 'switch', label: '数据切换'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'menus', label: '菜单组'} |
| | | ], |
| | |
| | | width: card.width || 24, |
| | | height: 400, |
| | | subtype: card.subtype, |
| | | click: 'switch', |
| | | name: card.name |
| | | } |
| | | |
| | |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | | {value: 'switch', label: '数据切换'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'menus', label: '菜单组'} |
| | | ], |
| | |
| | | {field: 'menus', values: ['menus']}, |
| | | {field: 'menuType', values: ['menus']}, |
| | | {field: 'open', values: ['menu', 'menus']}, |
| | | {field: 'joint', values: ['menu', 'menus']}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | {value: 'self', label: '当前窗口'}, |
| | | ], |
| | | forbid: appType !== 'pc' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'joint', |
| | | label: '参数拼接', |
| | | initval: card.joint || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'table', |
| | |
| | | <Modal |
| | | wrapClassName="mk-pop-modal" |
| | | visible={visible} |
| | | width={850} |
| | | width={900} |
| | | maskClosable={false} |
| | | onOk={this.onSubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover } from 'antd' |
| | | import { ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import { Graph, Shape } from '@antv/x6' |
| | | import { Graph } from '@antv/x6' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | max: 2 |
| | | }, |
| | | autoResize: true, |
| | | interacting: false, |
| | | background: { |
| | | color: card.plot.backgroundColor || 'transparent' |
| | | }, |
| | |
| | | allowBlank: false, |
| | | snap: { |
| | | radius: 20 |
| | | }, |
| | | createEdge() { |
| | | return new Shape.Edge({ |
| | | attrs: { |
| | | line: { |
| | | stroke: '#000000', |
| | | strokeWidth: 1, |
| | | targetMarker: { |
| | | name: 'block', |
| | | width: 12, |
| | | height: 8 |
| | | } |
| | | } |
| | | }, |
| | | zIndex: 0 |
| | | }) |
| | | }, |
| | | validateConnection({ targetMagnet }) { |
| | | return !!targetMagnet |
| | | } |
| | | }, |
| | | highlighting: { |
| | | magnetAdsorbed: { |
| | | name: 'stroke', |
| | | args: { |
| | | attrs: { |
| | | fill: '#5F95FF', |
| | | stroke: '#5F95FF' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | |
| | | max: 2 |
| | | }, |
| | | autoResize: true, |
| | | interacting: false, |
| | | background: { color: '#ffffff' }, |
| | | mousewheel: { |
| | | enabled: true, |
| | |
| | | allowBlank: false, |
| | | snap: { |
| | | radius: 20 |
| | | }, |
| | | createEdge() { |
| | | return new Shape.Edge({ |
| | | attrs: { |
| | | line: { |
| | | stroke: '#000000', |
| | | strokeWidth: 1, |
| | | targetMarker: { |
| | | name: 'block', |
| | | width: 12, |
| | | height: 8 |
| | | } |
| | | } |
| | | }, |
| | | zIndex: 2 |
| | | }) |
| | | }, |
| | | validateConnection({ targetMagnet }) { |
| | | return !!targetMagnet |
| | | } |
| | | }, |
| | | highlighting: { |
| | | magnetAdsorbed: { |
| | | name: 'stroke', |
| | | args: { |
| | | attrs: { |
| | | fill: '#5F95FF', |
| | | stroke: '#5F95FF' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | translating: { |
| | | restrict(cellView) { |
| | | const cell = cellView.cell |
| | | const parentId = cell.prop('parent') |
| | | |
| | | if (parentId) { |
| | | const parentNode = graph.getCellById(parentId) |
| | | if (parentNode) { |
| | | return parentNode.getBBox().moveAndExpand({ |
| | | x: 0, |
| | | y: 36, |
| | | width: 0, |
| | | height: -36, |
| | | }) |
| | | } |
| | | } |
| | | return cell.getBBox() |
| | | } |
| | | } |
| | | }) |
| | |
| | | handleClick = (data = null) => { |
| | | const { plot, config } = this.state |
| | | |
| | | if (plot.click && !data) return |
| | | |
| | | if (plot.click === 'menus') { |
| | | if (!data) return |
| | | |
| | | let menu = null |
| | | |
| | | if (plot.menus && plot.menus.length > 0) { |
| | |
| | | |
| | | MKEmitter.emit('modifyTabs', newtab, true) |
| | | } else if (plot.click === 'menu') { |
| | | if (!data) return |
| | | |
| | | let menuId = plot.menu.slice(-1)[0] |
| | | let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] |
| | | |
| | |
| | | true |
| | | ) |
| | | |
| | | const styles = { |
| | | blue: '#1890ff', |
| | | red: '#f5222d', |
| | | orange_red: '#fa541c', |
| | | orange: '#fa8c16', |
| | | orange_yellow: '#faad14', |
| | | yellow: '#fadb14', |
| | | yellow_green: '#a0d911', |
| | | green: '#52c41a', |
| | | cyan: '#13c2c2', |
| | | blue_purple: '#2f54eb', |
| | | purple: '#722ed1', |
| | | magenta: '#eb2f96', |
| | | grass_green: '#aeb303', |
| | | deep_red: '#c32539', |
| | | deep_blue: '#1d3661', |
| | | blue1: '#e6f7ff', |
| | | red1: '#fff1f0', |
| | | orange_red1: '#fff2e8', |
| | | orange1: '#fff7e6', |
| | | orange_yellow1: '#fffbe6', |
| | | yellow1: '#feffe6', |
| | | yellow_green1: '#fcffe6', |
| | | green1: '#f6ffed', |
| | | cyan1: '#e6fffb', |
| | | blue_purple1: '#f0f5ff', |
| | | purple1: '#f9f0ff', |
| | | magenta1: '#fff0f6', |
| | | grass_green1: '#f2efda', |
| | | deep_red1: '#fff0f0', |
| | | deep_blue1: '#eff1f4' |
| | | } |
| | | |
| | | let sysColor = '#1890ff' |
| | | let lightColor = '#e6f7ff' |
| | | if (window.GLOB.style) { |
| | | let type = window.GLOB.style.replace(/bg_black_style_|bg_white_style_/, '') |
| | | sysColor = styles[type] || '#1890ff' |
| | | lightColor = styles[type + '1'] || '#e6f7ff' |
| | | } |
| | | |
| | | class antvX6Chart extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object |
| | |
| | | max: 2 |
| | | }, |
| | | autoResize: true, |
| | | interacting: false, |
| | | panning: true, |
| | | background: { |
| | | color: config.plot.backgroundColor || 'transparent' |
| | |
| | | allowBlank: false, |
| | | snap: { |
| | | radius: 20 |
| | | }, |
| | | createEdge() { |
| | | return new Shape.Edge({ |
| | | attrs: { |
| | | line: { |
| | | stroke: '#000000', |
| | | strokeWidth: 1, |
| | | targetMarker: { |
| | | name: 'block', |
| | | width: 12, |
| | | height: 8 |
| | | } |
| | | } |
| | | }, |
| | | zIndex: 0 |
| | | }) |
| | | }, |
| | | validateConnection({ targetMagnet }) { |
| | | return !!targetMagnet |
| | | } |
| | | }, |
| | | highlighting: { |
| | | magnetAdsorbed: { |
| | | name: 'stroke', |
| | | args: { |
| | | attrs: { |
| | | fill: '#5F95FF', |
| | | stroke: '#5F95FF' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | |
| | | graph.resetCells(cells) |
| | | graph.positionContent('center') |
| | | } |
| | | |
| | | if (config.plot.click) { |
| | | graph.on('cell:click', ({ node }) => { |
| | | this.checkNode(graph, node) |
| | | }) |
| | | |
| | | graph.on('blank:click', () => { |
| | | this.checkNode(graph) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | laneSrender = () => { |
| | |
| | | min: 0.5, |
| | | max: 2 |
| | | }, |
| | | interacting: false, |
| | | autoResize: true, |
| | | panning: true, |
| | | background: { color: '#ffffff' }, |
| | |
| | | allowBlank: false, |
| | | snap: { |
| | | radius: 20 |
| | | }, |
| | | createEdge() { |
| | | return new Shape.Edge({ |
| | | attrs: { |
| | | line: { |
| | | stroke: '#000000', |
| | | strokeWidth: 1, |
| | | targetMarker: { |
| | | name: 'block', |
| | | width: 12, |
| | | height: 8 |
| | | } |
| | | } |
| | | }, |
| | | zIndex: 2 |
| | | }) |
| | | }, |
| | | validateConnection({ targetMagnet }) { |
| | | return !!targetMagnet |
| | | } |
| | | }, |
| | | highlighting: { |
| | | magnetAdsorbed: { |
| | | name: 'stroke', |
| | | args: { |
| | | attrs: { |
| | | fill: '#5F95FF', |
| | | stroke: '#5F95FF' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | translating: { |
| | | restrict(cellView) { |
| | | const cell = cellView.cell |
| | | const parentId = cell.prop('parent') |
| | | |
| | | if (parentId) { |
| | | const parentNode = graph.getCellById(parentId) |
| | | if (parentNode) { |
| | | return parentNode.getBBox().moveAndExpand({ |
| | | x: 0, |
| | | y: 36, |
| | | width: 0, |
| | | height: -36, |
| | | }) |
| | | } |
| | | } |
| | | return cell.getBBox() |
| | | } |
| | | } |
| | | }) |
| | |
| | | }) |
| | | graph.resetCells(cells) |
| | | graph.positionContent('top') |
| | | } |
| | | |
| | | if (config.plot.click) { |
| | | graph.on('cell:click', ({ node }) => { |
| | | this.checkNode(graph, node) |
| | | }) |
| | | |
| | | graph.on('blank:click', () => { |
| | | this.checkNode(graph) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | checkNode = (graph, node) => { |
| | | const { plot, config } = this.state |
| | | |
| | | let nodes = graph.getNodes() |
| | | |
| | | nodes.forEach(item => { |
| | | if (item.prop('shape') === 'lane') return |
| | | |
| | | if (item.prop('oristyle')) { |
| | | let style = item.prop('oristyle') |
| | | |
| | | item.prop('attrs/body/fill', style.fill) |
| | | item.prop('attrs/body/stroke', style.stroke) |
| | | item.prop('attrs/text/fill', style.text) |
| | | } |
| | | }) |
| | | |
| | | if (!node || ['lane', 'mk-text', 'edge'].includes(node.prop('shape'))) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | return |
| | | } |
| | | |
| | | if (!node.prop('oristyle')) { |
| | | node.prop('oristyle', { |
| | | fill: node.prop('attrs/body/fill'), |
| | | stroke: node.prop('attrs/body/stroke'), |
| | | text: node.prop('attrs/text/fill') |
| | | }) |
| | | } |
| | | |
| | | node.prop('attrs/body/fill', lightColor) |
| | | node.prop('attrs/body/stroke', sysColor) |
| | | node.prop('attrs/text/fill', sysColor) |
| | | |
| | | let sign = node.prop('mksign') || '' |
| | | |
| | | if (plot.click === 'menus') { |
| | | let menu = null |
| | | |
| | | if (plot.menus && plot.menus.length > 0) { |
| | | plot.menus.forEach(m => { |
| | | if (sign !== m.sign) return |
| | | menu = m |
| | | }) |
| | | } |
| | | if (!menu || !menu.MenuID) return |
| | | |
| | | let newtab = { |
| | | MenuID: menu.MenuID, |
| | | MenuName: menu.MenuName, |
| | | MenuNo: menu.MenuNo || '', |
| | | type: menu.tabType, |
| | | param: {$BID: sign} |
| | | } |
| | | |
| | | MKEmitter.emit('modifyTabs', newtab, true) |
| | | } else if (plot.click === 'menu') { |
| | | let menuId = plot.menu.slice(-1)[0] |
| | | let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] |
| | | |
| | | if (!newtab && plot.MenuID) { |
| | | newtab = { |
| | | MenuID: plot.MenuID, |
| | | MenuName: plot.MenuName, |
| | | MenuNo: plot.MenuNo, |
| | | type: plot.tabType |
| | | } |
| | | } else if (!newtab) { |
| | | return |
| | | } |
| | | |
| | | MKEmitter.emit('modifyTabs', {...newtab, param: {$BID: sign}}, true) |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, sign, {}) |
| | | } |
| | | } |
| | | |
| | | resetlane = (id, x, offset) => { |
| | | let nodes = this.mkGraph.getNodes() |
| | | |
| | |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config} /> |
| | | <div className="canvas" style={{width: '100%', minHeight: config.plot.height, height: config.plot.height}} id={config.uuid + 'canvas'}> |
| | | <div className={'canvas only-show' + (config.plot.click ? ' switchable' : '')} style={{width: '100%', minHeight: config.plot.height, height: config.plot.height}} id={config.uuid + 'canvas'}> |
| | | <div id={config.uuid + 'container'} className="mk-container"></div> |
| | | </div> |
| | | </div> |
| | |
| | | opacity: 0; |
| | | } |
| | | } |
| | | .only-show { |
| | | .x6-port { |
| | | display: none; |
| | | } |
| | | .x6-cell.x6-edge { |
| | | cursor: default; |
| | | path { |
| | | cursor: default; |
| | | } |
| | | } |
| | | } |
| | | .only-show.switchable { |
| | | .x6-cell.x6-node:not([data-shape="lane"]):not([data-shape="mk-text"]) { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .chart-header { |
| | | position: relative; |