| | |
| | | * @return {String} selfId 当前组件id |
| | | */ |
| | | static getSubModules (components, selfId, supId) { |
| | | let modules = components.map(item => { |
| | | let modules = [] |
| | | components.forEach(item => { |
| | | if (item.uuid === selfId || item.type === 'navbar') { |
| | | return { |
| | | children: null |
| | | } |
| | | return |
| | | } else if (item.format) { // 数据格式,存在数据源 |
| | | return { |
| | | modules.push({ |
| | | value: item.uuid, |
| | | label: item.name, |
| | | disabled: supId === item.uuid |
| | | } |
| | | }) |
| | | } else if (item.type === 'tabs') { |
| | | let _item = { |
| | | type: 'tabs', |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(f_tab => { |
| | | let subItem = { |
| | | type: 'tab', |
| | | value: f_tab.uuid, |
| | | label: f_tab.label, |
| | | children: this.getSubModules(f_tab.components, selfId) |
| | | } |
| | | |
| | | if (!subItem.children || subItem.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | return subItem |
| | | if (item.subtype === 'tabletabs') { |
| | | item.subtabs.forEach(tab => { |
| | | modules.push({ |
| | | value: tab.components[0].uuid, |
| | | label: tab.label, |
| | | disabled: supId === tab.components[0].uuid |
| | | }) |
| | | }) |
| | | } else { |
| | | let _item = { |
| | | type: 'tabs', |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(f_tab => { |
| | | let subItem = { |
| | | type: 'tab', |
| | | value: f_tab.uuid, |
| | | label: f_tab.label, |
| | | children: this.getSubModules(f_tab.components, selfId, supId) |
| | | } |
| | | |
| | | if (subItem.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | return subItem |
| | | }) |
| | | } |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length > 0) { |
| | | modules.push(_item) |
| | | } |
| | | } |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | |
| | | return _item |
| | | } else if (item.type === 'group') { |
| | | let _item = { |
| | | value: item.uuid, |
| | |
| | | } else if (f_tab.format) { |
| | | return { |
| | | value: f_tab.uuid, |
| | | label: f_tab.name |
| | | label: f_tab.name, |
| | | disabled: supId === f_tab.uuid |
| | | } |
| | | } |
| | | return { |
| | |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | |
| | | return _item |
| | | } else { |
| | | return { |
| | | children: null |
| | | if (_item.children.length > 0) { |
| | | modules.push(_item) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | modules = modules.filter(mod => mod.children !== null) |
| | | |
| | | if (modules.length === 0) { |
| | | return null |
| | | } |
| | | return modules |
| | | } |
| | | |
| | |
| | | * @return {String} selfId 当前组件id |
| | | */ |
| | | static getSupModules (components, selfId) { |
| | | let modules = components.map(item => { |
| | | let modules = [] |
| | | components.forEach(item => { |
| | | if (item.uuid === selfId) { |
| | | return { |
| | | children: null |
| | | } |
| | | |
| | | } else if (item.switchable) { // 数据可切换 |
| | | let disabled = false |
| | | if (item.type === 'card') { |
| | |
| | | } else if (item.type === 'table') { |
| | | disabled = item.wrap.tableType === '' |
| | | } |
| | | return { |
| | | modules.push({ |
| | | value: item.uuid, |
| | | label: item.name, |
| | | disabled: disabled |
| | | } |
| | | }) |
| | | } else if (item.type === 'form') { // 数据格式,存在数据源 |
| | | return { |
| | | modules.push({ |
| | | value: item.uuid, |
| | | label: item.name |
| | | } |
| | | }) |
| | | } else if (item.type === 'tabs') { |
| | | let _item = { |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(f_tab => { |
| | | let subItem = { |
| | | value: f_tab.uuid, |
| | | label: f_tab.label, |
| | | children: this.getSupModules(f_tab.components, selfId) |
| | | } |
| | | if (item.subtype === 'tabletabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.components[0].uuid === selfId) return |
| | | |
| | | if (!subItem.children || subItem.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | return subItem |
| | | modules.push({ |
| | | value: tab.components[0].uuid, |
| | | label: tab.label, |
| | | disabled: tab.components[0].wrap.tableType === '' |
| | | }) |
| | | }) |
| | | } else { |
| | | let _item = { |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(f_tab => { |
| | | let subItem = { |
| | | value: f_tab.uuid, |
| | | label: f_tab.label, |
| | | children: this.getSupModules(f_tab.components, selfId) |
| | | } |
| | | |
| | | if (subItem.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | return subItem |
| | | }) |
| | | } |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length > 0) { |
| | | modules.push(_item) |
| | | } |
| | | } |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | |
| | | return _item |
| | | } else if (item.type === 'group') { |
| | | let _item = { |
| | | value: item.uuid, |
| | |
| | | children: null |
| | | } |
| | | } else if (f_tab.switchable) { |
| | | let disabled = false |
| | | if (f_tab.type === 'card') { |
| | | disabled = f_tab.wrap.cardType === '' |
| | | } else if (f_tab.type === 'table') { |
| | | disabled = f_tab.wrap.tableType === '' |
| | | } |
| | | return { |
| | | value: f_tab.uuid, |
| | | label: f_tab.name |
| | | label: f_tab.name, |
| | | disabled: disabled |
| | | } |
| | | } |
| | | return { |
| | |
| | | |
| | | _item.children = _item.children.filter(t => t.children !== null) |
| | | |
| | | if (_item.children.length === 0) { |
| | | return {children: null} |
| | | } |
| | | |
| | | return _item |
| | | } else { |
| | | return { |
| | | children: null |
| | | if (_item.children.length > 0) { |
| | | modules.push(_item) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | modules = modules.filter(mod => mod.children !== null) |
| | | |
| | | if (modules.length === 0) { |
| | | return null |
| | | } |
| | | return modules |
| | | } |
| | | |