diff --git a/Yi.Vue3.X.RuoYi/src/api/system/post.js b/Yi.Vue3.X.RuoYi/src/api/system/post.js index 0a0aaf35..dd1eebf4 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/post.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/post.js @@ -47,3 +47,12 @@ export function delPost(postId) { data:postId }) } + +// 获取角色选择框列表 +export function postOptionselect() { + return request({ + url: '/post/getList', + method: 'get' + }) + +} diff --git a/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue index 798ab5fd..9a08f1d6 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue @@ -176,16 +176,16 @@ - + - + @@ -240,7 +240,10 @@ import { getToken } from "@/utils/auth"; import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser } from "@/api/system/user"; import { roleOptionselect } from "@/api/system/role"; -import { listDept} from "@/api/system/dept"; +import { postOptionselect } from "@/api/system/post"; +import { listDept } from "@/api/system/dept"; + + const router = useRouter(); const { proxy } = getCurrentInstance(); const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex"); @@ -319,11 +322,11 @@ watch(deptName, val => { /** 查询部门下拉树结构 */ function getDeptTree() { listDept().then(response => { - const selectList=[]; - response.data.forEach(res=>{ - selectList.push({id:res.id,label:res.deptName,parentId:res.parentId,orderNum:res.orderNum, children:[]}) + const selectList = []; + response.data.forEach(res => { + selectList.push({ id: res.id, label: res.deptName, parentId: res.parentId, orderNum: res.orderNum, children: [] }) } - + ) deptOptions.value = proxy.handleTree(selectList, "id");; }); @@ -450,7 +453,7 @@ function reset() { form.value = { user: { userName: undefined, - nick:undefined, + nick: undefined, password: undefined, phone: undefined, email: undefined, @@ -464,16 +467,23 @@ function reset() { }; proxy.resetForm("userRef"); - if(postOptions.value.length==0||roleOptions.value.length==0) - { - roleOptionselect().then(response=>{ - //岗位从另一个接口获取全量 - postOptions.value = []; - roleOptions.value = response.data; - }) + if (postOptions.value.length == 0 || roleOptions.value.length == 0) { + roleOptionselect().then(response => { + //岗位从另一个接口获取全量 + roleOptions.value = response.data; + }) + postOptionselect().then(response => { + postOptions.value = response.data; + + } + + ) + } + + }; /** 取消按钮 */ function cancel() { @@ -487,7 +497,7 @@ function handleAdd() { reset(); open.value = true; - title.value = "添加用户"; + title.value = "添加用户"; }; /** 修改按钮操作 */ function handleUpdate(row) {