From f393af9623c26ae177a3f69b8676afc4e23bff8d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 08 二月 2022 14:48:51 +0800 Subject: [PATCH] 2022-02-08 --- src/menu/datasource/index.jsx | 96 +++++++++++++++++------------------------------- 1 files changed, 34 insertions(+), 62 deletions(-) diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index f7964eb..f405cf1 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -45,45 +45,19 @@ if (appType === 'mob') { let ms = null menu.components.forEach(item => { - if (item.type === 'topbar' && (item.wrap.type === 'search' || (item.wrap.type === 'navbar' && item.wrap.search === 'true'))) { + if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { ms = item.search - } - }) - - if (config.floor > 1) { - let _search = null - let filterComponent = (box) => { - box.components.forEach(item => { - if (_search) return - - if (item.uuid === config.uuid) { - _search = box.slist.pop() - } else if (item.type === 'group') { - item.components.forEach(m => { - if (m.uuid !== config.uuid) return - _search = box.slist.pop() - }) - } else if (item.type === 'tabs') { - let able = item.setting.display === 'inline-block' && item.setting.position === 'top' - item.subtabs.forEach(tab => { - if (able && tab.hasSearch === 'icon' && tab.search) { - tab.slist = [...box.slist, tab.search] - } else { - tab.slist = [...box.slist] - } - - filterComponent(tab) - }) - } + } else if (item.type === 'search' && item.wrap.field) { + search.push({ + type: 'text', + label: item.wrap.label, + field: item.wrap.field, + match: item.wrap.match, + required: item.wrap.required, + value: item.wrap.initval || '' }) } - menu.slist = [] - filterComponent(menu) - - if (_search) { - ms = _search - } - } + }) if (ms) { if (ms.setting.type === 'search') { @@ -124,35 +98,33 @@ }) } } else { - if (config.floor > 1) { - let _search = null - let filterComponent = (box) => { - box.components.forEach(item => { - if (_search) return + let _search = null + let filterComponent = (box) => { + box.components.forEach(item => { + if (_search) return - if (item.type === 'search') { - box.slist = [...box.slist, item.search] - } else if (item.uuid === config.uuid) { + if (item.type === 'search') { + box.slist = [...box.slist, item.search] + } else if (item.uuid === config.uuid) { + _search = box.slist.pop() + } else if (item.type === 'group') { + item.components.forEach(m => { + if (m.uuid !== config.uuid) return _search = box.slist.pop() - } else if (item.type === 'group') { - item.components.forEach(m => { - if (m.uuid !== config.uuid) return - _search = box.slist.pop() - }) - } else if (item.type === 'tabs') { - item.subtabs.forEach(tab => { - tab.slist = [...box.slist] - filterComponent(tab) - }) - } - }) - } - menu.slist = [] - filterComponent(menu) + }) + } else if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + tab.slist = [...box.slist] + filterComponent(tab) + }) + } + }) + } + menu.slist = [] + filterComponent(menu) - if (_search) { - search = _search - } + if (_search) { + search = _search } else { menu.components.forEach(item => { if (item.type !== 'search') return -- Gitblit v1.8.0