'aa', 'value' => 1, 'selected' => true, 'prefix' => '    ']] * * @param array $data 待处理的数据 * @param string $symbol 分隔符号 默认   * @param int $repeatNum 重复次数 默认4 * @return array */ public function handleSelectedList(array $data, string $symbol = ' ', int $repeatNum = 4): array { $list = []; foreach ($data as $item) { $level = $item['level'] ?? 0; $arr = $item; $arr['children'] = $arr['children'] ?? []; $arr['prefix'] = str_repeat($symbol, $level * $repeatNum); $list[] = $arr; } return $list; } }