ทะเบียนประวัติ => ข้อมูลครอบครัว
This commit is contained in:
parent
f89c9e02c1
commit
acee32e3cf
12 changed files with 240 additions and 110 deletions
|
|
@ -33,6 +33,9 @@ const {
|
|||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
|
||||
const id = ref<string>("");
|
||||
const insigniaType = ref<string>("");
|
||||
|
|
@ -447,7 +450,7 @@ async function fetchData() {
|
|||
showLoader();
|
||||
try {
|
||||
const res = await http.get(
|
||||
config.API.profileNewInsignByProfileId(profileId.value)
|
||||
config.API.profileNewInsignByProfileId(profileId.value, empType.value)
|
||||
);
|
||||
rows.value = res.data.result;
|
||||
} catch (error) {
|
||||
|
|
@ -474,12 +477,15 @@ async function addEditData(editStatus: boolean = false) {
|
|||
if (!profileId.value) return;
|
||||
|
||||
const url = editStatus
|
||||
? config.API.profileNewInsignById(id.value)
|
||||
: config.API.profileNewInsign;
|
||||
? config.API.profileNewInsignById(id.value, empType.value)
|
||||
: config.API.profileNewInsign(empType.value);
|
||||
const method = editStatus ? "patch" : "post";
|
||||
const reqBody: RequestItemsObject = {
|
||||
...insigniaForm,
|
||||
profileId: editStatus ? undefined : profileId.value,
|
||||
profileEmployeeId:
|
||||
!editStatus && empType.value !== "" ? profileId.value : undefined,
|
||||
profileId:
|
||||
!editStatus && empType.value === "" ? profileId.value : undefined,
|
||||
};
|
||||
try {
|
||||
await http[method](url, reqBody);
|
||||
|
|
@ -528,7 +534,9 @@ async function clickHistory(row: ResponseObject) {
|
|||
|
||||
showLoader();
|
||||
try {
|
||||
const res = await http.get(config.API.profileNewInsignHisById(row.id));
|
||||
const res = await http.get(
|
||||
config.API.profileNewInsignHisById(row.id, empType.value)
|
||||
);
|
||||
rowsHistory.value = res.data.result;
|
||||
} catch (e) {
|
||||
messageError($q, e);
|
||||
|
|
@ -599,7 +607,13 @@ onMounted(async () => {
|
|||
|
||||
<template>
|
||||
<div class="row items-center q-gutter-x-sm q-pb-sm">
|
||||
<q-btn dense color="primary" icon="add" flat round @click="onClickOpenDialog()"
|
||||
<q-btn
|
||||
dense
|
||||
color="primary"
|
||||
icon="add"
|
||||
flat
|
||||
round
|
||||
@click="onClickOpenDialog()"
|
||||
><q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
||||
>
|
||||
|
||||
|
|
@ -799,7 +813,7 @@ onMounted(async () => {
|
|||
/>
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-section style="max-height: 55vh" class="scroll">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<datepicker
|
||||
autoApply
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue