fixing submit receive module change send name

This commit is contained in:
Warunee Tamkoo 2024-05-23 16:34:10 +07:00
parent a50177bf5c
commit 4c01e5aa0d
2 changed files with 38 additions and 52 deletions

View file

@ -114,12 +114,11 @@ const fetchPerson = async () => {
OpsFilter.value.genderOps = optiongenders;
let optionprefixs: DataOption[] = [];
data.prefixs.map((r: DataOptioninfo) => {
optionprefixs.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
optionprefixs = data.prefixs.map((v: any) => ({
id: v.id,
name: v.name,
}));
Ops.value.prefixOps = optionprefixs;
OpsFilter.value.prefixOps = optionprefixs;
@ -302,22 +301,22 @@ const onSubmit = async () => {
if (informaData.value.lastName != undefined)
formData.append("lastName", informaData.value.lastName);
if (informaData.value.genderId != undefined)
formData.append("genderId", informaData.value.genderId);
formData.append("gender", informaData.value.genderId);
if (informaData.value.nationality != undefined)
formData.append("nationality", informaData.value.nationality);
if (informaData.value.ethnicity != undefined)
formData.append("race", informaData.value.ethnicity);
if (informaData.value.religionId != undefined)
formData.append("religionId", informaData.value.religionId);
formData.append("religion", informaData.value.religionId);
if (informaData.value.birthDate != undefined)
formData.append(
"birthDate",
dateToISO(informaData.value.birthDate) ?? dateToISO(new Date())
);
if (informaData.value.bloodId != undefined)
formData.append("bloodGroupId", informaData.value.bloodId);
formData.append("bloodGroup", informaData.value.bloodId);
if (informaData.value.statusId != undefined)
formData.append("relationshipId", informaData.value.statusId);
formData.append("relationship", informaData.value.statusId);
if (informaData.value.tel != undefined)
formData.append("telephoneNumber", informaData.value.tel);
if (informaData.value.employeeType != undefined)
@ -348,20 +347,6 @@ const clickBack = () => {
router.push("/receive");
};
function fetchPrefix() {
http
.get(config.API.orgPrefix)
.then((res) => {
prefixOps.value = res.data.result.map((v: any) => ({
id: v.name,
name: v.name,
}));
})
.catch((err) => {
messageError($q, err);
});
}
function calculateAge(birthDate: Date | null) {
if (!birthDate) return null;
const birthDateTimeStamp = new Date(birthDate).getTime();
@ -394,7 +379,6 @@ watch(
onMounted(async () => {
await fetchPerson();
await fetchPrefix();
});
</script>
@ -749,9 +733,9 @@ onMounted(async () => {
dense
lazy-rules
class="inputgreen"
:options="prefixOps"
:options="Ops.prefixOps"
option-label="name"
option-value="id"
option-value="name"
map-options
hide-bottom-space
:rules="[
@ -857,7 +841,7 @@ onMounted(async () => {
hide-bottom-space
input-debounce="0"
option-label="name"
option-value="id"
option-value="name"
v-model="informaData.genderId"
class="inputgreen"
:options="Ops.genderOps"
@ -877,7 +861,7 @@ onMounted(async () => {
emit-value
map-options
hide-bottom-space
option-value="id"
option-value="name"
option-label="name"
input-debounce="0"
class="inputgreen"
@ -921,7 +905,7 @@ onMounted(async () => {
emit-value
map-options
hide-bottom-space
option-value="id"
option-value="name"
option-label="name"
input-debounce="0"
v-model="informaData.religionId"
@ -943,7 +927,7 @@ onMounted(async () => {
emit-value
map-options
hide-bottom-space
option-value="id"
option-value="name"
option-label="name"
input-debounce="0"
v-model="informaData.bloodId"