ทะเบียนประวัติ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-14 16:05:58 +07:00
parent 2edda09818
commit a20426bdf8
20 changed files with 931 additions and 794 deletions

View file

@ -28,6 +28,9 @@ const id = ref<string>("");
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const modelView = ref<string>("table");
const modalDialog = ref<boolean>(false);
@ -145,7 +148,7 @@ function onClickCloseDialog() {
async function getData() {
showLoader();
await http
.get(config.API.profileNewNoPaidByProfileId(profileId.value))
.get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
})
@ -160,9 +163,10 @@ async function getData() {
async function saveData() {
showLoader();
await http
.post(config.API.profileNewNoPaid, {
.post(config.API.profileNewNoPaid(empType.value), {
...formData,
profileId: profileId.value,
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -180,7 +184,7 @@ async function saveData() {
async function editData() {
showLoader();
await http
.patch(config.API.profileNewNoPaidById(id.value), {
.patch(config.API.profileNewNoPaidById(id.value, empType.value), {
...formData,
profileId: undefined,
})
@ -224,7 +228,13 @@ onMounted(() => {
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn dense color="teal-5" icon="add" flat round @click="onClickOpenDialog()"
<q-btn
dense
color="teal-5"
icon="add"
flat
round
@click="onClickOpenDialog()"
><q-tooltip>เพมขอม</q-tooltip></q-btn
>
@ -427,7 +437,7 @@ onMounted(() => {
:close="onClickCloseDialog"
/>
<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="col-xs-6 col-sm-6 col-md-6">
@ -451,9 +461,7 @@ onMounted(() => {
borderless
class="inputgreen"
:model-value="date2Thai(formData.date)"
:rules="[
(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`,
]"
:rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]"
hide-bottom-space
:label="`${'วัน/เดือน/ปี'}`"
>
@ -479,9 +487,7 @@ onMounted(() => {
borderless
v-model="formData.reference"
class="inputgreen"
:rules="[
(val) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`,
]"
:rules="[(val) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]"
hide-bottom-space
:label="`${'เอกสารอ้างอิง'}`"
/>