ข้อมูลบุคคล: ต่อAPI
This commit is contained in:
parent
47e96ddec5
commit
338c2a3b7d
12 changed files with 415 additions and 198 deletions
|
|
@ -14,6 +14,14 @@ const gender = `${env.API_URI}/metadata/gender/`;
|
||||||
const relationship = `${env.API_URI}/metadata/relationship/`;
|
const relationship = `${env.API_URI}/metadata/relationship/`;
|
||||||
const religion = `${env.API_URI}/metadata/religion/`;
|
const religion = `${env.API_URI}/metadata/religion/`;
|
||||||
|
|
||||||
|
const orgRelationship = `${env.API_URI}/org/relationship/`;
|
||||||
|
const orgPrefix = `${env.API_URI}/org/prefix/`;
|
||||||
|
const orgRank = `${env.API_URI}/org/rank/`;
|
||||||
|
const orgBloodGroup = `${env.API_URI}/org/bloodGroup/`;
|
||||||
|
const orgGender = `${env.API_URI}/org/gender/`;
|
||||||
|
const orgReligion = `${env.API_URI}/org/religion/`;
|
||||||
|
const orgEducationLevel = `${env.API_URI}/org/educationLevel/`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
person: `${person}person`,
|
person: `${person}person`,
|
||||||
|
|
||||||
|
|
@ -105,4 +113,20 @@ export default {
|
||||||
listEducationLevelHistoryId: (id: string) => `${educationLevel}history/${id}`,
|
listEducationLevelHistoryId: (id: string) => `${educationLevel}history/${id}`,
|
||||||
listEducationLevelPublished: `${educationLevel}history/published`,
|
listEducationLevelPublished: `${educationLevel}history/published`,
|
||||||
listEducationLevelPublishedHistory: `${educationLevel}history/published-history`,
|
listEducationLevelPublishedHistory: `${educationLevel}history/published-history`,
|
||||||
|
|
||||||
|
// API ใหม่
|
||||||
|
orgRelationship,
|
||||||
|
orgRelationshipId: (id: string) => `${orgRelationship}${id}`,
|
||||||
|
orgPrefix,
|
||||||
|
orgPrefixId: (id: string) => `${orgPrefix}${id}`,
|
||||||
|
orgRank,
|
||||||
|
orgRankId: (id: string) => `${orgRank}${id}`,
|
||||||
|
orgBloodGroup,
|
||||||
|
orgBloodGroupId: (id: string) => `${orgBloodGroup}${id}`,
|
||||||
|
orgGender,
|
||||||
|
orgGenderId: (id: string) => `${orgGender}${id}`,
|
||||||
|
orgReligion,
|
||||||
|
orgReligionId: (id: string) => `${orgReligion}${id}`,
|
||||||
|
orgEducationLevel,
|
||||||
|
orgEducationLevelId: (id: string) => `${orgEducationLevel}${id}`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,12 @@
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
const store = usePersonalDataStore();
|
import config from "@/app.config";
|
||||||
const router = useRouter();
|
const TABLE_COLUMNS = [
|
||||||
const mixin = useCounterMixin();
|
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
|
||||||
{
|
{
|
||||||
name: "prefix",
|
name: "prefix",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,13 +52,17 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
const store = usePersonalDataStore();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const prefix = ref<string>("");
|
const prefix = ref<string>("");
|
||||||
|
const editId = ref<string>("");
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("คำนำหน้าชื่อ");
|
const personalName = ref<string>("คำนำหน้าชื่อ");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
|
@ -97,8 +96,43 @@ const data = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.orgPrefix)
|
||||||
|
.then(async (res) => {
|
||||||
|
console.log(res.data.result);
|
||||||
|
store.save(res.data.result);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addData() {
|
||||||
|
await http.post(config.API.orgPrefix, {
|
||||||
|
name: prefix.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.orgPrefixId(id), {
|
||||||
|
name: prefix.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgPrefixId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -130,7 +164,7 @@ onMounted(async () => {
|
||||||
:display-value="$q.lang.table.columns"
|
:display-value="$q.lang.table.columns"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
:options="columns"
|
:options="TABLE_COLUMNS"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
options-cover
|
options-cover
|
||||||
style="min-width: 150px"
|
style="min-width: 150px"
|
||||||
|
|
@ -140,7 +174,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
<d-table
|
<d-table
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="TABLE_COLUMNS"
|
||||||
:rows="store.row"
|
:rows="store.row"
|
||||||
:filter="filterKeyword"
|
:filter="filterKeyword"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
|
|
@ -162,9 +196,7 @@ onMounted(async () => {
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div>
|
{{ col.value }}
|
||||||
{{ col.value }}
|
|
||||||
</div>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
@ -185,6 +217,8 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
prefix = props.row.name;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -197,7 +231,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -219,5 +258,9 @@ onMounted(async () => {
|
||||||
v-model:data="prefix"
|
v-model:data="prefix"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,9 @@ import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalSt
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
const store = usePersonalDataStore();
|
import config from "@/app.config";
|
||||||
const router = useRouter();
|
const columns = [
|
||||||
const mixin = useCounterMixin();
|
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
|
||||||
{
|
{
|
||||||
name: "rank",
|
name: "rank",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,16 +54,21 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
|
const store = usePersonalDataStore();
|
||||||
|
const router = useRouter();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const rank = ref<string>("");
|
const rank = ref<string>("");
|
||||||
const rankRef = ref<any>(null);
|
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("ยศ");
|
const personalName = ref<string>("ยศ");
|
||||||
|
const editId = ref<string>("");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"rank",
|
"rank",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
|
|
@ -74,32 +76,43 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = [
|
async function fetchData() {
|
||||||
{
|
showLoader();
|
||||||
id: "1",
|
await http
|
||||||
name: "ยศ 1",
|
.get(config.API.orgRank)
|
||||||
createdAt: new Date(),
|
.then(async (res) => {
|
||||||
lastUpdatedAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
store.save(res.data.result);
|
||||||
},
|
})
|
||||||
{
|
.catch((err) => {
|
||||||
id: "2",
|
messageError($q, err);
|
||||||
name: "ยศ 2",
|
})
|
||||||
createdAt: new Date(),
|
.finally(() => {
|
||||||
lastUpdatedAt: new Date(),
|
hideLoader();
|
||||||
lastUpdateFullName: "System Administrator",
|
});
|
||||||
},
|
}
|
||||||
{
|
|
||||||
id: "3",
|
async function addData() {
|
||||||
name: "ยศ 3",
|
await http.post(config.API.orgRank, {
|
||||||
createdAt: new Date(),
|
name: rank.value,
|
||||||
lastUpdatedAt: new Date(),
|
});
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
fetchData();
|
||||||
},
|
}
|
||||||
];
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.orgRankId(id), {
|
||||||
|
name: rank.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgRankId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -186,6 +199,8 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
rank = props.row.name;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -198,7 +213,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -220,5 +240,9 @@ onMounted(async () => {
|
||||||
v-model:data="rank"
|
v-model:data="rank"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalSt
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = usePersonalDataStore();
|
const store = usePersonalDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = [
|
||||||
{
|
{
|
||||||
name: "bloodGroup",
|
name: "bloodGroup",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,14 +59,14 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
|
const editId = ref<string>("");
|
||||||
const bloodGroup = ref<string>("");
|
const bloodGroup = ref<string>("");
|
||||||
const bloodGroupRef = ref<any>(null);
|
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("กลุ่มเลือด");
|
const personalName = ref<string>("กลุ่มเลือด");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
|
@ -74,32 +76,43 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = [
|
async function fetchData() {
|
||||||
{
|
showLoader();
|
||||||
id: "1",
|
await http
|
||||||
name: "A",
|
.get(config.API.orgBloodGroup)
|
||||||
createdAt: new Date(),
|
.then(async (res) => {
|
||||||
lastUpdatedAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
store.save(res.data.result);
|
||||||
},
|
})
|
||||||
{
|
.catch((err) => {
|
||||||
id: "2",
|
messageError($q, err);
|
||||||
name: "AB",
|
})
|
||||||
createdAt: new Date(),
|
.finally(() => {
|
||||||
lastUpdatedAt: new Date(),
|
hideLoader();
|
||||||
lastUpdateFullName: "System Administrator",
|
});
|
||||||
},
|
}
|
||||||
{
|
|
||||||
id: "3",
|
async function addData() {
|
||||||
name: "O",
|
await http.post(config.API.orgBloodGroup, {
|
||||||
createdAt: new Date(),
|
name: bloodGroup.value,
|
||||||
lastUpdatedAt: new Date(),
|
});
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
fetchData();
|
||||||
},
|
}
|
||||||
];
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.orgBloodGroupId(id), {
|
||||||
|
name: bloodGroup.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgBloodGroupId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -186,6 +199,8 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
bloodGroup = props.row.name;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -198,7 +213,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -220,5 +240,9 @@ onMounted(async () => {
|
||||||
v-model:data="bloodGroup"
|
v-model:data="bloodGroup"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalSt
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = usePersonalDataStore();
|
const store = usePersonalDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = [
|
||||||
{
|
{
|
||||||
name: "gender",
|
name: "gender",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,14 +59,14 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const gender = ref<string>("");
|
const gender = ref<string>("");
|
||||||
const genderRef = ref<any>(null);
|
const editId = ref<string>("");
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("เพศ");
|
const personalName = ref<string>("เพศ");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
|
@ -74,32 +76,43 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = [
|
async function fetchData() {
|
||||||
{
|
showLoader();
|
||||||
id: "1",
|
await http
|
||||||
name: "ชาย",
|
.get(config.API.orgGender)
|
||||||
createdAt: new Date(),
|
.then(async (res) => {
|
||||||
lastUpdatedAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
store.save(res.data.result);
|
||||||
},
|
})
|
||||||
{
|
.catch((err) => {
|
||||||
id: "2",
|
messageError($q, err);
|
||||||
name: "หญิง",
|
})
|
||||||
createdAt: new Date(),
|
.finally(() => {
|
||||||
lastUpdatedAt: new Date(),
|
hideLoader();
|
||||||
lastUpdateFullName: "System Administrator",
|
});
|
||||||
},
|
}
|
||||||
{
|
|
||||||
id: "3",
|
async function addData() {
|
||||||
name: "เพศทางเลือก",
|
await http.post(config.API.orgGender, {
|
||||||
createdAt: new Date(),
|
name: gender.value,
|
||||||
lastUpdatedAt: new Date(),
|
});
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
fetchData();
|
||||||
},
|
}
|
||||||
];
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.orgGenderId(id), {
|
||||||
|
name: gender.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgGenderId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -186,6 +199,8 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
gender = props.row.name;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -198,7 +213,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -220,5 +240,9 @@ onMounted(async () => {
|
||||||
v-model:data="gender"
|
v-model:data="gender"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalSt
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = usePersonalDataStore();
|
const store = usePersonalDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = [
|
||||||
{
|
{
|
||||||
name: "religion",
|
name: "religion",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,14 +59,14 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const religion = ref<string>("");
|
const religion = ref<string>("");
|
||||||
const religionRef = ref<any>(null);
|
const editId = ref<string>("");
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("ศาสนา");
|
const personalName = ref<string>("ศาสนา");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
|
@ -74,39 +76,43 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = [
|
async function fetchData() {
|
||||||
{
|
showLoader();
|
||||||
id: "1",
|
await http
|
||||||
name: "อิสลาม",
|
.get(config.API.orgReligion)
|
||||||
createdAt: new Date(),
|
.then(async (res) => {
|
||||||
lastUpdatedAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
store.save(res.data.result);
|
||||||
},
|
})
|
||||||
{
|
.catch((err) => {
|
||||||
id: "2",
|
messageError($q, err);
|
||||||
name: "พุทธ",
|
})
|
||||||
createdAt: new Date(),
|
.finally(() => {
|
||||||
lastUpdatedAt: new Date(),
|
hideLoader();
|
||||||
lastUpdateFullName: "System Administrator",
|
});
|
||||||
},
|
}
|
||||||
{
|
|
||||||
id: "3",
|
async function addData() {
|
||||||
name: "ขงจื้อ",
|
await http.post(config.API.orgReligion, {
|
||||||
createdAt: new Date(),
|
name: religion.value,
|
||||||
lastUpdatedAt: new Date(),
|
});
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
fetchData();
|
||||||
},
|
}
|
||||||
{
|
|
||||||
id: "4",
|
async function editData(id: string) {
|
||||||
name: "คริสต์",
|
await http.put(config.API.orgReligionId(id), {
|
||||||
createdAt: new Date(),
|
name: religion.value,
|
||||||
lastUpdatedAt: new Date(),
|
});
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
fetchData();
|
||||||
},
|
}
|
||||||
];
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgReligionId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -193,6 +199,8 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
religion = props.row.name;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -205,7 +213,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -227,5 +240,9 @@ onMounted(async () => {
|
||||||
v-model:data="religion"
|
v-model:data="religion"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,16 @@ import type { QTableProps } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = usePersonalDataStore();
|
const store = usePersonalDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = [
|
||||||
{
|
{
|
||||||
name: "relationship",
|
name: "relationship",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -57,14 +58,13 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const relationship = ref<string>("");
|
const relationship = ref<string>("");
|
||||||
const relationshipRef = ref<any>(null);
|
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
const personalName = ref<string>("สถานภาพ");
|
const personalName = ref<string>("สถานภาพ");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
|
|
@ -73,7 +73,7 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdatedAt",
|
"lastUpdatedAt",
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
const editId = ref<string>("");
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: "1",
|
id: "1",
|
||||||
|
|
@ -105,8 +105,43 @@ const data = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.orgRelationship)
|
||||||
|
.then(async (res) => {
|
||||||
|
console.log(res.data.result);
|
||||||
|
store.save(res.data.result);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addData() {
|
||||||
|
await http.post(config.API.orgRelationship, {
|
||||||
|
name: relationship.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.orgRelationshipId(id), {
|
||||||
|
name: relationship.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.orgRelationshipId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -193,6 +228,7 @@ onMounted(async () => {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
editId = props.row.id;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -205,7 +241,12 @@ onMounted(async () => {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -227,5 +268,9 @@ onMounted(async () => {
|
||||||
v-model:data="relationship"
|
v-model:data="relationship"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@ import { useRouter } from "vue-router";
|
||||||
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
import { usePersonalDataStore } from "@/modules/01_metadataNew/stores/personalStore";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
import DialogForm from "@/modules/01_metadataNew/components/personal/DialogForm.vue";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = usePersonalDataStore();
|
const store = usePersonalDataStore();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove } = mixin;
|
const { dialogRemove, messageError, showLoader, hideLoader } = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = [
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "name",
|
||||||
align: "left",
|
align: "left",
|
||||||
|
|
@ -66,7 +68,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
] as const satisfies QTableProps["columns"];
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
|
@ -84,43 +86,45 @@ const visibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = [
|
async function fetchData() {
|
||||||
{
|
showLoader();
|
||||||
id: "1",
|
await http
|
||||||
name: "เคยสมรสแต่ไม่ทราบสถานภาพสมรส",
|
.get(config.API.orgEducationLevel)
|
||||||
rank: 1,
|
.then(async (res) => {
|
||||||
createdAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdatedAt: new Date(),
|
store.save(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
})
|
||||||
},
|
.catch((err) => {
|
||||||
{
|
messageError($q, err);
|
||||||
id: "2",
|
})
|
||||||
name: "สมรส",
|
.finally(() => {
|
||||||
rank: 2,
|
hideLoader();
|
||||||
createdAt: new Date(),
|
});
|
||||||
lastUpdatedAt: new Date(),
|
}
|
||||||
lastUpdateFullName: "System Administrator",
|
|
||||||
},
|
async function addData() {
|
||||||
{
|
await http.post(config.API.orgEducationLevel, {
|
||||||
id: "3",
|
name: educationLevel.value,
|
||||||
name: "แยกกันอยู่",
|
rank: educationRank.value,
|
||||||
rank: 3,
|
});
|
||||||
createdAt: new Date(),
|
fetchData();
|
||||||
lastUpdatedAt: new Date(),
|
}
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
},
|
async function editData(id: string) {
|
||||||
{
|
await http.put(config.API.orgEducationLevelId(id), {
|
||||||
id: "4",
|
name: educationLevel.value,
|
||||||
name: "โสด",
|
rank: educationRank.value,
|
||||||
rank: 4,
|
});
|
||||||
createdAt: new Date(),
|
fetchData();
|
||||||
lastUpdatedAt: new Date(),
|
}
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
},
|
async function deleteData(id: string) {
|
||||||
];
|
await http.delete(config.API.orgEducationLevelId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
store.fetchData(data);
|
fetchData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -242,5 +246,9 @@ onMounted(async () => {
|
||||||
v-model:data="educationLevel"
|
v-model:data="educationLevel"
|
||||||
v-model:personalName="personalName"
|
v-model:personalName="personalName"
|
||||||
v-model:dialogStatus="dialogStatus"
|
v-model:dialogStatus="dialogStatus"
|
||||||
|
v-model:editId="editId"
|
||||||
|
:addData="addData"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:edit-data="editData"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { QInput, useQuasar } from "quasar";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogConfirm } = mixin;
|
const { dialogConfirm } = mixin;
|
||||||
|
|
||||||
const dataRef = ref<any>(null);
|
const dataRef = ref<QInput | null>(null);
|
||||||
|
const educationRankRef = ref<QInput | null>(null);
|
||||||
const data = defineModel<string>("data", {
|
const data = defineModel<string>("data", {
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
|
@ -16,7 +17,7 @@ const personalName = defineModel<string>("personalName");
|
||||||
const dialogStatus = defineModel<string>("dialogStatus");
|
const dialogStatus = defineModel<string>("dialogStatus");
|
||||||
const editId = defineModel<string>("editId");
|
const editId = defineModel<string>("editId");
|
||||||
const dialog = defineModel<boolean>("dialog");
|
const dialog = defineModel<boolean>("dialog");
|
||||||
const educationRank = defineModel<any>("rank");
|
const educationRank = defineModel<number>("rank");
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fetchData: {
|
fetchData: {
|
||||||
type: Function,
|
type: Function,
|
||||||
|
|
@ -36,8 +37,8 @@ function closeDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
dataRef.value.validate();
|
dataRef.value?.validate();
|
||||||
educationRank.value.validate();
|
educationRankRef.value?.validate();
|
||||||
onSubmit();
|
onSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,6 +99,7 @@ async function onSubmit() {
|
||||||
type="number"
|
type="number"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
borderless
|
borderless
|
||||||
|
min="1"
|
||||||
class="col-12 bg-white q-ma-md"
|
class="col-12 bg-white q-ma-md"
|
||||||
:rules="[(val) => val != undefined || 'กรุณากรอกลำดับ']"
|
:rules="[(val) => val != undefined || 'กรุณากรอกลำดับ']"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@ interface DataResponse {
|
||||||
lastUpdateFullName: String;
|
lastUpdateFullName: String;
|
||||||
lastUpdatedAt: Date;
|
lastUpdatedAt: Date;
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
rank?: string;
|
rank?: number;
|
||||||
bloodgroup?: string;
|
bloodgroup?: string;
|
||||||
gender?: string;
|
gender?: string;
|
||||||
religion?: string;
|
religion?: string;
|
||||||
relationship?: string;
|
relationship?: string;
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataRow {
|
interface DataRow {
|
||||||
|
|
@ -17,11 +18,12 @@ interface DataRow {
|
||||||
lastUpdateFullName: String;
|
lastUpdateFullName: String;
|
||||||
lastUpdatedAt: string | null;
|
lastUpdatedAt: string | null;
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
rank?: string;
|
rank?: number;
|
||||||
bloodgroup?: string;
|
bloodgroup?: string;
|
||||||
gender?: string;
|
gender?: string;
|
||||||
religion?: string;
|
religion?: string;
|
||||||
relationship?: string;
|
relationship?: string;
|
||||||
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { DataResponse, DataRow };
|
export type { DataResponse, DataRow };
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ const { date2Thai } = useCounterMixin();
|
||||||
|
|
||||||
export const usePersonalDataStore = defineStore("PersonalData", () => {
|
export const usePersonalDataStore = defineStore("PersonalData", () => {
|
||||||
const row = ref<DataRow[]>([]);
|
const row = ref<DataRow[]>([]);
|
||||||
function fetchData(data: DataResponse[]) {
|
|
||||||
|
function save(data: DataResponse[]) {
|
||||||
const list = data.map((e) => ({
|
const list = data.map((e) => ({
|
||||||
...e,
|
...e,
|
||||||
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
||||||
|
|
@ -19,7 +20,7 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
|
||||||
row.value = list;
|
row.value = list;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
fetchData,
|
save,
|
||||||
row,
|
row,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import ListBloodGroup from "@/modules/01_metadataNew/components/personal/03ListB
|
||||||
import ListGender from "@/modules/01_metadataNew/components/personal/04ListGender.vue";
|
import ListGender from "@/modules/01_metadataNew/components/personal/04ListGender.vue";
|
||||||
import ListReligion from "@/modules/01_metadataNew/components/personal/05ListReligion.vue";
|
import ListReligion from "@/modules/01_metadataNew/components/personal/05ListReligion.vue";
|
||||||
import ListRelationship from "@/modules/01_metadataNew/components/personal/06ListRelationship.vue";
|
import ListRelationship from "@/modules/01_metadataNew/components/personal/06ListRelationship.vue";
|
||||||
|
import ListEducation from "@/modules/01_metadataNew/components/personal/07ListEducationLevel.vue";
|
||||||
|
|
||||||
const currentTab = ref<string>("list_prefix");
|
const currentTab = ref<string>("list_prefix");
|
||||||
const tabs = ref<Array<any>>([]);
|
const tabs = ref<Array<any>>([]);
|
||||||
|
|
@ -18,6 +19,7 @@ onMounted(() => {
|
||||||
{ label: "เพศ", value: "list_gender" },
|
{ label: "เพศ", value: "list_gender" },
|
||||||
{ label: "ศาสนา", value: "list_religion" },
|
{ label: "ศาสนา", value: "list_religion" },
|
||||||
{ label: "สถานภาพ", value: "list_relationship" },
|
{ label: "สถานภาพ", value: "list_relationship" },
|
||||||
|
{ label: "ระดับการศึกษา", value: "list_education" },
|
||||||
];
|
];
|
||||||
tabs.value = tabsPerson;
|
tabs.value = tabsPerson;
|
||||||
});
|
});
|
||||||
|
|
@ -57,6 +59,7 @@ onMounted(() => {
|
||||||
<ListGender v-if="currentTab == 'list_gender'" />
|
<ListGender v-if="currentTab == 'list_gender'" />
|
||||||
<ListReligion v-if="currentTab == 'list_religion'" />
|
<ListReligion v-if="currentTab == 'list_religion'" />
|
||||||
<ListRelationship v-if="currentTab == 'list_relationship'" />
|
<ListRelationship v-if="currentTab == 'list_relationship'" />
|
||||||
|
<ListEducation v-if="currentTab == 'list_education'" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue