Pre Merge pull request !36 from David Wei/ts
This commit is contained in:
commit
ce6d660600
@ -17,7 +17,7 @@ export interface DeptVO extends BaseEntity {
|
|||||||
deptId: number | string;
|
deptId: number | string;
|
||||||
deptName: string;
|
deptName: string;
|
||||||
orderNum: number;
|
orderNum: number;
|
||||||
leader: string;
|
leaderId: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
email: string;
|
email: string;
|
||||||
status: string;
|
status: string;
|
||||||
@ -36,7 +36,7 @@ export interface DeptForm {
|
|||||||
deptId?: number | string;
|
deptId?: number | string;
|
||||||
deptName?: string;
|
deptName?: string;
|
||||||
orderNum?: number;
|
orderNum?: number;
|
||||||
leader?: string;
|
leaderId?: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
email?: string;
|
email?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
|
@ -175,17 +175,6 @@ export const updateAuthRole = (data: { userId: string; roleIds: string }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询当前部门的所有用户信息
|
|
||||||
* @param deptId
|
|
||||||
*/
|
|
||||||
export const listUserByDeptId = (deptId: string | number): AxiosPromise<UserVO[]> => {
|
|
||||||
return request({
|
|
||||||
url: '/system/user/list/dept/' + deptId,
|
|
||||||
method: 'get'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门下拉树结构
|
* 查询部门下拉树结构
|
||||||
*/
|
*/
|
||||||
@ -210,6 +199,5 @@ export default {
|
|||||||
uploadAvatar,
|
uploadAvatar,
|
||||||
getAuthRole,
|
getAuthRole,
|
||||||
updateAuthRole,
|
updateAuthRole,
|
||||||
deptTreeSelect,
|
deptTreeSelect
|
||||||
listUserByDeptId
|
|
||||||
};
|
};
|
||||||
|
@ -96,9 +96,23 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="负责人" prop="leader">
|
<el-form-item label="负责人" prop="leaderId">
|
||||||
<el-select v-model="form.leader" placeholder="请选择负责人">
|
<el-select
|
||||||
<el-option v-for="item in deptUserList" :key="item.userId" :label="item.userName" :value="item.userId" />
|
v-model="form.leaderId"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
placeholder="请选择负责人"
|
||||||
|
:remote-method="getAllUser"
|
||||||
|
:loading="userLoading"
|
||||||
|
style="width: 100%;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userList"
|
||||||
|
:key="item.userId"
|
||||||
|
:label="item.userName + '(' + item.nickName +')'"
|
||||||
|
:value="item.userId"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -135,14 +149,13 @@
|
|||||||
<script setup name="Dept" lang="ts">
|
<script setup name="Dept" lang="ts">
|
||||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
|
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
|
||||||
import { DeptForm, DeptQuery, DeptVO } from "@/api/system/dept/types";
|
import { DeptForm, DeptQuery, DeptVO } from "@/api/system/dept/types";
|
||||||
import {UserVO} from "@/api/system/user/types";
|
import {UserQuery, UserVO} from "@/api/system/user/types";
|
||||||
import {listUserByDeptId} from "@/api/system/user";
|
import {listUser} from "@/api/system/user";
|
||||||
|
|
||||||
interface DeptOptionsType {
|
interface DeptOptionsType {
|
||||||
deptId: number | string;
|
deptId: number | string;
|
||||||
deptName: string;
|
deptName: string;
|
||||||
children: DeptOptionsType[];
|
children: DeptOptionsType[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
||||||
@ -150,10 +163,11 @@ const { sys_normal_disable } = toRefs<any>(proxy?.useDict("sys_normal_disable"))
|
|||||||
|
|
||||||
const deptList = ref<DeptVO[]>([])
|
const deptList = ref<DeptVO[]>([])
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
|
const userLoading = ref(true)
|
||||||
const showSearch = ref(true)
|
const showSearch = ref(true)
|
||||||
const deptOptions = ref<DeptOptionsType[]>([])
|
const deptOptions = ref<DeptOptionsType[]>([])
|
||||||
const isExpandAll = ref(true)
|
const isExpandAll = ref(true)
|
||||||
const deptUserList = ref<UserVO[]>([]);
|
const userList = ref<UserVO[]>([]);
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
const dialog = reactive<DialogOption>({
|
||||||
visible: false,
|
visible: false,
|
||||||
@ -169,7 +183,7 @@ const initFormData: DeptForm = {
|
|||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
deptName: undefined,
|
deptName: undefined,
|
||||||
orderNum: 0,
|
orderNum: 0,
|
||||||
leader: undefined,
|
leaderId: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
email: undefined,
|
email: undefined,
|
||||||
status: "0"
|
status: "0"
|
||||||
@ -203,13 +217,16 @@ const getList = async () => {
|
|||||||
}
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
/** 查询当前部门可选的所有用户 */
|
||||||
/** 查询当前部门的所有用户 */
|
const getAllUser = async (query?: string) => {
|
||||||
async function getDeptAllUser(deptId: any) {
|
userLoading.value = true;
|
||||||
if (deptId !== null && deptId !== "" && deptId !== undefined) {
|
const res = await listUser({
|
||||||
const res = await listUserByDeptId(deptId);
|
userName: query,
|
||||||
deptUserList.value = res.data;
|
pageNum: 1,
|
||||||
}
|
pageSize: 50
|
||||||
|
});
|
||||||
|
userList.value = res.rows;
|
||||||
|
userLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
@ -264,8 +281,8 @@ const handleAdd = async (row?: DeptVO) => {
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row: DeptVO) => {
|
const handleUpdate = async (row: DeptVO) => {
|
||||||
reset();
|
reset();
|
||||||
//查询当前部门所有用户
|
// 查询当前部门可选所有用户
|
||||||
getDeptAllUser(row.deptId);
|
await getAllUser();
|
||||||
const res = await getDept(row.deptId);
|
const res = await getDept(row.deptId);
|
||||||
form.value = res.data
|
form.value = res.data
|
||||||
const response = await listDeptExcludeChild(row.deptId);
|
const response = await listDeptExcludeChild(row.deptId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user