ทะเบียนประวัติ => ข้อมูลผลงานและเครื่องราชฯ
This commit is contained in:
parent
0e290d0c94
commit
a268461792
6 changed files with 232 additions and 137 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue