fix bug
This commit is contained in:
parent
11bc7e421d
commit
322106631a
2 changed files with 89 additions and 111 deletions
|
|
@ -7,6 +7,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { DataOption } from "@/modules/04_registryNew/interface/index/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
|
|
@ -18,15 +19,8 @@ const route = useRoute();
|
|||
|
||||
const store = useProfileDataStore();
|
||||
const { fetchPerson, filterSelector } = store;
|
||||
const {
|
||||
dialogRemove,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
date2Thai,
|
||||
} = useCounterMixin();
|
||||
const { dialogConfirm, showLoader, hideLoader, messageError, success } =
|
||||
useCounterMixin();
|
||||
|
||||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
|
|
@ -34,6 +28,8 @@ const profileId = ref<string>(
|
|||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
|
||||
/** TableHisoty*/
|
||||
const visibleColumns = ref<String[]>([
|
||||
"citizenId",
|
||||
"prefix",
|
||||
|
|
@ -102,8 +98,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
]);
|
||||
const rows = ref<any[]>([]);
|
||||
|
||||
const childData = ref<any[]>([{}]);
|
||||
const coupleData = ref<any[]>([{}]);
|
||||
/** ข้อมูล*/
|
||||
const fatherData = ref({
|
||||
isLive: 1,
|
||||
citizenId: "1231231231231",
|
||||
|
|
@ -112,7 +107,7 @@ const fatherData = ref({
|
|||
lastName: "หวังดี",
|
||||
job: "จอมพล",
|
||||
});
|
||||
const momData = ref({
|
||||
const motherData = ref({
|
||||
isLive: 0,
|
||||
citizenId: "1572476458930",
|
||||
prefix: "นาง",
|
||||
|
|
@ -120,6 +115,17 @@ const momData = ref({
|
|||
lastName: "มาดี",
|
||||
job: "พยาบาล",
|
||||
});
|
||||
const coupleData = ref<any>({
|
||||
isLive: 1,
|
||||
citizenId: "1231231231231",
|
||||
prefix: "นาย",
|
||||
firstName: "ตรีชาไทย",
|
||||
lastName: "หวังดี",
|
||||
job: "จอมพล",
|
||||
lastNameOld: "หวังดี",
|
||||
statusMarital: "แต่งงานแล้ว",
|
||||
});
|
||||
const childData = ref<any[]>([{}]);
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
|
@ -129,8 +135,8 @@ const titleForm = ref<string>("");
|
|||
const typeForm = ref<string>("");
|
||||
const isEdit = ref<boolean>(false);
|
||||
|
||||
const optionRelationshipMain = ref<any>([]);
|
||||
const optionRelationship = ref<any>([]);
|
||||
const optionRelationshipMain = ref<DataOption[]>([]);
|
||||
const optionRelationship = ref<DataOption[]>([]);
|
||||
|
||||
const fromData = reactive({
|
||||
isLive: 0,
|
||||
|
|
@ -203,7 +209,7 @@ function fetchDataChildren() {
|
|||
function onSubmit(type: string) {
|
||||
dialogConfirm($q, () => {
|
||||
if (type === "father") {
|
||||
} else if (type === "mom") {
|
||||
} else if (type === "mother") {
|
||||
} else if (type === "couple") {
|
||||
} else if (type === "child") {
|
||||
submitChildren();
|
||||
|
|
@ -244,15 +250,15 @@ function onOpenDialogForm(
|
|||
fromData.lastName = fatherData.value.lastName;
|
||||
fromData.job = fatherData.value.job;
|
||||
}
|
||||
} else if (type === "mom") {
|
||||
} else if (type === "mother") {
|
||||
titleForm.value = "มารดา";
|
||||
if (isStatusEdit) {
|
||||
fromData.isLive = momData.value.isLive;
|
||||
fromData.citizenId = momData.value.citizenId;
|
||||
fromData.prefix = momData.value.prefix;
|
||||
fromData.firstName = momData.value.firstName;
|
||||
fromData.lastName = momData.value.lastName;
|
||||
fromData.job = momData.value.job;
|
||||
fromData.isLive = motherData.value.isLive;
|
||||
fromData.citizenId = motherData.value.citizenId;
|
||||
fromData.prefix = motherData.value.prefix;
|
||||
fromData.firstName = motherData.value.firstName;
|
||||
fromData.lastName = motherData.value.lastName;
|
||||
fromData.job = motherData.value.job;
|
||||
}
|
||||
} else if (type === "couple") {
|
||||
titleForm.value = "คู่สมรส";
|
||||
|
|
@ -269,38 +275,9 @@ function onOpenDialogForm(
|
|||
|
||||
function onOpenDialogHistory(type: string) {
|
||||
modalHistory.value = true;
|
||||
console.log(type);
|
||||
}
|
||||
|
||||
// function fetchData() {
|
||||
// const data = [
|
||||
// {
|
||||
// isLive: 0,
|
||||
// citizenId: "123456789101",
|
||||
// prefix: "นาง",
|
||||
// firstName: "บุษดี",
|
||||
// lastName: "มาดีหกหฟก",
|
||||
// job: "12",
|
||||
// lastNameOld: "",
|
||||
// statusMarital: "แต่งงาน",
|
||||
// },
|
||||
// ];
|
||||
// const data2 = [
|
||||
// {
|
||||
// isLive: 1,
|
||||
// citizenId: "123456789101",
|
||||
// prefix: "นาง",
|
||||
// firstName: "บุษดี",
|
||||
// lastName: "มาดีหกหฟก",
|
||||
// job: "12",
|
||||
// lastNameOld: "",
|
||||
// statusMarital: "แต่งงาน",
|
||||
// },
|
||||
// ];
|
||||
|
||||
// coupleData.value = data;
|
||||
// childData.value = data2;
|
||||
// }
|
||||
|
||||
function fetchDataRelationship() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -362,6 +339,8 @@ function submitChildren() {
|
|||
});
|
||||
}
|
||||
|
||||
function fetchHistory() {}
|
||||
|
||||
onMounted(() => {
|
||||
fetchDataFather();
|
||||
fetchDataMother();
|
||||
|
|
@ -457,7 +436,7 @@ onMounted(() => {
|
|||
icon="mdi-pencil-outline"
|
||||
size="14px"
|
||||
dense
|
||||
@click="onOpenDialogForm('mom', true)"
|
||||
@click="onOpenDialogForm('mother', true)"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip></q-btn
|
||||
>
|
||||
|
|
@ -468,7 +447,7 @@ onMounted(() => {
|
|||
color="info"
|
||||
icon="mdi-history"
|
||||
size="14px"
|
||||
@click="onOpenDialogHistory('mom')"
|
||||
@click="onOpenDialogHistory('mother')"
|
||||
>
|
||||
<q-tooltip>ประวัติการแก้ไขข้อมูลครอบครัว</q-tooltip></q-btn
|
||||
>
|
||||
|
|
@ -481,21 +460,21 @@ onMounted(() => {
|
|||
<div>เลขบัตรประจำตัวประชาชน</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
{{ momData.citizenId ? momData.citizenId : "-" }}
|
||||
{{ motherData.citizenId ? motherData.citizenId : "-" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">ชื่อ-นามสกุล</div>
|
||||
<div class="col-6">
|
||||
{{
|
||||
momData.prefix
|
||||
? momData.prefix + momData.firstName + " " + momData.lastName
|
||||
motherData.prefix
|
||||
? motherData.prefix + motherData.firstName + " " + motherData.lastName
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div class="col-1 text-grey-6 text-weight-medium">อาชีพ</div>
|
||||
<div class="col">
|
||||
{{ momData.job ? momData.job : "-" }}
|
||||
{{ motherData.job ? motherData.job : "-" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
|
|
@ -503,7 +482,7 @@ onMounted(() => {
|
|||
สถานภาพการมีชีวิต
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div v-if="momData.isLive">มีชีวิตอยู่</div>
|
||||
<div v-if="motherData.isLive">มีชีวิตอยู่</div>
|
||||
<div v-else>ถึงแก่กรรม</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -545,59 +524,56 @@ onMounted(() => {
|
|||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<div v-for="(item, index) in coupleData" :key="index">
|
||||
<q-card bordered class="bg-grey-1 q-pb-md">
|
||||
<div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center">
|
||||
<div class="text-weight-medium q-pr-md">
|
||||
คู่สมรสที่ : {{ index + 1 }}
|
||||
<q-card bordered class="bg-grey-1 q-pb-md">
|
||||
<div class="col-12 row q-py-sm q-px-md bg-grey-2 items-center">
|
||||
<div class="text-weight-medium q-pr-md">คู่สมรส</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="col-12 q-pa-md q-col-gutter-md">
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
<div>สถานภาพการสมรส</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
{{ coupleData.statusMarital }}
|
||||
</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="col-12 q-pa-md q-col-gutter-md">
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
<div>สถานภาพการสมรส</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
{{ item.statusMarital }}
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
<div>เลขบัตรประจำตัวประชาชน</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
<div>เลขบัตรประจำตัวประชาชน</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
{{ item.citizenId }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
ชื่อ-นามสกุล
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{
|
||||
item.prefix
|
||||
? item.prefix + item.firstName + " " + item.lastName
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div class="col-1 text-grey-6 text-weight-medium">อาชีพ</div>
|
||||
<div class="col">
|
||||
{{ item.job }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
สถานภาพการมีชีวิต
|
||||
</div>
|
||||
<div class="col">
|
||||
<div v-if="item.isLive">มีชีวิตอยู่</div>
|
||||
<div v-else>ถึงแก่กรรม</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
{{ coupleData.citizenId }}
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">ชื่อ-นามสกุล</div>
|
||||
<div class="col-6">
|
||||
{{
|
||||
coupleData.prefix
|
||||
? coupleData.prefix +
|
||||
coupleData.firstName +
|
||||
" " +
|
||||
coupleData.lastName
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div class="col-1 text-grey-6 text-weight-medium">อาชีพ</div>
|
||||
<div class="col">
|
||||
{{ coupleData.job }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row items-center">
|
||||
<div class="col-2 text-grey-6 text-weight-medium">
|
||||
สถานภาพการมีชีวิต
|
||||
</div>
|
||||
<div class="col">
|
||||
<div v-if="coupleData.isLive">มีชีวิตอยู่</div>
|
||||
<div v-else>ถึงแก่กรรม</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<!-- • บุตร -->
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ function editForm(row: any) {
|
|||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewAbilityByProfileId(id,empType.value))
|
||||
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
rows.value = res.data.result;
|
||||
})
|
||||
|
|
@ -243,7 +243,7 @@ async function fetchData(id: string) {
|
|||
async function fetchHistoryData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewAbilityHisByAbilityId(id,empType.value))
|
||||
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
historyRows.value = res.data.result;
|
||||
})
|
||||
|
|
@ -261,6 +261,8 @@ async function addData() {
|
|||
...specialSkill,
|
||||
dateStart: null,
|
||||
dateEnd: null,
|
||||
profileId: empType.value === "" ? id.value : undefined,
|
||||
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
||||
})
|
||||
.then(() => {
|
||||
fetchData(id.value);
|
||||
|
|
@ -276,7 +278,7 @@ async function addData() {
|
|||
|
||||
async function editData(idData: string) {
|
||||
await http
|
||||
.patch(config.API.profileNewAbilityByAbilityId(idData,empType.value), {
|
||||
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
|
||||
...specialSkill,
|
||||
dateStart: null,
|
||||
dateEnd: null,
|
||||
|
|
@ -297,7 +299,7 @@ async function editData(idData: string) {
|
|||
async function deleteData(idData: string) {
|
||||
dialogRemove($q, () =>
|
||||
http
|
||||
.delete(config.API.profileNewAbilityByAbilityId(idData,empType.value))
|
||||
.delete(config.API.profileNewAbilityByAbilityId(idData, empType.value))
|
||||
.then(() => {
|
||||
fetchData(id.value);
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue