| | |
| | | return {tbs, ptbs} |
| | | } |
| | | |
| | | getFuncAndInterface = (config) => { |
| | | let ptbs = [] |
| | | |
| | | let filterBtn = (cell, tbs) => { |
| | | if (cell.intertype === 'inner') { |
| | | tbs.push({ |
| | | label: cell.innerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } else if (cell.intertype === 'outer' || cell.intertype === 'custom') { |
| | | if (cell.innerFunc) { |
| | | tbs.push({ |
| | | label: cell.innerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.outerFunc) { |
| | | tbs.push({ |
| | | label: cell.outerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.interface && cell.sysInterface !== 'true') { |
| | | tbs.push({ |
| | | label: cell.interface + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.proInterface) { |
| | | tbs.push({ |
| | | label: cell.proInterface + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.exInterface) { |
| | | let url = '' |
| | | |
| | | try { |
| | | url = JSON.parse(cell.exInterface).url |
| | | } catch(e) { |
| | | url = '' |
| | | } |
| | | |
| | | if (url) { |
| | | tbs.push({ |
| | | label: url + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | if (cell.exProInterface) { |
| | | let url = '' |
| | | |
| | | try { |
| | | url = JSON.parse(cell.exProInterface).url |
| | | } catch(e) { |
| | | url = '' |
| | | } |
| | | |
| | | if (url) { |
| | | tbs.push({ |
| | | label: url + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | if (cell.callbackFunc) { |
| | | tbs.push({ |
| | | label: cell.callbackFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let filterSetting = (item, tbs) => { |
| | | if (!item.setting) return |
| | | if (item.setting.interType === 'inner') { |
| | | tbs.push({ |
| | | label: item.setting.innerFunc + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } else if (item.setting.interType === 'outer') { |
| | | if (item.setting.outerFunc) { |
| | | tbs.push({ |
| | | label: item.setting.outerFunc + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (item.setting.interface && item.setting.sysInterface !== 'true') { |
| | | tbs.push({ |
| | | label: item.setting.interface + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (item.setting.proInterface) { |
| | | tbs.push({ |
| | | label: item.setting.proInterface + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (item.setting.exInterface) { |
| | | let url = '' |
| | | |
| | | try { |
| | | url = JSON.parse(item.setting.exInterface).url |
| | | } catch(e) { |
| | | url = '' |
| | | } |
| | | |
| | | if (url) { |
| | | tbs.push({ |
| | | label: url + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | if (item.setting.exProInterface) { |
| | | let url = '' |
| | | |
| | | try { |
| | | url = JSON.parse(item.setting.exProInterface).url |
| | | } catch(e) { |
| | | url = '' |
| | | } |
| | | |
| | | if (url) { |
| | | tbs.push({ |
| | | label: url + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | let traversal = (components, extra) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components, extra) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components, extra) |
| | | } else { |
| | | let tbs = [] |
| | | |
| | | filterSetting(item, tbs) |
| | | |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | filterBtn(group.subButton, tbs) |
| | | }) |
| | | } |
| | | |
| | | if (tbs.length) { |
| | | ptbs.push({ |
| | | label: item.name + extra, |
| | | id: Utils.getuuid(), |
| | | direction: 'left', |
| | | color: 'orange', |
| | | children: tbs |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces) { |
| | | config.interfaces.forEach(item => { |
| | | let tbs = [] |
| | | filterSetting(item, tbs) |
| | | if (tbs.length) { |
| | | ptbs.push({ |
| | | label: item.name, |
| | | id: Utils.getuuid(), |
| | | direction: 'left', |
| | | color: 'orange', |
| | | children: tbs |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components, '') |
| | | |
| | | return ptbs |
| | | } |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | |
| | |
| | | |
| | | data.children.push(cell) |
| | | }) |
| | | } |
| | | |
| | | let funcs = this.getFuncAndInterface(config) |
| | | |
| | | if (funcs.length) { |
| | | data.children.push(...funcs) |
| | | } |
| | | |
| | | if (result.tb_list) { |
| | |
| | | </div> |
| | | <div className="footer"> |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>关闭</Button> |
| | | <span className="tip">注:点击表名可展开/收起菜单</span> |
| | | <span className="tip">注:点击表名(右侧)可展开/收起菜单,左侧橙色标注为接口或函数名。</span> |
| | | </div> |
| | | </Modal> |
| | | </div> |