king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
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