完善分配角色前台界面
This commit is contained in:
parent
02f2354ee7
commit
ec3eae7bae
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
@ -47,7 +47,6 @@
|
||||
|
||||
<script setup>
|
||||
import { getAuthRole, updateAuthRole } from "@/api/system/user";
|
||||
import {getCurrentInstance, reactive, ref, toRefs} from "vue";
|
||||
import {useRoute} from "vue-router";
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -64,16 +63,6 @@ const form = ref({
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
// const data = reactive({
|
||||
// form: {
|
||||
// nickName: undefined,
|
||||
// userName: undefined,
|
||||
// userId: undefined
|
||||
// }});
|
||||
//
|
||||
// const { form } = toRefs(data);
|
||||
|
||||
|
||||
/** 单击选中行数据 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row);
|
||||
@ -93,7 +82,6 @@ function close() {
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
//console.log("form.value.userId="+form.value.userId)
|
||||
const userId = form.value.userId;
|
||||
const rIds = roleIds.value.join(",");
|
||||
updateAuthRole({ userId: userId, roleIds: rIds }).then(response => {
|
||||
@ -102,27 +90,25 @@ function submitForm() {
|
||||
});
|
||||
}
|
||||
|
||||
(() => {
|
||||
const getList = async () => {
|
||||
const userId = route.params && route.params.userId;
|
||||
if (userId) {
|
||||
loading.value = true;
|
||||
getAuthRole(userId).then(response => {
|
||||
Object.assign(form.value, response.user);
|
||||
Object.assign(roles.value, response.roles);
|
||||
//form.value = response.user;
|
||||
//console.log("form.value.userName ="+form.value.userName );
|
||||
// roles.value = response.roles;
|
||||
const res = await getAuthRole(userId);
|
||||
form.value=res.data.user;
|
||||
roles.value=res.data.roles;
|
||||
total.value = roles.value.length;
|
||||
nextTick(() => {
|
||||
await nextTick(() => {
|
||||
roles.value.forEach(row => {
|
||||
if (row.flag) {
|
||||
if (row?.flag) {
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row);
|
||||
}
|
||||
});
|
||||
});
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
})();
|
||||
};
|
||||
|
||||
getList();
|
||||
|
||||
</script>
|
||||
|
@ -85,7 +85,7 @@ function getUser() {
|
||||
state.roleGroup = response.data.roleGroup;
|
||||
state.postGroup = response.data.postGroup;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
getUser();
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user