| | |
| | | |
| | | searches = search |
| | | } else { |
| | | let search = [] |
| | | |
| | | searches = fromJS(config.search || []).toJS() |
| | | |
| | | if (config.setting && config.setting.useMSearch === 'true' && window.GLOB.customMenu) { |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | let _search = null |
| | | let filterComponent = (box) => { |
| | | let filterComponent = (box, mainSearch) => { |
| | | box.components.forEach(item => { |
| | | if (_search) return |
| | | |
| | | if (item.type === 'search') { |
| | | box.slist = [...box.slist, item.search] |
| | | } else if (item.uuid === config.uuid) { |
| | | _search = box.slist.pop() |
| | | if (item.type !== 'search') return |
| | | mainSearch = item.search |
| | | }) |
| | | let has = false |
| | | box.components.forEach(item => { |
| | | if (item.uuid === config.uuid) { |
| | | has = true |
| | | } 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) |
| | | has = true |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | menu.slist = [] |
| | | filterComponent(menu) |
| | | |
| | | if (_search) { |
| | | search = _search |
| | | } else { |
| | | menu.components.forEach(item => { |
| | | if (item.type !== 'search') return |
| | | search = item.search |
| | | }) |
| | | } |
| | | } |
| | | |
| | | searches = fromJS(config.search || []).toJS() |
| | | |
| | | if (search.length > 0) { |
| | | let keys = searches.map(item => (item.field ? item.field.toLowerCase() : '')) |
| | | search.forEach(item => { |
| | | if (item.field && !keys.includes(item.field.toLowerCase())) { |
| | | searches.push(item) |
| | | |
| | | if (has) { |
| | | if (mainSearch) { |
| | | let keys = searches.map(item => (item.field ? item.field.toLowerCase() : '')) |
| | | mainSearch.forEach(item => { |
| | | if (item.field && !keys.includes(item.field.toLowerCase())) { |
| | | searches.push(item) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | box.components.forEach(item => { |
| | | if (item.type !== 'tabs') return |
| | | |
| | | item.subtabs.forEach(tab => { |
| | | filterComponent(tab, mainSearch) |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | filterComponent(menu, null) |
| | | } |
| | | } |
| | | |