| | |
| | | * @description 重置菜单配置,页面整体复制 |
| | | * @return {String} components 配置信息 |
| | | */ |
| | | static resetConfig = (components, uuids = {}) => { |
| | | static resetConfig = (components, uuids = {}, clear = false) => { |
| | | return components.map(item => { |
| | | if (item.type === 'navbar') { |
| | | return item |
| | |
| | | cell.parentId = item.uuid |
| | | return cell |
| | | }) |
| | | tab.components = this.resetConfig(tab.components, uuids) |
| | | tab.components = this.resetConfig(tab.components, uuids, clear) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = item.components.map(cell => { |
| | | cell.parentId = item.uuid |
| | | return cell |
| | | }) |
| | | item.components = this.resetConfig(item.components, uuids) |
| | | item.components = this.resetConfig(item.components, uuids, clear) |
| | | } else if (item.type === 'menubar') { |
| | | item.subMenus = item.subMenus.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | if (clear && cell.setting.type === 'linkmenu') { |
| | | cell.setting.type = 'menu' |
| | | cell.setting.linkMenuId = '' |
| | | } |
| | | return cell |
| | | }) |
| | | } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.subcards.forEach(card => { |
| | | card.uuid = this.getuuid() |
| | | |
| | | if (clear) { |
| | | if (card.setting.click === 'menu') { |
| | | card.setting.click = '' |
| | | card.setting.menu = '' |
| | | } else if (card.setting.click === 'menus') { |
| | | card.setting.click = '' |
| | | card.setting.menuType = '' |
| | | delete card.menus |
| | | } |
| | | } |
| | | |
| | | if (card.elements) { |
| | | card.elements = card.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | |
| | | if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | if (card.backElements) { |
| | | card.backElements = card.backElements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | |
| | | if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | if (item.elements) { |
| | | item.elements = item.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | |
| | | if (clear && cell.eleType === 'button' && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | |
| | | return cell |
| | | }) |
| | | } else if (c.type === 'action' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | |
| | | if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | oriUids[cell.uuid] = _uuid |
| | | cell.uuid = _uuid |
| | | |
| | | if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | return cell |
| | | }) |
| | | } |
| | | if (clear && item.wrap.menus) { |
| | | item.wrap.menus = [] |
| | | } |
| | | } else if (item.search) { |
| | | item.search = item.search.map(cell => { |
| | | cell.uuid = this.getuuid() |