update filter tree selected
This commit is contained in:
parent
f1d1b722d8
commit
47909bf034
1 changed files with 170 additions and 156 deletions
|
|
@ -123,8 +123,9 @@ const myFilterMethod = (node: any, filter: string) => {
|
||||||
const filt = filter;
|
const filt = filter;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
((node.name && node.name == null) || !node.name) &&
|
// ((node.name && node.name == null) || !node.name) &&
|
||||||
((node.organizationName && node.organizationName.indexOf(filt) > -1) ||
|
(node.name && node.name.indexOf(filt) > -1) ||
|
||||||
|
(node.organizationName && node.organizationName.indexOf(filt) > -1) ||
|
||||||
(node.positionNum && node.positionNum.indexOf(filt) > -1) ||
|
(node.positionNum && node.positionNum.indexOf(filt) > -1) ||
|
||||||
(node.positionName && node.positionName.indexOf(filt) > -1) ||
|
(node.positionName && node.positionName.indexOf(filt) > -1) ||
|
||||||
(node.governmentCode &&
|
(node.governmentCode &&
|
||||||
|
|
@ -139,7 +140,7 @@ const myFilterMethod = (node: any, filter: string) => {
|
||||||
(node.executivePosition && node.executivePosition.indexOf(filt) > -1) ||
|
(node.executivePosition && node.executivePosition.indexOf(filt) > -1) ||
|
||||||
(node.executivePositionSide &&
|
(node.executivePositionSide &&
|
||||||
node.executivePositionSide.indexOf(filt) > -1) ||
|
node.executivePositionSide.indexOf(filt) > -1) ||
|
||||||
(node.positionLevel && node.positionLevel.indexOf(filt) > -1))
|
(node.positionLevel && node.positionLevel.indexOf(filt) > -1)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -354,6 +355,7 @@ const selectedPosition = async (data: any) => {
|
||||||
dataForm.positionTypeId = "";
|
dataForm.positionTypeId = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkPosition = (val: string) => {
|
const checkPosition = (val: string) => {
|
||||||
const num = placementPosition.value.findIndex((e: string) => e === val);
|
const num = placementPosition.value.findIndex((e: string) => e === val);
|
||||||
return num;
|
return num;
|
||||||
|
|
@ -368,38 +370,52 @@ watch(props, () => {
|
||||||
});
|
});
|
||||||
console.log("personal", personal.value);
|
console.log("personal", personal.value);
|
||||||
}
|
}
|
||||||
if (personal.value.draft === false) {
|
|
||||||
const findData = dataRespone.value.find(findByPerson);
|
// console.log("draft===>", personal.value.draft);
|
||||||
console.log(findData);
|
|
||||||
loadTreeData();
|
if (personal.value.draft === true) {
|
||||||
selectedPosition(findData.children.children.children)
|
// const findData = dataRespone.value.find(findByPerson);
|
||||||
|
let findData: any = null;
|
||||||
|
dataRespone.value.map((x: any) => {
|
||||||
|
findData = findByPerson(x);
|
||||||
|
if (findData != null) {
|
||||||
|
console.log("findData===>", findData);
|
||||||
|
selectedPosition(findData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// loadTreeData();
|
||||||
|
// selectedPosition(findData.children.children.children)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const findByPerson = (obj: any) => {
|
|
||||||
if (
|
function findByPerson(element: any) {
|
||||||
obj.positionLineId === personal.value.positionLineId &&
|
// console.log("searchTree element===>", element)
|
||||||
obj.positionTypeId === personal.value.positionTypeId &&
|
if (element.positionNumId && element.positionLineId === personal.value.positionLineId &&
|
||||||
obj.positionNumId === personal.value.posNoId
|
element.positionTypeId === personal.value.positionTypeId &&
|
||||||
|
element.positionNumId === personal.value.posNoId
|
||||||
) {
|
) {
|
||||||
return true;
|
return element;
|
||||||
|
} else if (element.children) {
|
||||||
|
var i;
|
||||||
|
var result = null;
|
||||||
|
for (i = 0; result == null && i < element.children.length; i++) {
|
||||||
|
result = findByPerson(element.children[i]);
|
||||||
}
|
}
|
||||||
if (obj.children && obj.children.length > 0) {
|
return result;
|
||||||
obj.children = obj.children.find(findByPerson);
|
|
||||||
return obj.children;
|
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="props.modal" persistent>
|
<q-dialog v-model="props.modal" persistent>
|
||||||
<q-card style="width: 700px; max-width: 80vw">
|
<q-card style="width: 900px; max-width: 80vw">
|
||||||
<q-form ref="myFormPosition">
|
<q-form ref="myFormPosition">
|
||||||
<DialogHeader title="เลือกหน่วยงานที่รับบรรจุ" :close="closeModal" />
|
<DialogHeader title="เลือกหน่วยงานที่รับบรรจุ" :close="closeModal" />
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section class="q-pa-sm bg-grey-1">
|
<q-card-section class="q-pa-sm bg-grey-1">
|
||||||
<div class="row col-12 q-col-gutter-sm">
|
<div class="row col-12 q-col-gutter-sm">
|
||||||
<div class="col-xs-12 col-sm-6 row">
|
<div class="col-xs-12 col-sm-7 row">
|
||||||
<q-card flat bordered class="fit q-pa-sm">
|
<q-card flat bordered class="fit q-pa-sm">
|
||||||
<q-scroll-area visible style="height: 70vh">
|
<q-scroll-area visible style="height: 70vh">
|
||||||
<q-input
|
<q-input
|
||||||
|
|
@ -462,16 +478,14 @@ const findByPerson = (obj: any) => {
|
||||||
clickable
|
clickable
|
||||||
:active="selected == prop.node.keyId"
|
:active="selected == prop.node.keyId"
|
||||||
@click="selectedPosition(prop.node)"
|
@click="selectedPosition(prop.node)"
|
||||||
:disable="
|
:disable="prop.node.name != null ||
|
||||||
prop.node.name != null ||
|
|
||||||
checkPosition(prop.node.positionNumId) != -1
|
checkPosition(prop.node.positionNumId) != -1
|
||||||
"
|
"
|
||||||
active-class="my-list-link text-primary text-weight-medium"
|
active-class="my-list-link text-primary text-weight-medium"
|
||||||
class="row items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
|
class="row items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="
|
v-if="prop.node.avatar == '' ||
|
||||||
prop.node.avatar == '' ||
|
|
||||||
prop.node.avatar ==
|
prop.node.avatar ==
|
||||||
'https://cdn.quasar.dev/img/boy-avatar.png'
|
'https://cdn.quasar.dev/img/boy-avatar.png'
|
||||||
"
|
"
|
||||||
|
|
@ -540,7 +554,7 @@ const findByPerson = (obj: any) => {
|
||||||
</q-scroll-area>
|
</q-scroll-area>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-6">
|
<div class="col-xs-12 col-sm-5">
|
||||||
<q-card flat bordered class="fit q-pa-sm">
|
<q-card flat bordered class="fit q-pa-sm">
|
||||||
<q-scroll-area visible style="height: 70vh">
|
<q-scroll-area visible style="height: 70vh">
|
||||||
<div class="row col-12 q-col-gutter-xs">
|
<div class="row col-12 q-col-gutter-xs">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue