update 优化用户选择器
This commit is contained in:
parent
6f2298c88a
commit
d6c6b77672
@ -96,7 +96,7 @@
|
||||
</el-row>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="userDialog.closeDialog">取消</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -152,6 +152,18 @@ const queryParams = ref<UserQuery>({
|
||||
roleId: ''
|
||||
});
|
||||
|
||||
const defaultSelectUserIds = computed(() => computedIds(prop.data));
|
||||
|
||||
/** 根据名称筛选部门树 */
|
||||
watchEffect(
|
||||
() => {
|
||||
deptTreeRef.value?.filter(deptName.value);
|
||||
},
|
||||
{
|
||||
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
||||
}
|
||||
);
|
||||
|
||||
const confirm = () => {
|
||||
emit('update:modelValue', selectUserList.value);
|
||||
emit('confirmCallBack', selectUserList.value);
|
||||
@ -166,23 +178,11 @@ const computedIds = (data) => {
|
||||
} else if (typeof data === 'number') {
|
||||
return [data];
|
||||
} else {
|
||||
console.warn('The data type of data should be array or string or number, but I received other');
|
||||
console.warn('<UserSelect> The data type of data should be array or string or number, but I received other');
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const defaultSelectUserIds = computed(() => computedIds(prop.data));
|
||||
|
||||
/** 根据名称筛选部门树 */
|
||||
watchEffect(
|
||||
() => {
|
||||
deptTreeRef.value?.filter(deptName.value);
|
||||
},
|
||||
{
|
||||
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
||||
}
|
||||
);
|
||||
|
||||
/** 通过条件过滤节点 */
|
||||
const filterNode = (value: string, data: any) => {
|
||||
if (!value) return true;
|
||||
@ -277,6 +277,13 @@ const initSelectUser = async () => {
|
||||
selectUserList.value = data;
|
||||
}
|
||||
};
|
||||
const close = () => {
|
||||
userDialog.closeDialog();
|
||||
tableRef.value.clearCheckboxReserve();
|
||||
tableRef.value.clearCheckboxRow();
|
||||
resetQuery();
|
||||
selectUserList.value = [];
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initSelectUser();
|
||||
|
Loading…
x
Reference in New Issue
Block a user