fixing rank registry & change type any to interface
This commit is contained in:
parent
32b83298cd
commit
516a405df4
4 changed files with 68 additions and 11 deletions
30
src/interface/Main.ts
Normal file
30
src/interface/Main.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
interface ProfileData {
|
||||||
|
rank?: string;
|
||||||
|
prefix: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
position: string;
|
||||||
|
posExecutiveName?: string;
|
||||||
|
posTypeName: string;
|
||||||
|
posLevelName: string;
|
||||||
|
posNo: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InformationData {
|
||||||
|
rank?: string; //ยศ
|
||||||
|
citizenId: string; //เลขประจำตัวประชาชน
|
||||||
|
prefix: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
birthDate: Date | null; //วันเกิด
|
||||||
|
gender: string; //เพศ
|
||||||
|
relationship: string; //สถานภาพ
|
||||||
|
nationality: string; //สัญชาติ
|
||||||
|
ethnicity: string; //เชื้อชาติ
|
||||||
|
religion: string; //ศาสนา
|
||||||
|
bloodGroup: string; //หมู่เลือด
|
||||||
|
phone: string; //เบอร์โทร
|
||||||
|
email: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ProfileData, InformationData };
|
||||||
|
|
@ -9,6 +9,7 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
|
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
|
||||||
|
import type { InformationData } from "@/interface/Main";
|
||||||
|
|
||||||
const link = ref<string>("");
|
const link = ref<string>("");
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -31,12 +32,13 @@ const rowsHistory = ref<any[]>([]);
|
||||||
const modalHistory = ref<boolean>(false);
|
const modalHistory = ref<boolean>(false);
|
||||||
|
|
||||||
/** ตัวแปรข้อมูล */
|
/** ตัวแปรข้อมูล */
|
||||||
const formDataInformation = reactive<any>({
|
const formDataInformation = reactive<InformationData>({
|
||||||
|
rank: "", //ยศ
|
||||||
citizenId: "", //เลขประจำตัวประชาชน
|
citizenId: "", //เลขประจำตัวประชาชน
|
||||||
prefix: "",
|
prefix: "",
|
||||||
firstName: "",
|
firstName: "",
|
||||||
lastName: "",
|
lastName: "",
|
||||||
birthDate: "", //วันเกิด
|
birthDate: null, //วันเกิด
|
||||||
gender: "", //เพศ
|
gender: "", //เพศ
|
||||||
relationship: "", //สถานภาพ
|
relationship: "", //สถานภาพ
|
||||||
nationality: "", //สัญชาติ
|
nationality: "", //สัญชาติ
|
||||||
|
|
@ -247,6 +249,7 @@ async function getData() {
|
||||||
.get(config.API.dataUserInformationByType(link.value))
|
.get(config.API.dataUserInformationByType(link.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result;
|
const data = await res.data.result;
|
||||||
|
formDataInformation.rank = data.rank;
|
||||||
formDataInformation.citizenId = data.citizenId;
|
formDataInformation.citizenId = data.citizenId;
|
||||||
formDataInformation.prefix = data.prefix;
|
formDataInformation.prefix = data.prefix;
|
||||||
formDataInformation.firstName = data.firstName;
|
formDataInformation.firstName = data.firstName;
|
||||||
|
|
@ -395,7 +398,13 @@ onMounted(async () => {
|
||||||
<div class="col-7">
|
<div class="col-7">
|
||||||
{{
|
{{
|
||||||
formDataInformation.firstName
|
formDataInformation.firstName
|
||||||
? `${formDataInformation.prefix}${formDataInformation.firstName} ${formDataInformation.lastName}`
|
? `${
|
||||||
|
formDataInformation.rank
|
||||||
|
? formDataInformation.rank
|
||||||
|
: formDataInformation.prefix
|
||||||
|
}${formDataInformation.firstName} ${
|
||||||
|
formDataInformation.lastName
|
||||||
|
}`
|
||||||
: "-"
|
: "-"
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,6 @@ const clickBack = () => {
|
||||||
function redirectToPagePetition() {
|
function redirectToPagePetition() {
|
||||||
router.push(`/registry/request-edit`);
|
router.push(`/registry/request-edit`);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -154,7 +153,13 @@ function redirectToPagePetition() {
|
||||||
<div class="column text-center q-mt-md q-mb-sm">
|
<div class="column text-center q-mt-md q-mb-sm">
|
||||||
<span class="text-teal text-weight-medium">{{
|
<span class="text-teal text-weight-medium">{{
|
||||||
dataStore.formData.firstName
|
dataStore.formData.firstName
|
||||||
? `${dataStore.formData.prefix}${dataStore.formData.firstName} ${dataStore.formData.lastName}`
|
? `${
|
||||||
|
dataStore.formData.rank
|
||||||
|
? dataStore.formData.rank
|
||||||
|
: dataStore.formData.prefix
|
||||||
|
}${dataStore.formData.firstName} ${
|
||||||
|
dataStore.formData.lastName
|
||||||
|
}`
|
||||||
: "-"
|
: "-"
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="text-grey text-weight-medium">{{
|
<span class="text-grey text-weight-medium">{{
|
||||||
|
|
@ -165,7 +170,9 @@ function redirectToPagePetition() {
|
||||||
: "ลูกจ้างชั่วคราว"
|
: "ลูกจ้างชั่วคราว"
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="text-grey text-weight-medium">{{
|
<span class="text-grey text-weight-medium">{{
|
||||||
dataStore.formData.position ? `${dataStore.formData.position}` : "-"
|
dataStore.formData.position
|
||||||
|
? `${dataStore.formData.position}`
|
||||||
|
: "-"
|
||||||
}}</span>
|
}}</span>
|
||||||
|
|
||||||
<div class="text-grey">{{ dataStore.formData.posNo }}</div>
|
<div class="text-grey">{{ dataStore.formData.posNo }}</div>
|
||||||
|
|
@ -182,10 +189,14 @@ function redirectToPagePetition() {
|
||||||
</q-item> -->
|
</q-item> -->
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section class="text-grey-6">{{
|
<q-item-section class="text-grey-6">{{
|
||||||
dataStore.officerType == "OFFICER" ? "ตำแหน่งประเภท" : "กลุ่มงาน"
|
dataStore.officerType == "OFFICER"
|
||||||
|
? "ตำแหน่งประเภท"
|
||||||
|
: "กลุ่มงาน"
|
||||||
}}</q-item-section>
|
}}</q-item-section>
|
||||||
<q-item-section>{{
|
<q-item-section>{{
|
||||||
dataStore.formData.posTypeName ? dataStore.formData.posTypeName : "-"
|
dataStore.formData.posTypeName
|
||||||
|
? dataStore.formData.posTypeName
|
||||||
|
: "-"
|
||||||
}}</q-item-section>
|
}}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item>
|
<q-item>
|
||||||
|
|
@ -193,7 +204,9 @@ function redirectToPagePetition() {
|
||||||
dataStore.officerType == "OFFICER" ? "ระดับ" : "ระดับชั้นงาน"
|
dataStore.officerType == "OFFICER" ? "ระดับ" : "ระดับชั้นงาน"
|
||||||
}}</q-item-section>
|
}}</q-item-section>
|
||||||
<q-item-section>{{
|
<q-item-section>{{
|
||||||
dataStore.formData.posLevelName ? dataStore.formData.posLevelName : "-"
|
dataStore.formData.posLevelName
|
||||||
|
? dataStore.formData.posLevelName
|
||||||
|
: "-"
|
||||||
}}</q-item-section>
|
}}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
|
|
@ -291,7 +304,9 @@ function redirectToPagePetition() {
|
||||||
: "ลูกจ้างประจำกรุงเทพมหานคร"
|
: "ลูกจ้างประจำกรุงเทพมหานคร"
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="text-grey text-weight-medium">{{
|
<span class="text-grey text-weight-medium">{{
|
||||||
dataStore.formData.position ? `${dataStore.formData.position}` : "-"
|
dataStore.formData.position
|
||||||
|
? `${dataStore.formData.position}`
|
||||||
|
: "-"
|
||||||
}}</span>
|
}}</span>
|
||||||
<div class="text-grey">{{ dataStore.formData.posNo }}</div>
|
<div class="text-grey">{{ dataStore.formData.posNo }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import config from "@/app.config";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||||
import { useCounterMixin } from "./mixin";
|
import { useCounterMixin } from "./mixin";
|
||||||
|
import type { ProfileData } from "@/interface/Main";
|
||||||
|
|
||||||
export const useDataStore = defineStore("data", () => {
|
export const useDataStore = defineStore("data", () => {
|
||||||
const storeRegistry = useRegistryInFormationStore();
|
const storeRegistry = useRegistryInFormationStore();
|
||||||
|
|
@ -13,7 +14,8 @@ export const useDataStore = defineStore("data", () => {
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { messageError, showLoader, hideLoader } = mixin;
|
const { messageError, showLoader, hideLoader } = mixin;
|
||||||
// ref() คือการประกาศ state เหมือน vuex
|
// ref() คือการประกาศ state เหมือน vuex
|
||||||
const formData = reactive<any>({
|
const formData = reactive<ProfileData>({
|
||||||
|
rank: "",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
firstName: "",
|
firstName: "",
|
||||||
lastName: "",
|
lastName: "",
|
||||||
|
|
@ -92,6 +94,7 @@ export const useDataStore = defineStore("data", () => {
|
||||||
const data = await dataPerson;
|
const data = await dataPerson;
|
||||||
isProbation.value = data.isProbation;
|
isProbation.value = data.isProbation;
|
||||||
|
|
||||||
|
formData.rank = data.rank;
|
||||||
formData.prefix = data.prefix;
|
formData.prefix = data.prefix;
|
||||||
formData.firstName = data.firstName;
|
formData.firstName = data.firstName;
|
||||||
formData.lastName = data.lastName;
|
formData.lastName = data.lastName;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue