Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
4069f78a
提交
4069f78a
authored
1月 17, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style(user/authrole): 修复样式问题
同上
上级
9486bf69
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
126 行增加
和
93 行删除
+126
-93
authRole.vue
src/views/system/user/authRole.vue
+126
-93
没有找到文件。
src/views/system/user/authRole.vue
浏览文件 @
4069f78a
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<div
class=
"container"
>
<h4
class=
"form-header h4"
>
基本信息
</h4>
<el-form
:model=
"form"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"8"
:offset=
"2"
>
<el-form-item
label=
"用户昵称"
prop=
"nickName"
>
<el-input
v-model=
"form.nickName"
disabled
/>
</el-form-item>
</el-col>
<el-col
:span=
"8"
:offset=
"2"
>
<el-form-item
label=
"登录账号"
prop=
"userName"
>
<el-input
v-model=
"form.userName"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-form
:model=
"form"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"8"
:offset=
"2"
>
<el-form-item
label=
"用户昵称"
prop=
"nickName"
>
<el-input
v-model=
"form.nickName"
disabled
/>
</el-form-item>
</el-col>
<el-col
:span=
"8"
:offset=
"2"
>
<el-form-item
label=
"登录账号"
prop=
"userName"
>
<el-input
v-model=
"form.userName"
disabled
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<h4
class=
"form-header h4"
>
角色信息
</h4>
<el-table
v-loading=
"loading"
:row-key=
"getRowKey"
@
row-click=
"clickRow"
ref=
"roleRef"
@
selection-change=
"handleSelectionChange"
:data=
"roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"
>
<el-table-column
label=
"序号"
width=
"55"
type=
"index"
align=
"center"
>
<template
#
default=
"scope"
>
<span>
{{
(
pageNum
-
1
)
*
pageSize
+
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<el-table-column
type=
"selection"
:reserve-selection=
"true"
width=
"55"
></el-table-column>
<el-table-column
label=
"角色编号"
align=
"center"
prop=
"roleId"
/>
<el-table-column
label=
"角色名称"
align=
"center"
prop=
"roleName"
/>
<el-table-column
label=
"权限字符"
align=
"center"
prop=
"roleKey"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"180"
>
<
template
#
default=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
)
}}
</span>
</
template
>
</el-table-column>
<el-table
v-loading=
"loading"
:row-key=
"getRowKey"
@
row-click=
"clickRow"
ref=
"roleRef"
@
selection-change=
"handleSelectionChange"
:data=
"roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"
>
<el-table-column
label=
"序号"
width=
"55"
type=
"index"
align=
"center"
>
<template
#
default=
"scope"
>
<span>
{{
(
pageNum
-
1
)
*
pageSize
+
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<el-table-column
type=
"selection"
:reserve-selection=
"true"
width=
"55"
></el-table-column>
<el-table-column
label=
"角色编号"
align=
"center"
prop=
"roleId"
/>
<el-table-column
label=
"角色名称"
align=
"center"
prop=
"roleName"
/>
<el-table-column
label=
"权限字符"
align=
"center"
prop=
"roleKey"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"180"
>
<
template
#
default=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
)
}}
</span>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total > 0"
:total=
"total"
v-model:page=
"pageNum"
v-model:limit=
"pageSize"
/>
<pagination
v-show=
"total > 0"
:total=
"total"
v-model:page=
"pageNum"
v-model:limit=
"pageSize"
/>
<el-form
label-width=
"100px"
>
<div
style=
"text-align: center;margin-left:-120px;margin-top:30px;"
>
<el-button
type=
"primary"
@
click=
"submitForm()"
>
提交
</el-button>
<el-button
@
click=
"close()"
>
返回
</el-button>
</div>
<div
style=
"text-align: center;margin-left:-120px;margin-top:30px;"
>
<el-button
type=
"primary"
@
click=
"submitForm()"
>
提交
</el-button>
<el-button
@
click=
"close()"
>
返回
</el-button>
</div>
</el-form>
</div>
</div>
</div>
</template>
<
script
setup
name=
"AuthRole"
>
import
{
getAuthRole
,
updateAuthRole
}
from
"@/api"
;
<
script
setup
name=
"AuthRole"
>
import
{
getAuthRole
,
updateAuthRole
}
from
"@/api"
;
const
route
=
useRoute
();
const
{
proxy
}
=
getCurrentInstance
();
const
route
=
useRoute
();
const
{
proxy
}
=
getCurrentInstance
();
const
loading
=
ref
(
true
);
const
total
=
ref
(
0
);
const
pageNum
=
ref
(
1
);
const
pageSize
=
ref
(
10
);
const
roleIds
=
ref
([]);
const
roles
=
ref
([]);
const
form
=
ref
({
nickName
:
undefined
,
userName
:
undefined
,
userId
:
undefined
});
const
loading
=
ref
(
true
);
const
total
=
ref
(
0
);
const
pageNum
=
ref
(
1
);
const
pageSize
=
ref
(
10
);
const
roleIds
=
ref
([]);
const
roles
=
ref
([]);
const
form
=
ref
({
nickName
:
undefined
,
userName
:
undefined
,
userId
:
undefined
});
/** 单击选中行数据 */
function
clickRow
(
row
)
{
proxy
.
$refs
[
"roleRef"
].
toggleRowSelection
(
row
);
};
/** 单击选中行数据 */
function
clickRow
(
row
)
{
proxy
.
$refs
[
"roleRef"
].
toggleRowSelection
(
row
);
};
/** 多选框选中数据 */
function
handleSelectionChange
(
selection
)
{
roleIds
.
value
=
selection
.
map
(
item
=>
item
.
roleId
);
};
/** 多选框选中数据 */
function
handleSelectionChange
(
selection
)
{
roleIds
.
value
=
selection
.
map
(
item
=>
item
.
roleId
);
};
/** 保存选中的数据编号 */
function
getRowKey
(
row
)
{
return
row
.
roleId
;
};
/** 保存选中的数据编号 */
function
getRowKey
(
row
)
{
return
row
.
roleId
;
};
/** 关闭按钮 */
function
close
()
{
const
obj
=
{
path
:
"/system/user"
};
proxy
.
$tab
.
closeOpenPage
(
obj
);
};
/** 关闭按钮 */
function
close
()
{
const
obj
=
{
path
:
"/system/user"
};
proxy
.
$tab
.
closeOpenPage
(
obj
);
};
/** 提交按钮 */
function
submitForm
()
{
const
userId
=
form
.
value
.
userId
;
const
rIds
=
roleIds
.
value
.
join
(
","
);
updateAuthRole
({
userId
:
userId
,
roleIds
:
rIds
}).
then
(
response
=>
{
proxy
.
$modal
.
msgSuccess
(
"授权成功"
);
close
();
});
};
/** 提交按钮 */
function
submitForm
()
{
const
userId
=
form
.
value
.
userId
;
const
rIds
=
roleIds
.
value
.
join
(
","
);
updateAuthRole
({
userId
:
userId
,
roleIds
:
rIds
}).
then
(
response
=>
{
proxy
.
$modal
.
msgSuccess
(
"授权成功"
);
close
();
});
};
(()
=>
{
const
userId
=
route
.
params
&&
route
.
params
.
userId
;
if
(
userId
)
{
loading
.
value
=
true
;
getAuthRole
(
userId
).
then
(
response
=>
{
form
.
value
=
response
.
user
;
roles
.
value
=
response
.
roles
;
total
.
value
=
roles
.
value
.
length
;
nextTick
(()
=>
{
roles
.
value
.
forEach
(
row
=>
{
if
(
row
.
flag
)
{
proxy
.
$refs
[
"roleRef"
].
toggleRowSelection
(
row
);
}
(()
=>
{
const
userId
=
route
.
params
&&
route
.
params
.
userId
;
if
(
userId
)
{
loading
.
value
=
true
;
getAuthRole
(
userId
).
then
(
response
=>
{
form
.
value
=
response
.
user
;
roles
.
value
=
response
.
roles
;
total
.
value
=
roles
.
value
.
length
;
nextTick
(()
=>
{
roles
.
value
.
forEach
(
row
=>
{
if
(
row
.
flag
)
{
proxy
.
$refs
[
"roleRef"
].
toggleRowSelection
(
row
);
}
});
});
loading
.
value
=
false
;
});
loading
.
value
=
false
;
});
}
})();
}
})();
</
script
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论