| | |
| | | sqlList = [] |
| | | verSqls = [] |
| | | linkMain = null |
| | | modules = null |
| | | supError = null |
| | | |
| | | trigger = () => { |
| | | let config = fromJS(this.props.config).toJS() |
| | |
| | | if (error) { |
| | | Modal.warning({ |
| | | title: error, |
| | | okText: '知道了' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.modules = {} |
| | | this.supError = null |
| | | |
| | | this.getModules(config.components, config.interfaces) |
| | | |
| | | config.interfaces && config.interfaces.forEach(item => { |
| | | if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') { |
| | | let id = item.setting.supModule[item.setting.supModule.length - 1] |
| | | if (!this.modules[id]) { |
| | | this.supError = item.name + '(公共数据源)' |
| | | } |
| | | } |
| | | }) |
| | | |
| | | this.checklink(config.components) |
| | | |
| | | if (this.supError) { |
| | | Modal.warning({ |
| | | title: this.supError + ':上级组件不存在!', |
| | | okText: '知道了' |
| | | }) |
| | | return |
| | |
| | | this.sqlList = [] |
| | | } |
| | | |
| | | getModules = (components, interfaces, sups = []) => { |
| | | components.forEach(item => { |
| | | this.modules[item.uuid] = [...sups, item.uuid] |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(f_tab => { |
| | | this.getModules(f_tab.components, null, [...sups, item.uuid, f_tab.uuid]) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components.forEach(cell => { |
| | | this.modules[cell.uuid] = [...sups, item.uuid, cell.uuid] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (interfaces && interfaces.length > 0) { |
| | | interfaces.forEach(item => { |
| | | this.modules[item.uuid] = [item.uuid] |
| | | }) |
| | | } |
| | | } |
| | | |
| | | checklink = (components, suplabel = '') => { |
| | | if (this.supError) return |
| | | components.forEach(item => { |
| | | if (this.supError) return |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(f_tab => { |
| | | this.checklink(f_tab.components, suplabel) |
| | | }) |
| | | } else if (item.type === 'group' ) { |
| | | item.components && this.checklink(item.components, suplabel) |
| | | } else { |
| | | if (item.wrap && item.wrap.supType === 'multi') { |
| | | if (item.setting && item.setting.supModule) { |
| | | item.setting.supModule = '' |
| | | } |
| | | if (item.supNodes) { |
| | | item.supNodes.forEach(cell => { |
| | | let id = cell.nodes[cell.nodes.length - 1] |
| | | if (!this.modules[id]) { |
| | | this.supError = suplabel + item.name |
| | | } |
| | | }) |
| | | } |
| | | } else if ((item.wrap && item.wrap.datatype === 'static') || (['mainsearch', 'voucher'].includes(item.subtype))) { |
| | | if (item.wrap && item.wrap.supModule && item.wrap.supModule[0]) { |
| | | let id = item.wrap.supModule[item.wrap.supModule.length - 1] |
| | | if (!this.modules[id]) { |
| | | this.supError = suplabel + item.name |
| | | } |
| | | } |
| | | } else if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') { |
| | | let id = item.setting.supModule[item.setting.supModule.length - 1] |
| | | if (!this.modules[id]) { |
| | | this.supError = suplabel + item.name |
| | | } |
| | | } |
| | | |
| | | if (this.supError) return |
| | | |
| | | if (['card', 'carousel', 'timeline'].includes(item.type)) { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button' && cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components && cell.config.enabled) { |
| | | this.checklink(cell.config.components, item.name + '-' + cell.label + '(弹窗标签)-') |
| | | } |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType === 'button' && cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components && cell.config.enabled) { |
| | | this.checklink(cell.config.components, item.name + '-' + cell.label + '(弹窗标签)-') |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType === 'button' && cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components && cell.config.enabled) { |
| | | this.checklink(cell.config.components, item.name + '-' + cell.label + '(弹窗标签)-') |
| | | } |
| | | } |
| | | }) |
| | | } else if (item.type === 'table' && item.cols) { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType === 'button' && cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components && cell.config.enabled) { |
| | | this.checklink(cell.config.components, item.name + '-' + cell.label + '(弹窗标签)-') |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | loopCol(item.cols) |
| | | } |
| | | |
| | | item.action && item.action.forEach(cell => { |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components && cell.config.enabled) { |
| | | this.checklink(cell.config.components, item.name + '-' + cell.label + '(弹窗标签)-') |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, mainSearch, regs, process, ispop = false) => { |
| | | let appType = sessionStorage.getItem('appType') |
| | | |