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