เพิ่ม interface ให้ any

This commit is contained in:
setthawutttty 2023-09-22 16:10:30 +07:00
parent 7d3c48142c
commit 77ccaec4e3
18 changed files with 259 additions and 73 deletions

View file

@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { ResponseDataDetail } from "@/modules/05_placement/interface/response/Transfer";
import type { OtherdataInterface,resApiData } from "@/modules/05_placement/interface/response/OhterMain";
import type { QForm } from "quasar";
import http from "@/plugins/http";
@ -58,10 +59,14 @@ const myform = ref<any>();
const positionLevelOld = ref<string>("");
const posNo = ref<string>("");
const salary = ref<number>(0);
const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
const Otherdata = ref<any>([]);
const Otherdata = ref<OtherdataInterface>({
citizenId: "",
prefixId: "",
firstname: "",
lastname: "",
});
const avatar = ref<string>("");
//-----(fetch data by id)-----//
@ -69,9 +74,9 @@ const fecthOther = async () => {
showLoader();
await http
.get(config.API.otherByid(paramsId.toString()))
.then((res: any) => {
.then((res: resApiData) => {
const data = res.data.result;
Otherdata.value = res.data.result;
Otherdata.value = data
avatar.value = data.avatar ?? "";
title.value.fullname = `${data.firstname ?? "-"} ${data.lastname ?? "-"}`;
title.value.organizationPositionOld = data.organizationPositionOld ?? "-";
@ -79,24 +84,19 @@ const fecthOther = async () => {
title.value.positionTypeOld = data.positionTypeOld ?? "-";
responseData.value.profileId = data.profileId;
responseData.value.createdAt = data.createdAt;
responseData.value.date = data.date !== null ? new Date(data.date) : new Date();
responseData.value.id = data.id ?? "";
responseData.value.organization = data.organization ?? "";
responseData.value.organizationPositionOld = data.organizationPositionOld ?? "";
responseData.value.positionLevelOld = data.positionLevelOld ?? "";
responseData.value.positionNumberOld = data.positionNumberOld ?? "";
responseData.value.positionTypeOld = data.positionTypeOld ?? "";
responseData.value.reason = data.reason ?? "";
responseData.value.salary = data.salary !== null ? data.salary : 0;
responseData.value.status = data.status ?? "";
responseData.value.avataPath = data.avataPath ?? "";
responseData.value.fullname = `${data.prefix ?? "-"}${data.firstname ?? "-"} ${data.lastname ?? "-"}`;
organizationPositionOld.value = data.organizationPositionOld ?? "";
positionTypeOld.value = data.positionTypeOld ?? "";
positionLevelOld.value = data.positionLevelOld ?? "";
posNo.value = data.positionNumberOld ?? "";
salary.value = data.amountOld ?? "";
organization.value = data.organization ?? "";
date.value = data.positionDate !== null ? new Date(data.positionDate) : null;
reason.value = data.reason ?? "";
})