From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/pc/createview/index.jsx | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/pc/createview/index.jsx b/src/pc/createview/index.jsx index 44c6198..580b8cc 100644 --- a/src/pc/createview/index.jsx +++ b/src/pc/createview/index.jsx @@ -5,7 +5,7 @@ import moment from 'moment' import Utils from '@/utils/utils.js' -import MenuUtils from '@/utils/utils-custom.js' +import MenuUtils, { getTables } from '@/utils/utils-custom.js' import SettingForm from './settingform' import Api from '@/api' import './index.scss' @@ -56,7 +56,7 @@ }) let config = { - version: 1.0, + version: 2.0, uuid: menuId, MenuID: menuId, Template: 'webPage', @@ -170,6 +170,11 @@ config.tables = _config.tables || [] config.style = _config.style || {} config.statusBarbgColor = _config.statusBarbgColor || '' + + if (config.version !== 2.0) { + config.components = this.collectTB(config.components) + config.version = 2.0 + } } param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) @@ -201,6 +206,36 @@ }) } + collectTB = (components) => { + return components.map(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + delete tab.floor + delete tab.hasSearch + delete tab.parentId + + tab.components = this.collectTB(tab.components) + }) + } else if (item.type === 'group') { + item.components = this.collectTB(item.components) + } else if (!['search', 'navbar', 'login', 'topbar', 'officialAccount'].includes(item.type)) { + item.$tables = getTables(item) + } + + if (item.subtype === 'tablecard') { // 鍏煎 + item.type = 'card' + } + + delete item.tabId + delete item.parentId + delete item.btnlog + delete item.floor + delete item.dataName + + return item + }) + } + render () { const { config } = this.props const { visible, loading } = this.state -- Gitblit v1.8.0