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