API อัตราเงินเดือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-16 17:57:37 +07:00
parent bbb14c060f
commit 65341e199b
3 changed files with 79 additions and 31 deletions

View file

@ -107,7 +107,7 @@ const itemMenu = ref<ItemsMenu[]>([
/** queryString*/
const formQuery = reactive<FormQuerySalary>({
page: 1, //*
pageSize: 100, //*
pageSize: 10, //*
keyword: "", //keyword
});
const totalRow = ref<number>(1);
@ -124,6 +124,7 @@ async function fetchListSalalyRate() {
)
.then((res) => {
console.log(res);
rows.value = res.data.result.data;
})
.catch((err) => {
// messageError($q, err);
@ -175,8 +176,8 @@ async function fetchListSalalyRate() {
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: NewPagination) {
// formQuery.page = 1;
// formQuery.pageSize = newPagination.rowsPerPage;
formQuery.page = 1;
formQuery.pageSize = newPagination.rowsPerPage;
}
const typeAction = ref<string>("");
@ -189,9 +190,20 @@ function onClickSalaryRate(type: string, data: SalaryRate | null) {
}
}
function onClickDelete() {
dialogRemove($q, () => {
success($q, "ลบข้อมูลสำเร็จ");
function onClickDelete(id: string) {
dialogRemove($q, async () => {
await http
.delete(config.API.salaryRateListByid(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
fetchListSalalyRate();
hideLoader();
});
});
}
@ -275,29 +287,35 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
<div v-else-if="col.name === 'salaryHalf'">
{{
props.row.salaryHalfSpecial
? col.value + " " + `(${props.row.salaryHalfSpecial})`
: col.value
? col.value.toLocaleString() +
" " +
`(${props.row.salaryHalfSpecial.toLocaleString()})`
: col.value.toLocaleString()
}}
</div>
<div v-else-if="col.name === 'salaryFull'">
{{
props.row.salaryFullSpecial
? col.value + " " + `(${props.row.salaryFullSpecial})`
: col.value
? col.value.toLocaleString() +
" " +
`(${props.row.salaryFullSpecial.toLocaleString()})`
: col.value.toLocaleString()
}}
</div>
<div v-else-if="col.name === 'salaryFullHalf'">
{{
props.row.salaryFullHalfSpecial
? col.value + " " + `(${props.row.salaryFullHalfSpecial})`
: col.value
? col.value.toLocaleString() +
" " +
`(${props.row.salaryFullHalfSpecial.toLocaleString()})`
: col.value.toLocaleString()
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
{{ col.value ? col.value.toLocaleString() : "-" }}
</div>
</q-td>
<q-td>
@ -320,7 +338,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
item.type === 'edit'
? onClickSalaryRate('edit', props.row)
: item.type === 'delete'
? onClickDelete()
? onClickDelete(props.row.id)
: null
"
>
@ -361,6 +379,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
v-model:modal="modalDialogFormRate"
:typeAction="typeAction"
:data="dataRow"
:fetchData="fetchListSalalyRate"
/>
</template>