ต้นแบบ สำหรับลงในตำแหน่ง/เงินเดือน fix ค้นหาข้อมูล
This commit is contained in:
parent
2597b4b344
commit
b30cc6d657
2 changed files with 27 additions and 22 deletions
|
|
@ -10,8 +10,9 @@ export default {
|
|||
page: number,
|
||||
pageSize: number,
|
||||
isActive: boolean,
|
||||
commandSysId: string
|
||||
commandSysId: string,
|
||||
search: string
|
||||
) =>
|
||||
`${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}`,
|
||||
commandSalaryById:(id:string)=>`${commandSalary}/${id}`
|
||||
`${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}&search=${search}`,
|
||||
commandSalaryById: (id: string) => `${commandSalary}/${id}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -116,21 +116,21 @@ function onDialogEdit(data: ListTemplateSalary) {
|
|||
* ลบ คำสั่ง
|
||||
* @param id id คำสั่ง
|
||||
*/
|
||||
function onDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
async function onDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.delete(config.API.commandSalaryById(id))
|
||||
.then(async (res) => {
|
||||
success($q, "ลบข้อมูลเสร็จสิ้น");
|
||||
.then(async () => {
|
||||
await fetchSalaryList();
|
||||
hideLoader();
|
||||
success($q, "ลบข้อมูลเสร็จสิ้น");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -146,33 +146,34 @@ function closeDialog() {
|
|||
|
||||
/** บันทึกข้อมูล dialog */
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
dialogConfirm($q, async () => {
|
||||
const url = isEdit.value
|
||||
? config.API.commandSalaryById(dataForm.id)
|
||||
: config.API.commandSalary;
|
||||
showLoader();
|
||||
http[isEdit.value ? "put" : "post"](url, {
|
||||
await http[isEdit.value ? "put" : "post"](url, {
|
||||
name: dataForm.name,
|
||||
commandSysId: activeOrderId.value,
|
||||
isActive: dataForm.isActive,
|
||||
})
|
||||
.then(async (res) => {
|
||||
closeDialog();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await fetchSalaryList();
|
||||
hideLoader();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** เก็บ id list คำสั่งที่เลือก เพื่อใช้ class */
|
||||
function selectInbox(data: CommandSysType) {
|
||||
activeOrderId.value = data.id;
|
||||
pagination.value.page = 1;
|
||||
fetchSalaryList();
|
||||
}
|
||||
|
||||
|
|
@ -181,13 +182,15 @@ function selectInbox(data: CommandSysType) {
|
|||
*/
|
||||
async function fetchSalaryList() {
|
||||
showLoader();
|
||||
rows.value = [];
|
||||
await http
|
||||
.get(
|
||||
config.API.commandSalaryDetail(
|
||||
pagination.value.page,
|
||||
pagination.value.rowsPerPage,
|
||||
isActive.value,
|
||||
activeOrderId.value
|
||||
activeOrderId.value,
|
||||
filter.value
|
||||
)
|
||||
)
|
||||
.then(async (res) => {
|
||||
|
|
@ -239,6 +242,7 @@ watch(
|
|||
watch(
|
||||
() => isActive.value,
|
||||
async () => {
|
||||
pagination.value.page = 1;
|
||||
await fetchSalaryList();
|
||||
}
|
||||
);
|
||||
|
|
@ -321,6 +325,7 @@ onMounted(() => {
|
|||
outlined
|
||||
v-model="filter"
|
||||
placeholder="ค้นหา"
|
||||
@keydown.enter="(pagination.page = 1), fetchSalaryList()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" v-if="filter == ''" />
|
||||
|
|
@ -352,13 +357,12 @@ onMounted(() => {
|
|||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:filter="filter"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
:rows-per-page-options="[1, 25, 50, 100]"
|
||||
:rows-per-page-options="[25, 50, 100]"
|
||||
@update:pagination="updatePagination"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue