diff --git a/src/api/index.ts b/src/api/index.ts index 660556e1d..4b6fabe6d 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -26,7 +26,7 @@ const config = ref({ "https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230712_172702.json", MEET_URI: "meet.frappet.com", API_RETIREMENT_URI: "https://bma-ehr.frappet.synology.me/api/v1", - API_PROBATION_URI: "http://192.168.1.151:7776/v1", + API_PROBATION_URI: "https://ehr.joolsoft.com/v1", }, test: { API_URI: "http://localhost:5010/api/v1", diff --git a/src/modules/05_placement/components/probation/MainProbation.vue b/src/modules/05_placement/components/probation/MainProbation.vue index 18e4fa248..1fabf0f9e 100644 --- a/src/modules/05_placement/components/probation/MainProbation.vue +++ b/src/modules/05_placement/components/probation/MainProbation.vue @@ -6,73 +6,28 @@
- + เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ
- + - +
- +
@@ -127,55 +71,23 @@ - + - +
- +
@@ -436,11 +329,11 @@ onMounted(async () => { getpersonalList(); }); -// watch(modal, () => { -// if (modal.value === true) { -// getpersonalList(); -// } -// }); +watch(modal, () => { + if (modal.value === true) { + fecthlistPersonal(); + } +}); const getpersonalList = async () => { showLoader(); @@ -462,12 +355,30 @@ const getpersonalList = async () => { })); console.log("(data)", data); }) - .catch(() => {}) + .catch(() => { }) .finally(() => { hideLoader(); }); }; +// fecth profile +const fecthlistPersonal = async () => { + showLoader(); + await http + .get(config.API.profileOrganizRoot) + .then((res) => { + const id = res.data.result[0].id; + if (id !== "") { + findlist(id); + } + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +}; const findlist = async (id: string) => { let data = [ { criteriaType: "is_retire", criteriaValue: "false" }, @@ -478,7 +389,7 @@ const findlist = async (id: string) => { criterias: data, }) .then((res) => { - console.log("res:", res); + // console.log("res:", res); rows2.value = res.data.result.map((e: any) => ({ id: e.id, fullname: e.fullname, @@ -499,9 +410,9 @@ const clickDelete = (id: string) => { }, persistent: true, }) - .onOk(async () => {}) - .onCancel(() => {}) - .onDismiss(() => {}); + .onOk(async () => { }) + .onCancel(() => { }) + .onDismiss(() => { }); }; const clickAdd = (id: string) => { @@ -515,16 +426,23 @@ const clickAdd = (id: string) => { persistent: true, }) .onOk(async () => { + showLoader() const postData = { personal_id: id, }; - console.log("postData:", postData); + // console.log("postData:", postData); await http.post(config.API.personalAdd(), postData).then((res) => { - console.log("res:", res); + // console.log("res:", res); + getpersonalList(); + }).catch((e) => { + messageError($q, e); + }).finally(() => { + clickClose() + hideLoader() }); }) - .onCancel(() => {}) - .onDismiss(() => {}); + .onCancel(() => { }) + .onDismiss(() => { }); }; const clickClose = async () => {