Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-21 16:05:29 +07:00
commit 1ee826236f
2 changed files with 36 additions and 10 deletions

View file

@ -62,6 +62,7 @@ const positionId = ref<string>("");
const seletcId = ref<string>("");
const selectedPos = ref<any[]>([]);
const datePos = ref<Date>(new Date());
const posMasterMain = ref<any>([]);
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchOrganizationActive() {
@ -140,6 +141,7 @@ async function fetchDataTable(id: string, level: number = 0) {
.post(config.API.orgPosPlacement, body)
.then((res) => {
const dataMain: PositionMaim[] = [];
posMasterMain.value = res.data.result.data;
res.data.result.data.forEach((e: PositionNo) => {
const p = e.positions;
if (p.length !== 0) {
@ -149,6 +151,7 @@ async function fetchDataTable(id: string, level: number = 0) {
dataMain.push(data);
}
});
positionNo.value = store.fetchPosNo(dataMain);
})
.catch((err) => {
@ -190,7 +193,12 @@ async function fetchPosFind(level: number, id: string) {
}
/** function บันทึกข้อมูลตำแหน่ง*/
function onClickSubmit() {
async function onClickSubmit() {
const dataPosMaster = await posMasterMain.value?.find(
(e: any) => e.id === positionId.value
);
const dataNode = await filterNodeFn(nodes.value, nodeId.value);
if (selectedPos.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
} else {
@ -203,7 +211,12 @@ function onClickSubmit() {
posmasterId: positionId.value,
positionId: selectedPos.value[0].id,
reportingDate: datePos.value,
organizationName: dataNode.orgTreeName, //
orgTreeShortName: dataNode.orgTreeShortName, //
posPath: selectedPos.value[0].positionName, //
posNumber: dataPosMaster.posMasterNo, //()
};
await http
.post(config.API.placementPass(), body)
.then(() => {
@ -261,6 +274,20 @@ function filterItemsTaps(data: TreeMain[]) {
itemTaps.value = orgTreeIds;
return orgTreeIds;
}
function filterNodeFn(data: any, id: string) {
for (const child of data) {
if (child.orgTreeId === id) {
return child;
} else if (child.children) {
const result: any = filterNodeFn(child.children, id);
if (result !== null) {
return result;
}
}
}
return null;
}
</script>
<template>
<q-dialog v-model="modal" full-width persistent>

View file

@ -306,6 +306,9 @@ async function getTable() {
nodeId: data.nodeId,
posmasterId: data.posmasterId,
positionId: data.positionId,
orgTreeShortName: data.orgTreeShortName,
posPath: data.posPath,
posNumber: data.posNumber,
};
rowsAll.value.push(rowData);
});
@ -687,20 +690,16 @@ onMounted(async () => {
<div class="text-weight-medium">
{{ props.row.orgName !== null ? props.row.orgName : "-" }}
{{
props.row.organizationShortName !== null
? `(${props.row.organizationShortName})`
props.row.orgTreeShortName !== null
? `(${props.row.orgTreeShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{ props.row.posPath !== null ? props.row.posPath : "-" }}
{{
props.row.positionPath !== null
? props.row.positionPath
: "-"
}}
{{
props.row.positionNumber !== null
? `(${props.row.positionNumber})`
props.row.orgTreeShortName !== null
? `(${props.row.orgTreeShortName}${props.row.posNumber})`
: ""
}}
</div>