/**
 * 跟进值获取节点
*/
export function getNodeByValue(value, data, valueField, childrenField) {
  let result
  if (!value || !data) {
    return result
  }
  const loop = (data) => {
    if (!data || !data.length) {
      return
    }
    return data.some(v => {
      if (v[valueField] === value) {
        result = v
        return true
      }
      return loop(v[childrenField])
    })
  }
  loop(data)
  return result
}
