Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
be1307db94 | ||
![]() |
a6c879ce09 | ||
![]() |
ff14f46fe0 | ||
![]() |
03ea4759af | ||
![]() |
9abd62b801 | ||
![]() |
1849c85c39 | ||
![]() |
d02d56a6c0 | ||
![]() |
f819869cea |
@@ -18,7 +18,7 @@
|
|||||||
"guzzlehttp/guzzle": "^7.2",
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
"laravel/framework": "^10.0",
|
"laravel/framework": "^10.0",
|
||||||
"laravel/tinker": "^2.8",
|
"laravel/tinker": "^2.8",
|
||||||
"catchadmin/core": "^0.1.12"
|
"catchadmin/core": "^0.1.14"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
@@ -220,4 +220,10 @@ const getParent = (parentId: any) => {
|
|||||||
:deep(.el-tree .el-tree__empty-block .el-tree__empty-text) {
|
:deep(.el-tree .el-tree__empty-block .el-tree__empty-text) {
|
||||||
@apply left-10 top-4;
|
@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>
|
</style>
|
||||||
|
@@ -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())));
|
||||||
|
@@ -37,7 +37,7 @@ class User extends Model implements AuthenticatableContract
|
|||||||
public array $searchable = [
|
public array $searchable = [
|
||||||
'username' => 'like',
|
'username' => 'like',
|
||||||
'email' => 'like',
|
'email' => 'like',
|
||||||
'status' => '='
|
'status' => '=',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
<el-table-column prop="username" label="用户名" width="150" />
|
<el-table-column prop="username" label="用户名" width="150" />
|
||||||
<el-table-column prop="avatar" label="头像">
|
<el-table-column prop="avatar" label="头像">
|
||||||
<template #default="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="email" label="邮箱" />
|
<el-table-column prop="email" label="邮箱" />
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
// @ts-nocheck
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import Create from './create.vue'
|
import Create from './create.vue'
|
||||||
import { useGetList } from '/admin/composables/curd/useGetList'
|
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 Department from './components/department.vue'
|
||||||
import { useUserStore } from '/admin/stores/modules/user'
|
import { useUserStore } from '/admin/stores/modules/user'
|
||||||
import { isUndefined } from '/admin/support/helper'
|
import { isUndefined } from '/admin/support/helper'
|
||||||
|
import { UserFilled } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const api = 'users'
|
const api = 'users'
|
||||||
|
|
||||||
const { data, query, search, reset, loading } = useGetList(api)
|
const { data, query, search, reset, loading } = useGetList(api)
|
||||||
const { destroy, deleted } = useDestroy()
|
const { destroy, deleted } = useDestroy()
|
||||||
const { open, close, title, visible, id } = useOpen()
|
const { open, close, title, visible, id } = useOpen()
|
||||||
@@ -74,9 +76,7 @@ const hasRoles = ref<boolean>(false)
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
search()
|
search()
|
||||||
|
|
||||||
deleted(reset)
|
deleted(reset)
|
||||||
|
|
||||||
hasRoles.value = !isUndefined(userStore.getRoles)
|
hasRoles.value = !isUndefined(userStore.getRoles)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
46
package.json
46
package.json
@@ -11,43 +11,45 @@
|
|||||||
"@heroicons/vue": "^2.0.18",
|
"@heroicons/vue": "^2.0.18",
|
||||||
"@tinymce/tinymce-vue": "^5.1.0",
|
"@tinymce/tinymce-vue": "^5.1.0",
|
||||||
"@vueuse/core": "^10.1.2",
|
"@vueuse/core": "^10.1.2",
|
||||||
"autoprefixer": "^10.4.13",
|
"element-plus": "^2.3.5",
|
||||||
"element-plus": "^2.3.4",
|
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.0.36",
|
"pinia": "^2.1.3",
|
||||||
"postcss": "^8.4.23",
|
"terser": "^5.16.6",
|
||||||
"tailwindcss": "^3.3.2",
|
"vue": "^3.3.4",
|
||||||
"terser": "^5.17.3",
|
|
||||||
"vue": "^3.2.47",
|
|
||||||
"vue-i18n": "9",
|
"vue-i18n": "9",
|
||||||
"vue-router": "4.1.6",
|
"vue-router": "4.2.1",
|
||||||
"vuedraggable": "^4.1.0"
|
"vuedraggable": "^2.24.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/logos": "^1.1.28",
|
"@iconify-json/logos": "^1.1.31",
|
||||||
"@rollup/plugin-alias": "^5.0.0",
|
"@rollup/plugin-alias": "^5.0.0",
|
||||||
"@types/mockjs": "^1.0.7",
|
"@types/mockjs": "^1.0.7",
|
||||||
"@types/node": "^20.1.1",
|
"@types/node": "^20.2.3",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"@typescript-eslint/parser": "^5.59.5",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
"@vitejs/plugin-vue": "^4.2.1",
|
"@vitejs/plugin-vue": "^4.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||||
|
"autoprefixer": "^10.4.14",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"eslint": "^8.40.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-standard": "^17.0.0",
|
"eslint-config-standard": "^17.0.0",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"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-promise": "^6.1.1",
|
||||||
"eslint-plugin-vue": "^9.11.1",
|
"eslint-plugin-vue": "^9.14.0",
|
||||||
"prettier": "2.8.4",
|
"mockjs": "^1.1.0",
|
||||||
|
"postcss": "^8.4.23",
|
||||||
|
"prettier": "2.8.8",
|
||||||
"sass": "^1.62.1",
|
"sass": "^1.62.1",
|
||||||
|
"tailwindcss": "^3.3.2",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
"unplugin-auto-import": "^0.14.4",
|
"unplugin-auto-import": "^0.16.2",
|
||||||
"unplugin-icons": "^0.16.1",
|
"unplugin-icons": "^0.16.1",
|
||||||
"unplugin-vue-components": "^0.24.0",
|
"unplugin-vue-components": "^0.24.0",
|
||||||
"vite": "^4.3.5",
|
"vite": "^4.3.8",
|
||||||
"vite-plugin-html": "^3.2.0",
|
"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)
|
el.parentNode && el.parentNode.removeChild(el)
|
||||||
}
|
}
|
||||||
} else {
|
} 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>
|
<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