method()) { case "GET": $params = request()->get(); $query = (new Usedpart())->query(); if (!empty($params["name"])) { $query->where("name", "like", "%" . $params["name"] . "%"); } $list = $query->paginate($params["limit"] ?? 10); return $this->success(dataReturn(1, "success", $list)); break; } } catch (\Throwable $th) { // var_dump($th); // var_dump($th->getMessage()); return $this->success(dataReturn(-1, $th->getMessage())); } } public function getChildren() { $param = request()->get(); $UsedListModel = new UsedList(); $where[] = ['UsedList_parent_wbs', '=', $param['id']]; // $where[] = ['org_id', '=', get_current_org_id()]; $org = (new AdminOrg)->getInfoById($param['org_id']); // if (!empty($params["name"])) { // $UsedListModel->where("name", "like", "%" . $UsedListModel["name"] . "%"); // } $where[] = ['deptcode', '=', $org['deptcode']]; // $where[] = ['deptcode', '=', $param['org_id']]; print_r($where); $list = $UsedListModel->where($where) ->limit($param["limit"] ?? 10) ->get()->toArray(); return sparkSuccess(dataReturn(0, 'success', $list)); } public function getUsedListDetail() { $param = request()->all(); $where = []; $usedListDetailModel = new UsedListDetail(); //名称 $name = isset($param['account_name']) ? $param['account_name'] : ''; if (!empty($name)) { $where[] = ['name', 'like', '%' . $name . '%']; } //组织 // $node_id = $param['usedlist_wbs']; $org = (new AdminOrg)->getInfoById($param['org_id']); //所属 if (!empty($param['usedlist_wbs'])) { $where[] = ['usedlist_wbs', '=', $param['usedlist_wbs']]; } else { $where[] = ['usedlist_wbs', '=', 0]; } $where[] = ['deptcode', '=', $org['deptcode']]; $list = $usedListDetailModel->where($where) ->paginate($param["limit"] ?? 10); return sparkSuccess(dataReturn(0, 'success', $list)); } }