修服左侧菜单排序不生效 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',
'keepalive as keepAlive', 'hide_children_in_menu', 'type', 'permission_mark', 'status'
])
->order()
->select();
}

View File

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

View File

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