เปลี่ยนชื่อเมื่อค้นหา
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: "เลือกหน่วยงาน/ส่วนราชการ",
|
node: "เลือกหน่วยงาน/ส่วนราชการ",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const nodeData = reactive<any>({
|
||||||
|
nodeId: null,
|
||||||
|
node: null,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fetchType,
|
fetchType,
|
||||||
fetchLevel,
|
fetchLevel,
|
||||||
|
|
@ -83,5 +88,6 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
||||||
mode,
|
mode,
|
||||||
formFilter,
|
formFilter,
|
||||||
labelOption,
|
labelOption,
|
||||||
|
nodeData
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ const nodeData = reactive<any>({
|
||||||
round: "",
|
round: "",
|
||||||
nodeId: null,
|
nodeId: null,
|
||||||
node: null,
|
node: null,
|
||||||
|
name: "เลือกหน่วยงาน/ส่วนราชการ",
|
||||||
keyword: "",
|
keyword: "",
|
||||||
});
|
});
|
||||||
const conditionTotal = computed(() => {
|
const conditionTotal = computed(() => {
|
||||||
|
|
@ -142,9 +143,9 @@ function fetchDataPerson() {
|
||||||
queryParams.type = empType.value;
|
queryParams.type = empType.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nodeData.node !== null && nodeData.nodeId !== null){
|
if (nodeData.node !== null && nodeData.nodeId !== null) {
|
||||||
queryParams.node = nodeData.node
|
queryParams.node = nodeData.node;
|
||||||
queryParams.nodeId = nodeData.nodeId
|
queryParams.nodeId = nodeData.nodeId;
|
||||||
}
|
}
|
||||||
http
|
http
|
||||||
.get(
|
.get(
|
||||||
|
|
@ -314,6 +315,8 @@ async function fetchTree(id: string) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
node.value = data;
|
node.value = data;
|
||||||
|
store.nodeData.node = nodeData.node;
|
||||||
|
store.nodeData.nodeId = nodeData.nodeId;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, 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(
|
watch(
|
||||||
() => selectNode.value,
|
() => selectNode.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -348,14 +359,14 @@ watch(
|
||||||
|
|
||||||
function updateSelectedTreeMain(data: any) {
|
function updateSelectedTreeMain(data: any) {
|
||||||
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
||||||
nodeData.node = null;
|
store.nodeData.node = null;
|
||||||
nodeData.nodeId = null;
|
store.nodeData.nodeId = null;
|
||||||
|
nodeData.name = "เลือกหน่วยงาน/ส่วนราชการ";
|
||||||
} else {
|
} else {
|
||||||
nodeData.node = data.orgLevel;
|
store.nodeData.node = data.orgLevel;
|
||||||
nodeData.nodeId = data.orgTreeId;
|
store.nodeData.nodeId = data.orgTreeId;
|
||||||
|
nodeData.name = data.orgName;
|
||||||
}
|
}
|
||||||
selectNode.value = false
|
|
||||||
fetchDataPerson()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -650,7 +661,7 @@ onMounted(async () => {
|
||||||
<q-item
|
<q-item
|
||||||
clickable
|
clickable
|
||||||
@click.stop="updateSelectedTreeMain(prop.node)"
|
@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"
|
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"
|
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>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</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-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue