Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
be1307db94 | ||
![]() |
a6c879ce09 | ||
![]() |
ff14f46fe0 | ||
![]() |
03ea4759af | ||
![]() |
9abd62b801 | ||
![]() |
1849c85c39 | ||
![]() |
d02d56a6c0 | ||
![]() |
f819869cea |
@@ -18,7 +18,7 @@
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/tinker": "^2.8",
|
||||
"catchadmin/core": "^0.1.12"
|
||||
"catchadmin/core": "^0.1.14"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
|
@@ -220,4 +220,10 @@ const getParent = (parentId: any) => {
|
||||
:deep(.el-tree .el-tree__empty-block .el-tree__empty-text) {
|
||||
@apply left-10 top-4;
|
||||
}
|
||||
:deep(.el-tree-node .is-expanded .el-tree-node__children) {
|
||||
@apply flex flex-wrap pl-9;
|
||||
}
|
||||
:deep(.el-tree-node .is-expanded .el-tree-node__children .el-tree-node__content) {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
@@ -58,16 +58,16 @@ trait UserRelations
|
||||
|
||||
/* @var Permissions $permissionsModel */
|
||||
$permissionsModel = app($this->getPermissionsModel());
|
||||
|
||||
if ($this->isSuperAdmin()) {
|
||||
$permissions = $permissionsModel->get();
|
||||
} else {
|
||||
$permissions = Collection::make();
|
||||
$permissionIds = Collection::make();
|
||||
$this->roles()->with('permissions')->get()
|
||||
->each(function ($role) use (&$permissions) {
|
||||
$permissions = $permissions->concat($role->permissions);
|
||||
->each(function ($role) use (&$permissionIds) {
|
||||
$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())));
|
||||
|
@@ -37,7 +37,7 @@ class User extends Model implements AuthenticatableContract
|
||||
public array $searchable = [
|
||||
'username' => 'like',
|
||||
'email' => 'like',
|
||||
'status' => '='
|
||||
'status' => '=',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ class User extends Model implements AuthenticatableContract
|
||||
*/
|
||||
public function updateBy($id, array $data): mixed
|
||||
{
|
||||
if (isset($data['password']) && ! $data['password']) {
|
||||
if (empty($data['password'])) {
|
||||
unset($data['password']);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,8 @@
|
||||
<el-table-column prop="username" label="用户名" width="150" />
|
||||
<el-table-column prop="avatar" label="头像">
|
||||
<template #default="scope">
|
||||
<el-avatar :src="scope.row.avatar" />
|
||||
<el-avatar :icon="UserFilled" v-if="!scope.row.avatar" />
|
||||
<el-avatar :src="scope.row.avatar" v-else />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="email" label="邮箱" />
|
||||
@@ -50,6 +51,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// @ts-nocheck
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import Create from './create.vue'
|
||||
import { useGetList } from '/admin/composables/curd/useGetList'
|
||||
@@ -58,11 +60,11 @@ import { useOpen } from '/admin/composables/curd/useOpen'
|
||||
import Department from './components/department.vue'
|
||||
import { useUserStore } from '/admin/stores/modules/user'
|
||||
import { isUndefined } from '/admin/support/helper'
|
||||
import { UserFilled } from '@element-plus/icons-vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const api = 'users'
|
||||
|
||||
const { data, query, search, reset, loading } = useGetList(api)
|
||||
const { destroy, deleted } = useDestroy()
|
||||
const { open, close, title, visible, id } = useOpen()
|
||||
@@ -74,9 +76,7 @@ const hasRoles = ref<boolean>(false)
|
||||
|
||||
onMounted(() => {
|
||||
search()
|
||||
|
||||
deleted(reset)
|
||||
|
||||
hasRoles.value = !isUndefined(userStore.getRoles)
|
||||
})
|
||||
</script>
|
||||
|
46
package.json
46
package.json
@@ -11,43 +11,45 @@
|
||||
"@heroicons/vue": "^2.0.18",
|
||||
"@tinymce/tinymce-vue": "^5.1.0",
|
||||
"@vueuse/core": "^10.1.2",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"element-plus": "^2.3.4",
|
||||
"element-plus": "^2.3.5",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.0.36",
|
||||
"postcss": "^8.4.23",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"terser": "^5.17.3",
|
||||
"vue": "^3.2.47",
|
||||
"pinia": "^2.1.3",
|
||||
"terser": "^5.16.6",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "9",
|
||||
"vue-router": "4.1.6",
|
||||
"vuedraggable": "^4.1.0"
|
||||
"vue-router": "4.2.1",
|
||||
"vuedraggable": "^2.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/logos": "^1.1.28",
|
||||
"@iconify-json/logos": "^1.1.31",
|
||||
"@rollup/plugin-alias": "^5.0.0",
|
||||
"@types/mockjs": "^1.0.7",
|
||||
"@types/node": "^20.1.1",
|
||||
"@types/node": "^20.2.3",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
||||
"@typescript-eslint/parser": "^5.59.5",
|
||||
"@vitejs/plugin-vue": "^4.2.1",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||
"@typescript-eslint/parser": "^5.59.7",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"axios": "^1.4.0",
|
||||
"eslint": "^8.40.0",
|
||||
"eslint": "^8.41.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-n": "^15.6.0",
|
||||
"eslint-plugin-n": "^16.0.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-vue": "^9.11.1",
|
||||
"prettier": "2.8.4",
|
||||
"eslint-plugin-vue": "^9.14.0",
|
||||
"mockjs": "^1.1.0",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "2.8.8",
|
||||
"sass": "^1.62.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"typescript": "^5.0.4",
|
||||
"unplugin-auto-import": "^0.14.4",
|
||||
"unplugin-auto-import": "^0.16.2",
|
||||
"unplugin-icons": "^0.16.1",
|
||||
"unplugin-vue-components": "^0.24.0",
|
||||
"vite": "^4.3.5",
|
||||
"vite": "^4.3.8",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vue-tsc": "^1.6.4"
|
||||
"vite-plugin-mock": "^3.0.0",
|
||||
"vue-tsc": "^1.6.5"
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ function checkAction(el: any, action: any) {
|
||||
el.parentNode && el.parentNode.removeChild(el)
|
||||
}
|
||||
} else {
|
||||
throw new Error(`need action! Like v-action="module.controller.action" || v-action="module@controller@action" `)
|
||||
throw new Error(`need action! Like v-action="module.controller.action"`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,13 +13,16 @@
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="MenuItem" setup>
|
||||
<script lang="ts" setup>
|
||||
import { Menu } from '/admin/types/Menu'
|
||||
import { onMounted, PropType, ref } from 'vue'
|
||||
import { PropType } from 'vue'
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
import { isMiniScreen } from '/admin/support/helper'
|
||||
|
||||
@@ -37,6 +40,12 @@ defineProps({
|
||||
require: true,
|
||||
},
|
||||
})
|
||||
|
||||
const openUrl = (path: string) => {
|
||||
const start = path.indexOf('https://') || path.indexOf('http://')
|
||||
window.open(path.substring(start))
|
||||
return false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
@@ -7,22 +7,15 @@
|
||||
:collapse="!appStore.isExpand"
|
||||
:collapse-transition="false"
|
||||
:router="true"
|
||||
@select="selectMenu"
|
||||
:unique-opened="true"
|
||||
>
|
||||
<slot />
|
||||
</el-menu>
|
||||
</template>
|
||||
<script lang="ts" setup name="menus">
|
||||
<script lang="ts" setup>
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const selectMenu = (index: string) => {
|
||||
if (index.startsWith('http') || index.startsWith('https')) {
|
||||
window.open(index)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user