!33 将部门管理 负责人选项改为下拉框选择

Merge pull request !33 from Lionel./deptHead
This commit is contained in:
疯狂的狮子Li 2023-08-09 02:47:41 +00:00 committed by Gitee
commit 53ac5fb43c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 31 additions and 4 deletions

View File

@ -169,6 +169,17 @@ export const updateAuthRole = (data: { userId: string; roleIds: string }) => {
});
};
/**
*
* @param deptId
*/
export const listUserByDeptId = (deptId: string | number): AxiosPromise<DeptVO[]> => {
return request({
url: "/system/user/list/dept/" + deptId,
method: "get"
});
};
/**
*
*/
@ -193,5 +204,6 @@ export default {
uploadAvatar,
getAuthRole,
updateAuthRole,
deptTreeSelect
deptTreeSelect,
listUserByDeptId
};

View File

@ -97,7 +97,9 @@
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="leader">
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
<el-select v-model="form.leader" placeholder="请选择负责人">
<el-option v-for="item in deptUserList" :key="item.userId" :label="item.userName" :value="item.userId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -133,6 +135,8 @@
<script setup name="Dept" lang="ts">
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
import { DeptForm, DeptQuery, DeptVO } from "@/api/system/dept/types";
import {UserVO} from "@/api/system/user/types";
import {listUserByDeptId} from "@/api/system/user";
interface DeptOptionsType {
deptId: number | string;
@ -149,7 +153,7 @@ const loading = ref(true)
const showSearch = ref(true)
const deptOptions = ref<DeptOptionsType[]>([])
const isExpandAll = ref(true)
const deptUserList = ref<UserVO[]>([]);
const dialog = reactive<DialogOption>({
visible: false,
@ -199,6 +203,15 @@ const getList = async () => {
}
loading.value = false
}
/** 查询当前部门的所有用户 */
async function getDeptAllUser(deptId: any) {
if (deptId !== null && deptId !== "" && deptId !== undefined) {
const res = await listUserByDeptId(deptId);
deptUserList.value = res.data;
}
}
/** 取消按钮 */
const cancel = () => {
reset()
@ -251,6 +264,8 @@ const handleAdd = async (row?: DeptVO) => {
/** 修改按钮操作 */
const handleUpdate = async (row: DeptVO) => {
reset();
//
getDeptAllUser(row.deptId);
const res = await getDept(row.deptId);
form.value = res.data
const response = await listDeptExcludeChild(row.deptId);