ต่อ API
This commit is contained in:
parent
daa78078a2
commit
c776d4e7f1
10 changed files with 105 additions and 103 deletions
|
|
@ -201,4 +201,6 @@ export default {
|
|||
`${registryNew}-employee/employment/history/${id}`,
|
||||
|
||||
developMentPlan: `${registryNew}/development`,
|
||||
|
||||
requestInformationbyType:(type:string,id:string)=>`${registryNew}/request-edit/${type}/${id}`
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
import { ref, onMounted, watch } from "vue";
|
||||
|
||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||
import type { RequestAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
||||
import type { RequestregistrationAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
||||
|
||||
const storeLinkCenter = useDataLinkCenter();
|
||||
const formDataAddress = defineModel<RequestAddressObject>("formDataAddress", {
|
||||
const formDataAddress = defineModel<RequestregistrationAddressObject>("formDataAddress", {
|
||||
required: true,
|
||||
});
|
||||
const presentAddress = defineModel<string>("presentAddress", {
|
||||
|
|
@ -18,12 +18,6 @@ const dataLabel = {
|
|||
registrationDistrict: "เขต/อำเภอ",
|
||||
registrationSubDistrict: "แขวง / ตำบล",
|
||||
registrationZipCode: "รหัสไปรษณีย์",
|
||||
currentAddress: "ที่อยู่ปัจจุบัน",
|
||||
currentProvince: "จังหวัด",
|
||||
currentDistrict: "เขต/อำเภอ",
|
||||
currentSubDistrict: "แขวง / ตำบล",
|
||||
currentZipCode: "รหัสไปรษณีย์",
|
||||
registrationSame: "ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้าน",
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -37,10 +31,6 @@ async function selectProvince(e: string | null, name: string) {
|
|||
formDataAddress.value.registrationSubDistrictId = "";
|
||||
formDataAddress.value.registrationZipCode = "";
|
||||
formDataAddress.value.registrationDistrictId = "";
|
||||
} else {
|
||||
formDataAddress.value.currentSubDistrictId = "";
|
||||
formDataAddress.value.currentZipCode = "";
|
||||
formDataAddress.value.currentDistrictId = "";
|
||||
}
|
||||
await storeLinkCenter.fetchDistrict(e, name, true);
|
||||
}
|
||||
|
|
@ -56,9 +46,6 @@ async function selectDistrict(e: string | null, name: string) {
|
|||
if (name == "1") {
|
||||
formDataAddress.value.registrationSubDistrictId = "";
|
||||
formDataAddress.value.registrationZipCode = "";
|
||||
} else {
|
||||
formDataAddress.value.currentSubDistrictId = "";
|
||||
formDataAddress.value.currentZipCode = "";
|
||||
}
|
||||
await storeLinkCenter.fetchSubDistrict(e, name, true);
|
||||
}
|
||||
|
|
@ -81,7 +68,6 @@ function selectSubDistrict(e: string | null, name: string) {
|
|||
(r) => r.id == e
|
||||
);
|
||||
const namecode = findcode.length > 0 ? findcode[0].zipCode : "";
|
||||
formDataAddress.value.currentZipCode = namecode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,11 +78,6 @@ watch(
|
|||
() => presentAddress.value,
|
||||
(v) => {
|
||||
if (v === "0") {
|
||||
formDataAddress.value.currentAddress = "";
|
||||
formDataAddress.value.currentProvinceId = "";
|
||||
formDataAddress.value.currentDistrictId = "";
|
||||
formDataAddress.value.currentSubDistrictId = "";
|
||||
formDataAddress.value.currentZipCode = "";
|
||||
storeLinkCenter.OpsAddress.districtCOps = [];
|
||||
storeLinkCenter.OpsAddress.subdistrictCOps = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
||||
|
||||
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
||||
import type { FormPerson } from "@/modules/04_registryPerson/interface/index/family";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
||||
|
|
@ -15,6 +15,7 @@ import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popu
|
|||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const storeLinkCenter = useDataLinkCenter();
|
||||
const storeRequestEdit = useRequestEditStore();
|
||||
const storeProfile = useProfileDataStore();
|
||||
|
||||
const {
|
||||
|
|
@ -56,30 +57,30 @@ async function closeDialog() {
|
|||
fatherData.job = "";
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
fatherCitizenId: fatherData.citizenId,
|
||||
fatherPrefix: fatherData.prefix,
|
||||
fatherFirstName: fatherData.firstName,
|
||||
fatherLastName: fatherData.lastName,
|
||||
fatherCareer: fatherData.job,
|
||||
fatherLive: fatherData.isLive === 1 ? true : false,
|
||||
};
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.profileFamily("", "father"), body)
|
||||
.patch(
|
||||
config.API.requestInformationbyType("father", storeRequestEdit.profileId),
|
||||
body
|
||||
)
|
||||
.then(async (res) => {
|
||||
await upDateStatus();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.fetchData?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +103,7 @@ async function upDateStatus() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
||||
|
||||
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
||||
import type { FormPerson } from "@/modules/04_registryPerson/interface/index/family";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
||||
|
|
@ -16,6 +16,8 @@ const $q = useQuasar();
|
|||
const mixin = useCounterMixin();
|
||||
const storeLinkCenter = useDataLinkCenter();
|
||||
const storeProfile = useProfileDataStore();
|
||||
const storeRequestEdit = useRequestEditStore();
|
||||
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -55,30 +57,30 @@ async function closeDialog() {
|
|||
motherData.job = "";
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
motherCitizenId: motherData.citizenId,
|
||||
motherPrefix: motherData.prefix,
|
||||
motherFirstName: motherData.firstName,
|
||||
motherLastName: motherData.lastName,
|
||||
motherCareer: motherData.job,
|
||||
motherLive: motherData.isLive === 1 ? true : false,
|
||||
};
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.profileFamily("", "mother"), body)
|
||||
.patch(
|
||||
config.API.requestInformationbyType("mother", storeRequestEdit.profileId),
|
||||
body
|
||||
)
|
||||
.then(async (res) => {
|
||||
await upDateStatus();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.fetchData?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
||||
|
||||
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
||||
import type { FormPerson } from "@/modules/04_registryPerson/interface/index/family";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
||||
|
|
@ -16,6 +16,8 @@ const $q = useQuasar();
|
|||
const mixin = useCounterMixin();
|
||||
const storeLinkCenter = useDataLinkCenter();
|
||||
const storeProfile = useProfileDataStore();
|
||||
const storeRequestEdit = useRequestEditStore();
|
||||
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -59,11 +61,9 @@ async function closeDialog() {
|
|||
coupleData.statusMarital = "";
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
profileId: profileId.value,
|
||||
coupleCitizenId: coupleData.citizenId,
|
||||
couplePrefix: coupleData.prefix,
|
||||
coupleFirstName: coupleData.firstName,
|
||||
coupleLastName: coupleData.lastName,
|
||||
|
|
@ -72,19 +72,24 @@ async function onSubmit() {
|
|||
relationship: coupleData.statusMarital,
|
||||
coupleLastNameOld: coupleData.lastNameOld,
|
||||
};
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.profileFamily("", "couple"), body)
|
||||
.patch(
|
||||
config.API.requestInformationbyType(
|
||||
"couple",
|
||||
storeRequestEdit.profileId
|
||||
),
|
||||
body
|
||||
)
|
||||
.then(async (res) => {
|
||||
await upDateStatus();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.fetchData?.();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLinkageStore } from "@/stores/linkage";
|
||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
||||
|
||||
import type { RequestAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
||||
import type { RequestregistrationAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
||||
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
|
||||
import type {
|
||||
FormPerson,
|
||||
|
|
@ -27,6 +28,7 @@ const profileId = defineModel<string>("profileId", { required: true }); //id บ
|
|||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const storeLinkage = useLinkageStore();
|
||||
const storeRequestEdit = useRequestEditStore();
|
||||
const storeLinkCenter = useDataLinkCenter();
|
||||
const {
|
||||
showLoader,
|
||||
|
|
@ -62,13 +64,7 @@ const formInformations = reactive<RequestObject>({
|
|||
rank: null,
|
||||
});
|
||||
|
||||
const formDataAddress = reactive<RequestAddressObject>({
|
||||
currentZipCode: "",
|
||||
currentSubDistrictId: "",
|
||||
currentDistrictId: "",
|
||||
currentProvinceId: "",
|
||||
currentAddress: "",
|
||||
|
||||
const formDataAddress = reactive<RequestregistrationAddressObject>({
|
||||
registrationZipCode: "",
|
||||
registrationSubDistrictId: "",
|
||||
registrationDistrictId: "",
|
||||
|
|
@ -114,12 +110,6 @@ async function upDateInfomation() {
|
|||
/** อัพเดตข้อมูลที่อยู่ */
|
||||
async function upDateAddress() {
|
||||
if (presentAddress.value === "1") {
|
||||
formDataAddress.currentAddress = formDataAddress.registrationAddress;
|
||||
formDataAddress.currentProvinceId = formDataAddress.registrationProvinceId;
|
||||
formDataAddress.currentDistrictId = formDataAddress.registrationDistrictId;
|
||||
formDataAddress.currentSubDistrictId =
|
||||
formDataAddress.registrationSubDistrictId;
|
||||
formDataAddress.currentZipCode = formDataAddress.registrationZipCode;
|
||||
storeLinkCenter.OpsAddress.districtCOps =
|
||||
storeLinkCenter.OpsAddress.districtOps;
|
||||
storeLinkCenter.OpsAddress.subdistrictCOps =
|
||||
|
|
@ -162,16 +152,40 @@ async function upDateStatus() {
|
|||
/** อัพเดตข้อมูล */
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
registrationZipCode: formDataAddress.registrationZipCode,
|
||||
registrationSubDistrictId: formDataAddress.registrationSubDistrictId,
|
||||
registrationDistrictId: formDataAddress.registrationDistrictId,
|
||||
registrationProvinceId: formDataAddress.registrationProvinceId,
|
||||
registrationAddress: formDataAddress.registrationAddress,
|
||||
|
||||
bloodGroup: formInformations.bloodGroup,
|
||||
relationship: formInformations.relationship,
|
||||
gender: formInformations.gender,
|
||||
religion: formInformations.religion,
|
||||
nationality: formInformations.nationality,
|
||||
ethnicity: formInformations.ethnicity,
|
||||
birthDate: formInformations.birthDate,
|
||||
lastName: formInformations.lastName,
|
||||
firstName: formInformations.firstName,
|
||||
prefix: formInformations.prefix,
|
||||
rank: formInformations.rank,
|
||||
};
|
||||
showLoader();
|
||||
await upDateInfomation();
|
||||
await upDateAddress();
|
||||
if (count.value == 2) {
|
||||
await upDateStatus();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.fetchData?.();
|
||||
}
|
||||
hideLoader();
|
||||
http
|
||||
.patch(
|
||||
config.API.requestInformationbyType("myprofile", storeRequestEdit.profileId),
|
||||
body
|
||||
)
|
||||
.then(async (res) => {
|
||||
await upDateStatus();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -243,11 +257,6 @@ async function amiRequest() {
|
|||
formDataAddress.registrationSubDistrictId =
|
||||
data.value.registrationSubDistrictId;
|
||||
formDataAddress.registrationZipCode = data.value.registrationZipCode;
|
||||
formDataAddress.currentAddress = data.value.currentAddress;
|
||||
formDataAddress.currentProvinceId = data.value.currentProvinceId;
|
||||
formDataAddress.currentDistrictId = data.value.currentDistrictId;
|
||||
formDataAddress.currentSubDistrictId = data.value.currentSubDistrictId;
|
||||
formDataAddress.currentZipCode = data.value.currentZipCode;
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
@ -272,21 +281,11 @@ watch(
|
|||
"1",
|
||||
false
|
||||
);
|
||||
storeLinkCenter.fetchDistrict(
|
||||
formDataAddress.currentProvinceId,
|
||||
"2",
|
||||
false
|
||||
);
|
||||
storeLinkCenter.fetchSubDistrict(
|
||||
formDataAddress.registrationDistrictId,
|
||||
"1",
|
||||
false
|
||||
);
|
||||
storeLinkCenter.fetchSubDistrict(
|
||||
formDataAddress.currentDistrictId,
|
||||
"2",
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ function filterOption(val: string, update: Function) {
|
|||
*/
|
||||
function onclickEdit(data: Request) {
|
||||
requestId.value = data.id;
|
||||
store.profileId = data.profileId;
|
||||
router.push(`/registry-officer/request-edit/personal/${data.id}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ onMounted(async () => {
|
|||
|
||||
<template>
|
||||
<div class="q-gutter-sm q-pa-sm">
|
||||
<div class="toptitle text-dark row items-center q-py-xs">
|
||||
<div class="toptitle text-dark row items-center q-py-xs ">
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
|
|
@ -246,19 +246,19 @@ onMounted(async () => {
|
|||
@click="router.go(-1)"
|
||||
/>
|
||||
รายละเอียดคำร้องขอแก้ไขทะเบียนประวัติของ{{ dataRequest.fullname }}
|
||||
<q-space />
|
||||
<q-btn
|
||||
v-if="
|
||||
workflowRef?.permission.isUpdate &&
|
||||
topicConvert(dataRequest.topic) !== ''
|
||||
"
|
||||
color="public"
|
||||
:label="topicConvert(dataRequest.topic)"
|
||||
@click="onUpdate(dataRequest)"
|
||||
>
|
||||
<q-tooltip>{{ topicConvert(dataRequest.topic) }}</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<q-space />
|
||||
<q-btn
|
||||
v-if="
|
||||
workflowRef?.permission.isUpdate &&
|
||||
topicConvert(dataRequest.topic) !== ''
|
||||
"
|
||||
color="public"
|
||||
:label="topicConvert(dataRequest.topic)"
|
||||
@click="onUpdate(dataRequest)"
|
||||
>
|
||||
<q-tooltip>{{ topicConvert(dataRequest.topic) }}</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
|
|
|
|||
|
|
@ -24,4 +24,12 @@ interface RequestAddressObject {
|
|||
registrationAddress: string | null;
|
||||
}
|
||||
|
||||
export type { RequestObject ,RequestAddressObject};
|
||||
interface RequestregistrationAddressObject {
|
||||
registrationZipCode: string | null;
|
||||
registrationSubDistrictId: string | null;
|
||||
registrationDistrictId: string | null;
|
||||
registrationProvinceId: string | null;
|
||||
registrationAddress: string | null;
|
||||
}
|
||||
|
||||
export type { RequestObject ,RequestAddressObject,RequestregistrationAddressObject};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ref } from "vue";
|
|||
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
||||
|
||||
export const useRequestEditStore = defineStore("requestEditStore", () => {
|
||||
const profileId = ref<string>('')
|
||||
const optionTopic = ref<string[]>([
|
||||
"ขอแก้ไขคำนำหน้านาม ชื่อ นามสกุล",
|
||||
"ขอแก้ไขรูปภาพประจำตัว",
|
||||
|
|
@ -58,5 +59,6 @@ export const useRequestEditStore = defineStore("requestEditStore", () => {
|
|||
optionStatus,
|
||||
optionStatusIDP,
|
||||
convertStatusIDP,
|
||||
profileId
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue