Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
有来技术
vue3-element-admin
提交
50cc85ba
V
vue3-element-admin
项目概览
有来技术
/
vue3-element-admin
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue3-element-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
50cc85ba
编写于
1月 16, 2023
作者:
H
haoxr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 暗黑模式临时提交
Former-commit-id:
8653f216
上级
af4fd8cb
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
281 addition
and
271 deletion
+281
-271
.eslintrc-auto-import.json
.eslintrc-auto-import.json
+1
-0
src/components/Hamburger/index.vue
src/components/Hamburger/index.vue
+5
-5
src/components/IconSelect/index.vue
src/components/IconSelect/index.vue
+1
-1
src/components/SvgIcon/index.vue
src/components/SvgIcon/index.vue
+1
-0
src/layout/components/Settings/index.vue
src/layout/components/Settings/index.vue
+13
-13
src/layout/components/TagsView/index.vue
src/layout/components/TagsView/index.vue
+1
-8
src/main.ts
src/main.ts
+1
-1
src/styles/dark.scss
src/styles/dark.scss
+11
-0
src/styles/element-plus.scss
src/styles/element-plus.scss
+0
-6
src/styles/index.scss
src/styles/index.scss
+1
-6
src/styles/reset.scss
src/styles/reset.scss
+4
-0
src/types/auto-imports.d.ts
src/types/auto-imports.d.ts
+2
-0
src/types/components.d.ts
src/types/components.d.ts
+2
-0
src/views/system/menu/index.vue
src/views/system/menu/index.vue
+221
-217
src/views/system/role/index.vue
src/views/system/role/index.vue
+17
-14
未找到文件。
.eslintrc-auto-import.json
浏览文件 @
50cc85ba
{
"globals"
:
{
"EffectScope"
:
true
,
"ElForm"
:
true
,
"ElMessage"
:
true
,
"ElMessageBox"
:
true
,
"asyncComputed"
:
true
,
...
...
src/components/Hamburger/index.vue
浏览文件 @
50cc85ba
...
...
@@ -32,13 +32,13 @@ function toggleClick() {
}
</
script
>
<
style
scoped
>
<
style
lang=
"scss"
scoped
>
.hamburger
{
display
:
inline-block
;
width
:
20px
;
height
:
20px
;
}
.hamburger.is-active
{
transform
:
rotate
(
180deg
);
&
.is-active
{
transform
:
rotate
(
180deg
);
}
}
</
style
>
src/components/IconSelect/index.vue
浏览文件 @
50cc85ba
...
...
@@ -69,7 +69,7 @@ onMounted(() => {
placeholder=
"点击选择图标"
>
<template
#prepend
>
<svg-icon
:icon
Name
=
"inputValue"
></svg-icon>
<svg-icon
:icon
-class
=
"inputValue"
></svg-icon>
</
template
>
</el-input>
...
...
src/components/SvgIcon/index.vue
浏览文件 @
50cc85ba
...
...
@@ -32,6 +32,7 @@ const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
<
style
scoped
>
.svg-icon
{
display
:
inline-block
;
outline
:
none
;
width
:
1em
;
height
:
1em
;
...
...
src/layout/components/Settings/index.vue
浏览文件 @
50cc85ba
...
...
@@ -4,25 +4,24 @@ import { Sunny, Moon } from '@element-plus/icons-vue';
import
{
useSettingsStore
}
from
'
@/store/modules/settings
'
;
import
{
useDark
,
useToggle
}
from
'
@vueuse/core
'
;
import
{
ElDivider
,
ElSwitch
,
ElTooltip
}
from
'
element-plus
'
;
import
{
onMounted
}
from
'
vue
'
;
/**
* 暗黑模式
*/
const
settingsStore
=
useSettingsStore
();
const
isDark
=
useDark
();
const
toggleDark
=
useToggle
(
isDark
);
function
toggleTheme
()
{
const
isDark
=
useDark
();
useToggle
(
isDark
);
/**
* 切换布局
*/
function
changeLayout
(
layout
:
string
)
{
settingsStore
.
changeSetting
({
key
:
'
layout
'
,
value
:
layout
});
window
.
document
.
body
.
setAttribute
(
'
layout
'
,
settingsStore
.
layout
);
}
onMounted
(()
=>
{
window
.
document
.
body
.
setAttribute
(
'
layout
'
,
settingsStore
.
layout
);
});
function
changeLayout
(
layout
:
string
)
{
settingsStore
.
changeSetting
({
key
:
'
layout
'
,
value
:
layout
});
window
.
document
.
body
.
setAttribute
(
'
layout
'
,
settingsStore
.
layout
);
}
</
script
>
<
template
>
...
...
@@ -46,11 +45,12 @@ function changeLayout(layout: string) {
<el-divider>
主题
</el-divider>
<div
class=
"flex justify-center"
@
click.stop
>
<button
@
click=
"toggleDark()"
>
当前状态是:
{{
isDark
}}
</button>
<div
class=
"flex justify-center"
@
click=
"toggleDark()"
>
<el-switch
v-model=
"isDark"
inline-prompt
@
change=
"toggleTheme"
:active-icon=
"Sunny"
:inactive-icon=
"Moon"
/>
...
...
src/layout/components/TagsView/index.vue
浏览文件 @
50cc85ba
<
script
setup
lang=
"ts"
>
import
{
getCurrentInstance
,
nextTick
,
ref
,
watch
,
onMounted
,
ComponentInternalInstance
}
from
'
vue
'
;
import
{
ComponentInternalInstance
}
from
'
vue
'
;
import
{
storeToRefs
}
from
'
pinia
'
;
import
path
from
'
path-browserify
'
;
...
...
src/main.ts
浏览文件 @
50cc85ba
...
...
@@ -15,7 +15,7 @@ import i18n from '@/lang/index';
import
'
@/styles/index.scss
'
;
import
'
element-plus/theme-chalk/index.css
'
;
//
import 'element-plus/theme-chalk/dark/css-vars.css';
import
'
element-plus/theme-chalk/dark/css-vars.css
'
;
const
app
=
createApp
(
App
);
// 自定义指令
...
...
src/styles/dark.scss
0 → 100644
浏览文件 @
50cc85ba
// only scss variables
$--colors
:
(
"primary"
:
(
"base"
:
#589ef8
,
)
,
);
@forward
"element-plus/theme-chalk/src/dark/var.scss"
with
(
$
colors
:
$
--colors
)
;
src/styles/element-plus.scss
浏览文件 @
50cc85ba
...
...
@@ -10,12 +10,6 @@
font-weight
:
400
!
important
;
}
.el-upload__input
{
display
:
none
;
}
// 选中行背景色值
.el-table__body
tr
.current-row
td
{
background-color
:
#e1f3d8
b5
!
important
;
...
...
src/styles/index.scss
浏览文件 @
50cc85ba
...
...
@@ -2,10 +2,8 @@
@import
'src/styles/element-plus'
;
@import
'./sidebar.scss'
;
@import
'./tailwind.scss'
;
@import
'./reset.scss'
;
html
,
body
,
#app
{
height
:
100%
;
}
// main-container global css
.app-container
{
...
...
@@ -20,6 +18,3 @@ html,body,#app{
box-shadow
:
1px
1px
1px
#eee
;
}
svg
{
display
:
inline-block
;
}
src/styles/reset.scss
0 → 100644
浏览文件 @
50cc85ba
svg
{
display
:
inline-block
;
}
src/types/auto-imports.d.ts
浏览文件 @
50cc85ba
...
...
@@ -2,6 +2,7 @@
export
{}
declare
global
{
const
EffectScope
:
typeof
import
(
'
vue
'
)[
'
EffectScope
'
]
const
ElForm
:
typeof
import
(
'
element-plus/es
'
)[
'
ElForm
'
]
const
ElMessage
:
typeof
import
(
'
element-plus/es
'
)[
'
ElMessage
'
]
const
ElMessageBox
:
typeof
import
(
'
element-plus/es
'
)[
'
ElMessageBox
'
]
const
asyncComputed
:
typeof
import
(
'
@vueuse/core
'
)[
'
asyncComputed
'
]
...
...
@@ -266,6 +267,7 @@ import { UnwrapRef } from 'vue'
declare
module
'
vue
'
{
interface
ComponentCustomProperties
{
readonly
EffectScope
:
UnwrapRef
<
typeof
import
(
'
vue
'
)[
'
EffectScope
'
]
>
readonly
ElForm
:
UnwrapRef
<
typeof
import
(
'
element-plus/es
'
)[
'
ElForm
'
]
>
readonly
ElMessage
:
UnwrapRef
<
typeof
import
(
'
element-plus/es
'
)[
'
ElMessage
'
]
>
readonly
ElMessageBox
:
UnwrapRef
<
typeof
import
(
'
element-plus/es
'
)[
'
ElMessageBox
'
]
>
readonly
asyncComputed
:
UnwrapRef
<
typeof
import
(
'
@vueuse/core
'
)[
'
asyncComputed
'
]
>
...
...
src/types/components.d.ts
浏览文件 @
50cc85ba
...
...
@@ -55,6 +55,8 @@ declare module '@vue/runtime-core' {
IEpClose
:
typeof
import
(
'
~icons/ep/close
'
)[
'
default
'
]
IEpDownload
:
typeof
import
(
'
~icons/ep/download
'
)[
'
default
'
]
IEpPlus
:
typeof
import
(
'
~icons/ep/plus
'
)[
'
default
'
]
IEpRefresh
:
typeof
import
(
'
~icons/ep/refresh
'
)[
'
default
'
]
IEpSearch
:
typeof
import
(
'
~icons/ep/search
'
)[
'
default
'
]
IEpTop
:
typeof
import
(
'
~icons/ep/top
'
)[
'
default
'
]
LangSelect
:
typeof
import
(
'
./../components/LangSelect/index.vue
'
)[
'
default
'
]
MultiUpload
:
typeof
import
(
'
./../components/Upload/MultiUpload.vue
'
)[
'
default
'
]
...
...
src/views/system/menu/index.vue
浏览文件 @
50cc85ba
<
script
lang=
"ts"
>
export
default
{
name
:
'
cmenu
'
};
</
script
>
<
script
setup
lang=
"ts"
>
import
{
MenuQuery
,
MenuForm
,
Menu
}
from
'
@/api/menu/types
'
;
// API 依赖
import
{
listMenus
,
getMenuDetail
,
listMenuOptions
,
addMenu
,
deleteMenus
,
updateMenu
}
from
'
@/api/menu
'
;
import
SvgIcon
from
'
@/components/SvgIcon/index.vue
'
;
import
IconSelect
from
'
@/components/IconSelect/index.vue
'
;
const
emit
=
defineEmits
([
'
menuClick
'
]);
const
queryFormRef
=
ref
(
ElForm
);
const
dataFormRef
=
ref
(
ElForm
);
const
state
=
reactive
({
loading
:
true
,
// 选中ID数组
ids
:
[],
queryParams
:
{}
as
MenuQuery
,
menuList
:
[]
as
Menu
[],
dialog
:
{
visible
:
false
}
as
DialogType
,
formData
:
{
parentId
:
'
0
'
,
name
:
''
,
visible
:
1
,
sort
:
1
,
component
:
undefined
,
type
:
'
MENU
'
}
as
MenuForm
,
rules
:
{
parentId
:
[{
required
:
true
,
message
:
'
请选择顶级菜单
'
,
trigger
:
'
blur
'
}],
name
:
[{
required
:
true
,
message
:
'
请输入菜单名称
'
,
trigger
:
'
blur
'
}],
type
:
[{
required
:
true
,
message
:
'
请选择菜单类型
'
,
trigger
:
'
blur
'
}],
path
:
[{
required
:
true
,
message
:
'
请输入路由路径
'
,
trigger
:
'
blur
'
}],
component
:
[
{
required
:
true
,
message
:
'
请输入组件完整路径
'
,
trigger
:
'
blur
'
}
]
},
menuOptions
:
[]
as
OptionType
[],
currentRow
:
undefined
,
cacheData
:
{
menuType
:
''
,
menuPath
:
''
}
});
const
{
loading
,
queryParams
,
menuList
,
dialog
,
formData
,
rules
,
menuOptions
,
cacheData
}
=
toRefs
(
state
);
/**
* 查询
*/
function
handleQuery
()
{
// 重置父组件
emit
(
'
menuClick
'
,
null
);
loading
.
value
=
true
;
listMenus
(
state
.
queryParams
).
then
(({
data
})
=>
{
menuList
.
value
=
data
;
loading
.
value
=
false
;
});
}
/**
* 下拉菜单
*/
async
function
loadMenuData
()
{
listMenuOptions
().
then
(({
data
})
=>
{
menuOptions
.
value
=
[{
value
:
'
0
'
,
label
:
'
顶级菜单
'
,
children
:
data
}];
});
}
/**
* 查询重置
*/
function
resetQuery
()
{
queryFormRef
.
value
.
resetFields
();
handleQuery
();
}
function
handleRowClick
(
row
:
any
)
{
state
.
currentRow
=
JSON
.
parse
(
JSON
.
stringify
(
row
));
emit
(
'
menuClick
'
,
row
);
}
/**
* 新增菜单
*/
async
function
handleAdd
(
row
:
any
)
{
dialog
.
value
=
{
title
:
'
添加菜单
'
,
visible
:
true
};
await
loadMenuData
();
if
(
row
.
id
)
{
// 行点击新增
formData
.
value
.
parentId
=
row
.
id
;
}
else
{
// 工具栏新增
if
(
state
.
currentRow
)
{
// 选择行
formData
.
value
.
parentId
=
(
state
.
currentRow
as
any
).
id
;
}
else
{
// 未选择行
formData
.
value
.
parentId
=
'
0
'
;
}
}
}
/**
* 编辑菜单
*/
async
function
handleUpdate
(
row
:
MenuForm
)
{
await
loadMenuData
();
dialog
.
value
=
{
title
:
'
编辑菜单
'
,
visible
:
true
};
const
id
=
row
.
id
as
string
;
getMenuDetail
(
id
).
then
(({
data
})
=>
{
state
.
formData
=
data
;
cacheData
.
value
.
menuType
=
data
.
type
;
cacheData
.
value
.
menuPath
=
data
.
path
;
});
}
/**
* 菜单类型 change
*/
function
handleMenuTypeChange
(
menuType
:
any
)
{
if
(
menuType
!==
cacheData
.
value
.
menuType
)
{
formData
.
value
.
path
=
''
;
}
else
{
formData
.
value
.
path
=
cacheData
.
value
.
menuPath
;
}
}
/**
* 菜单提交
*/
function
submitForm
()
{
dataFormRef
.
value
.
validate
((
isValid
:
boolean
)
=>
{
if
(
isValid
)
{
if
(
state
.
formData
.
id
)
{
updateMenu
(
state
.
formData
.
id
,
state
.
formData
).
then
(()
=>
{
ElMessage
.
success
(
'
修改成功
'
);
cancel
();
handleQuery
();
});
}
else
{
addMenu
(
state
.
formData
).
then
(()
=>
{
ElMessage
.
success
(
'
新增成功
'
);
cancel
();
handleQuery
();
});
}
}
});
}
/**
* 删除菜单
*
*/
function
handleDelete
(
row
:
any
)
{
const
ids
=
[
row
.
id
||
state
.
ids
].
join
(
'
,
'
);
ElMessageBox
.
confirm
(
'
确认删除已选中的数据项?
'
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
})
.
then
(()
=>
{
deleteMenus
(
ids
).
then
(()
=>
{
ElMessage
.
success
(
'
删除成功
'
);
handleQuery
();
});
})
.
catch
(()
=>
ElMessage
.
info
(
'
已取消删除
'
));
}
/**
* 取消关闭弹窗
*/
function
cancel
()
{
formData
.
value
.
id
=
undefined
;
dataFormRef
.
value
.
resetFields
();
dialog
.
value
.
visible
=
false
;
}
onMounted
(()
=>
{
handleQuery
();
});
</
script
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"search"
>
...
...
@@ -11,10 +223,13 @@
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
:icon=
"Search"
@
click=
"handleQuery"
>
搜索
</el-button
<el-button
type=
"primary"
@
click=
"handleQuery"
><template
#icon
><i-ep-search
/></
template
>
搜索
</el-button
>
<el-button
@
click=
"resetQuery"
>
<
template
#icon
><i-ep-refresh
/></
template
>
重置
</el-button
>
<el-button
:icon=
"Refresh"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -22,8 +237,9 @@
<!-- 数据表格 -->
<el-card
shadow=
"never"
>
<
template
#header
>
<el-button
type=
"success"
:icon=
"Plus"
@
click=
"handleAdd"
>
新增
</el-button
<el-button
type=
"success"
@
click=
"handleAdd"
>
<template
#icon
><i-ep-plus
/></
template
>
新增
</el-button
>
</template>
...
...
@@ -122,7 +338,6 @@
</el-table>
</el-card>
<!-- dialog -->
<el-dialog
:title=
"dialog.title"
v-model=
"dialog.visible"
...
...
@@ -251,214 +466,3 @@
</el-dialog>
</div>
</template>
<
script
setup
lang=
"ts"
>
import
{
Search
,
Plus
,
Refresh
}
from
'
@element-plus/icons-vue
'
;
import
{
ElForm
,
ElMessage
,
ElMessageBox
}
from
'
element-plus
'
;
import
{
MenuQuery
,
MenuForm
,
Menu
}
from
'
@/api/menu/types
'
;
// API 依赖
import
{
listMenus
,
getMenuDetail
,
listMenuOptions
,
addMenu
,
deleteMenus
,
updateMenu
}
from
'
@/api/menu
'
;
import
SvgIcon
from
'
@/components/SvgIcon/index.vue
'
;
import
IconSelect
from
'
@/components/IconSelect/index.vue
'
;
const
emit
=
defineEmits
([
'
menuClick
'
]);
const
queryFormRef
=
ref
(
ElForm
);
const
dataFormRef
=
ref
(
ElForm
);
const
state
=
reactive
({
loading
:
true
,
// 选中ID数组
ids
:
[],
queryParams
:
{}
as
MenuQuery
,
menuList
:
[]
as
Menu
[],
dialog
:
{
visible
:
false
}
as
DialogType
,
formData
:
{
parentId
:
'
0
'
,
name
:
''
,
visible
:
1
,
sort
:
1
,
component
:
undefined
,
type
:
'
MENU
'
}
as
MenuForm
,
rules
:
{
parentId
:
[{
required
:
true
,
message
:
'
请选择顶级菜单
'
,
trigger
:
'
blur
'
}],
name
:
[{
required
:
true
,
message
:
'
请输入菜单名称
'
,
trigger
:
'
blur
'
}],
type
:
[{
required
:
true
,
message
:
'
请选择菜单类型
'
,
trigger
:
'
blur
'
}],
path
:
[{
required
:
true
,
message
:
'
请输入路由路径
'
,
trigger
:
'
blur
'
}],
component
:
[
{
required
:
true
,
message
:
'
请输入组件完整路径
'
,
trigger
:
'
blur
'
}
]
},
menuOptions
:
[]
as
OptionType
[],
currentRow
:
undefined
,
cacheData
:
{
menuType
:
''
,
menuPath
:
''
}
});
const
{
loading
,
queryParams
,
menuList
,
dialog
,
formData
,
rules
,
menuOptions
,
cacheData
}
=
toRefs
(
state
);
/**
* 查询
*/
function
handleQuery
()
{
// 重置父组件
emit
(
'
menuClick
'
,
null
);
loading
.
value
=
true
;
listMenus
(
state
.
queryParams
).
then
(({
data
})
=>
{
menuList
.
value
=
data
;
loading
.
value
=
false
;
});
}
/**
* 下拉菜单
*/
async
function
loadMenuData
()
{
await
listMenuOptions
().
then
(({
data
})
=>
{
menuOptions
.
value
=
[{
value
:
'
0
'
,
label
:
'
顶级菜单
'
,
children
:
data
}];
});
}
/**
* 查询重置
*/
function
resetQuery
()
{
queryFormRef
.
value
.
resetFields
();
handleQuery
();
}
function
handleRowClick
(
row
:
any
)
{
state
.
currentRow
=
JSON
.
parse
(
JSON
.
stringify
(
row
));
emit
(
'
menuClick
'
,
row
);
}
/**
* 新增菜单
*/
async
function
handleAdd
(
row
:
any
)
{
formData
.
value
.
id
=
undefined
;
await
loadMenuData
();
dialog
.
value
=
{
title
:
'
添加菜单
'
,
visible
:
true
};
if
(
row
.
id
)
{
// 行点击新增
formData
.
value
.
parentId
=
row
.
id
;
}
else
{
// 工具栏新增
if
(
state
.
currentRow
)
{
// 选择行
formData
.
value
.
parentId
=
(
state
.
currentRow
as
any
).
id
;
}
else
{
// 未选择行
formData
.
value
.
parentId
=
'
0
'
;
}
}
}
/**
* 编辑菜单
*/
async
function
handleUpdate
(
row
:
MenuForm
)
{
await
loadMenuData
();
dialog
.
value
=
{
title
:
'
编辑菜单
'
,
visible
:
true
};
const
id
=
row
.
id
as
string
;
getMenuDetail
(
id
).
then
(({
data
})
=>
{
state
.
formData
=
data
;
cacheData
.
value
.
menuType
=
data
.
type
;
cacheData
.
value
.
menuPath
=
data
.
path
;
});
}
/**
* 菜单类型 change
*/
function
handleMenuTypeChange
(
menuType
:
any
)
{
if
(
menuType
!==
cacheData
.
value
.
menuType
)
{
formData
.
value
.
path
=
''
;
}
else
{
formData
.
value
.
path
=
cacheData
.
value
.
menuPath
;
}
}
/**
* 菜单提交
*/
function
submitForm
()
{
dataFormRef
.
value
.
validate
((
isValid
:
boolean
)
=>
{
if
(
isValid
)
{
if
(
state
.
formData
.
id
)
{
updateMenu
(
state
.
formData
.
id
,
state
.
formData
).
then
(()
=>
{
ElMessage
.
success
(
'
修改成功
'
);
cancel
();
handleQuery
();
});
}
else
{
addMenu
(
state
.
formData
).
then
(()
=>
{
ElMessage
.
success
(
'
新增成功
'
);
cancel
();
handleQuery
();
});
}
}
});
}
/**
* 删除菜单
*
* @param row
*/
function
handleDelete
(
row
:
any
)
{
const
ids
=
[
row
.
id
||
state
.
ids
].
join
(
'
,
'
);
ElMessageBox
.
confirm
(
'
确认删除已选中的数据项?
'
,
'
警告
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
})
.
then
(()
=>
{
deleteMenus
(
ids
).
then
(()
=>
{
ElMessage
.
success
(
'
删除成功
'
);
handleQuery
();
});
})
.
catch
(()
=>
ElMessage
.
info
(
'
已取消删除
'
));
}
/**
* 取消关闭弹窗
*/
function
cancel
()
{
dataFormRef
.
value
.
resetFields
();
state
.
dialog
.
visible
=
false
;
}
onMounted
(()
=>
{
handleQuery
();
});
</
script
>
src/views/system/role/index.vue
浏览文件 @
50cc85ba
...
...
@@ -40,14 +40,17 @@ const state = reactive({
title
:
''
,
visible
:
false
}
as
DialogType
,
formData
:
{}
as
RoleForm
,
formData
:
{
sort
:
1
,
status
:
1
}
as
RoleForm
,
rules
:
{
name
:
[{
required
:
true
,
message
:
'
请输入角色名称
'
,
trigger
:
'
blur
'
}],
code
:
[{
required
:
true
,
message
:
'
请输入角色编码
'
,
trigger
:
'
blur
'
}],
dataScope
:
[{
required
:
true
,
message
:
'
请选择数据权限
'
,
trigger
:
'
blur
'
}],
status
:
[{
required
:
true
,
message
:
'
请选择状态
'
,
trigger
:
'
blur
'
}]
},
allocation
DialogVisible
:
false
,
resource
DialogVisible
:
false
,
resourceOptions
:
[]
as
OptionType
[],
// 勾选的菜单ID
checkedMenuIds
:
new
Set
([]),
...
...
@@ -67,7 +70,7 @@ const {
dialog
,
formData
,
rules
,
allocation
DialogVisible
,
resource
DialogVisible
,
checkedRole
,
resourceOptions
}
=
toRefs
(
state
);
...
...
@@ -171,8 +174,8 @@ function handleDelete(row: any) {
/**
* 资源分配弹窗
*/
function
showAllocation
Dialog
(
row
:
Role
)
{
allocation
DialogVisible
.
value
=
true
;
function
openResource
Dialog
(
row
:
Role
)
{
resource
DialogVisible
.
value
=
true
;
loading
.
value
=
true
;
const
roleId
:
any
=
row
.
id
;
...
...
@@ -206,7 +209,7 @@ function handleAllocationSubmit() {
updateRoleMenus
(
checkedRole
.
value
.
id
,
checkedMenuIds
).
then
(
res
=>
{
ElMessage
.
success
(
'
分配权限成功
'
);
allocation
DialogVisible
.
value
=
false
;
resource
DialogVisible
.
value
=
false
;
handleQuery
();
});
}
...
...
@@ -214,8 +217,8 @@ function handleAllocationSubmit() {
/**
* 关闭资源弹窗
*/
function
close
AllocationDia
log
()
{
allocation
DialogVisible
.
value
=
false
;
function
close
ResourceDai
log
()
{
resource
DialogVisible
.
value
=
false
;
}
onMounted
(()
=>
{
...
...
@@ -288,7 +291,7 @@ onMounted(() => {
<el-button
type=
"success"
link
@
click.stop=
"
showAllocation
Dialog(scope.row)"
@
click.stop=
"
openResource
Dialog(scope.row)"
>
资源分配
</el-button>
...
...
@@ -306,12 +309,12 @@ onMounted(() => {
</el-table-column>
</el-table>
<!--
pagination
-->
<!--
分页
-->
<pagination
v-if=
"total > 0"
:total=
"total"
v-model
:page=
"queryParams.pageNum"
v-model
:limit=
"queryParams.pageSize"
:page=
"queryParams.pageNum"
:limit=
"queryParams.pageSize"
@
pagination=
"handleQuery"
/>
</el-card>
...
...
@@ -374,7 +377,7 @@ onMounted(() => {
<!-- assign permission dialog -->
<el-dialog
:title=
"'【' + checkedRole.name + '】资源分配'"
v-model=
"
allocation
DialogVisible"
v-model=
"
resource
DialogVisible"
width=
"800px"
>
<el-scrollbar
max-height=
"600px"
v-loading=
"loading"
>
...
...
@@ -396,7 +399,7 @@ onMounted(() => {
<el-button
type=
"primary"
@
click=
"handleAllocationSubmit"
>
确 定
</el-button
>
<el-button
@
click=
"close
AllocationDia
log"
>
取 消
</el-button>
<el-button
@
click=
"close
ResourceDai
log"
>
取 消
</el-button>
</div>
</
template
>
</el-dialog>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录