修服左侧菜单排序不生效 bug

This commit is contained in:
JaguarJack 2020-05-25 14:30:28 +08:00
parent dfcec7394f
commit 0f59685ae3
3 changed files with 14 additions and 15 deletions

View File

@ -74,6 +74,7 @@ class Permissions extends CatchModel
'route', 'icon', 'component', 'redirect', 'route', 'icon', 'component', 'redirect',
'keepalive as keepAlive', 'hide_children_in_menu', 'type', 'permission_mark', 'status' 'keepalive as keepAlive', 'hide_children_in_menu', 'type', 'permission_mark', 'status'
]) ])
->order()
->select(); ->select();
} }

View File

@ -93,7 +93,6 @@ class CatchQuery extends Query
if ($needAlias) { if ($needAlias) {
$alias = $this->getAlias(); $alias = $this->getAlias();
$this->options['field'] = array_map(function ($field) use ($alias) { $this->options['field'] = array_map(function ($field) use ($alias) {
return $alias . '.' . $field; return $alias . '.' . $field;
}, $this->options['field']); }, $this->options['field']);
@ -190,22 +189,20 @@ class CatchQuery extends Query
*/ */
public function order($field = '', string $order = 'desc', $position = 'backend') public function order($field = '', string $order = 'desc', $position = 'backend')
{ {
// 排序在前
if ($position = 'front') { if ($position = 'front') {
parent::order($field, $order); parent::order($field, $order);
} }
if (in_array('sort', array_keys($this->getFields()))) {
if (property_exists($this, 'field')) { parent::order('sort', $order);
if (in_array('sort', $this->field)) {
parent::order('sort', 'desc');
} }
} // 紧跟权重的排序
if ($position == 'middle') { if ($position == 'middle') {
parent::order($field, $order); parent::order($field, $order);
} }
parent::order($this->getPk(), 'desc'); parent::order($this->getPk(), $order);
// 最后插入排序
if ($position == 'backend') { if ($position == 'backend') {
parent::order($field, $order); parent::order($field, $order);
} }

View File

@ -0,0 +1 @@
<?php