Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
be1307db94 | ||
![]() |
a6c879ce09 | ||
![]() |
ff14f46fe0 | ||
![]() |
03ea4759af |
@@ -58,16 +58,16 @@ trait UserRelations
|
|||||||
|
|
||||||
/* @var Permissions $permissionsModel */
|
/* @var Permissions $permissionsModel */
|
||||||
$permissionsModel = app($this->getPermissionsModel());
|
$permissionsModel = app($this->getPermissionsModel());
|
||||||
|
|
||||||
if ($this->isSuperAdmin()) {
|
if ($this->isSuperAdmin()) {
|
||||||
$permissions = $permissionsModel->get();
|
$permissions = $permissionsModel->get();
|
||||||
} else {
|
} else {
|
||||||
$permissions = Collection::make();
|
$permissionIds = Collection::make();
|
||||||
$this->roles()->with('permissions')->get()
|
$this->roles()->with('permissions')->get()
|
||||||
->each(function ($role) use (&$permissions) {
|
->each(function ($role) use (&$permissionIds) {
|
||||||
$permissions = $permissions->concat($role->permissions);
|
$permissionIds = $permissionIds->concat($role->permissions?->pluck('id'));
|
||||||
});
|
});
|
||||||
$permissions = $permissions->unique();
|
|
||||||
|
$permissions = $permissionsModel->whereIn('id', $permissionIds->unique())->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setAttribute('permissions', $permissions->each(fn ($permission) => $permission->setAttribute('hidden', $permission->isHidden())));
|
$this->setAttribute('permissions', $permissions->each(fn ($permission) => $permission->setAttribute('hidden', $permission->isHidden())));
|
||||||
|
@@ -96,7 +96,7 @@ class User extends Model implements AuthenticatableContract
|
|||||||
*/
|
*/
|
||||||
public function updateBy($id, array $data): mixed
|
public function updateBy($id, array $data): mixed
|
||||||
{
|
{
|
||||||
if (isset($data['password']) && ! $data['password']) {
|
if (empty($data['password'])) {
|
||||||
unset($data['password']);
|
unset($data['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,13 +13,16 @@
|
|||||||
<el-icon>
|
<el-icon>
|
||||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span>{{ menu?.meta?.title }}</span>
|
<span v-if="menu?.path.indexOf('https://') !== -1 || menu?.path.indexOf('http://') !== -1">
|
||||||
|
<span @click="openUrl(menu?.path as string)">{{ menu?.meta?.title }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-else>{{ menu?.meta?.title }}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="MenuItem" setup>
|
<script lang="ts" setup>
|
||||||
import { Menu } from '/admin/types/Menu'
|
import { Menu } from '/admin/types/Menu'
|
||||||
import { onMounted, PropType, ref } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { useAppStore } from '/admin/stores/modules/app'
|
import { useAppStore } from '/admin/stores/modules/app'
|
||||||
import { isMiniScreen } from '/admin/support/helper'
|
import { isMiniScreen } from '/admin/support/helper'
|
||||||
|
|
||||||
@@ -37,6 +40,12 @@ defineProps({
|
|||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const openUrl = (path: string) => {
|
||||||
|
const start = path.indexOf('https://') || path.indexOf('http://')
|
||||||
|
window.open(path.substring(start))
|
||||||
|
return false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@@ -7,22 +7,15 @@
|
|||||||
:collapse="!appStore.isExpand"
|
:collapse="!appStore.isExpand"
|
||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
:router="true"
|
:router="true"
|
||||||
@select="selectMenu"
|
|
||||||
:unique-opened="true"
|
:unique-opened="true"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="menus">
|
<script lang="ts" setup>
|
||||||
import { useAppStore } from '/admin/stores/modules/app'
|
import { useAppStore } from '/admin/stores/modules/app'
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const selectMenu = (index: string) => {
|
|
||||||
if (index.startsWith('http') || index.startsWith('https')) {
|
|
||||||
window.open(index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
Reference in New Issue
Block a user