| | |
| | | { |
| | | "appId": "202111141127408033E3114885F864B619CF5", |
| | | "appkey": "20211114112719750F93B1E64FD79486C8E92", |
| | | "appId": "202108312122504607B107A83F55B40C98CCF", |
| | | "appkey": "20210831212235413F287EC3BF489424496C8", |
| | | "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", |
| | | "systemType": "", |
| | | "externalDatabase": "", |
| | | "lineColor": "", |
| | | "filter": "false", |
| | | "defaultApp": "", |
| | | "defaultApp": "mkindustry", |
| | | "defaultLang": "zh-CN", |
| | | "WXAppID": "", |
| | | "WXminiAppID": "", |
| | |
| | | "keepPassword": "true", |
| | | "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], |
| | | "host": "http://demo.mk9h.cn", |
| | | "service": "cr_mes/" |
| | | "service": "erp_new/" |
| | | } |
| | |
| | | controlFields: [ |
| | | {field: 'dirField', values: ['mindmap']}, |
| | | {field: 'nodeColor', values: ['mindmap']}, |
| | | {field: 'collapsed', values: ['indentTree', 'kapmap']}, |
| | | // {field: 'collapsed', values: ['indentTree', 'kapmap']}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | G6.registerNode( |
| | | 'dice-mind-map-sub', { |
| | | jsx: (cfg) => { |
| | | const width = Util.getTextSize(cfg.label, 14)[0] + 24 |
| | | |
| | | return ` |
| | | <group> |
| | | <rect style={{width: ${width}, height: 22, cursor: pointer}}> |
| | | <text style={{ fontSize: 14, fill: ${cfg.selected ? systemColor : '#000000'}, marginLeft: 12, marginTop: 6, cursor: pointer }}>${cfg.label}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${cfg.color}, width: ${width}, height: 2, x: 0, y: 22, cursor: pointer }} /> |
| | | </group> |
| | | ` |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | | [0, 0.965], |
| | | [1, 0.965] |
| | | ] |
| | | } |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | G6.registerNode( |
| | | 'dice-mind-map-leaf', { |
| | | jsx: (cfg) => { |
| | |
| | | ev.preventDefault() |
| | | } |
| | | }) |
| | | |
| | | const dataMapTransform = (data) => { |
| | | const changeData = (d, level = 0, color) => { |
| | | const data = { ...d } |
| | | |
| | | switch (level) { |
| | | case 0: |
| | | data.type = 'dice-mind-map-root' |
| | | break |
| | | case 1: |
| | | data.type = 'dice-mind-map-sub' |
| | | break |
| | | default: |
| | | data.type = 'dice-mind-map-leaf' |
| | | break |
| | | } |
| | | |
| | | if (color) { |
| | | data.color = color |
| | | } |
| | | |
| | | if (level === 1 && !d.direction) { |
| | | data.direction = 'right' |
| | | } |
| | | |
| | | if (d.children) { |
| | | data.children = d.children.map((child) => changeData(child, level + 1, data.color)) |
| | | } |
| | | return data |
| | | } |
| | | return changeData(data) |
| | | } |
| | | |
| | | // 缩进文件树 |
| | | G6.registerNode('indentedRoot', { |
| | |
| | | if (item.direction === 'left') { |
| | | item.color = card.plot.leftColor || '#26C281' |
| | | } else { |
| | | item.direction = 'right' |
| | | item.color = card.plot.nodeColor || '#1890ff' |
| | | } |
| | | }) |
| | | |
| | | data.collapsed = false |
| | | data.type = 'dice-mind-map-root' |
| | | |
| | | const collapse = (item) => { |
| | | if (!item.children) return |
| | | |
| | | item.children.forEach(cell => { |
| | | cell.collapsed = card.plot.collapsed === 'true' |
| | | cell.direction = cell.direction || 'right' |
| | | cell.type = 'dice-mind-map-leaf' |
| | | cell.color = cell.color || item.color |
| | | collapse(cell) |
| | | }) |
| | | } |
| | | |
| | | collapse(data) |
| | | } else if (card.plot.subtype === 'indentTree') { |
| | | data.isRoot = true |
| | | data.collapsed = false |
| | |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | | const height = getHeight(plot.height) |
| | | |
| | | const graph = new G6.TreeGraph({ |
| | | container: card.uuid + 'canvas', |
| | | width: this.wrap.scrollWidth - 30, |
| | | height: getHeight(plot.height), |
| | | height: height, |
| | | modes: { |
| | | default: [ |
| | | { |
| | |
| | | graph.data(data) |
| | | graph.render() |
| | | graph.fitView() |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | graph.zoomTo(1, { x: 0, y: height / 2 }) |
| | | } |
| | | } |
| | | |
| | | indentrender = () => { |
| | |
| | | const { card } = this.state |
| | | const plot = card.plot |
| | | const data = this.getdata() |
| | | const width = this.wrap.scrollWidth - 30 |
| | | const height = getHeight(plot.height) |
| | | let modes = ['drag-canvas', 'zoom-canvas', 'dice-mindmap'] |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | modes = [{ type: 'collapse-expand' },'drag-canvas', 'zoom-canvas', 'dice-mindmap'] |
| | | } |
| | | |
| | | const tree = new G6.TreeGraph({ |
| | | container: card.uuid + 'canvas', |
| | | width: this.wrap.scrollWidth - 30, |
| | | height: getHeight(plot.height), |
| | | width: width, |
| | | height: height, |
| | | fitView: true, |
| | | layout: { |
| | | type: 'mindmap', |
| | |
| | | }, |
| | | minZoom: 0.5, |
| | | modes: { |
| | | default: ['drag-canvas', 'zoom-canvas', 'dice-mindmap'] |
| | | default: modes |
| | | } |
| | | }) |
| | | |
| | | tree.data(dataMapTransform(data)) |
| | | tree.data(data) |
| | | |
| | | tree.render() |
| | | |
| | | if (plot.collapsed === 'true' && plot.dirField) { |
| | | tree.zoomTo(1, { x: width / 2, y: height / 2 }) |
| | | } else if (plot.collapsed === 'true') { |
| | | tree.zoomTo(1, { x: 0, y: height / 2 }) |
| | | } |
| | | } |
| | | |
| | | updateComponent = (card) => { |
| | |
| | | |
| | | 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) |
| | |
| | | return ` |
| | | <group> |
| | | <rect draggable="true" style={{width: ${width}, height: 26, cursor: ${cfg.direction !== 'left' ? 'pointer' : 'default'}, fill: 'transparent' }}> |
| | | <text style={{ fontSize: 12, fill: ${cfg.fontcolor ? cfg.fontcolor : 'black'}, cursor: ${cfg.direction !== 'left' ? 'pointer' : 'default'}, marginLeft: 12, marginTop: 6 }}>${cfg.label}</text> |
| | | <text style={{ fontSize: 12, fill: ${cfg.fontcolor ? cfg.fontcolor : 'black'}, cursor: ${cfg.direction !== 'left' ? 'pointer' : 'default'}, marginLeft: 12, marginTop: 6 }}>${cfg.label} ${cfg.collable ? '+' : ''}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${color}, width: ${width}, cursor: ${cfg.direction !== 'left' ? 'pointer' : 'default'}, height: 2, x: 0, y: 32 }} /> |
| | | </group> |
| | |
| | | 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; |
| | |
| | | }, |
| | | minZoom: 0.3, |
| | | modes: { |
| | | default: ['drag-canvas', 'zoom-canvas', 'dice-mindmap'], |
| | | default: [ |
| | | { |
| | | type: 'collapse-expand', |
| | | trigger: 'click', |
| | | shouldBegin: (e, self) => { |
| | | if (e.item && e.item.getModel().collable) return true; |
| | | return false; |
| | | }, |
| | | }, |
| | | 'drag-canvas', |
| | | 'zoom-canvas', |
| | | 'dice-mindmap' |
| | | ], |
| | | }, |
| | | }); |
| | | |
| | |
| | | </div> |
| | | <div className="footer"> |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>关闭</Button> |
| | | <span className="tip">注:点击表名可展开/收起菜单</span> |
| | | </div> |
| | | </Modal> |
| | | </div> |
| | |
| | | } |
| | | |
| | | .footer { |
| | | position: relative; |
| | | text-align: center; |
| | | |
| | | .tip { |
| | | position: absolute; |
| | | font-size: 12px; |
| | | color: #1890ff; |
| | | right: 10px; |
| | | top: 20px; |
| | | } |
| | | } |
| | | .tb-search { |
| | | position: absolute; |
| | |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | G6.registerNode( |
| | | 'dice-mind-map-sub', { |
| | | jsx: (cfg) => { |
| | | const width = Util.getTextSize(cfg.label, 14)[0] + 24 |
| | | |
| | | return ` |
| | | <group> |
| | | <rect style={{width: ${width}, height: 22, cursor: pointer}}> |
| | | <text style={{ fontSize: 14, fill: ${cfg.selected ? systemColor : '#000000'}, marginLeft: 12, marginTop: 6, cursor: pointer }}>${cfg.label}</text> |
| | | </rect> |
| | | <rect style={{ fill: ${cfg.color}, width: ${width}, height: 2, x: 0, y: 22, cursor: pointer }} /> |
| | | </group> |
| | | ` |
| | | }, |
| | | getAnchorPoints() { |
| | | return [ |
| | | [0, 0.965], |
| | | [1, 0.965] |
| | | ] |
| | | } |
| | | }, |
| | | 'single-node', |
| | | ) |
| | | G6.registerNode( |
| | | 'dice-mind-map-leaf', { |
| | | jsx: (cfg) => { |
| | |
| | | ev.preventDefault() |
| | | } |
| | | }) |
| | | |
| | | const dataMapTransform = (data) => { |
| | | const changeData = (d, level = 0, color) => { |
| | | const data = { ...d } |
| | | |
| | | switch (level) { |
| | | case 0: |
| | | data.type = 'dice-mind-map-root' |
| | | break |
| | | case 1: |
| | | data.type = 'dice-mind-map-sub' |
| | | break |
| | | default: |
| | | data.type = 'dice-mind-map-leaf' |
| | | break |
| | | } |
| | | |
| | | if (color) { |
| | | data.color = color |
| | | } |
| | | |
| | | if (level === 1 && !d.direction) { |
| | | data.direction = 'right' |
| | | } |
| | | |
| | | if (d.children) { |
| | | data.children = d.children.map((child) => changeData(child, level + 1, data.color)) |
| | | } |
| | | return data |
| | | } |
| | | return changeData(data) |
| | | } |
| | | |
| | | // 缩进文件树 |
| | | G6.registerNode('indentedRoot', { |
| | |
| | | root.children = root.children || [] |
| | | |
| | | if (plot.subtype === 'mindmap') { |
| | | root.type = 'dice-mind-map-root' |
| | | |
| | | if (plot.dirField) { |
| | | root.children = root.children.map(item => { |
| | | item.direction = item[plot.dirField] === plot.dirSign ? 'left' : 'right' |
| | |
| | | if (item.direction === 'left') { |
| | | item.color = plot.leftColor || '#26C281' |
| | | } else { |
| | | item.direction = 'right' |
| | | item.color = plot.nodeColor || '#1890ff' |
| | | } |
| | | }) |
| | | |
| | | const collapse = (item) => { |
| | | if (!item.children) return |
| | | |
| | | item.children.forEach(cell => { |
| | | cell.collapsed = plot.collapsed === 'true' |
| | | cell.direction = cell.direction || 'right' |
| | | cell.type = 'dice-mind-map-leaf' |
| | | cell.color = cell.color || item.color |
| | | collapse(cell) |
| | | }) |
| | | } |
| | | |
| | | collapse(root) |
| | | } else if (plot.subtype === 'indentTree') { |
| | | root.isRoot = true |
| | | root.collapsed = false |
| | |
| | | graph.data(data) |
| | | graph.render() |
| | | graph.fitView() |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | graph.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | } |
| | | |
| | | indentrender = () => { |
| | |
| | | ponitrender = () => { |
| | | const { config, plot, chartId } = this.state |
| | | const data = this.getdata() |
| | | const width = this.wrap.scrollWidth - 30 |
| | | let modes = ['drag-canvas', 'zoom-canvas', config.uuid] |
| | | |
| | | if (plot.collapsed === 'true') { |
| | | modes = [{ type: 'collapse-expand' }, 'drag-canvas', 'zoom-canvas', config.uuid] |
| | | } |
| | | |
| | | const tree = new G6.TreeGraph({ |
| | | container: chartId, |
| | | width: this.wrap.scrollWidth - 30, |
| | | width: width, |
| | | height: plot.height, |
| | | fitView: true, |
| | | layout: { |
| | |
| | | }, |
| | | minZoom: 0.5, |
| | | modes: { |
| | | default: ['drag-canvas', 'zoom-canvas', config.uuid] |
| | | default: modes |
| | | } |
| | | }) |
| | | |
| | | tree.data(dataMapTransform(data)) |
| | | tree.data(data) |
| | | |
| | | tree.render() |
| | | |
| | | if (plot.collapsed === 'true' && plot.dirField) { |
| | | tree.zoomTo(1, { x: width / 2, y: plot.height / 2 }) |
| | | } else if (plot.collapsed === 'true') { |
| | | tree.zoomTo(1, { x: 0, y: plot.height / 2 }) |
| | | } |
| | | } |
| | | |
| | | handleClick = (data = null) => { |
| | |
| | | |
| | | 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) |
| | |
| | | |
| | | 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 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}, height: 2, x: 0, y: 32 }} /> |
| | | <rect style={{ fill: ${color}, width: ${width}, cursor: ${cfg.collable ? 'pointer' : 'default'}, height: 2, x: 0, y: 32 }} /> |
| | | </group> |
| | | `; |
| | | }, |
| | |
| | | }, |
| | | '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); |
| | |
| | | }, |
| | | 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> |
| | |
| | | } |
| | | |
| | | .footer { |
| | | position: relative; |
| | | text-align: center; |
| | | |
| | | .tip { |
| | | position: absolute; |
| | | font-size: 12px; |
| | | color: var(--mk-sys-color); |
| | | right: 10px; |
| | | top: 20px; |
| | | } |
| | | } |
| | | .tb-search { |
| | | position: absolute; |
| | |
| | | export function getTables (config, pops) { |
| | | let tables = [] |
| | | let cuts = [] |
| | | let cutreg = /(from|update|insert\s+into)\s+(@db@)?[a-z_]+/ig |
| | | let cutreg = /(from|update|insert\s+into)\s+(@db@)?[a-z0-9_]+/ig |
| | | let trimreg = /(from|update|insert\s+into)\s+(@db@)?/ig |
| | | |
| | | if (config.setting && (!config.wrap || !config.wrap.datatype || config.wrap.datatype === 'dynamic')) { |
| | |
| | | |
| | | cuts = cuts.map(item => item.replace(trimreg, '')) |
| | | tables.push(...cuts) |
| | | tables = tables.filter(Boolean) |
| | | tables = tables.filter(tb => tb && tb !== 'dbo' && tb.length > 1) |
| | | tables = Array.from(new Set(tables)) |
| | | |
| | | return tables |