ทะเบียนประวัติ
This commit is contained in:
parent
2edda09818
commit
a20426bdf8
20 changed files with 931 additions and 794 deletions
|
|
@ -28,6 +28,9 @@ const {
|
|||
} = mixin;
|
||||
|
||||
const profileId = ref<string>(route.params.id.toString());
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
/** ตัวแปรข้อมูลหลัก */
|
||||
const formMain = reactive<FormMain>({
|
||||
ocId: "", //สังกัด
|
||||
|
|
@ -324,6 +327,7 @@ function openDialogEdit() {
|
|||
|
||||
function openDialogHistory() {
|
||||
modalHistory.value = true;
|
||||
filterKeyword.value = "";
|
||||
getDataHistory();
|
||||
}
|
||||
/** ปิด dialog */
|
||||
|
|
@ -355,15 +359,18 @@ function onSubmit() {
|
|||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.patch(config.API.profileNewGovernmentById(profileId.value), {
|
||||
dateAppoint: containDate.value,
|
||||
dateStart: workDate.value,
|
||||
reasonSameDate:
|
||||
dateToISO(containDate.value as Date) ===
|
||||
dateToISO(workDate.value as Date)
|
||||
? ""
|
||||
: reasonSameDate.value,
|
||||
})
|
||||
.patch(
|
||||
config.API.profileNewGovernmentById(profileId.value, empType.value),
|
||||
{
|
||||
dateAppoint: containDate.value,
|
||||
dateStart: workDate.value,
|
||||
reasonSameDate:
|
||||
dateToISO(containDate.value as Date) ===
|
||||
dateToISO(workDate.value as Date)
|
||||
? ""
|
||||
: reasonSameDate.value,
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
closeDialog();
|
||||
getData();
|
||||
|
|
@ -383,7 +390,7 @@ function onSubmit() {
|
|||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewGovernmentById(profileId.value))
|
||||
.get(config.API.profileNewGovernmentById(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
formMain.ocId = data.org; //สังกัด
|
||||
|
|
@ -416,7 +423,7 @@ function getData() {
|
|||
function getDataHistory() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewGovernmentHistory(profileId.value))
|
||||
.get(config.API.profileNewGovernmentHistory(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
rowsHistory.value = [];
|
||||
|
|
@ -447,21 +454,22 @@ function getDataHistory() {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
modalHistory.value = false
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modalHistory.value,
|
||||
(isOpen) => {
|
||||
if (isOpen === true) {
|
||||
filterKeyword.value = "";
|
||||
getDataHistory();
|
||||
}
|
||||
}
|
||||
);
|
||||
// watch(
|
||||
// () => modalHistory.value,
|
||||
// (isOpen) => {
|
||||
// if (isOpen === true) {
|
||||
// filterKeyword.value = "";
|
||||
// getDataHistory();
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
onMounted(() => {
|
||||
getData();
|
||||
|
|
@ -709,9 +717,7 @@ onMounted(() => {
|
|||
? date2Thai(workDate as Date)
|
||||
: null
|
||||
"
|
||||
:rules="[
|
||||
(val) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ',
|
||||
]"
|
||||
:rules="[(val) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ']"
|
||||
label="วัน/เดือน/ปี เริ่มปฎิบัติราชการ"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -746,18 +752,18 @@ onMounted(() => {
|
|||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
id="onSubmit"
|
||||
type="submit"
|
||||
color="public"
|
||||
class="q-px-md"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
id="onSubmit"
|
||||
type="submit"
|
||||
color="public"
|
||||
class="q-px-md"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ const route = useRoute();
|
|||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -32,7 +35,7 @@ const {
|
|||
dialogRemove,
|
||||
} = mixin;
|
||||
const disciplineData = reactive<RequestItemsObject>({
|
||||
date: new Date(),
|
||||
date: null,
|
||||
level: "",
|
||||
detail: "",
|
||||
unStigma: "",
|
||||
|
|
@ -235,7 +238,7 @@ function openDialogAdd() {
|
|||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewDisciplineByProfileId(id))
|
||||
.get(config.API.profileNewDisciplineByProfileId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
rows.value = res.data.result;
|
||||
})
|
||||
|
|
@ -248,8 +251,19 @@ async function fetchData(id: string) {
|
|||
}
|
||||
|
||||
async function addData() {
|
||||
const body = {
|
||||
date: disciplineData.date,
|
||||
level: disciplineData.level,
|
||||
detail: disciplineData.detail,
|
||||
unStigma: disciplineData.unStigma,
|
||||
refCommandNo: disciplineData.refCommandNo,
|
||||
profileId: empType.value === "" ? disciplineData.profileId : undefined,
|
||||
profileEmployeeId:
|
||||
empType.value !== "" ? disciplineData.profileId : undefined,
|
||||
refCommandDate: disciplineData.refCommandDate,
|
||||
};
|
||||
await http
|
||||
.post(config.API.profileNewDiscipline, disciplineData)
|
||||
.post(config.API.profileNewDiscipline(empType.value), body)
|
||||
.then(() => {
|
||||
fetchData(profileId.value);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
|
|
@ -264,10 +278,13 @@ async function addData() {
|
|||
|
||||
async function editData(idData: string) {
|
||||
await http
|
||||
.patch(config.API.profileNewDisciplineByDisciplineId(idData), {
|
||||
...disciplineData,
|
||||
profileId: undefined,
|
||||
})
|
||||
.patch(
|
||||
config.API.profileNewDisciplineByDisciplineId(idData, empType.value),
|
||||
{
|
||||
...disciplineData,
|
||||
profileId: undefined,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
fetchData(profileId.value);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ref, watch, reactive } from "vue";
|
|||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -16,6 +17,7 @@ const modal = defineModel<boolean>("modal", { required: true });
|
|||
const id = defineModel<string>("id", { required: true });
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
|
||||
|
|
@ -144,10 +146,16 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewDisciplineHisByDisciplineId(id.value))
|
||||
.get(
|
||||
config.API.profileNewDisciplineHisByDisciplineId(id.value, empType.value)
|
||||
)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
rows.value = [];
|
||||
|
|
@ -185,10 +193,7 @@ watch(modal, (status) => {
|
|||
<template>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="min-width: 80%">
|
||||
<DialogHeader
|
||||
tittle="ประวัติแก้ไขวินัย"
|
||||
:close="() => (modal = false)"
|
||||
/>
|
||||
<DialogHeader tittle="ประวัติแก้ไขวินัย" :close="() => (modal = false)" />
|
||||
<q-separator color="grey-4" />
|
||||
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ const route = useRoute();
|
|||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -368,9 +371,9 @@ function validateForm() {
|
|||
*/
|
||||
function saveData() {
|
||||
showLoader();
|
||||
|
||||
http
|
||||
.post(config.API.profileNewLeave(), {
|
||||
profileId: profileId.value,
|
||||
.post(config.API.profileNewLeave(empType.value), {
|
||||
leaveTypeId: typeLeave.value.id,
|
||||
dateLeaveStart: dateToISO(dateRange.value[0]),
|
||||
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
||||
|
|
@ -379,8 +382,10 @@ function saveData() {
|
|||
totalLeave: 0,
|
||||
status: statLeave.value,
|
||||
reason: reason.value,
|
||||
profileId: empType.value === "" ? profileId.value : undefined,
|
||||
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
})
|
||||
|
|
@ -398,7 +403,7 @@ function saveData() {
|
|||
const editData = async () => {
|
||||
showLoader();
|
||||
http
|
||||
.patch(config.API.profileNewLeaveById(id.value), {
|
||||
.patch(config.API.profileNewLeaveById(id.value, empType.value), {
|
||||
leaveTypeId: typeLeave.value.id,
|
||||
dateLeaveStart: dateToISO(dateRange.value[0]),
|
||||
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
||||
|
|
@ -408,7 +413,7 @@ const editData = async () => {
|
|||
status: statLeave.value,
|
||||
reason: reason.value,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
})
|
||||
|
|
@ -423,7 +428,7 @@ const editData = async () => {
|
|||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewLeaveById(profileId.value))
|
||||
.get(config.API.profileNewLeaveById(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
console.log(res.data.result);
|
||||
const data = res.data.result;
|
||||
|
|
@ -440,7 +445,7 @@ function getData() {
|
|||
}));
|
||||
})
|
||||
.catch((e) => {
|
||||
// messageError($q, e);
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
@ -679,121 +684,121 @@ onMounted(() => {
|
|||
<q-separator color="grey-4" />
|
||||
|
||||
<q-card-section style="max-height: 50vh" class="scroll">
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-select
|
||||
ref="typeLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="typeLeave"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทการลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'ประเภทการลา'}`"
|
||||
@update:modelValue="clickEditRowType"
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="typeLeaveOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
@filter="(inputValue:string,
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-select
|
||||
ref="typeLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="typeLeave"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทการลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'ประเภทการลา'}`"
|
||||
@update:modelValue="clickEditRowType"
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="typeLeaveOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
@filter="(inputValue:string,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'typeLeaveOption'
|
||||
) "
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<datepicker
|
||||
:readonly="!typeLeave"
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateRange"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
range
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:readonly="!typeLeave"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
ref="dateRangeRef"
|
||||
:model-value="dateThaiRange(dateRange)"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกวัน เดือน ปีที่ลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วัน เดือน ปีที่ลา'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
ref="numLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="numLeave"
|
||||
type="number"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกจำนวนวันที่ลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'จำนวนวันที่ลา'}`"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-select
|
||||
ref="statLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="statLeave"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะการลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'สถานะการลา'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="statLeaveOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
@filter="(inputValue:string,
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<datepicker
|
||||
:readonly="!typeLeave"
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateRange"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
range
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:readonly="!typeLeave"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
ref="dateRangeRef"
|
||||
:model-value="dateThaiRange(dateRange)"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกวัน เดือน ปีที่ลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วัน เดือน ปีที่ลา'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
ref="numLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="numLeave"
|
||||
type="number"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกจำนวนวันที่ลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'จำนวนวันที่ลา'}`"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-select
|
||||
ref="statLeaveRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="statLeave"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะการลา'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'สถานะการลา'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="statLeaveOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
@filter="(inputValue:string,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'statLeaveOption'
|
||||
) "
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||
<q-input
|
||||
ref="reasonRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="reason"
|
||||
type="textarea"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'เหตุผล'}`"
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||
<q-input
|
||||
ref="reasonRef"
|
||||
class="full-width inputgreen cursor-pointer"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="reason"
|
||||
type="textarea"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'เหตุผล'}`"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ref, watch, reactive } from "vue";
|
|||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -16,9 +17,13 @@ const modal = defineModel<boolean>("modal", { required: true });
|
|||
const id = defineModel<string>("id", { required: true });
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
const filterKeyword = ref<string>("");
|
||||
const rows = ref<DetailData[]>([]); //select data history
|
||||
const formFilter = reactive<FormFilter>({
|
||||
|
|
@ -144,7 +149,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewLeaveHistory(id.value))
|
||||
.get(config.API.profileNewLeaveHistory(id.value, empType.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
rows.value = [];
|
||||
|
|
@ -215,10 +220,7 @@ watch(modal, (status) => {
|
|||
<template>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="min-width: 80%">
|
||||
<DialogHeader
|
||||
tittle="ประวัติแก้ไขการลา"
|
||||
:close="() => (modal = false)"
|
||||
/>
|
||||
<DialogHeader tittle="ประวัติแก้ไขการลา" :close="() => (modal = false)" />
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
<div class="row q-gutter-sm q-mb-sm">
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ const route = useRoute();
|
|||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -200,7 +203,7 @@ function closeDialog() {
|
|||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileNewDutyByProfileId(id))
|
||||
.get(config.API.profileNewDutyByProfileId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
rows.value = res.data.result;
|
||||
})
|
||||
|
|
@ -215,8 +218,18 @@ async function fetchData(id: string) {
|
|||
/** เพิ่มข้อมูล */
|
||||
|
||||
async function addData() {
|
||||
const body = {
|
||||
profileId: empType.value === "" ? profileId.value : undefined,
|
||||
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
|
||||
dateStart: dutyData.dateStart,
|
||||
dateEnd: dutyData.dateEnd,
|
||||
detail: dutyData.detail,
|
||||
reference: dutyData.reference,
|
||||
refCommandNo: dutyData.refCommandNo,
|
||||
refCommandDate: dutyData.refCommandDate,
|
||||
};
|
||||
await http
|
||||
.post(config.API.profileNewDuty, dutyData)
|
||||
.post(config.API.profileNewDuty(empType.value), body)
|
||||
.then(() => {
|
||||
fetchData(profileId.value);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
|
|
@ -233,7 +246,7 @@ async function addData() {
|
|||
|
||||
async function editData(idData: string) {
|
||||
await http
|
||||
.patch(config.API.profileNewDutyByDutyId(idData), {
|
||||
.patch(config.API.profileNewDutyByDutyId(idData, empType.value), {
|
||||
...dutyData,
|
||||
profileId: undefined,
|
||||
})
|
||||
|
|
@ -551,9 +564,7 @@ onMounted(async () => {
|
|||
outlined
|
||||
dense
|
||||
:model-value="date2Thai(dutyData.dateStart)"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`,
|
||||
]"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่เริ่มต้น'}`"
|
||||
>
|
||||
|
|
@ -592,9 +603,7 @@ onMounted(async () => {
|
|||
dense
|
||||
outlined
|
||||
:model-value="date2Thai(dutyData.dateEnd)"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`,
|
||||
]"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่สิ้นสุด'}`"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -11,14 +11,19 @@ import type {
|
|||
FormFilter,
|
||||
ResponseObject,
|
||||
} from "@/modules/04_registryNew/interface/index/performSpecialWork";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const id = defineModel<string>("id", { required: true });
|
||||
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
|
||||
const empType = ref<string>(
|
||||
route.name === "registryNewByid" ? "" : "-employee"
|
||||
);
|
||||
const currentPage = ref<number>(1);
|
||||
const maxPage = ref<number>(1);
|
||||
const filterKeyword = ref<string>("");
|
||||
|
|
@ -147,7 +152,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profileNewDutyHisByDutyId(id.value))
|
||||
.get(config.API.profileNewDutyHisByDutyId(id.value, empType.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
rows.value = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue