เปลี่ยนชื่อเมื่อค้นหา
This commit is contained in:
parent
013ac6e4ff
commit
89ec10e853
2 changed files with 34 additions and 10 deletions
|
|
@ -71,6 +71,11 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
|||
node: "เลือกหน่วยงาน/ส่วนราชการ",
|
||||
});
|
||||
|
||||
const nodeData = reactive<any>({
|
||||
nodeId: null,
|
||||
node: null,
|
||||
});
|
||||
|
||||
return {
|
||||
fetchType,
|
||||
fetchLevel,
|
||||
|
|
@ -83,5 +88,6 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
|||
mode,
|
||||
formFilter,
|
||||
labelOption,
|
||||
nodeData
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const nodeData = reactive<any>({
|
|||
round: "",
|
||||
nodeId: null,
|
||||
node: null,
|
||||
name: "เลือกหน่วยงาน/ส่วนราชการ",
|
||||
keyword: "",
|
||||
});
|
||||
const conditionTotal = computed(() => {
|
||||
|
|
@ -142,9 +143,9 @@ function fetchDataPerson() {
|
|||
queryParams.type = empType.value;
|
||||
}
|
||||
|
||||
if(nodeData.node !== null && nodeData.nodeId !== null){
|
||||
queryParams.node = nodeData.node
|
||||
queryParams.nodeId = nodeData.nodeId
|
||||
if (nodeData.node !== null && nodeData.nodeId !== null) {
|
||||
queryParams.node = nodeData.node;
|
||||
queryParams.nodeId = nodeData.nodeId;
|
||||
}
|
||||
http
|
||||
.get(
|
||||
|
|
@ -314,6 +315,8 @@ async function fetchTree(id: string) {
|
|||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
node.value = data;
|
||||
store.nodeData.node = nodeData.node;
|
||||
store.nodeData.nodeId = nodeData.nodeId;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -337,6 +340,14 @@ function fetchActive() {
|
|||
});
|
||||
}
|
||||
|
||||
function sendNode() {
|
||||
nodeData.node = store.nodeData.node;
|
||||
nodeData.nodeId = store.nodeData.nodeId;
|
||||
store.labelOption.node = nodeData.name;
|
||||
selectNode.value = false;
|
||||
fetchDataPerson();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => selectNode.value,
|
||||
() => {
|
||||
|
|
@ -348,14 +359,14 @@ watch(
|
|||
|
||||
function updateSelectedTreeMain(data: any) {
|
||||
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
||||
nodeData.node = null;
|
||||
nodeData.nodeId = null;
|
||||
store.nodeData.node = null;
|
||||
store.nodeData.nodeId = null;
|
||||
nodeData.name = "เลือกหน่วยงาน/ส่วนราชการ";
|
||||
} else {
|
||||
nodeData.node = data.orgLevel;
|
||||
nodeData.nodeId = data.orgTreeId;
|
||||
store.nodeData.node = data.orgLevel;
|
||||
store.nodeData.nodeId = data.orgTreeId;
|
||||
nodeData.name = data.orgName;
|
||||
}
|
||||
selectNode.value = false
|
||||
fetchDataPerson()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -650,7 +661,7 @@ onMounted(async () => {
|
|||
<q-item
|
||||
clickable
|
||||
@click.stop="updateSelectedTreeMain(prop.node)"
|
||||
:active="nodeData.nodeId === prop.node.orgTreeId"
|
||||
:active="store.nodeData.nodeId === prop.node.orgTreeId"
|
||||
active-class="my-list-link text-primary text-weight-medium"
|
||||
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
|
||||
>
|
||||
|
|
@ -673,6 +684,13 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn label="ค้นหา" color="secondary" @click="sendNode"
|
||||
><q-tooltip>ค้นหา</q-tooltip></q-btn
|
||||
>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue