mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
添加组织人数
This commit is contained in:
@@ -590,6 +590,10 @@ const closeDrawer = () => {
|
||||
visiable.value = false;
|
||||
nameSearch.value.keyword = "";
|
||||
selectedOrgKeys.value = [];
|
||||
|
||||
counts.value = 0
|
||||
keysId.value = []
|
||||
lists.value = []
|
||||
};
|
||||
|
||||
function searchAudi() {
|
||||
@@ -639,7 +643,7 @@ function stuStuOrgSelect(e) {
|
||||
const selectedOrgKeys = ref([]);
|
||||
|
||||
watch(selectedOrgKeys, () => {
|
||||
console.log("selectedKeys", selectedOrgKeys);
|
||||
// console.log("selectedKeys", selectedOrgKeys);
|
||||
});
|
||||
|
||||
function orgDel(i) {
|
||||
@@ -655,14 +659,68 @@ const listData = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
function onOrgSelectChange(e, l) {
|
||||
console.log(e, l);
|
||||
|
||||
const keysId = ref([])
|
||||
const counts = ref(0)
|
||||
const addOrMinus = ref(false)
|
||||
|
||||
const lists = ref([])
|
||||
const onOrgSelectChange = async (e, l) => {
|
||||
const uniqueElements = keysId.value.filter(element => !e.includes(element))
|
||||
.concat(e.filter(element => !keysId.value.includes(element)));
|
||||
|
||||
// let set = new Set()
|
||||
// for (let item of l.selectedNodes) {
|
||||
// if (e.includes(item?.id) && item.parentId !== '0') {
|
||||
// set.add(item.parentId);
|
||||
// }
|
||||
// }
|
||||
// console.log(e);
|
||||
// console.log(l.selectedNodes);
|
||||
// console.log(lists.value);
|
||||
// console.log([...set]);
|
||||
// if (!e.includes([...set][0])) {
|
||||
// console.log('不包含');
|
||||
// }
|
||||
// const setListId = lists.value.filter(element => ![...set].includes(element))
|
||||
// .concat([...set].filter(element => !lists.value.includes(element)));
|
||||
// console.log(setListId, '获取父级id');
|
||||
// if (setListId.length > 0 && [...set].length > 0) {
|
||||
// listData.departId = setListId[0]
|
||||
// const result = await userList(listData)
|
||||
// counts.value -= result.data.result.totalElement
|
||||
// } else if (setListId.length > 0 && [...set].length == 0) {
|
||||
// listData.departId = setListId[0]
|
||||
// const result = await userList(listData)
|
||||
// counts.value += result.data.result.totalElement
|
||||
// }
|
||||
// lists.value = [...set]
|
||||
|
||||
|
||||
if (keysId.value.length < e.length) {
|
||||
addOrMinus.value = true
|
||||
} else {
|
||||
addOrMinus.value = false
|
||||
}
|
||||
keysId.value = e
|
||||
listData.departId = uniqueElements[0]
|
||||
|
||||
|
||||
orgRowSelection.value = e;
|
||||
deptList.value = l.selectedNodes;
|
||||
// listData.departId = e[0]
|
||||
// userList(listData).then((res) => {
|
||||
// console.log(res);
|
||||
// })
|
||||
|
||||
userList(listData).then((res) => {
|
||||
if (res.status == 200) {
|
||||
if (!addOrMinus.value) {
|
||||
counts.value -= res.data.result.totalElement
|
||||
} else {
|
||||
counts.value += res.data.result.totalElement
|
||||
}
|
||||
}
|
||||
|
||||
console.log(counts.value);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const resetStu = () => {
|
||||
@@ -703,7 +761,7 @@ const handleOk = () => {
|
||||
|
||||
// 总人数
|
||||
const count = computed(() => {
|
||||
return (auditSelectRows.value?.reduce((acc, item) => acc + item.totalMember, 0) || 0) + stuSelectRows.value.length;
|
||||
return (auditSelectRows.value?.reduce((acc, item) => acc + item.totalMember, 0) || 0) + stuSelectRows.value.length + counts.value;
|
||||
})
|
||||
function handleDialogOk() {
|
||||
// if (auditSelectRowKeys.value.length || deptList.value.length) {
|
||||
@@ -739,6 +797,9 @@ function handleStageOk() {
|
||||
message.success("推荐成功");
|
||||
deleteDepSelect();
|
||||
emit("finash", true);
|
||||
counts.value = 0
|
||||
keysId.value = []
|
||||
lists.value = []
|
||||
}).catch(() => {
|
||||
message.error("推荐失败");
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user