Merge branch 'NiceDev' into develop
# Conflicts: # src/modules/10_registry/01_Information/03_Address.vue
This commit is contained in:
commit
baa411524a
9 changed files with 276 additions and 65 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import env from "../index";
|
||||
|
||||
const metadata = `${env.API_URI}/org/metadata/`;
|
||||
const org = `${env.API_URI}/org`;
|
||||
const profileOrg = `${env.API_URI}/org/profile`;
|
||||
const report = `${env.API_URI}/report/profile/`;
|
||||
|
|
@ -66,4 +67,11 @@ export default {
|
|||
/** struct-chart*/
|
||||
orgStructChart: (id: string, type: string) =>
|
||||
`${org}/struct-chart/${id}/${type}`,
|
||||
|
||||
/**
|
||||
* ข้อมูลจังหวัด
|
||||
*/
|
||||
profileNewProvince: `${metadata}province`,
|
||||
profileNewDistrictByPId: (id: string) => `${metadata}province/${id}`,
|
||||
profileNewSubDistrictByDId: (id: string) => `${metadata}district/${id}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -251,7 +251,9 @@ function getData() {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,9 @@ function getData() {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,19 @@
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type {
|
||||
Address,
|
||||
Provinces,
|
||||
Districts,
|
||||
SubDistricts,
|
||||
} from "@/modules/10_registry/interface/response/01_Information";
|
||||
|
||||
//history dialog
|
||||
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||
|
||||
const store = useRegistryInFormationStore();
|
||||
|
|
@ -18,7 +26,7 @@ const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
|||
const modalHistory = ref<boolean>(false);
|
||||
/** ตัวแปรข้อมูล */
|
||||
|
||||
const formData = reactive<any>({
|
||||
const formData = reactive({
|
||||
registrationAddress: "", //ที่อยู่ตามทะเบียนบ้าน
|
||||
registrationProvince: "", //จังหวัด
|
||||
registrationDistrict: "", //เขต / อำเภอ
|
||||
|
|
@ -32,6 +40,12 @@ const formData = reactive<any>({
|
|||
currentZipCode: "", //รหัสไปรษณีย์
|
||||
});
|
||||
|
||||
const provinceData = ref<Provinces[]>([]);
|
||||
const districtRegistration = ref<Districts[]>([]);
|
||||
const districtCurrent = ref<Districts[]>([]);
|
||||
const subDistrictRegistration = ref<SubDistricts[]>([]);
|
||||
const subDistrictCurrent = ref<SubDistricts[]>([]);
|
||||
|
||||
const visibleColumnsHistory = ref<string[]>([
|
||||
"currentAddress",
|
||||
"currentDistrict",
|
||||
|
|
@ -215,23 +229,31 @@ function getData() {
|
|||
http
|
||||
.get(config.API.dataUserAddress)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
const data: Address = res.data.result;
|
||||
fetchDistrict(data.registrationProvinceId, "1");
|
||||
fetchDistrict(data.currentProvinceId, "2");
|
||||
fetchSubDistrict(data.registrationDistrictId, "1");
|
||||
fetchSubDistrict(data.currentDistrictId, "2");
|
||||
|
||||
formData.registrationAddress = data.registrationAddress;
|
||||
formData.registrationProvince = data.registrationProvince;
|
||||
formData.registrationDistrict = data.registrationDistrict;
|
||||
formData.registrationSubDistrict = data.registrationSubDistrict;
|
||||
formData.registrationProvince = data.registrationProvinceId;
|
||||
formData.registrationDistrict = data.registrationDistrictId;
|
||||
formData.registrationSubDistrict = data.registrationSubDistrictId;
|
||||
formData.registrationZipCode = data.registrationZipCode;
|
||||
|
||||
formData.currentAddress = data.currentAddress;
|
||||
formData.currentProvince = data.currentProvince;
|
||||
formData.currentDistrict = data.currentDistrict;
|
||||
formData.currentSubDistrict = data.currentSubDistrict;
|
||||
formData.currentProvince = data.currentProvinceId;
|
||||
formData.currentDistrict = data.currentDistrictId;
|
||||
formData.currentSubDistrict = data.currentSubDistrictId;
|
||||
formData.currentZipCode = data.currentZipCode;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -256,8 +278,99 @@ function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getData();
|
||||
/**
|
||||
*function fetch ข้อมูลจังหวัด
|
||||
*/
|
||||
function fetchProvince() {
|
||||
http
|
||||
.get(config.API.profileNewProvince)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
provinceData.value = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลอำเภอ
|
||||
* @param id จังหวัด
|
||||
* @param position ที่อยู่ตามทะเบียนบ้าน,ที่อยู่ปัจจุบัน
|
||||
*/
|
||||
function fetchDistrict(id: string | null, position: string) {
|
||||
if (!id) return;
|
||||
http
|
||||
.get(config.API.profileNewDistrictByPId(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result.districts;
|
||||
if (position === "1") {
|
||||
districtRegistration.value = data;
|
||||
} else {
|
||||
districtCurrent.value = data;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลอำเภ
|
||||
* @param id อำเภอ
|
||||
* @param position ที่อยู่ตามทะเบียนบ้าน,ที่อยู่ปัจจุบัน
|
||||
*/
|
||||
function fetchSubDistrict(id: string | null, position: string) {
|
||||
if (!id) return;
|
||||
http
|
||||
.get(config.API.profileNewSubDistrictByDId(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result.subDistricts;
|
||||
if (position === "1") {
|
||||
subDistrictRegistration.value = data;
|
||||
} else {
|
||||
subDistrictCurrent.value = data;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function แปลงชื้่อจังหวัด
|
||||
* @param id
|
||||
*/
|
||||
function convertProvinceName(id: string) {
|
||||
const province = provinceData.value.find((e: Provinces) => e.id === id);
|
||||
return province?.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* function แปลงชื้่ออำเภอ
|
||||
* @param id
|
||||
*/
|
||||
function convertDistrictName(id: string, type: string) {
|
||||
const data =
|
||||
type === "1" ? districtRegistration.value : districtCurrent.value;
|
||||
const district = data.find((e: Districts) => e.id === id);
|
||||
return district?.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* function แปลงชื้่อตำบล
|
||||
* @param id
|
||||
*/
|
||||
function convertSubDistrictName(id: string, type: string) {
|
||||
const data =
|
||||
type === "1" ? subDistrictRegistration.value : subDistrictCurrent.value;
|
||||
const district = data.find((e: SubDistricts) => e.id === id);
|
||||
return district?.name;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchProvince();
|
||||
await getData();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -279,18 +392,20 @@ onMounted(() => {
|
|||
</q-toolbar>
|
||||
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12 col-md-6">
|
||||
<q-card bordered class="bg-grey-1">
|
||||
<q-toolbar>
|
||||
<q-toolbar-title class="text-subtitle2 text-bold"
|
||||
>ที่อยู่ตามทะเบียนบ้าน</q-toolbar-title
|
||||
>
|
||||
</q-toolbar>
|
||||
<div class="col-md-6 col-sm-12 col-xs-12">
|
||||
<q-card class="bg-grey-1" bordered>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-item-label>ที่อยู่ตามทะเบียนบ้าน</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
<div class="row q-pa-md">
|
||||
<div class="col-12 col-sm-12 col-md-12 q-gutter-y-sm">
|
||||
<q-card-section>
|
||||
<div class="col-12 col-sm-12 col-md-6 q-gutter-y-sm">
|
||||
<div class="row">
|
||||
<div class="col-5 text-grey-6 text-weight-medium">ที่อยู่</div>
|
||||
<div class="col-5 text-grey-6 text-weight-medium">
|
||||
ที่อยู่ตามทะเบียนบ้าน
|
||||
</div>
|
||||
<div class="col-7">
|
||||
{{
|
||||
formData.registrationAddress
|
||||
|
|
@ -305,7 +420,7 @@ onMounted(() => {
|
|||
<div class="col-7">
|
||||
{{
|
||||
formData.registrationProvince
|
||||
? formData.registrationProvince
|
||||
? convertProvinceName(formData.registrationProvince)
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -318,7 +433,7 @@ onMounted(() => {
|
|||
<div class="col-7">
|
||||
{{
|
||||
formData.registrationDistrict
|
||||
? formData.registrationDistrict
|
||||
? convertDistrictName(formData.registrationDistrict, "1")
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -331,7 +446,10 @@ onMounted(() => {
|
|||
<div class="col-7">
|
||||
{{
|
||||
formData.registrationSubDistrict
|
||||
? formData.registrationSubDistrict
|
||||
? convertSubDistrictName(
|
||||
formData.registrationSubDistrict,
|
||||
"1"
|
||||
)
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -350,22 +468,22 @@ onMounted(() => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<q-card bordered class="bg-grey-1">
|
||||
<q-toolbar>
|
||||
<q-toolbar-title class="text-subtitle2 text-bold"
|
||||
>ที่อยู่ปัจจุบัน</q-toolbar-title
|
||||
>
|
||||
</q-toolbar>
|
||||
<div class="col-md-6 col-sm-12 col-xs-12">
|
||||
<q-card class="bg-grey-1" bordered>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-item-label>ที่อยู่ปัจจุบัน</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
<div class="row q-pa-md">
|
||||
<div class="col-12 col-sm-12 col-md-12 q-gutter-y-sm">
|
||||
<q-card-section>
|
||||
<div class="col-12 col-sm-12 col-md-6 q-gutter-y-sm">
|
||||
<div class="row">
|
||||
<div class="col-5 text-grey-6 text-weight-medium">
|
||||
ที่อยู่
|
||||
ที่อยู่ปัจจุบัน
|
||||
</div>
|
||||
<div class="col-7">
|
||||
{{ formData.currentAddress ? formData.currentAddress : "-" }}
|
||||
|
|
@ -375,7 +493,9 @@ onMounted(() => {
|
|||
<div class="col-5 text-grey-6 text-weight-medium">จังหวัด</div>
|
||||
<div class="col-7">
|
||||
{{
|
||||
formData.currentProvince ? formData.currentProvince : "-"
|
||||
formData.currentProvince
|
||||
? convertProvinceName(formData.currentProvince)
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -385,7 +505,9 @@ onMounted(() => {
|
|||
</div>
|
||||
<div class="col-7">
|
||||
{{
|
||||
formData.currentDistrict ? formData.currentDistrict : "-"
|
||||
formData.currentDistrict
|
||||
? convertDistrictName(formData.currentDistrict, "2")
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -396,7 +518,7 @@ onMounted(() => {
|
|||
<div class="col-7">
|
||||
{{
|
||||
formData.currentSubDistrict
|
||||
? formData.currentSubDistrict
|
||||
? convertSubDistrictName(formData.currentSubDistrict, "2")
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -410,7 +532,7 @@ onMounted(() => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -149,12 +149,13 @@ function onHistory(type: string, id: string) {
|
|||
idFamily.value = id ? id : "user";
|
||||
}
|
||||
|
||||
const checkFatherData = ref<boolean>(false);
|
||||
const checkMotherData = ref<boolean>(false);
|
||||
const checkCoupleData = ref<boolean>(false);
|
||||
const checkChildData = ref<boolean>(false);
|
||||
|
||||
/** get data */
|
||||
function getData(type: string) {
|
||||
// father
|
||||
// mother
|
||||
// couple
|
||||
// children
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.dataUserFamily(type))
|
||||
|
|
@ -162,6 +163,7 @@ function getData(type: string) {
|
|||
const data = res.data.result;
|
||||
if (data) {
|
||||
if (type == "father") {
|
||||
checkFatherData.value = data ? true : false;
|
||||
fatherData.isLive = data.fatherLive;
|
||||
fatherData.citizenId = data.fatherCitizenId;
|
||||
fatherData.prefix = data.fatherPrefix;
|
||||
|
|
@ -170,6 +172,7 @@ function getData(type: string) {
|
|||
fatherData.job = data.fatherCareer;
|
||||
fatherData.profileId = data.profileId;
|
||||
} else if (type == "mother") {
|
||||
checkMotherData.value = data ? true : false;
|
||||
motherData.isLive = data.motherLive;
|
||||
motherData.citizenId = data.motherCitizenId;
|
||||
motherData.prefix = data.motherPrefix;
|
||||
|
|
@ -178,6 +181,7 @@ function getData(type: string) {
|
|||
motherData.job = data.motherCareer;
|
||||
motherData.profileId = data.profileId;
|
||||
} else if (type == "couple") {
|
||||
checkCoupleData.value = data ? true : false;
|
||||
coupleData.isLive = data.coupleLive;
|
||||
coupleData.citizenId = data.coupleCitizenId;
|
||||
coupleData.prefix = data.couplePrefix;
|
||||
|
|
@ -188,6 +192,7 @@ function getData(type: string) {
|
|||
coupleData.statusMarital = data.relationship;
|
||||
coupleData.profileId = data.profileId;
|
||||
} else {
|
||||
checkChildData.value = data.length !== 0 ? true : false;
|
||||
childData.value = data;
|
||||
}
|
||||
}
|
||||
|
|
@ -196,7 +201,9 @@ function getData(type: string) {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -235,18 +242,30 @@ function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getData("father");
|
||||
await getData("mother");
|
||||
await getData("couple");
|
||||
await getData("children");
|
||||
onMounted(() => {
|
||||
getData("father");
|
||||
getData("mother");
|
||||
getData("couple");
|
||||
getData("children");
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="col-12">
|
||||
<q-toolbar class="q-px-none">
|
||||
<span class="text-blue-6 text-weight-bold text-body1"
|
||||
>ข้อมูลครอบครัว</span
|
||||
>ข้อมูลครอบครัว
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="text-blue-6 text-subtitle2 q-ml-sm"
|
||||
v-if="
|
||||
!checkFatherData &&
|
||||
!checkMotherData &&
|
||||
!checkCoupleData &&
|
||||
!checkChildData
|
||||
"
|
||||
>
|
||||
(ไม่มีข้อมูล)</span
|
||||
>
|
||||
</q-toolbar>
|
||||
<div class="row q-col-gutter-sm">
|
||||
|
|
|
|||
|
|
@ -446,7 +446,9 @@ function getData() {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,9 @@ function getData() {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
48
src/modules/10_registry/interface/response/01_Information.ts
Normal file
48
src/modules/10_registry/interface/response/01_Information.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
interface Address {
|
||||
currentAddress: string;
|
||||
currentDistrictId: string;
|
||||
currentProvinceId: string;
|
||||
currentSubDistrictId: string;
|
||||
currentZipCode: string;
|
||||
id: string;
|
||||
registrationAddress: string;
|
||||
registrationDistrictId: string;
|
||||
registrationProvinceId: string;
|
||||
registrationSubDistrictId: string;
|
||||
registrationZipCode: string;
|
||||
}
|
||||
interface Provinces {
|
||||
createdAt: string;
|
||||
createdFullName: string;
|
||||
id: string;
|
||||
lastUpdateFullName: string;
|
||||
lastUpdatedAt: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Districts {
|
||||
createdAt: string;
|
||||
createdFullName: string;
|
||||
createdUserId: string;
|
||||
id: string;
|
||||
lastUpdateFullName: string;
|
||||
lastUpdateUserId: string;
|
||||
lastUpdatedAt: string;
|
||||
name: string;
|
||||
provinceId: string;
|
||||
}
|
||||
|
||||
interface SubDistricts {
|
||||
createdAt: string;
|
||||
createdFullName: string;
|
||||
createdUserId: string;
|
||||
districtId: string;
|
||||
id: string;
|
||||
lastUpdateFullName: string;
|
||||
lastUpdateUserId: string;
|
||||
lastUpdatedAt: string;
|
||||
name: string;
|
||||
zipCode: string;
|
||||
}
|
||||
|
||||
export type { Address, Provinces, Districts, SubDistricts };
|
||||
|
|
@ -45,6 +45,7 @@ function onMobile(type: string) {
|
|||
}
|
||||
|
||||
function getMain() {
|
||||
showLoader();
|
||||
http.get(config.API.profilePosition()).then((res) => {
|
||||
const data = res.data.result;
|
||||
formData.prefix = data.prefix;
|
||||
|
|
@ -73,7 +74,9 @@ function getImg(id: string, pathName: string) {
|
|||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function getType() {
|
||||
|
|
@ -84,8 +87,7 @@ function getType() {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function onClickDownloadKp7(type: string) {
|
||||
|
|
@ -218,7 +220,7 @@ onMounted(async () => {
|
|||
class="full-width"
|
||||
unelevated
|
||||
color="blue-6"
|
||||
@click="onClickDownloadKp7('FULL')"
|
||||
@click="onClickDownloadKp7('SHORT')"
|
||||
><q-icon left size="2em" name="mdi-file-download-outline" />
|
||||
<div>ดาวน์โหลดประวัติแบบย่อ</div></q-btn
|
||||
>
|
||||
|
|
@ -226,7 +228,7 @@ onMounted(async () => {
|
|||
class="full-width"
|
||||
unelevated
|
||||
color="primary"
|
||||
@click="onClickDownloadKp7('SHORT')"
|
||||
@click="onClickDownloadKp7('FULL')"
|
||||
><q-icon left size="2em" name="mdi-folder-download-outline" />
|
||||
<div>ดาวน์โหลด ก.พ.7/ก.ก. 1</div></q-btn
|
||||
>
|
||||
|
|
@ -313,8 +315,10 @@ onMounted(async () => {
|
|||
text-color="light-blue-5"
|
||||
size="14px"
|
||||
icon="mdi-file-download-outline"
|
||||
@click="onClickDownloadKp7('FULL')"
|
||||
></q-btn>
|
||||
@click="onClickDownloadKp7('SHORT')"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดประวัติแบบย่อ </q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
color="teal-1"
|
||||
text-color="primary"
|
||||
|
|
@ -323,8 +327,10 @@ onMounted(async () => {
|
|||
round
|
||||
size="14px"
|
||||
icon="mdi-folder-download-outline"
|
||||
@click="onClickDownloadKp7('SHORT')"
|
||||
></q-btn>
|
||||
@click="onClickDownloadKp7('FULL')"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลด ก.พ.7/ก.ก. 1</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
color="red-1"
|
||||
text-color="red-12"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue