diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index 0b9e0fb9f..1a7087759 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -1,12 +1,13 @@ import env from "../index"; -const registryNew = `${env.API_URI}/org/profile/`; +const registryNew = `${env.API_URI}/org/profile`; const metadata = `${env.API_URI}/org/metadata/`; const salaryNew = `${env.API_URI}/org/profile/salary`; export default { - registryNew, - registryNewByProfileId: (profileId: string) => `${registryNew}${profileId}`, + registryNew: (type: string) => `${registryNew}${type}`, + registryNewByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/${profileId}`, // metadata profileNewMetaMain: `${metadata}main/person`, @@ -15,132 +16,132 @@ export default { profileNewSubDistrictByDId: (id: string) => `${metadata}district/${id}`, // ประวัติส่วนตัว - profileNewProfileByProfileId: (profileId: string) => - `${registryNew}${profileId}`, - profileNewProfileById: (dataId: string) => `${registryNew}${dataId}`, - profileNewProfileHisById: (dataId: string) => - `${registryNew}history/${dataId}`, + profileNewProfileById: (dataId: string, type: string) => + `${registryNew}${type}/${dataId}`, + profileNewProfileHisById: (dataId: string, type: string) => + `${registryNew}${type}/history/${dataId}`, // ข้อมูลที่อยู่ - profileNewAddressByProfileId: (profileId: string) => - `${registryNew}address/${profileId}`, - profileNewAddressById: (dataId: string) => `${registryNew}address/${dataId}`, - profileNewAddressHisById: (dataId: string) => - `${registryNew}address/history/${dataId}`, + profileNewAddressByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/address/${profileId}`, + profileNewAddressById: (dataId: string, type: string) => + `${registryNew}${type}/address/${dataId}`, + profileNewAddressHisById: (dataId: string, type: string) => + `${registryNew}${type}/address/history/${dataId}`, // บันทึกวันที่ไม่ได้รับเงินเดือนฯ - profileNewNoPaid: `${registryNew}nopaid`, + profileNewNoPaid: `${registryNew}/nopaid`, profileNewNoPaidByProfileId: (profileId: string) => - `${registryNew}nopaid/${profileId}`, - profileNewNoPaidById: (dataId: string) => `${registryNew}nopaid/${dataId}`, + `${registryNew}/nopaid/${profileId}`, + profileNewNoPaidById: (dataId: string) => `${registryNew}/nopaid/${dataId}`, profileNewNoPaidHisById: (dataId: string) => - `${registryNew}nopaid/history/${dataId}`, + `${registryNew}/nopaid/history/${dataId}`, // เครื่องราชฯ - profileNewInsign: `${registryNew}insignia`, + profileNewInsign: `${registryNew}/insignia`, profileNewInsignByProfileId: (profileId: string) => - `${registryNew}insignia/${profileId}`, - profileNewInsignById: (dataId: string) => `${registryNew}insignia/${dataId}`, + `${registryNew}/insignia/${profileId}`, + profileNewInsignById: (dataId: string) => `${registryNew}/insignia/${dataId}`, profileNewInsignHisById: (dataId: string) => - `${registryNew}insignia/history/${dataId}`, + `${registryNew}/insignia/history/${dataId}`, // ประกาศเกียรติคุณ - profileNewHonor: `${registryNew}honor`, + profileNewHonor: `${registryNew}/honor`, profileNewHonorByProfileId: (profileId: string) => - `${registryNew}honor/${profileId}`, - profileNewHonorById: (dataId: string) => `${registryNew}honor/${dataId}`, + `${registryNew}/honor/${profileId}`, + profileNewHonorById: (dataId: string) => `${registryNew}/honor/${dataId}`, profileNewHonorHisById: (dataId: string) => - `${registryNew}honor/history/${dataId}`, + `${registryNew}/honor/history/${dataId}`, // ผลการประเมินการปฏิบัติราชการ - profileNewAssessments: `${registryNew}assessments`, + profileNewAssessments: `${registryNew}/assessments`, profileNewAssessmentsByProfileId: (profileId: string) => - `${registryNew}assessments/${profileId}`, + `${registryNew}/assessments/${profileId}`, profileNewAssessmentsById: (dataId: string) => - `${registryNew}assessments/${dataId}`, + `${registryNew}/assessments/${dataId}`, profileNewAssessmentsHisById: (dataId: string) => - `${registryNew}assessments/history/${dataId}`, + `${registryNew}/assessments/history/${dataId}`, // การฝึกอบรม - profileNewTraining: `${registryNew}training`, + profileNewTraining: `${registryNew}/training`, profileNewTrainingByProfileId: (profileId: string) => - `${registryNew}training/${profileId}`, + `${registryNew}/training/${profileId}`, profileNewTrainingByTrainingId: (trainingId: string) => - `${registryNew}training/${trainingId}`, + `${registryNew}/training/${trainingId}`, profileNewTrainingHisByTrainingId: (trainingId: string) => - `${registryNew}training/history/${trainingId}`, + `${registryNew}/training/history/${trainingId}`, // ประวัติการศึกษา - profileNewEducation: `${registryNew}educations`, + profileNewEducation: `${registryNew}/educations`, profileNewEducationByProfileId: (profileId: string) => - `${registryNew}educations/${profileId}`, + `${registryNew}/educations/${profileId}`, profileNewEducationByEducationId: (educationId: string) => - `${registryNew}educations/${educationId}`, + `${registryNew}/educations/${educationId}`, profileNewEducationHisByEducationId: (educationsId: string) => - `${registryNew}educations/history/${educationsId}`, + `${registryNew}/educations/history/${educationsId}`, // ความสามารถพิเศษ - profileNewAbility: `${registryNew}ability`, + profileNewAbility: `${registryNew}/ability`, profileNewAbilityByProfileId: (profileId: string) => - `${registryNew}ability/${profileId}`, + `${registryNew}/ability/${profileId}`, profileNewAbilityByAbilityId: (abilityId: string) => - `${registryNew}ability/${abilityId}`, + `${registryNew}/ability/${abilityId}`, profileNewAbilityHisByAbilityId: (abilityId: string) => - `${registryNew}ability/history/${abilityId}`, + `${registryNew}/ability/history/${abilityId}`, // ใบอนุญาตประกอบวิชาชีพ - profileNewCertificate: `${registryNew}certificate`, + profileNewCertificate: `${registryNew}/certificate`, profileNewCertificateByProfileId: (profileId: string) => - `${registryNew}certificate/${profileId}`, + `${registryNew}/certificate/${profileId}`, profileNewCertificateByCertificateId: (certificateId: string) => - `${registryNew}certificate/${certificateId}`, + `${registryNew}/certificate/${certificateId}`, profileNewCertificateHisByCertificateId: (certificateId: string) => - `${registryNew}certificate/history/${certificateId}`, + `${registryNew}/certificate/history/${certificateId}`, // ข้อมูลอื่นๆ - profileNewOther: `${registryNew}other`, + profileNewOther: `${registryNew}/other`, profileNewOtherByProfileId: (profileId: string) => - `${registryNew}other/${profileId}`, - profileNewOtherById: (dataId: string) => `${registryNew}other/${dataId}`, + `${registryNew}/other/${profileId}`, + profileNewOtherById: (dataId: string) => `${registryNew}/other/${dataId}`, profileNewOtherHisById: (dataId: string) => - `${registryNew}other/history/${dataId}`, + `${registryNew}/other/history/${dataId}`, // ข้อมูลครอบครัว - profileNewFamily: `${registryNew}family`, + profileNewFamily: `${registryNew}/family`, profileNewFamilyByProfileId: (profileId: string) => - `${registryNew}family/${profileId}`, + `${registryNew}/family/${profileId}`, profileNewFamilyByFamilyId: (familyId: string) => - `${registryNew}family/${familyId}`, + `${registryNew}/family/${familyId}`, profileNewFamilyHisByFamilyId: (familyId: string) => - `${registryNew}family/history/${familyId}`, + `${registryNew}/family/history/${familyId}`, // วินัย - profileNewDiscipline: `${registryNew}discipline`, + profileNewDiscipline: `${registryNew}/discipline`, profileNewDisciplineByProfileId: (profileId: string) => - `${registryNew}discipline/${profileId}`, + `${registryNew}/discipline/${profileId}`, profileNewDisciplineByDisciplineId: (disciplineId: string) => - `${registryNew}discipline/${disciplineId}`, + `${registryNew}/discipline/${disciplineId}`, profileNewDisciplineHisByDisciplineId: (disciplineId: string) => - `${registryNew}discipline/history/${disciplineId}`, + `${registryNew}/discipline/history/${disciplineId}`, // ปฏิบัติราชการพิเศษ - profileNewDuty: `${registryNew}duty`, + profileNewDuty: `${registryNew}/duty`, profileNewDutyByProfileId: (profileId: string) => - `${registryNew}duty/${profileId}`, - profileNewDutyByDutyId: (dutyId: string) => `${registryNew}duty/${dutyId}`, + `${registryNew}/duty/${profileId}`, + profileNewDutyByDutyId: (dutyId: string) => `${registryNew}/duty/${dutyId}`, profileNewDutyHisByDutyId: (dutyId: string) => - `${registryNew}duty/history/${dutyId}`, + `${registryNew}/duty/history/${dutyId}`, //ข้อมูลราชการ - profileNewGovernment: () => `${registryNew}government`, - profileNewGovernmentById: (id: string) => `${registryNew}government/${id}`, + profileNewGovernment: () => `${registryNew}/government`, + profileNewGovernmentById: (id: string) => `${registryNew}/government/${id}`, profileNewGovernmentHistory: (id: string) => - `${registryNew}government/history/${id}`, + `${registryNew}/government/history/${id}`, //การลา - profileNewLeave: () => `${registryNew}leave`, - profileNewLeaveById: (id: string) => `${registryNew}leave/${id}`, - profileNewLeaveHistory: (id: string) => `${registryNew}leave/history/${id}`, + profileNewLeave: () => `${registryNew}/leave`, + profileNewLeaveById: (id: string) => `${registryNew}/leave/${id}`, + profileNewLeaveHistory: (id: string) => `${registryNew}/leave/history/${id}`, profileCheckDate: () => `${env.API_URI}/leave/user/check`, profileNewLeaveType: () => `${env.API_URI}/leave/type`, @@ -153,11 +154,11 @@ export default { `${salaryNew}/swap/${type}/${id}`, // ประวัติการเปลี่ยนชื่อ-นามสกุล - profileNewChangeName: `${registryNew}changeName`, - profileNewChangeNameByProfileId: (profileId: string) => - `${registryNew}changeName/${profileId}`, - profileNewChangeNameByChangeNameId: (changeNameId: string) => - `${registryNew}changeName/${changeNameId}`, - profileNewChangeNameHisByChangeNameId: (changeNameId: string) => - `${registryNew}changeName/history/${changeNameId}`, + profileNewChangeName: (type: string) => `${registryNew}${type}/changeName`, + profileNewChangeNameByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/changeName/${profileId}`, + profileNewChangeNameByChangeNameId: (changeNameId: string, type: string) => + `${registryNew}${type}/changeName/${changeNameId}`, + profileNewChangeNameHisByChangeNameId: (changeNameId: string, type: string) => + `${registryNew}${type}/changeName/history/${changeNameId}`, }; diff --git a/src/modules/04_registryNew/components/TableView.vue b/src/modules/04_registryNew/components/TableView.vue index f7470769c..35fa9fd72 100644 --- a/src/modules/04_registryNew/components/TableView.vue +++ b/src/modules/04_registryNew/components/TableView.vue @@ -23,6 +23,7 @@ const props = defineProps({ fetchData: { type: Function }, fetchType: { type: Function }, total: { type: Number }, + empType: { type: String }, }); const columns = ref([ @@ -166,7 +167,11 @@ function onClickHistory() { } function onClickViewDetail(id: string) { - router.push(`/registry-new/${id}`); + if (props.empType === "officer") { + router.push(`/registry-new/${id}`); + } else { + router.push(`/registry-new-employee/${id}`); + } } watch( diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue index dc2cc1d55..84021f7e6 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue @@ -28,6 +28,9 @@ const { calculateAge, fetchPerson, filterSelector } = store; const profileId = ref( route.params.id ? route.params.id.toString() : "" ); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const currentPage = ref(1); const maxPage = ref(1); @@ -256,7 +259,7 @@ const visibleColumnsHistory = ref([ async function getData() { showLoader(); await http - .get(config.API.profileNewProfileByProfileId(profileId.value)) + .get(config.API.registryNewByProfileId(profileId.value, empType.value)) .then((res) => { informaData.value = res.data.result; if (informaData.value) { @@ -281,7 +284,7 @@ const calculateMaxDate = () => { async function editData() { showLoader(); await http - .put(config.API.profileNewProfileById(id.value), { + .put(config.API.profileNewProfileById(id.value, empType.value), { ...formData, }) .then((res) => { @@ -299,7 +302,6 @@ async function editData() { function onClickOpenDialog() { if (!informaData.value) return; modal.value = true; - id.value = informaData.value.id; age.value = calculateAge(informaData.value.birthDate); formData.citizenId = informaData.value.citizenId; @@ -332,7 +334,7 @@ function onSubmit() { async function clickHistory() { modalHistory.value = true; await http - .get(config.API.profileNewProfileHisById(id.value)) + .get(config.API.profileNewProfileHisById(id.value,empType.value)) .then((res) => { rowsHistory.value = res.data.result; }) @@ -383,7 +385,14 @@ onMounted(async () => { > แก้ไขข้อมูล - + ประวัติแก้ไขข้อมูลส่วนตัว @@ -465,297 +474,297 @@ onMounted(async () => { + tittle="แก้ไขประวัติส่วนตัว" + :close="() => (modal = false)" + />
-
- + -
-
- + -
-
- + -
-
- -
-
- -
-
- - - - - -
-
- -
-
- + +
+
+ +
+
+ + + + + +
+
+ +
+
+ -
-
- + -
-
- -
-
- -
-
- + +
+
+ +
+
+ -
-
- + -
-
- -
+ />
+
+ +
+
- บันทึกข้อมูล - + dense + unelevated + label="บันทึก" + id="onSubmit" + type="submit" + color="public" + class="q-px-md" + > + บันทึกข้อมูล +
@@ -764,92 +773,90 @@ onMounted(async () => { + tittle="ประวัติแก้ไขข้อมูลส่วนตัว" + :close="() => (modalHistory = false)" + /> -
- - - - - -
- - + + - > - diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue index f13ac6e3a..69416b122 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue @@ -30,6 +30,10 @@ const { const submitDisable = ref(true); const { fetchPerson } = store; const profileId = ref(route.params.id.toString()); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); + const editId = ref(""); const dialog = ref(false); const dialogStatus = ref("create"); @@ -315,7 +319,7 @@ async function uploadFileURL(uploadUrl: string, file: any) { async function fetchDataPersonal() { showLoader(); await http - .get(config.API.registryNewByProfileId(profileId.value)) + .get(config.API.registryNewByProfileId(profileId.value, empType.value)) .then((res) => { profileInfo.value = res.data.result; }) @@ -353,7 +357,7 @@ async function fetchProfile(id: string) { async function addData() { await http - .post(config.API.profileNewChangeName, { + .post(config.API.profileNewChangeName(empType.value), { ...changeNameData, }) .then((res) => { @@ -372,10 +376,13 @@ async function addData() { function editData(idData: string) { http - .patch(config.API.profileNewChangeNameByChangeNameId(idData), { - ...changeNameData, - profileId: undefined, - }) + .patch( + config.API.profileNewChangeNameByChangeNameId(idData, empType.value), + { + ...changeNameData, + profileId: undefined, + } + ) .then(() => { fetchData(profileId.value); success($q, "บันทึกข้อมูลสำเร็จ"); @@ -429,7 +436,7 @@ function deleteFileData(idData: string) { async function fetchHistoryData(id: string) { showLoader(); await http - .get(config.API.profileNewChangeNameHisByChangeNameId(id)) + .get(config.API.profileNewChangeNameHisByChangeNameId(id, empType.value)) .then(async (res) => { historyRows.value = res.data.result; }) @@ -456,7 +463,7 @@ function closeHistoryDialog() { async function fetchData(id: string) { showLoader(); await http - .get(config.API.profileNewChangeNameByProfileId(id)) + .get(config.API.profileNewChangeNameByProfileId(id, empType.value)) .then(async (res) => { rows.value = res.data.result; }) @@ -901,39 +908,38 @@ watch(
- - บันทึกข้อมูล - - + } + " + > + บันทึกข้อมูล + +
- - + + tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล" + :close="closeHistoryDialog" + /> @@ -1003,7 +1009,7 @@ watch( - + diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/03_Address.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/03_Address.vue index 4cee5d5e8..0673166c6 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/03_Address.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/03_Address.vue @@ -35,6 +35,9 @@ const { const profileId = ref( route.params.id ? route.params.id.toString() : "" ); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const currentPage = ref(1); const maxPage = ref(1); @@ -251,7 +254,7 @@ const columnsHistory = ref([ async function getData() { showLoader(); await http - .get(config.API.profileNewAddressByProfileId(profileId.value)) + .get(config.API.profileNewAddressByProfileId(profileId.value,empType.value)) .then((res) => { Object.assign(addressData, res.data.result); @@ -366,7 +369,7 @@ async function fetchAll() { async function editData() { showLoader(); await http - .patch(config.API.profileNewAddressById(id.value), { + .patch(config.API.profileNewAddressById(id.value,empType.value), { ...formData, id: undefined, }) @@ -420,7 +423,7 @@ async function onClickOpenDialog() { async function clickHistory() { modalHistory.value = true; await http - .get(config.API.profileNewAddressHisById(id.value)) + .get(config.API.profileNewAddressHisById(id.value,empType.value)) .then((res) => { rowsHistory.value = res.data.result; }) @@ -482,14 +485,21 @@ onMounted(async () => { แก้ไขข้อมูล - + ประวัติข้อมูลที่อยู่ @@ -572,6 +582,127 @@ onMounted(async () => { +
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + + +
+ +
{ hide-bottom-space type="textarea" class="inputgreen" - v-model="formData.registrationAddress" - :label="dataLabel.registrationAddress" - :rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]" + v-model="formData.currentAddress" + :label="dataLabel.currentAddress" + :rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]" />
@@ -599,11 +730,11 @@ onMounted(async () => { option-label="name" input-debounce="0" class="inputgreen" - v-model="formData.registrationProvinceId" + v-model="formData.currentProvinceId" :options="store.Ops.provinceOps" - :label="dataLabel.registrationProvince" + :label="dataLabel.currentProvince" :rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]" - @update:model-value="(value:string) => selectProvince(value, '1')" + @update:model-value="(value:string) => selectProvince(value, '2')" @filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps' ) " @@ -622,11 +753,11 @@ onMounted(async () => { option-label="name" input-debounce="0" class="inputgreen" - v-model="formData.registrationDistrictId" - :options="store.Ops.districtOps" - :label="dataLabel.registrationDistrict" + v-model="formData.currentDistrictId" + :options="store.Ops.districtCOps" + :label="dataLabel.currentDistrict" :rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]" - @update:model-value="(value:string) => selectDistrict(value, '1')" + @update:model-value="(value:string) => selectDistrict(value, '2')" @filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps' ) " @@ -645,11 +776,11 @@ onMounted(async () => { option-label="name" input-debounce="0" class="inputgreen" - v-model="formData.registrationSubDistrictId" - :options="store.Ops.subdistrictOps" - :label="dataLabel.registrationSubDistrict" + v-model="formData.currentSubDistrictId" + :options="store.Ops.subdistrictCOps" + :label="dataLabel.currentSubDistrict" :rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]" - @update:model-value="(value:string) => selectSubDistrict(value, '1')" + @update:model-value="(value:string) => selectSubDistrict(value, '2')" @filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps' ) " @@ -662,133 +793,12 @@ onMounted(async () => { outlined lazy-rules hide-bottom-space - v-model="formData.registrationZipCode" + v-model="formData.currentZipCode" :label="dataLabel.registrationZipCode" />
- -
- - - -
- -
-
- -
-
-
- -
-
- -
-
- -
-
- -
-
-
+
diff --git a/src/modules/04_registryNew/router.ts b/src/modules/04_registryNew/router.ts index 45327c5b2..1f5bc5ec3 100644 --- a/src/modules/04_registryNew/router.ts +++ b/src/modules/04_registryNew/router.ts @@ -23,6 +23,16 @@ export default [ Role: "organization", }, }, + { + path: "/registry-new-employee/:id", + name: "registryNewEmployeeByid", + component: detailPage, + meta: { + Auth: true, + Key: [7], + Role: "organization", + }, + }, // { // path: "/registry-new/list", diff --git a/src/modules/04_registryNew/views/detailView.vue b/src/modules/04_registryNew/views/detailView.vue index 870e0d77d..54f4ba160 100644 --- a/src/modules/04_registryNew/views/detailView.vue +++ b/src/modules/04_registryNew/views/detailView.vue @@ -37,6 +37,10 @@ const { } = mixin; const profileId = ref(route.params.id.toString()); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); + const formDetail = ref(); const itemsMenu = ref([ { @@ -142,7 +146,7 @@ async function fetchProfile(id: string) { async function fetchDataPersonal() { showLoader(); await http - .get(config.API.registryNewByProfileId(profileId.value)) + .get(config.API.registryNewByProfileId(profileId.value, empType.value)) .then((res) => { formDetail.value = res.data.result; }) diff --git a/src/modules/04_registryNew/views/list.vue b/src/modules/04_registryNew/views/list.vue index 25d52e4e1..60a259e5d 100644 --- a/src/modules/04_registryNew/views/list.vue +++ b/src/modules/04_registryNew/views/list.vue @@ -148,7 +148,10 @@ async function fetchDataPerson(search: boolean = false) { // check type person empType.value http - .get(config.API.registryNew, { params: queryParams }) + .get( + config.API.registryNew(empType.value !== "officer" ? "-employee" : ""), + { params: queryParams } + ) .then((res) => { maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); dataPersonMain.value = res.data.result.data; @@ -646,6 +649,7 @@ onMounted(async () => { :fetchData="fetchDataPerson" :fetchType="fetchType" :total="total" + :empType="empType" />