Browse Source

*大屏运营为null判断,条件过滤逻辑编辑

release_0.0.4
wanyiwei 2 years ago
parent
commit
63b867f9bc
  1. 88
      web/client/src/sections/quanju/containers/footer/operation/left.js

88
web/client/src/sections/quanju/containers/footer/operation/left.js

@ -5,8 +5,6 @@ import Module from '../../public/module'
import { getBusTierList } from '../../../actions/example' import { getBusTierList } from '../../../actions/example'
import './style.less' import './style.less'
const Left = (props) => { const Left = (props) => {
const [treeData, setTreeData] = useState([]) const [treeData, setTreeData] = useState([])
const [treeDataList, setTreeDataList] = useState([]) const [treeDataList, setTreeDataList] = useState([])
@ -29,12 +27,12 @@ const Left = (props) => {
const onChange = (e) => { const onChange = (e) => {
const { value } = e.target; const { value } = e.target;
let keys = [] let titles = []
const newExpandedKeys = treeDataList.filter(e => e.key.match(value)) const newExpandedKeys = treeDataList.filter(e => e.title != null && e.title.match(value))
newExpandedKeys.forEach(e => { newExpandedKeys.forEach(e => {
keys.push(e.key) titles.push(e.title)
}) })
setExpandedKeys(keys); setExpandedKeys(titles);
setSearchValue(value); setSearchValue(value);
setAutoExpandParent(true); setAutoExpandParent(true);
}; };
@ -78,51 +76,53 @@ const Left = (props) => {
let busTierOpen = [] let busTierOpen = []
let dataList = [] let dataList = []
let busTierNewList = [] let busTierNewList = []
if (busTier && busTier.data && busTier.data.length > 0) { // Math.ceil(Math.random() * 100);
busTierNewList.push(busTier && busTier.data && busTier.data[0]) // if (busTier && busTier.data && busTier.data.length > 0) {
} // busTierNewList.push(busTier && busTier.data && busTier.data[0])
if (busTierNewList.length > 0) { // }
busTierNewList.forEach((e, index) => { // if (busTierNewList.length > 0) {
if (index == 0) { // }
busTierOpen.push(e.name) busTier && busTier.data && busTier.data.forEach((e, index) => {
} if (index == 0) {
busTierList.push({ busTierOpen.push(e.name)
key: e.name, }
title: e.name, busTierList.push({
children: e.child.map(s => { key: e.name,
return { title: e.name,
key: s.name, children: e.child.map(s => {
title: s.name, return {
children: s.child.map(i => { key: s.name,
return { title: s.name,
key: i.name, children: s.child.map(i => {
title: i.name, return {
children: i.child.map(x => { key: i.name == '--' || i.name == null ? Math.ceil(Math.random() * 100) : i.name,
return { title: i.name,
key: x.name, children: i.child.map(x => {
title: x.name, return {
} key: x.name == '--' || x.name == null ? Math.ceil(Math.random() * 100) : x.name,
}) title: x.name == null ? '--' : x.name,
} }
}) })
}
}
})
}
})
}) })
}) })
busTierNewList.forEach(e => { })
e.child.forEach(i => { busTier && busTier.data && busTier.data.forEach(e => {
i.child.forEach(s => { e.child.forEach(i => {
s.child.forEach(x => { i.child.forEach(s => {
dataList.push({ s.child.forEach(x => {
key: x.name, dataList.push({
title: x.name key: x.name,
}) title: x.name
}) })
}) })
}) })
}) })
} })
setTreeData(busTierList) setTreeData(busTierList)
setExpandedKeys(busTierOpen) setExpandedKeys(busTierOpen)
setTreeDataList(dataList) setTreeDataList(dataList)

Loading…
Cancel
Save