ปรับ API ทะเบียนประวัติ (ใหม่)

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-13 18:06:06 +07:00
parent e100ac0ec3
commit f91f3d9b40
8 changed files with 645 additions and 598 deletions

View file

@ -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}`,
};

View file

@ -23,6 +23,7 @@ const props = defineProps({
fetchData: { type: Function },
fetchType: { type: Function },
total: { type: Number },
empType: { type: String },
});
const columns = ref<QTableProps["columns"]>([
@ -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(

View file

@ -28,6 +28,9 @@ const { calculateAge, fetchPerson, filterSelector } = store;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
@ -256,7 +259,7 @@ const visibleColumnsHistory = ref<String[]>([
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 () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn dense flat round icon="mdi-history" color="info" @click="clickHistory">
<q-btn
dense
flat
round
icon="mdi-history"
color="info"
@click="clickHistory"
>
<q-tooltip>ประวแกไขขอมลสวนต</q-tooltip>
</q-btn>
</div>
@ -465,297 +474,297 @@ onMounted(async () => {
<q-card>
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader
tittle="แก้ไขประวัติส่วนตัว"
:close="() => (modal = false)"
/>
tittle="แก้ไขประวัติส่วนตัว"
:close="() => (modal = false)"
/>
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
maxlength="13"
mask="#############"
v-model="formData.citizenId"
class="inputgreen"
:label="dataLabel.citizenId"
:rules="[
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
maxlength="13"
mask="#############"
v-model="formData.citizenId"
class="inputgreen"
:label="dataLabel.citizenId"
:rules="[
(val: string) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`,
(val: string) =>
val.length >= 13 ||
`${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`,
]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.prefix"
class="inputgreen"
:options="store.Ops.prefixOps"
:label="dataLabel.prefix"
:rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.prefix"
class="inputgreen"
:options="store.Ops.prefixOps"
:label="dataLabel.prefix"
:rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
clearable
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.rank"
class="inputgreen"
:options="store.Ops.rankOps"
:label="dataLabel.rank"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
clearable
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.rank"
class="inputgreen"
:options="store.Ops.rankOps"
:label="dataLabel.rank"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.firstName"
class="inputgreen"
:label="dataLabel.firstName"
:rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.lastName"
class="inputgreen"
:label="dataLabel.lastName"
:rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
:max-date="calculateMaxDate()"
borderless
:enableTimePicker="false"
week-start="0"
menu-class-name="modalfix"
v-model="formData.birthDate"
:locale="'th'"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
for="inputDatereceive"
ref="dateReceivedRef"
outlined
dense
hide-bottom-space
class="inputgreen"
:model-value="
formData.birthDate != null
? date2Thai(formData.birthDate)
: null
"
:label="dataLabel.birthDate"
:rules="[
(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`,
]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
readonly
v-model="age"
:label="dataLabel.age"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.gender"
class="inputgreen"
:options="store.Ops.genderOps"
:label="dataLabel.gender"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.firstName"
class="inputgreen"
:label="dataLabel.firstName"
:rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="formData.lastName"
class="inputgreen"
:label="dataLabel.lastName"
:rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
:max-date="calculateMaxDate()"
borderless
:enableTimePicker="false"
week-start="0"
menu-class-name="modalfix"
v-model="formData.birthDate"
:locale="'th'"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
for="inputDatereceive"
ref="dateReceivedRef"
outlined
dense
hide-bottom-space
class="inputgreen"
:model-value="
formData.birthDate != null
? date2Thai(formData.birthDate)
: null
"
:label="dataLabel.birthDate"
:rules="[
(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`,
]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
readonly
v-model="age"
:label="dataLabel.age"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="name"
v-model="formData.gender"
class="inputgreen"
:options="store.Ops.genderOps"
:label="dataLabel.gender"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.relationship"
:options="store.Ops.statusOps"
:label="dataLabel.relationship"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.relationship"
:options="store.Ops.statusOps"
:label="dataLabel.relationship"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
class="inputgreen"
v-model="formData.nationality"
:label="dataLabel.nationality"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
class="inputgreen"
v-model="formData.ethnicity"
:label="dataLabel.ethnicity"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
v-model="formData.religion"
class="inputgreen"
:options="store.Ops.religionOps"
:label="dataLabel.religion"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
class="inputgreen"
v-model="formData.nationality"
:label="dataLabel.nationality"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
class="inputgreen"
v-model="formData.ethnicity"
:label="dataLabel.ethnicity"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
v-model="formData.religion"
class="inputgreen"
:options="store.Ops.religionOps"
:label="dataLabel.religion"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
v-model="formData.bloodGroup"
class="inputgreen"
:options="store.Ops.bloodOps"
:label="dataLabel.bloodGroup"
@filter="(inputValue: any,
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
clearable
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="name"
option-label="name"
input-debounce="0"
v-model="formData.bloodGroup"
class="inputgreen"
:options="store.Ops.bloodOps"
:label="dataLabel.bloodGroup"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps'
)"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
mask="##########"
class="inputgreen"
v-model="formData.phone"
:label="dataLabel.phone"
/>
</div>
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
mask="##########"
class="inputgreen"
v-model="formData.phone"
:label="dataLabel.phone"
/>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
@ -764,92 +773,90 @@ onMounted(async () => {
<q-dialog v-model="modalHistory" persistent>
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขข้อมูลส่วนตัว"
:close="() => (modalHistory = false)"
/>
tittle="ประวัติแก้ไขข้อมูลส่วนตัว"
:close="() => (modalHistory = false)"
/>
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
>
<template v-slot:append>
<q-icon
v-if="filterHistory == ''"
name="search"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
<d-table
ref="table"
flat
bordered
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
:columns="columnsHistory"
:rows="rowsHistory"
class="custom-header-table"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
<template v-slot:append>
<q-icon
v-if="filterHistory == ''"
name="search"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columnsHistory"
:rows="rowsHistory"
class="custom-header-table"
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
<q-separator />
<q-card-actions align="right">
</q-card-actions>
<q-card-actions align="right"> </q-card-actions>
</q-card>
</q-dialog>
</template>

View file

@ -30,6 +30,10 @@ const {
const submitDisable = ref<boolean>(true);
const { fetchPerson } = store;
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const editId = ref<string>("");
const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("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(
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
id="onSubmit"
type="submit"
dense
:disable="submitDisable"
unelevated
label="บันทึก"
color="public"
class="q-px-md"
@click="
() => {
if (!!fileUpload && dialogStatus === 'create') {
alertUpload = false;
} else {
alertUpload = true;
}
<q-btn
id="onSubmit"
type="submit"
dense
:disable="submitDisable"
unelevated
label="บันทึก"
color="public"
class="q-px-md"
@click="
() => {
if (!!fileUpload && dialogStatus === 'create') {
alertUpload = false;
} else {
alertUpload = true;
}
"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
}
"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<q-dialog v-model="historyDialog" class="dialog" persistent>
<q-card style="min-width: 70%">
<q-card style="min-width: 70%">
<dialog-header
tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล"
:close="closeHistoryDialog"
/>
tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล"
:close="closeHistoryDialog"
/>
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
@ -1003,7 +1009,7 @@ watch(
</template>
</d-table>
</q-card-section>
</q-card>
</q-card>
</q-dialog>
</template>

View file

@ -35,6 +35,9 @@ const {
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
@ -251,7 +254,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
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 () => {
<q-btn
flat
round
dense=""
dense
icon="mdi-pencil-outline"
color="primary"
@click="onClickOpenDialog"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn dense flat round icon="mdi-history" color="info" @click="clickHistory">
<q-btn
dense
flat
round
icon="mdi-history"
color="info"
@click="clickHistory"
>
<q-tooltip>ประวอมลทอย</q-tooltip>
</q-btn>
</div>
@ -572,6 +582,127 @@ onMounted(async () => {
<DialogHeader tittle="แก้ไขข้อมูลที่อยู่" :close="clickClose" />
<q-separator color="grey-4" />
<q-card-section style="max-height: 60vh" class="scroll">
<div class="col-12 q-pb-xs">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
type="textarea"
class="inputgreen"
v-model="formData.registrationAddress"
:label="dataLabel.registrationAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
/>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationProvinceId"
:options="store.Ops.provinceOps"
:label="dataLabel.registrationProvince"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
@update:model-value="(value:string) => selectProvince(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationDistrictId"
:options="store.Ops.districtOps"
:label="dataLabel.registrationDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
@update:model-value="(value:string) => selectDistrict(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.registrationSubDistrictId"
:options="store.Ops.subdistrictOps"
:label="dataLabel.registrationSubDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]"
@update:model-value="(value:string) => selectSubDistrict(value, '1')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="formData.registrationZipCode"
:label="dataLabel.registrationZipCode"
/>
</div>
</div>
<!-- same address ? -->
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-medium"
>อยจจนตรงกบทอยตามทะเบยนบาน</label
>
<q-radio
dense
val="1"
label="ใช่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
<q-radio
dense
val="0"
label="ไม่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
</div>
<!-- current address -->
<div v-if="sameAddress === '0'">
<div class="col-12 q-pb-xs">
<q-input
dense
@ -580,9 +711,9 @@ 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 || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
/>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
@ -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"
/>
</div>
</div>
<!-- same address ? -->
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
<label class="text-medium"
>อยจจนตรงกบทอยตามทะเบยนบาน</label
>
<q-radio
dense
val="1"
label="ใช่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
<q-radio
dense
val="0"
label="ไม่"
checked-icon="task_alt"
class="inputgreen"
v-model="sameAddress"
unchecked-icon="panorama_fish_eye"
/>
</div>
<!-- current address -->
<div v-if="sameAddress === '0'">
<div class="col-12 q-pb-xs">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
type="textarea"
class="inputgreen"
v-model="formData.currentAddress"
:label="dataLabel.currentAddress"
:rules="[(val:string) => !!val || `${'กรุณากรอก ที่อยู่ปัจจุบัน'}`]"
/>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentProvinceId"
:options="store.Ops.provinceOps"
:label="dataLabel.currentProvince"
:rules="[(val:string) => !!val || `${'กรุณาเลือก จังหวัด'}`]"
@update:model-value="(value:string) => selectProvince(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'provinceOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentDistrictId"
:options="store.Ops.districtCOps"
:label="dataLabel.currentDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เขต / อำเภอ'}`]"
@update:model-value="(value:string) => selectDistrict(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'districtOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-select
dense
outlined
use-input
lazy-rules
emit-value
map-options
hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0"
class="inputgreen"
v-model="formData.currentSubDistrictId"
:options="store.Ops.subdistrictCOps"
:label="dataLabel.currentSubDistrict"
:rules="[(val:string) => !!val || `${'กรุณาเลือก แขวง / ตำบล'}`]"
@update:model-value="(value:string) => selectSubDistrict(value, '2')"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'subdistrictOps'
) "
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="formData.currentZipCode"
:label="dataLabel.registrationZipCode"
/>
</div>
</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">

View file

@ -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",

View file

@ -37,6 +37,10 @@ const {
} = mixin;
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const formDetail = ref<ResponseObject>();
const itemsMenu = ref<DataOption[]>([
{
@ -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;
})

View file

@ -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"
/>
</q-card-section>
</q-card>