1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2026-01-22 15:40:21 +08:00

26 Commits

Author SHA1 Message Date
zclzone
0fe0b9d41b feat: 优化crud表格弹性高度 2025-05-19 11:21:45 +08:00
zclzone
7243f4f38e style: lint fix 2025-05-19 11:20:51 +08:00
zclzone
5178b70aca chore: update deps 2025-05-19 10:37:18 +08:00
zclzone
1934776063 chore: update deps 2025-04-24 15:36:37 +08:00
Khalil Yao
c675a4d420 feat: optimize password input. (#122) 2025-04-12 10:42:32 +08:00
zclzone
e29343586f docs: update README 2025-04-08 21:15:02 +08:00
zclzone
6fea2a1b69 Merge branch '2.x' of https://github.com/zclzone/vue-naive-admin into 2.x 2025-03-30 21:02:00 +08:00
zclzone
2513e475be fix: tooltip箭头未居中问题 2025-03-30 21:01:20 +08:00
dxmqj200682
dde25dd7ab fix: 菜单path跳转判空,close #120 2025-03-30 15:43:11 +08:00
leip247
1eb59b7cad fix: 正确指向官网 (#119) 2025-03-27 09:08:03 +08:00
zclzone
27a50a99b4 fix: 移除演示按钮的点击事件 2025-03-24 11:09:11 +08:00
zclzone
cf0ba0a2bf fix: withPermission完善 2025-03-21 14:39:26 +08:00
zclzone
70c2098d2e refactor: 操作指引改成非自动触发 2025-03-18 10:14:20 +08:00
zclzone
82748abcc3 fix: unocss废弃api替换 2025-03-18 10:05:50 +08:00
zclzone
e5fd1405da style: lint fix 2025-03-13 10:29:17 +08:00
zclzone
833321d31d chore: update deps 2025-02-28 17:25:28 +08:00
zclzone
53afc9b531 chore: update deps 2025-02-06 16:03:45 +08:00
zclzone
0733b81f82 fix(crud): 浅拷贝 -> 深拷贝 2025-01-21 14:37:16 +08:00
zclzone
26ce0bd551 chore: update deps 2025-01-09 21:15:09 +08:00
zclzone
1201e8e172 chore: update deps 2024-12-27 18:31:08 +08:00
zclzone
78d9bb99f2 chore: update deps and lint fix 2024-12-14 19:56:56 +08:00
zclzone
9b510e8350 fix: pinia持久化paths -> pick 2024-11-29 15:26:07 +08:00
zclzone
7ce6cf1f7c fix: 移除多余的class 2024-11-22 16:00:49 +08:00
zclzone
30ca69cf16 fix: remove scss style 2024-11-22 15:59:20 +08:00
zclzone
c34c3646aa chore: update settings.json 2024-11-22 15:49:08 +08:00
leip247
6563797afc feat(guide): 添加操作指引 (#106)
* fix(slot): 优化部分slot写法,减少手动判断

* fix(slot): 优化部分slot写法,减少手动判断

* feat(guide): 添加操作指引
2024-11-22 15:47:00 +08:00
38 changed files with 3071 additions and 2598 deletions

View File

@@ -19,6 +19,5 @@
"markdown",
"json",
"jsonc"
],
"common-intellisense.ui": ["naiveUi2"]
]
}

View File

@@ -7,6 +7,10 @@
<a href="./LICENSE"><img alt="MIT License" src="https://badgen.net/github/license/zclzone/vue-naive-admin"/></a>
</p>
---
<a href="https://hellogithub.com/repository/54f19ba1f9ae4238b3cbd111f3c428b0" target="_blank"><img src="https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=54f19ba1f9ae4238b3cbd111f3c428b0&claim_uid=jXGayRdJZScqMNr" alt="FeaturedHelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>
## 简介
Vue Naive Admin 是一款极简风格的后台管理模板,包含前后端解决方案,前端使用 Vite + Vue3 + Pinia + Unocss后端使用 Nestjs + TypeOrm + MySql简单易用赏心悦目历经十几次重构和细节打磨诚意满满

View File

@@ -13,42 +13,43 @@
},
"dependencies": {
"@arco-design/color": "^0.4.0",
"@vueuse/core": "^11.1.0",
"axios": "^1.7.7",
"@vueuse/core": "^13.2.0",
"axios": "^1.9.0",
"dayjs": "^1.11.13",
"echarts": "^5.5.1",
"echarts": "^5.6.0",
"lodash-es": "^4.17.21",
"naive-ui": "^2.40.1",
"pinia": "^2.2.4",
"pinia-plugin-persistedstate": "^4.1.1",
"vue": "^3.5.12",
"naive-ui": "^2.41.0",
"pinia": "^3.0.2",
"pinia-plugin-persistedstate": "^4.3.0",
"vue": "^3.5.14",
"vue-echarts": "^7.0.3",
"vue-router": "^4.4.5",
"vue-router": "^4.5.1",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@antfu/eslint-config": "^3.8.0",
"@iconify/json": "^2.2.262",
"@unocss/eslint-config": "^0.63.6",
"@unocss/eslint-plugin": "^0.63.6",
"@unocss/preset-rem-to-px": "^0.63.6",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"eslint": "^9.13.0",
"eslint-plugin-format": "^0.1.2",
"@antfu/eslint-config": "^4.13.1",
"@iconify/json": "^2.2.339",
"@unocss/eslint-config": "^66.1.2",
"@unocss/eslint-plugin": "^66.1.2",
"@unocss/preset-rem-to-px": "^66.1.2",
"@vitejs/plugin-vue": "^5.2.4",
"@vitejs/plugin-vue-jsx": "^4.1.2",
"eslint": "^9.27.0",
"eslint-plugin-format": "^1.0.1",
"esno": "^4.8.0",
"fs-extra": "^11.2.0",
"glob": "^11.0.0",
"lint-staged": "^15.2.10",
"rollup-plugin-visualizer": "^5.12.0",
"simple-git-hooks": "^2.11.1",
"taze": "^0.17.2",
"unocss": "^0.63.6",
"unplugin-auto-import": "^0.18.3",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.9",
"fs-extra": "^11.3.0",
"glob": "^11.0.2",
"lint-staged": "^16.0.0",
"rollup-plugin-visualizer": "^5.14.0",
"simple-git-hooks": "^2.13.0",
"taze": "^19.1.0",
"unocss": "^66.1.2",
"unplugin-auto-import": "^19.2.0",
"unplugin-vue-components": "^28.5.0",
"vite": "^6.3.5",
"vite-plugin-router-warn": "^1.0.0",
"vite-plugin-vue-devtools": "^7.5.2"
"vite-plugin-vue-devtools": "^7.7.6",
"vue3-intro-step": "^1.0.5"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"

5214
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -29,9 +29,9 @@
</template>
<script setup>
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
import { LayoutSetting } from '@/components'
import { useAppStore, useTabStore } from '@/store'
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
import { layoutSettingVisible } from './settings'
const layouts = new Map()

View File

@@ -10,7 +10,7 @@
<div>
<n-tooltip trigger="hover" placement="left">
<template #trigger>
<div class="f-c-c rounded-4 bg-primary p-8" @click="modalRef.open()">
<div id="layout-setting" class="f-c-c rounded-4 bg-primary p-8" @click="modalRef.open()">
<i class="i-fe:settings cursor-pointer bg-white text-20" />
</div>
</template>

View File

@@ -1,21 +1,24 @@
<template>
<n-tooltip trigger="hover">
<template #trigger>
<n-color-picker
class="mr-16 h-32 w-32"
:value="appStore.primaryColor"
:swatches="primaryColors"
:on-update:value="(v) => appStore.setPrimaryColor(v)"
:render-label="() => ''"
/>
</template>
设置主题色
</n-tooltip>
<div class="f-c-c">
<n-tooltip trigger="hover" placement="bottom">
<template #trigger>
<n-color-picker
id="theme-setting"
class="h-32 w-32"
:value="appStore.primaryColor"
:swatches="primaryColors"
:on-update:value="(v) => appStore.setPrimaryColor(v)"
:render-label="() => ''"
/>
</template>
设置主题色
</n-tooltip>
</div>
</template>
<script setup>
import { useAppStore } from '@/store'
import { getPresetColors } from '@arco-design/color'
import { useAppStore } from '@/store'
const appStore = useAppStore()

View File

@@ -1,5 +1,6 @@
<template>
<i
id="toggleTheme"
class="mr-16 cursor-pointer"
:class="isDark ? 'i-fe:moon' : 'i-fe:sun'"
@click="toggleDark"
@@ -7,8 +8,8 @@
</template>
<script setup>
import { useAppStore } from '@/store'
import { useDark, useToggle } from '@vueuse/core'
import { useAppStore } from '@/store'
const appStore = useAppStore()
const isDark = useDark()

View File

@@ -7,48 +7,52 @@
--------------------------------->
<template>
<AppCard v-if="$slots.default" bordered bg="#fafafc dark:black" class="mb-30 min-h-60 rounded-4">
<form class="flex justify-between p-16" @submit.prevent="handleSearch()">
<n-scrollbar x-scrollable>
<n-space :wrap="!expand || isExpanded" :size="[32, 16]" class="p-10">
<slot />
</n-space>
</n-scrollbar>
<div class="flex-shrink-0 p-10">
<n-button ghost type="primary" @click="handleReset">
<i class="i-fe:rotate-ccw mr-4" />
重置
</n-button>
<n-button attr-type="submit" class="ml-20" type="primary">
<i class="i-fe:search mr-4" />
搜索
</n-button>
<template v-if="expand">
<n-button v-if="!isExpanded" type="primary" text @click="toggleExpand">
<i class="i-fe:chevrons-down ml-4" />
展开
<div class="h-full flex flex-col overflow-hidden">
<AppCard v-if="$slots.default" bordered bg="#fafafc dark:black" class="mb-30 min-h-60 rounded-4">
<form class="flex justify-between p-16" @submit.prevent="handleSearch()">
<n-scrollbar x-scrollable>
<n-space :wrap="!expand || isExpanded" :size="[32, 16]" class="p-10">
<slot />
</n-space>
</n-scrollbar>
<div class="flex-shrink-0 p-10">
<n-button ghost type="primary" @click="handleReset">
<i class="i-fe:rotate-ccw mr-4" />
重置
</n-button>
<n-button v-else text type="primary" @click="toggleExpand">
<i class="i-fe:chevrons-up ml-4" />
收起
<n-button attr-type="submit" class="ml-20" type="primary">
<i class="i-fe:search mr-4" />
搜索
</n-button>
</template>
</div>
</form>
</AppCard>
<NDataTable
:remote="remote"
:loading="loading"
:scroll-x="scrollX"
:columns="columns"
:data="tableData"
:row-key="(row) => row[rowKey]"
:pagination="isPagination ? pagination : false"
@update:checked-row-keys="onChecked"
@update:page="onPageChange"
/>
<template v-if="expand">
<n-button v-if="!isExpanded" type="primary" text @click="toggleExpand">
<i class="i-fe:chevrons-down ml-4" />
展开
</n-button>
<n-button v-else text type="primary" @click="toggleExpand">
<i class="i-fe:chevrons-up ml-4" />
收起
</n-button>
</template>
</div>
</form>
</AppCard>
<NDataTable
:remote="remote"
:loading="loading"
:scroll-x="scrollX"
:columns="columns"
:data="tableData"
:row-key="(row) => row[rowKey]"
:pagination="isPagination ? pagination : false"
flex-height
class="flex-1"
@update:checked-row-keys="onChecked"
@update:page="onPageChange"
/>
</div>
</template>
<script setup>

View File

@@ -6,6 +6,7 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { cloneDeep } from 'lodash-es'
import { useForm, useModal } from '.'
const ACTIONS = {
@@ -21,7 +22,7 @@ export function useCrud({ name, initForm = {}, doCreate, doDelete, doUpdate, ref
/** 新增 */
function handleAdd(row = {}, title) {
handleOpen({ action: 'add', title, row: { ...initForm, ...row } })
handleOpen({ action: 'add', title, row: Object.assign({}, cloneDeep(initForm), cloneDeep(row)) })
}
/** 修改 */

View File

@@ -6,9 +6,11 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { cloneDeep } from 'lodash-es'
export function useForm(initFormData = {}) {
const formRef = ref(null)
const formModel = ref({ ...initFormData })
const formModel = ref(cloneDeep(initFormData))
const rules = {
required: {
required: true,

View File

@@ -6,6 +6,7 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { withDirectives } from 'vue'
import { router } from '@/router'
const permission = {
@@ -21,3 +22,17 @@ const permission = {
export function setupDirectives(app) {
app.directive('permission', permission)
}
/**
* 用于h函数使用自定义权限指令
*
* @param {*} vnode 虚拟节点
* @param {*} code 权限码
* @returns 返回一个包含权限指令的vnode
*
* 使用示例withPermission(h('button', {class: 'text-red-500'}, '删除'), 'user:delete')
*
*/
export function withPermission(vnode, code) {
return withDirectives(vnode, [[permission, code]])
}

View File

@@ -0,0 +1,120 @@
<template>
<n-tooltip trigger="hover">
<template #trigger>
<i
class="i-fe:beginner mr-16 cursor-pointer text-20"
@click="show = true"
/>
</template>
操作指引
</n-tooltip>
<Vue3IntroStep
ref="myIntroStep"
v-model:show="show"
:config="config"
>
<template #prev="{ tipItem, index }">
<NButton class="mr-12" type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="prev(tipItem, index)">
上一步
</NButton>
</template>
<template #next="{ tipItem }">
<NButton class="mr-12" type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="next(tipItem)">
下一步
</NButton>
</template>
<template #skip>
<NButton type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="skip">
跳过
</NButton>
</template>
<template #done>
<NButton type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="done">
完成
</NButton>
</template>
</Vue3IntroStep>
</template>
<script setup>
import Vue3IntroStep from 'vue3-intro-step'
const myIntroStep = shallowRef(null)
const show = shallowRef(false)
const config = {
backgroundOpacity: 0.8,
titleStyle: {
textAlign: 'left',
fontSize: '18px',
},
contentStyle: {
textAlign: 'left',
fontSize: '14px',
},
tips: [
{
el: '#toggleTheme',
tipPosition: 'bottom',
title: '切换系统主题',
content: '一键开启护眼模式',
},
{
el: '#fullscreen',
tipPosition: 'bottom',
title: '全屏/退出全屏',
content: '一键开启全屏',
},
{
el: '#theme-setting',
tipPosition: 'bottom',
title: '设置主题色',
content: '调整为你喜欢的主题色',
},
{
el: '#user-dropdown',
tipPosition: 'bottom',
title: '个人中心',
content: '查看个人资料和退出系统',
},
{
el: '#menu-collapse',
tipPosition: 'bottom',
title: '展开/收起菜单',
content: '一键展开/收起菜单',
},
{
el: '#top-tab',
tipPosition: 'bottom',
title: '标签栏',
content: '鼠标滚轮滑动可调整至最佳视野',
},
{
el: '#layout-setting',
tipPosition: 'left',
title: '调整系统布局',
content: '将系统布局调整为你喜欢的样子',
},
],
}
function skip() {
show.value = false
}
function done() {
show.value = false
}
function next() {
// tipItem当前的提示项信息
// 调用vue3-intro-step的next方法 手动触发下一步
myIntroStep.value.next()
}
function prev() {
// 调用vue3-intro-step的prev方法 手动触发上一步
myIntroStep.value.prev()
}
</script>

View File

@@ -1,5 +1,6 @@
<template>
<i
id="fullscreen"
class="mr-16 cursor-pointer"
:class="isFullscreen ? 'i-fe:minimize' : 'i-fe:maximize'"
@click="toggle"

View File

@@ -8,6 +8,7 @@
<template>
<div
id="menu-collapse"
class="f-c-c cursor-pointer rounded-4 p-6 text-22 transition-all-300 auto-bg-hover"
@click="appStore.switchCollapsed"
>

View File

@@ -54,6 +54,8 @@ function handleMenuSelect(key, item) {
})
}
else {
if (!item.path)
return
router.push(item.path)
}
}

View File

@@ -8,7 +8,7 @@
<template>
<n-dropdown :options="options" @select="handleSelect">
<div class="flex cursor-pointer items-center">
<div id="user-dropdown" class="flex cursor-pointer items-center">
<n-avatar round :size="36" :src="userStore.avatar" />
<div v-if="userStore.userInfo" class="ml-12 flex-col flex-shrink-0 items-center">
<span class="text-14">{{ userStore.nickName ?? userStore.username }}</span>

View File

@@ -1,3 +1,4 @@
export { default as BeginnerGuide } from './BeginnerGuide.vue'
export { default as BreadCrumb } from './BreadCrumb.vue'
export { default as Fullscreen } from './Fullscreen.vue'
export { default as MenuCollapse } from './MenuCollapse.vue'

View File

@@ -7,7 +7,7 @@
--------------------------------->
<template>
<div>
<div id="top-tab">
<n-tabs
:value="tabStore.activeTab"
:closable="tabStore.tabs.length > 1"

View File

@@ -13,6 +13,8 @@
<BreadCrumb />
<div class="ml-auto flex flex-shrink-0 items-center px-12 text-18">
<BeginnerGuide />
<ToggleTheme />
<Fullscreen />
@@ -35,7 +37,7 @@
<script setup>
import { ToggleTheme } from '@/components'
import { BreadCrumb, Fullscreen, MenuCollapse, UserAvatar } from '@/layouts/components'
import { BeginnerGuide, BreadCrumb, Fullscreen, MenuCollapse, UserAvatar } from '@/layouts/components'
function handleLinkClick(link) {
window.open(link)

View File

@@ -15,6 +15,8 @@
<span class="mx-6 opacity-20">|</span>
<div class="flex flex-shrink-0 items-center px-12 text-18">
<BeginnerGuide />
<ToggleTheme />
<Fullscreen />
@@ -37,7 +39,7 @@
<script setup>
import { ToggleTheme } from '@/components'
import { AppTab, Fullscreen, MenuCollapse, UserAvatar } from '@/layouts/components'
import { AppTab, BeginnerGuide, Fullscreen, MenuCollapse, UserAvatar } from '@/layouts/components'
function handleLinkClick(link) {
window.open(link)

View File

@@ -6,10 +6,10 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { defaultLayout, defaultPrimaryColor, naiveThemeOverrides } from '@/settings'
import { generate, getRgbStr } from '@arco-design/color'
import { useDark } from '@vueuse/core'
import { defineStore } from 'pinia'
import { defaultLayout, defaultPrimaryColor, naiveThemeOverrides } from '@/settings'
export const useAppStore = defineStore('app', {
state: () => ({
@@ -50,7 +50,7 @@ export const useAppStore = defineStore('app', {
},
},
persist: {
paths: ['collapsed', 'layout', 'primaryColor', 'naiveThemeOverrides'],
pick: ['collapsed', 'layout', 'primaryColor', 'naiveThemeOverrides'],
storage: sessionStorage,
},
})

View File

@@ -6,8 +6,8 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { usePermissionStore, useRouterStore, useTabStore, useUserStore } from '@/store'
import { defineStore } from 'pinia'
import { usePermissionStore, useRouterStore, useTabStore, useUserStore } from '@/store'
export const useAuthStore = defineStore('auth', {
state: () => ({

View File

@@ -6,9 +6,9 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { isExternal } from '@/utils'
import { hyphenate } from '@vueuse/core'
import { defineStore } from 'pinia'
import { isExternal } from '@/utils'
export const usePermissionStore = defineStore('permission', {
state: () => ({

View File

@@ -88,7 +88,7 @@ export const useTabStore = defineStore('tab', {
},
},
persist: {
paths: ['tabs'],
pick: ['tabs'],
storage: sessionStorage,
},
})

View File

@@ -7,9 +7,9 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import * as NaiveUI from 'naive-ui'
import { useAppStore } from '@/store'
import { isNullOrUndef } from '@/utils'
import * as NaiveUI from 'naive-ui'
export function setupMessage(NMessage) {
class Message {

View File

@@ -11,14 +11,14 @@ import { createStorage } from './storage'
const prefixKey = 'vue-naive-admin_'
export const createLocalStorage = function (option = {}) {
export function createLocalStorage(option = {}) {
return createStorage({
prefixKey: option.prefixKey || '',
storage: localStorage,
})
}
export const createSessionStorage = function (option = {}) {
export function createSessionStorage(option = {}) {
return createStorage({
prefixKey: option.prefixKey || '',
storage: sessionStorage,

View File

@@ -98,7 +98,7 @@
<script setup>
import { sleep } from '@/utils'
const handleDelete = function () {
function handleDelete() {
$dialog.confirm({
content: '确认删除?',
confirm() {

View File

@@ -33,7 +33,6 @@
class="text-14 text-primary text-highlight hover:underline hover:opacity-80"
href="https://isme.top"
target="_blank"
@click.prevent="message?.info('官网正在火速开发中...')"
>
isme.top
</a>
@@ -160,13 +159,13 @@
</template>
<script setup>
import { useUserStore } from '@/store'
import { BarChart, LineChart, PieChart } from 'echarts/charts'
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components'
import * as echarts from 'echarts/core'
import { UniversalTransition } from 'echarts/features'
import { CanvasRenderer } from 'echarts/renderers'
import VChart from 'vue-echarts'
import { useUserStore } from '@/store'
const userStore = useUserStore()
@@ -284,6 +283,4 @@ const skillOption = {
},
],
}
const message = $message
</script>

View File

@@ -101,9 +101,9 @@
</template>
<script setup>
import { useStorage } from '@vueuse/core'
import { useAuthStore } from '@/store'
import { lStorage, throttle } from '@/utils'
import { useStorage } from '@vueuse/core'
import api from './api'
const authStore = useAuthStore()

View File

@@ -6,8 +6,8 @@
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
import { request } from '@/utils'
import axios from 'axios'
import { request } from '@/utils'
export default {
getMenuTree: () => request.get('/permission/menu/tree'),

View File

@@ -159,10 +159,10 @@
</template>
<script setup>
import { MeModal } from '@/components'
import { useForm, useModal } from '@/composables'
import icons from 'isme:icons'
import pagePathes from 'isme:page-pathes'
import { MeModal } from '@/components'
import { useForm, useModal } from '@/composables'
import api from '../api'
import QuestionLabel from './QuestionLabel.vue'

View File

@@ -92,8 +92,8 @@
</template>
<script setup>
import { MeCrud } from '@/components'
import { NButton, NSwitch } from 'naive-ui'
import { MeCrud } from '@/components'
import api from './api'
import MenuTree from './components/MenuTree.vue'
import ResAddOrEdit from './components/ResAddOrEdit.vue'

View File

@@ -75,7 +75,7 @@
:checked-keys="modalForm.permissionIds"
:on-update:checked-keys="(keys) => (modalForm.permissionIds = keys)"
default-expand-all checkable check-on-click
checkable check-on-click default-expand-all
class="cus-scroll max-h-200 w-full"
/>
</n-form-item>
@@ -95,9 +95,9 @@
</template>
<script setup>
import { NButton, NSwitch } from 'naive-ui'
import { MeCrud, MeModal, MeQueryItem } from '@/components'
import { useCrud } from '@/composables'
import { NButton, NSwitch } from 'naive-ui'
import api from './api'
defineOptions({ name: 'RoleMgt' })

View File

@@ -67,10 +67,10 @@
</template>
<script setup>
import { MeCrud, MeQueryItem } from '@/components'
import { formatDateTime } from '@/utils'
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
import { h } from 'vue'
import { MeCrud, MeQueryItem } from '@/components'
import { formatDateTime } from '@/utils'
import api from './api'
defineOptions({ name: 'RoleUser' })
@@ -163,31 +163,31 @@ const columns = [
render(row) {
return row.roles?.some(item => item.id === +route.params.roleId)
? h(
NButton,
{
size: 'small',
type: 'error',
secondary: true,
onClick: () => handleBatchRemove([row.id]),
},
{
default: () => '取消授权',
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
},
)
NButton,
{
size: 'small',
type: 'error',
secondary: true,
onClick: () => handleBatchRemove([row.id]),
},
{
default: () => '取消授权',
icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
},
)
: h(
NButton,
{
size: 'small',
type: 'primary',
secondary: true,
onClick: () => handleBatchAdd([row.id]),
},
{
default: () => '授权',
icon: () => h('i', { class: 'i-line-md:confirm-circle text-14' }),
},
)
NButton,
{
size: 'small',
type: 'primary',
secondary: true,
onClick: () => handleBatchAdd([row.id]),
},
{
default: () => '授权',
icon: () => h('i', { class: 'i-line-md:confirm-circle text-14' }),
},
)
},
},
]

View File

@@ -77,7 +77,7 @@
trigger: ['input', 'blur'],
}"
>
<n-input v-model:value="modalForm.password" />
<n-input v-model:value="modalForm.password" type="password" show-password-on="mousedown" />
</n-form-item>
<n-form-item v-if="['add', 'setRole'].includes(modalAction)" label="角色" path="roleIds">
@@ -110,10 +110,11 @@
</template>
<script setup>
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
import { MeCrud, MeModal, MeQueryItem } from '@/components'
import { useCrud } from '@/composables'
import { withPermission } from '@/directives'
import { formatDateTime } from '@/utils'
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
import api from './api'
defineOptions({ name: 'UserMgt' })
@@ -225,11 +226,23 @@ const columns = [
hideInExcel: true,
render(row) {
return [
withPermission(
h(NButton, {
size: 'small',
type: 'primary',
secondary: true,
}, {
default: () => '超管专属',
icon: () => h('i', { class: 'i-carbon:user-role text-14' }),
}),
'SuperAdmin',
),
h(
NButton,
{
size: 'small',
type: 'primary',
class: 'ml-12px',
secondary: true,
onClick: () => handleOpenRolesSet(row),
},

View File

@@ -73,10 +73,10 @@
require-mark-placement="left"
>
<n-form-item label="原密码" path="oldPassword" :rule="required">
<n-input v-model:value="pwdForm.oldPassword" type="password" placeholder="请输入原密码" />
<n-input v-model:value="pwdForm.oldPassword" type="password" placeholder="请输入原密码" show-password-on="mousedown" />
</n-form-item>
<n-form-item label="新密码" path="newPassword" :rule="required">
<n-input v-model:value="pwdForm.newPassword" type="password" placeholder="请输入新密码" />
<n-input v-model:value="pwdForm.newPassword" type="password" placeholder="请输入新密码" show-password-on="mousedown" />
</n-form-item>
</n-form>
</MeModal>

View File

@@ -8,13 +8,13 @@
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
import presetRemToPx from '@unocss/preset-rem-to-px'
import { defineConfig, presetAttributify, presetIcons, presetUno } from 'unocss'
import { defineConfig, presetAttributify, presetIcons, presetWind3 } from 'unocss'
import { getIcons } from './build/index.js'
const icons = getIcons()
export default defineConfig({
presets: [
presetUno(),
presetWind3(),
presetAttributify(),
presetIcons({
warn: true,