ทะเบียนประวัติ => ข้อมูลผลงานและเครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 15:35:15 +07:00
parent 0e290d0c94
commit a268461792
6 changed files with 232 additions and 137 deletions

View file

@ -23,7 +23,6 @@ const {
hideLoader,
messageError,
success,
dialogRemove,
pathRegistryEmp,
} = useCounterMixin();
const id = ref<string>("");
@ -111,24 +110,27 @@ const formData = reactive<RequestNoPaidObject>({
refCommandNo: "",
refCommandDate: null,
});
const formFilter = reactive({
page: 1,
pageSize: 10,
keyword: "",
});
const maxPage = ref<number>(1);
const keyword = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* funciton นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm($q, () => {
isStatusEdit.value ? editData() : saveData();
onClickCloseDialog();
});
}
/**
* function เป Didalig นทกวนทไมไดบเงนเดอนฯ
* @param StatusEdit แกไข , เพ
* @param data อม
*/
function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) {
isStatusEdit.value = StatusEdit;
id.value = StatusEdit ? data.id : "";
@ -140,14 +142,20 @@ function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) {
modalDialog.value = true;
}
/**
* function Didalig นทกวนทไมไดบเงนเดอนฯ
*/
function onClickCloseDialog() {
modalDialog.value = false;
isStatusEdit.value = false;
}
async function getData() {
/**
* function fetch รายการบนทกวนทไมไดบเงนเดอนฯ
*/
function getData() {
showLoader();
await http
http
.get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
@ -160,18 +168,21 @@ async function getData() {
});
}
async function saveData() {
/**
* function เพมขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function saveData() {
showLoader();
await http
http
.post(config.API.profileNewNoPaid(empType.value), {
...formData,
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -181,17 +192,20 @@ async function saveData() {
});
}
async function editData() {
/**
* function แกไขขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function editData() {
showLoader();
await http
http
.patch(config.API.profileNewNoPaidById(id.value, empType.value), {
...formData,
profileId: undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -201,22 +215,9 @@ async function editData() {
});
}
// async function deleteData(id: string) {
// showLoader();
// await http
// .delete(config.API.profileNewNoPaidById(id))
// .then((res) => {
// success($q, "");
// getData();
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
/**
* function เปดขอมลประวการแกไช
*/
function onClickHistory(rowId: string) {
id.value = rowId;
modalHistory.value = true;
@ -243,7 +244,7 @@ onMounted(() => {
<q-input
standout
dense
v-model="formFilter.keyword"
v-model="keyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@ -251,15 +252,15 @@ onMounted(() => {
>
<template v-slot:append>
<q-icon
v-if="formFilter.keyword == ''"
v-if="keyword == ''"
name="search"
@click.stop.prevent="formFilter.keyword = ''"
@click.stop.prevent="keyword = ''"
class="cursor-pointer"
/>
<q-icon
v-if="formFilter.keyword"
v-if="keyword"
name="cancel"
@click.stop.prevent="formFilter.keyword = ''"
@click.stop.prevent="keyword = ''"
class="cursor-pointer"
/>
</template>
@ -320,7 +321,7 @@ onMounted(() => {
:columns="columns"
:rows="rows"
:paging="true"
:filter="formFilter.keyword"
:filter="keyword"
v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns"