diff --git a/src/api/05_placement/api.probation.ts b/src/api/05_placement/api.probation.ts index e81bc8db0..a4f54e3ea 100644 --- a/src/api/05_placement/api.probation.ts +++ b/src/api/05_placement/api.probation.ts @@ -34,6 +34,8 @@ export default { changestatusProbations: (personalId: string) => `${evaluate}/report/change-status?personal_id=${personalId}`, + + // probationGetAssignList: (personalId: string) => // `${finish}/probation-assign-list?personal_id=${personalId}`, // clearPosition: (personalId:string) => `${placement}/position/clear/${personalId}` diff --git a/src/components/Dialogs/PopupPersonalNew.vue b/src/components/Dialogs/PopupPersonalNew.vue index 3dedffa82..d9664e4cb 100644 --- a/src/components/Dialogs/PopupPersonalNew.vue +++ b/src/components/Dialogs/PopupPersonalNew.vue @@ -109,9 +109,8 @@ async function fetchInformation(id: string) { imformation.age = data.birthDate ? calculateAge(data.birthDate) : "-"; imformation.gender = data.gender ?? "-"; - avatar.fullname = data.createdFullName - ? `${data.prefix}${data.lastUpdateFullName}` - : "-"; + avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`; + avatar.position = data.position ? data.position : "-"; }) .catch((err) => { @@ -133,15 +132,19 @@ async function fetchProfileGov(id: string) { .get(config.API.profileNewGovernmentById(id)) .then((res) => { const data = res.data.result; - goverment.oc = data.org ?? "-"; - goverment.posNo = data.posMasterNo ?? "-"; - goverment.position = data.position ?? "-"; - goverment.positionPathSide = data.positionArea ?? "-"; - goverment.positionLine = data.positionField ?? "-"; - goverment.positionType = data.posType ?? "-"; - goverment.positionLevel = data.posLevel ?? "-"; - goverment.positionExecutive = data.posExecutive ?? "-"; - goverment.positionExecutiveSide = data.positionExecutiveField ?? "-"; + goverment.oc = data.org !== "" ? data.org : "-"; + goverment.posNo = data.posMasterNo !== "" ? data.posMasterNo : "-"; + goverment.position = data.position !== "" ? data.position : "-"; + goverment.positionPathSide = + data.positionArea !== "" ? data.positionArea : "-"; + goverment.positionLine = + data.positionField !== "" ? data.positionField : "-"; + goverment.positionType = data.posType !== "" ? data.posType : "-"; + goverment.positionLevel = data.posLevel !== "" ? data.posLevel : "-"; + goverment.positionExecutive = + data.posExecutive !== "" ? data.posExecutive : "-"; + goverment.positionExecutiveSide = + data.positionExecutiveField !== "" ? data.positionExecutiveField : "-"; }) .catch((err) => { @@ -168,11 +171,11 @@ watch( () => props.modal, async () => { modal.value = props.modal ? props.modal : false; - modal.value && - props.id && - (await fetchInformation(props.id), await fetchProfileGov(props.id)), + if (modal.value) { + props.id && (fetchInformation(props.id), fetchProfileGov(props.id)); (fileName.value = `profile-${props.id}`), - await fetchProfile(props.id as string); + fetchProfile(props.id as string); + } } ); @@ -189,9 +192,8 @@ async function fetchProfile(id: string) { .then(async (res) => { avatar.avatar = res.data.downloadUrl; }) - .catch(() => {}) .finally(() => { - hideLoader(); + statusLoad.value.val = true; }); } diff --git a/src/modules/02_organizationalNew/components/DialogAddPosition.vue b/src/modules/02_organizationalNew/components/DialogAddPosition.vue index 4860a9e3e..3ac2c622d 100644 --- a/src/modules/02_organizationalNew/components/DialogAddPosition.vue +++ b/src/modules/02_organizationalNew/components/DialogAddPosition.vue @@ -112,7 +112,6 @@ function validateFormPositionEdit() { } function saveSelectEdit() { - console.log(formPositionSelect.positionExecutive); dialogConfirm( $q, async () => { @@ -133,8 +132,9 @@ function saveSelectEdit() { posDictField: formPositionSelect.positionField, //สายงาน posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง - posExecutiveId: dataExecutive, //ตำแหน่งทางการบริหาร - posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร + posExecutiveId: dataExecutive ?? "", //ตำแหน่งทางการบริหาร + posDictExecutiveField: + formPositionSelect.positionExecutiveField ?? "", //ด้านทางการบริหาร posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา isSpecial: isSpecial.value, } @@ -143,7 +143,7 @@ function saveSelectEdit() { posDictField: formPositionSelect.positionField, //สายงาน posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง - posExecutive: dataExecutive, //ตำแหน่งทางการบริหาร + posExecutive: dataExecutive ?? "", //ตำแหน่งทางการบริหาร posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา isSpecial: isSpecial.value, @@ -169,7 +169,6 @@ function saveSelectEdit() { } /** ฟังชั่น บันทึก */ function onSubmitSelectEdit() { - console.log(formPositionSelect.positionExecutive); dialogConfirm( $q, async () => { @@ -182,6 +181,7 @@ function onSubmitSelectEdit() { ? config.API.orgPosPosition : config.API.orgPosPositionExecutive(); showLoader(); + const body = shape.value == "false" ? { @@ -189,7 +189,7 @@ function onSubmitSelectEdit() { posDictField: formPositionSelect.positionField, //สายงาน posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง - posExecutiveId: dataExecutive, //ตำแหน่งทางการบริหาร + posExecutiveId: dataExecutive ?? "", //ตำแหน่งทางการบริหาร posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา isSpecial: isSpecial.value, @@ -199,11 +199,12 @@ function onSubmitSelectEdit() { posDictField: formPositionSelect.positionField, //สายงาน posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง - posExecutive: dataExecutive, //ตำแหน่งทางการบริหาร + posExecutive: dataExecutive ?? "", //ตำแหน่งทางการบริหาร posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา isSpecial: isSpecial.value, }; + await http .post(url, body) .then(() => { @@ -313,10 +314,9 @@ watch( if (modal.value === true) { await fetchType(); await fetchExecutive(); - if (props.data) { const dataList = props.data; - console.log(dataList); + updateSelectType(dataList.posTypeId); formPositionSelect.positionId = dataList.id; formPositionSelect.positionName = dataList.positionName; diff --git a/src/modules/04_registry/components/Salary.vue b/src/modules/04_registry/components/Salary.vue index 079629228..4538d1a1c 100644 --- a/src/modules/04_registry/components/Salary.vue +++ b/src/modules/04_registry/components/Salary.vue @@ -150,7 +150,6 @@ :class="getClass(edit)" :outlined="edit" dense - :borderless="!edit" :model-value="date2Thai(formDataSalary.date)" :rules="[ @@ -198,6 +197,7 @@
v.name === tempPositionLevelInput.value + (v:any) => v.name === tempPositionLevelInput.value ) ) { createValue(tempPositionLevelInput.value); diff --git a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue index 0faa5a41d..b08374d15 100644 --- a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue +++ b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue @@ -30,6 +30,8 @@ const { hideLoader, success, dialogRemove, + findOrgName, + findPosMasterNo, } = mixin; const visibleColumns = ref([ @@ -73,7 +75,7 @@ const columns = ref([ { name: "posNo", align: "left", - label: "ตำแหน่งเลขที่", + label: "เลขที่ตำแหน่ง", sortable: true, field: "posNo", headerStyle: "font-size: 14px", @@ -91,7 +93,7 @@ const columns = ref([ { name: "positionLevel", align: "left", - label: "ระดับ", + label: "ประเภทตำแหน่ง", sortable: true, field: "positionLevel", headerStyle: "font-size: 14px", @@ -181,8 +183,13 @@ const getData = async () => { id: item.id, fullname: `${item.prefix}${item.firstName} ${item.lastName}`, position: item.position, - posNo: item.posNo, - positionLevel: item.positionLevel, + posNo: findPosMasterNo(item), + positionLevel: + item.posTypeName == null && item.posLevelName == null + ? "-" + : (item.posTypeName != null ? item.posTypeName : "") + + " " + + (item.posLevelName != null ? ` (${item.posLevelName})` : ""), createdAt: date2Thai(item.createdAt), organization: item.organization, reason: item.reason, @@ -323,7 +330,7 @@ onMounted(async () => { :props="props" @click="openDetail(props.row.id)" > - {{ props.row.position }} + {{ props.row.position ?? "-" }} (false); const personalId = ref(""); @@ -67,10 +67,10 @@ const getData = async () => { prefix.value = data.prefix; firstName.value = data.firstName; lastName.value = data.lastName; - avatar.value = data.avatar ?? ""; - position.value = data.position; + + position.value = data.position ?? "-"; posNo.value = data.posNo; - positionLevel.value = data.positionLevel; + positionLevel.value = `${data.posTypeName}(${data.posLevelName})`; createdAt.value = data.createdAt; organization.value = data.organization; reason.value = data.reason; @@ -82,6 +82,7 @@ const getData = async () => { positionNumberOld.value = data.positionNumberOld; organizationPositionOld.value = data.organizationPositionOld; dateRepatriation.value = data.dateRepatriation; + fetchProfile(data.profileId); }) .catch((e) => { messageError($q, e); @@ -91,6 +92,27 @@ const getData = async () => { }); }; +function fetchProfile(id: string) { + showLoader(); + http + .get( + config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) + ) + .then(async (res) => { + avatar.value = res.data.downloadUrl; + }) + .catch((e) => { + if (e.response.data.message === "ไม่พบไฟล์ในระบบ") { + avatar.value = ""; + } else { + messageError($q, e); + } + }) + .finally(() => { + hideLoader(); + }); +} + const getClass = (val: boolean) => { return { "full-width inputgreen cursor-pointer": val, @@ -200,15 +222,15 @@ onMounted(async () => {
ตำแหน่งในสายงาน
- {{ positionTypeOld }} + {{ position }}
-
ระดับ
+
ประเภทตำแหน่ง
- {{ positionLevelOld }} + {{ positionLevel }}
@@ -216,7 +238,7 @@ onMounted(async () => {
สังกัด
- {{ organizationPositionOld }} + {{ organization }}
diff --git a/src/modules/05_placement/components/helpgovernment/governmentDetail.vue b/src/modules/05_placement/components/helpgovernment/governmentDetail.vue index f22988124..aa3e2b197 100644 --- a/src/modules/05_placement/components/helpgovernment/governmentDetail.vue +++ b/src/modules/05_placement/components/helpgovernment/governmentDetail.vue @@ -7,7 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { QForm } from "quasar"; import type { resHelpDetail } from "@/modules/05_placement/interface/response/officer"; -import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; +import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue"; const modalPersonal = ref(false); const personId = ref(""); @@ -60,28 +60,52 @@ const getData = async () => { (id.value = data.id); profileId.value = data.profileId; prefix.value = data.prefix; - avatar.value = data.avatar ?? ""; firstName.value = data.firstName; lastName.value = data.lastName; - position.value = data.position; + position.value = data.position ?? "-"; posNo.value = data.posNo; - positionLevel.value = data.positionLevel; + positionLevel.value = `${data.posTypeName}(${data.posLevelName})`; createdAt.value = data.createdAt; organization.value = data.organization; reason.value = data.reason; status.value = data.status; dateStart.value = data.dateStart; dateEnd.value = data.dateEnd; - positionTypeOld.value = data.positionTypeOld; - positionLevelOld.value = data.positionLevelOld; + positionTypeOld.value = data.position; + positionLevelOld.value = `${data.posTypeName}(${data.posLevelName})`; positionNumberOld.value = data.positionNumberOld; organizationPositionOld.value = data.organizationPositionOld; + fetchProfile(data.profileId); + }) + .catch((e) => { + messageError($q, e); }) - .catch((e) => {}) .finally(() => { hideLoader(); }); }; + +function fetchProfile(id: string) { + showLoader(); + http + .get( + config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) + ) + .then(async (res) => { + avatar.value = res.data.downloadUrl; + }) + .catch((e) => { + if (e.response.data.message === "ไม่พบไฟล์ในระบบ") { + avatar.value = ""; + } else { + messageError($q, e); + } + }) + .finally(() => { + hideLoader(); + }); +} + const getClass = (val: boolean) => { return { "full-width inputgreen cursor-pointer": val, @@ -124,7 +148,7 @@ const saveData = async () => { showLoader(); await http .put(config.API.officerMainEdit(dataId), body) - .then((res: any) => { + .then(() => { success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ"); edit.value = false; }) @@ -190,15 +214,15 @@ onMounted(async () => {
ตำแหน่งในสายงาน
- {{ positionTypeOld }} + {{ position }}
-
ระดับ
+
ประเภทตำแหน่ง
- {{ positionLevelOld }} + {{ positionLevel }}
@@ -206,7 +230,7 @@ onMounted(async () => {
สังกัด
- {{ organizationPositionOld }} + {{ organization }}
diff --git a/src/modules/05_placement/components/helpgovernment/mainHelp.vue b/src/modules/05_placement/components/helpgovernment/mainHelp.vue index 6bda234e8..b5a6c995d 100644 --- a/src/modules/05_placement/components/helpgovernment/mainHelp.vue +++ b/src/modules/05_placement/components/helpgovernment/mainHelp.vue @@ -31,6 +31,8 @@ const { hideLoader, success, dialogRemove, + findOrgName, + findPosMasterNo, } = mixin; //ค้นหา คอลัมน์ คอลัมน์ที่แสดง @@ -71,7 +73,7 @@ const columns = ref([ { name: "posNo", align: "left", - label: "ตำแหน่งเลขที่", + label: "เลขที่ตำแหน่ง", sortable: true, field: "posNo", headerStyle: "font-size: 14px", @@ -89,7 +91,7 @@ const columns = ref([ { name: "positionLevel", align: "left", - label: "ระดับ", + label: "ประเภทตำแหน่ง", sortable: true, field: "positionLevel", headerStyle: "font-size: 14px", @@ -196,9 +198,14 @@ const getData = async () => { rows.value = data.map((item: officerType) => ({ id: item.id, fullname: `${item.prefix}${item.firstName} ${item.lastName}`, - position: item.position, - posNo: item.posNo, - positionLevel: item.positionLevel, + position: item.position != null ? item.position : "-", + posNo: findPosMasterNo(item), + positionLevel: + item.posTypeName == null && item.posLevelName == null + ? "-" + : (item.posTypeName != null ? item.posTypeName : "") + + " " + + (item.posLevelName != null ? ` (${item.posLevelName})` : ""), createdAt: date2Thai(item.createdAt), organization: item.organization, reason: item.reason, @@ -209,13 +216,14 @@ const getData = async () => { positionTypeOld: item.positionTypeOld, positionLevelOld: item.positionLevelOld, positionNumberOld: item.positionNumberOld, - organizationPositionOld: item.organizationPositionOld, + organizationPositionOld: findOrgName(item), isActive: item.isActive, - dateEnd: item.dateEnd == null ? "-" : date2Thai(new Date(item.dateEnd)), + dateEnd: item.dateEnd == null ? "" : date2Thai(new Date(item.dateEnd)), dateStart: - item.dateStart == null ? "-" : date2Thai(new Date(item.dateStart)), + item.dateStart == null ? "" : date2Thai(new Date(item.dateStart)), })); }) + .catch((e) => {}) .finally(() => { hideLoader(); @@ -243,6 +251,7 @@ onMounted(async () => { await getData(); }); +