ทะเบียนประวัติ: store ประวัติส่วนตัว

This commit is contained in:
puriphatt 2024-03-26 10:28:41 +07:00
parent 986e4b4898
commit 9d77ed6298
2 changed files with 262 additions and 80 deletions

View file

@ -25,8 +25,16 @@ const {
messageError,
dialogConfirm,
} = mixin;
const { calculateAge, getGender, getRelationship, getReligion, getBloodGroup } =
store;
const {
calculateAge,
fetchPerson,
filterSelector,
// getGender,
// getRelationship,
// getReligion,
// getBloodGroup,
// getPersonOp,
} = store;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
@ -354,10 +362,19 @@ watch(
onMounted(async () => {
await getData();
store.genderOp.length === 0 ? await getGender() : "";
store.relationshipOp.length === 0 ? await getRelationship() : "";
store.religionOp.length === 0 ? await getReligion() : "";
store.bloodGroupOp.length === 0 ? await getBloodGroup() : "";
if (
store.Ops.prefixOps.length === 0 ||
store.Ops.genderOps.length === 0 ||
store.Ops.bloodOps.length === 0 ||
store.Ops.statusOps.length === 0 ||
store.Ops.religionOps.length === 0
) {
await fetchPerson();
}
// store.genderOp.length === 0 ? await getGender() : "";
// store.relationshipOp.length === 0 ? await getRelationship() : "";
// store.religionOp.length === 0 ? await getReligion() : "";
// store.bloodGroupOp.length === 0 ? await getBloodGroup() : "";
});
</script>
<template>
@ -487,12 +504,16 @@ onMounted(async () => {
map-options
hide-bottom-space
input-debounce="0"
new-value-mode="add-unique"
option-label="name"
option-value="id"
v-model="formData.prefix"
class="inputgreen"
:options="store.prefixOp"
: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">
@ -590,7 +611,7 @@ onMounted(async () => {
option-value="id"
v-model="formData.genderId"
class="inputgreen"
:options="store.genderOp"
:options="store.Ops.genderOps"
:label="dataLabel.gender"
/>
</div>
@ -608,7 +629,7 @@ onMounted(async () => {
input-debounce="0"
class="inputgreen"
v-model="formData.relationshipId"
:options="store.relationshipOp"
:options="store.Ops.statusOps"
:label="dataLabel.relationship"
/>
</div>
@ -648,7 +669,7 @@ onMounted(async () => {
input-debounce="0"
v-model="formData.religionId"
class="inputgreen"
:options="store.religionOp"
:options="store.Ops.religionOps"
:label="dataLabel.religion"
/>
</div>
@ -666,7 +687,7 @@ onMounted(async () => {
input-debounce="0"
v-model="formData.bloodGroupId"
class="inputgreen"
:options="store.bloodGroupOp"
:options="store.Ops.bloodOps"
:label="dataLabel.bloodGroup"
/>
</div>