Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(menu): 菜单排序无效问题 #449

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/CurrentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{
// @phpstan-ignore-next-line
return $this->user()->roles()->get()->map(static function (Role $role) {
return $role->menus()->where('parent_id', 0)->with('children')->get();
return $role->menus()->where('parent_id', 0)->orderBy('sort')->with('children')->get();

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / build Code coverage report (ubuntu-latest, 8.1, v5.1.3)

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / build Code coverage report (ubuntu-latest, 8.1, v5.1.3)

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 71 in app/Http/CurrentUser.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().
})->flatten();
}

Expand Down
11 changes: 11 additions & 0 deletions app/Repository/Permission/MenuRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
protected readonly Menu $model
) {}

public function enablePageOrderBy(): bool
{
return false;
}

public function list(array $params = []): \Hyperf\Collection\Collection
{
return $this->perQuery($this->getQuery($params), $params)->orderBy('sort')->get();
}

public function handleSearch(Builder $query, array $params): Builder
{
$whereInName = static function (Builder $query, array|string $code) {
Expand All @@ -48,9 +58,10 @@

public function allTree(): Collection
{
return $this->model

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / build Code coverage report (ubuntu-latest, 8.1, v5.1.3)

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / build Code coverage report (ubuntu-latest, 8.1, v5.1.3)

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swow-develop

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-v5.0.3

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.1 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.2 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-master

Call to an undefined method Hyperf\Database\Query\Builder::with().

Check failure on line 61 in app/Repository/Permission/MenuRepository.php

View workflow job for this annotation

GitHub Actions / Test on PHP8.3 Swoole-v5.1.5

Call to an undefined method Hyperf\Database\Query\Builder::with().
->newQuery()
->where('parent_id', 0)
->orderBy('sort')
->with('children')
->get();
}
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@imengyu/vue3-context-menu": "^1.4.2",
"@mineadmin/echarts": "^1.0.1",
"@mineadmin/form": "^1.0.21",
"@mineadmin/pro-table": "^1.0.27",
"@mineadmin/search": "^1.0.21",
"@mineadmin/pro-table": "^1.0.29",
"@mineadmin/search": "^1.0.23",
"@mineadmin/table": "^1.0.29",
"@vueuse/core": "^11.1.0",
"@vueuse/integrations": "^11.1.0",
Expand Down
Loading