diff --git a/src/components/Dialogs/DialogOrgSelect.vue b/src/components/Dialogs/DialogOrgSelect.vue index 49aaaa234..7feca2de9 100644 --- a/src/components/Dialogs/DialogOrgSelect.vue +++ b/src/components/Dialogs/DialogOrgSelect.vue @@ -244,6 +244,7 @@ function close() { async function getDataTable(id: string, level: number = 0) { showLoader(); + const body = { node: level, nodeId: id, @@ -308,10 +309,16 @@ async function getDataTable(id: string, level: number = 0) { * @param data ข่อมูล Tree */ function updateSelected(data: DataTree) { - positionId.value = ""; - seletcId.value = ""; - selectedPos.value = []; - datePos.value = new Date(); + if (props?.dataRows?.nodeId === data.orgTreeId) { + positionId.value = props?.dataRows?.posmasterId; + seletcId.value = props?.dataRows?.positionId; + datePos.value = props?.dataRows?.reportingDateFullDate; + } else { + positionId.value = ""; + seletcId.value = ""; + selectedPos.value = []; + datePos.value = new Date(); + } nodeId.value = data.orgTreeId ? data.orgTreeId : ""; nodeLevel.value = data.orgLevel; @@ -396,11 +403,50 @@ async function onClickSelectPos(id: string) { } } +/** + * function fetch ข้อมูล expanded tree + * @param level levelTree + * @param id treeId + */ +async function fetchPosFind(level: number, id: string) { + showLoader(); + const body = { + node: level, + nodeId: id, + }; + await http + .post(config.API.orgPosFind, body) + .then((res) => { + const data = res.data.result; + expanded.value = data; + nodeId.value = id; + positionId.value = props?.dataRows?.posmasterId; + seletcId.value = props?.dataRows?.positionId; + datePos.value = props?.dataRows?.reportingDateFullDate; + + getDataTable(nodeId.value, level); + }) + .catch((e) => { + messageError($q, e); + hideLoader(); + }); +} + watch( () => modal.value, - (n) => { + async (n) => { if (n == true) { getActive(); + if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) { + await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId); + if (positionId.value) { + setTimeout(async () => { + await onClickSelectPos(positionId.value); + }, 200); + } + } else { + expanded.value = []; + } } } ); @@ -436,7 +482,7 @@ function onSubmit() { (e: any) => e.id === positionId.value ); - console.log(dataPosMaster) + console.log(dataPosMaster); if (selectedPos.value.length === 0) { dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง"); } else { @@ -461,7 +507,6 @@ function onSubmit() { props.onSubmit?.(body); }); } - } diff --git a/src/modules/05_placement/components/AppointMent/Main.vue b/src/modules/05_placement/components/AppointMent/Main.vue index 3558340ba..0673a59ca 100644 --- a/src/modules/05_placement/components/AppointMent/Main.vue +++ b/src/modules/05_placement/components/AppointMent/Main.vue @@ -191,8 +191,8 @@ const fecthlistappointment = async () => { // })); rows2.value = rows.value.filter( - (e: orgFilter) => - e.orgName !== null && + (e: any) => + e.root !== null && e.status !== "REPORT" && e.status !== "DONE" && e.educationOld && @@ -232,7 +232,7 @@ const fecthTypeOption = async () => { // เปิดโครงสร้าง const openModalTree = (data: any, type: string) => { - personalId.value = data.id + personalId.value = data.id; modalTree.value = true; typeModal.value = type; dataRows.value = data; @@ -310,7 +310,6 @@ function onSave(data: any) { }); } - onMounted(() => { fecthlistappointment(); }); @@ -416,7 +415,11 @@ onMounted(() => { {{ props.row.status ? statusText(props.row.status) : "-" }}
- {{ props.row.status ? statusText(props.row.status) : "-" }} + {{ + props.row.dateOfBirth + ? date2Thai(props.row.dateOfBirth) + : "-" + }}
@@ -470,12 +473,7 @@ onMounted(() => { { {