$scope.DefaultActions = [];
                        $scope.MoreActions = [];

                        //Approve\Reject
                        if (
                            $scope.ActionGroups &&
                            $scope.ActionGroups.length == 0
                        ) {
                            for (var item of $scope.Actions) {
                                if (
                                    item.Name.toLowerCase() == "reject" ||
                                    item.Name.toLowerCase() == "rejected" ||
                                    item.Name.toLowerCase() == "approve" ||
                                    item.Name.toLowerCase() == "approved" ||
                                    item.Name.toLowerCase() == "approval"
                                ) {
                                    $scope.DefaultActions.push(item);
                                }
                            }
                        } else {
                            for (var item of $scope.ActionGroups) {
                                if (
                                    item.Name.toLowerCase() == "reject" ||
                                    item.Name.toLowerCase() == "rejected" ||
                                    item.Name.toLowerCase() == "approve" ||
                                    item.Name.toLowerCase() == "approved" ||
                                    item.Name.toLowerCase() == "approval"
                                ) {
                                    $scope.DefaultActions.push(item);
                                }
                            }
                        }
                        console.log("DefaultActions", $scope.DefaultActions);
                        //More Actions
                        if (
                            $scope.ActionGroups &&
                            $scope.ActionGroups.length == 0
                        ) {
                            for (var item of $scope.Actions) {
                                if (
                                    !(
                                        item.Name.toLowerCase() == "reject" ||
                                        item.Name.toLowerCase() == "rejected"
                                    ) &&
                                    !(
                                        item.Name.toLowerCase() == "approve" ||
                                        item.Name.toLowerCase() == "approved" ||
                                        item.Name.toLowerCase() == "approval"
                                    )
                                ) {
                                    $scope.MoreActions.push(item);
                                }
                            }
                        } else {
                            for (var item of $scope.ActionGroups) {
                                if (
                                    !(
                                        item.Name.toLowerCase() == "reject" ||
                                        item.Name.toLowerCase() == "rejected"
                                    ) &&
                                    !(
                                        item.Name.toLowerCase() == "approve" ||
                                        item.Name.toLowerCase() == "approved" ||
                                        item.Name.toLowerCase() == "approval"
                                    )
                                ) {
                                    $scope.MoreActions.push(item);
                                }
                            }
                        }
                        console.log("MoreActions", $scope.MoreActions);
优化上面代码，输出最终代码