ทะเบียนประวัติ ==> ข้อมูลครอบครัว
This commit is contained in:
parent
8b4e14708d
commit
dd1dd14d06
1 changed files with 46 additions and 39 deletions
|
|
@ -25,6 +25,7 @@ const route = useRoute();
|
||||||
const store = useProfileDataStore();
|
const store = useProfileDataStore();
|
||||||
const { filterSelector } = store;
|
const { filterSelector } = store;
|
||||||
const {
|
const {
|
||||||
|
date2Thai,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
|
|
@ -47,6 +48,8 @@ const visibleColumns = ref<String[]>([
|
||||||
"job",
|
"job",
|
||||||
"isLive",
|
"isLive",
|
||||||
"lastNameOld",
|
"lastNameOld",
|
||||||
|
"lastUpdateFullName",
|
||||||
|
"lastUpdatedAt",
|
||||||
]);
|
]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -114,6 +117,25 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"),
|
format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "lastUpdateFullName",
|
||||||
|
align: "left",
|
||||||
|
label: "ผู้ดำเนินการ",
|
||||||
|
sortable: true,
|
||||||
|
field: "lastUpdateFullName",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "lastUpdatedAt",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่แก้ไข",
|
||||||
|
sortable: true,
|
||||||
|
field: "lastUpdatedAt",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
format: (val) => date2Thai(val),
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
const rows = ref<any[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
|
|
||||||
|
|
@ -173,13 +195,12 @@ const fromData = reactive({
|
||||||
* function fetch ข้อมูลบิดา
|
* function fetch ข้อมูลบิดา
|
||||||
*/
|
*/
|
||||||
async function fetchDataFather() {
|
async function fetchDataFather() {
|
||||||
showLoader();
|
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "father") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
fatherData.isLive = data.fatherLive;
|
fatherData.isLive = data.fatherLive;
|
||||||
|
|
@ -192,9 +213,6 @@ async function fetchDataFather() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,13 +220,12 @@ async function fetchDataFather() {
|
||||||
* function fetch ข้อมูลมารดา
|
* function fetch ข้อมูลมารดา
|
||||||
*/
|
*/
|
||||||
async function fetchDataMother() {
|
async function fetchDataMother() {
|
||||||
showLoader();
|
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "mother") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
if (data) {
|
if (data) {
|
||||||
motherData.isLive = data.motherLive;
|
motherData.isLive = data.motherLive;
|
||||||
motherData.citizenId = data.motherCitizenId;
|
motherData.citizenId = data.motherCitizenId;
|
||||||
|
|
@ -220,9 +237,6 @@ async function fetchDataMother() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,13 +244,12 @@ async function fetchDataMother() {
|
||||||
* function fetch ข้อมูลคู่สมรส
|
* function fetch ข้อมูลคู่สมรส
|
||||||
*/
|
*/
|
||||||
async function fetchDataCouple() {
|
async function fetchDataCouple() {
|
||||||
showLoader();
|
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
|
config.API.profileFamily(empType.value, "couple") + `/${profileId.value}`
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
if (data) {
|
if (data) {
|
||||||
coupleData.isLive = data.coupleLive;
|
coupleData.isLive = data.coupleLive;
|
||||||
coupleData.citizenId = data.coupleCitizenId;
|
coupleData.citizenId = data.coupleCitizenId;
|
||||||
|
|
@ -250,9 +263,6 @@ async function fetchDataCouple() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,21 +270,17 @@ async function fetchDataCouple() {
|
||||||
* function fetch ข้อมูลบุตร
|
* function fetch ข้อมูลบุตร
|
||||||
*/
|
*/
|
||||||
async function fetchDataChildren() {
|
async function fetchDataChildren() {
|
||||||
showLoader();
|
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.profileFamily(empType.value, "children") +
|
config.API.profileFamily(empType.value, "children") +
|
||||||
`/${profileId.value}`
|
`/${profileId.value}`
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
childData.value = data;
|
childData.value = data;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,6 +345,7 @@ function closeDialog() {
|
||||||
fromData.job = "";
|
fromData.job = "";
|
||||||
fromData.lastNameOld = "";
|
fromData.lastNameOld = "";
|
||||||
fromData.statusMarital = "";
|
fromData.statusMarital = "";
|
||||||
|
rows.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -412,7 +419,6 @@ function onOpenDialogHistory(type: string, id: string = "") {
|
||||||
* function fetch ข้อมูลความสัมพันธ์
|
* function fetch ข้อมูลความสัมพันธ์
|
||||||
*/
|
*/
|
||||||
function fetchDataRelationship() {
|
function fetchDataRelationship() {
|
||||||
// showLoader();
|
|
||||||
http
|
http
|
||||||
.get(config.API.orgRelationship)
|
.get(config.API.orgRelationship)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -424,11 +430,6 @@ function fetchDataRelationship() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// hideLoader();
|
|
||||||
// }, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,13 +451,13 @@ function filterSelectorRelation(val: any, update: Function) {
|
||||||
* @param id
|
* @param id
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
function fetchHistory(id: string, type: string) {
|
async function fetchHistory(id: string, type: string) {
|
||||||
hideLoader();
|
showLoader();
|
||||||
http
|
await http
|
||||||
.get(config.API.profileFamilyHistory(id, empType.value, type))
|
.get(config.API.profileFamilyHistory(id, empType.value, type))
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
rows.value = data.map((e: any) => ({
|
rows.value = await data.map((e: any) => ({
|
||||||
citizenId: e[`${type}CitizenId`],
|
citizenId: e[`${type}CitizenId`],
|
||||||
prefix: e[`${type}Prefix`],
|
prefix: e[`${type}Prefix`],
|
||||||
firstName: e[`${type}FirstName`],
|
firstName: e[`${type}FirstName`],
|
||||||
|
|
@ -464,6 +465,8 @@ function fetchHistory(id: string, type: string) {
|
||||||
job: e[`${type}Career`],
|
job: e[`${type}Career`],
|
||||||
isLive: e[`${type}Live`],
|
isLive: e[`${type}Live`],
|
||||||
lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined,
|
lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined,
|
||||||
|
lastUpdateFullName: e.lastUpdateFullName,
|
||||||
|
lastUpdatedAt: e.lastUpdatedAt,
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -482,9 +485,13 @@ onMounted(async () => {
|
||||||
fetchDataCouple(),
|
fetchDataCouple(),
|
||||||
fetchDataChildren(),
|
fetchDataChildren(),
|
||||||
fetchDataRelationship(),
|
fetchDataRelationship(),
|
||||||
]).then(() => {
|
])
|
||||||
hideLoader();
|
.then(() => {
|
||||||
});
|
hideLoader();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue