perf: 用户管理过滤掉已禁用部门
This commit is contained in:
@@ -315,7 +315,7 @@
|
|||||||
<el-form-item label="归属部门" prop="deptId">
|
<el-form-item label="归属部门" prop="deptId">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.deptId"
|
v-model="form.deptId"
|
||||||
:data="deptOptions"
|
:data="enabledDeptOptions"
|
||||||
:props="{ value: 'id', label: 'label', children: 'children' }"
|
:props="{ value: 'id', label: 'label', children: 'children' }"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
placeholder="请选择归属部门"
|
placeholder="请选择归属部门"
|
||||||
@@ -533,6 +533,7 @@ const title = ref("");
|
|||||||
const dateRange = ref([]);
|
const dateRange = ref([]);
|
||||||
const deptName = ref("");
|
const deptName = ref("");
|
||||||
const deptOptions = ref(undefined);
|
const deptOptions = ref(undefined);
|
||||||
|
const enabledDeptOptions = ref(undefined);
|
||||||
const initPassword = ref(undefined);
|
const initPassword = ref(undefined);
|
||||||
const postOptions = ref([]);
|
const postOptions = ref([]);
|
||||||
const roleOptions = ref([]);
|
const roleOptions = ref([]);
|
||||||
@@ -627,12 +628,6 @@ const filterNode = (value, data) => {
|
|||||||
watch(deptName, (val) => {
|
watch(deptName, (val) => {
|
||||||
proxy.$refs["deptTreeRef"].filter(val);
|
proxy.$refs["deptTreeRef"].filter(val);
|
||||||
});
|
});
|
||||||
/** 查询部门下拉树结构 */
|
|
||||||
function getDeptTree() {
|
|
||||||
deptTreeSelect().then((response) => {
|
|
||||||
deptOptions.value = response.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@@ -644,6 +639,25 @@ function getList() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/** 查询部门下拉树结构 */
|
||||||
|
function getDeptTree() {
|
||||||
|
deptTreeSelect().then(response => {
|
||||||
|
deptOptions.value = response.data;
|
||||||
|
enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/** 过滤禁用的部门 */
|
||||||
|
function filterDisabledDept(deptList) {
|
||||||
|
return deptList.filter(dept => {
|
||||||
|
if (dept.disabled) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (dept.children && dept.children.length) {
|
||||||
|
dept.children = filterDisabledDept(dept.children);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
};
|
||||||
/** 节点单击事件 */
|
/** 节点单击事件 */
|
||||||
function handleNodeClick(data) {
|
function handleNodeClick(data) {
|
||||||
queryParams.value.deptId = data.id;
|
queryParams.value.deptId = data.id;
|
||||||
|
Reference in New Issue
Block a user