| | |
| | | sessionStorage.setItem('role_type', param.role_type || 'true') |
| | | sessionStorage.setItem('login_types', param.login_types || 'false') |
| | | sessionStorage.setItem('typename', param.typename || 'mob') |
| | | sessionStorage.setItem('adapter', param.adapter || 'false') |
| | | |
| | | this.setState({ |
| | | localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS, |
| | |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | this.checkBtn(cell) |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'carousel') { |
| | | } else if (item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | |
| | | } |
| | | } |
| | | |
| | | getMiniStyle = (config) => { |
| | | config.miniStyle = this.transferStyle(config.style) |
| | | |
| | | let traversal = (components) => { |
| | | return components.map(item => { |
| | | if (item.style) { |
| | | item.miniStyle = this.transferStyle(item.style) |
| | | } |
| | | if (item.headerStyle) { |
| | | item.miniHeaderStyle = this.transferStyle(item.headerStyle) |
| | | } |
| | | |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.map(btn => { |
| | | btn.miniStyle = this.transferStyle(btn.style) |
| | | return btn |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components = traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = traversal(item.components) |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.subcards.forEach(card => { |
| | | card.miniStyle = this.transferStyle(card.style) |
| | | card.elements = card.elements.map(cell => { |
| | | cell.miniStyle = this.transferStyle(cell.style) |
| | | return cell |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | cell.miniStyle = this.transferStyle(cell.style) |
| | | }) |
| | | } else if (item.type === 'menubar') { |
| | | item.subMenus = item.subMenus.map(menu => { |
| | | menu.miniStyle = this.transferStyle(menu.style) |
| | | return menu |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | let getCols = (cols) => { |
| | | return cols.map(col => { |
| | | if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | } else if (col.type === 'custom' || col.type === 'action') { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.miniStyle = this.transferStyle(cell.style) |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | config.components = traversal(config.components) |
| | | |
| | | return config |
| | | } |
| | | |
| | | transferStyle = (style = {}) => { |
| | | let _style = '' |
| | | Object.keys(style).forEach(key => { |
| | | if (['hShadow', 'vShadow', 'shadowBlur', 'shadowColor'].includes(key)) return |
| | | if (!style[key]) return |
| | | _style += `${key.replace(/[A-Z]/g, m => '-' + m.toLowerCase())}:${style[key]};` |
| | | }) |
| | | |
| | | return _style |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | |
| | | |
| | | if (config.components.findIndex(item => item.type === 'login') > -1) { |
| | | roleParam.login = true |
| | | config.loginview = true |
| | | } else { |
| | | config.loginview = false |
| | | } |
| | | |
| | | if (sessionStorage.getItem('adapter') === 'true') { |
| | | config = this.getMiniStyle(config) |
| | | } |
| | | |
| | | let param = { |
| | |
| | | |
| | | if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return |
| | | if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return |
| | | if (['menubar'].includes(item.type) && item.wrap.datatype !== 'dynamic') return |
| | | |
| | | if (item.setting) { |
| | | if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) { |
| | |
| | | error = `组件《${item.name}》未设置数据源!` |
| | | } else if (!item.setting.primaryKey) { |
| | | error = `组件《${item.name}》未设置主键!` |
| | | } else if (!item.setting.supModule) { |
| | | } else if (!item.setting.supModule && !['navbar', 'balcony', 'menubar'].includes(item.type)) { |
| | | error = `组件《${item.name}》未设置上级组件!` |
| | | } |
| | | } |