fix CurrentPage ===> รายชื่อลูกจ้างชั่วคราว
This commit is contained in:
parent
8a0395da63
commit
76e83221d5
1 changed files with 17 additions and 17 deletions
|
|
@ -1,12 +1,14 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRouter } from "vue-router";
|
||||
import {
|
||||
checkPermission,
|
||||
checkPermissionList,
|
||||
checkPermissionCreate,
|
||||
} from "@/utils/permissions";
|
||||
import { updateCurrentPage } from "@/utils/function";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRegistryEmp } from "@/modules/08_registryEmployee/stores/registry-employee";
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -43,7 +45,7 @@ const modalPos = ref<boolean>(false); //popup กำหนดตำแหน่
|
|||
const modalSendOrder = ref<boolean>(false); //popup ส่งไปออกคำสั่ง
|
||||
const dataRow = ref<DataEmployee>(); //ข้อมูลรายชื่อลูกจ้างชั่วคราวที่ต้องการกำหนดตำแหน่ง
|
||||
|
||||
/** Table*/
|
||||
/** Table */
|
||||
const rows = ref<DataEmployee[]>([]); //รายชื่อลูกจ้างชั่วคราว
|
||||
const maxPage = ref<number>(0); //จำนวนหน้า
|
||||
const total = ref<number>(0); //จำนวนข้อมูล
|
||||
|
|
@ -208,7 +210,7 @@ const visibleColumns = ref<String[]>([
|
|||
"dateAppoint",
|
||||
]);
|
||||
|
||||
/** ฟังก์ชันดึงข้อมูลรายชื่อลูกจ้างชั่วคราว*/
|
||||
/** ฟังก์ชันดึงข้อมูลรายชื่อลูกจ้างชั่วคราว */
|
||||
async function fetchList() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -233,20 +235,19 @@ async function fetchList() {
|
|||
|
||||
/**
|
||||
* ฟังก์ชันลบข้อมูลรายชื่อลูกจ้างชั่วคราว
|
||||
* @param id รายชื่อลูกจ้างชั่วคราวที่ต้องการลบ
|
||||
* @param id รายชื่อลูกจ้างชั่วคราวที่ต้องการลบ
|
||||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
queryParams.page =
|
||||
queryParams.page !== 1 &&
|
||||
queryParams.page === maxPage.value &&
|
||||
rows.value.length === 1
|
||||
? queryParams.page - 1
|
||||
: queryParams.page;
|
||||
await http
|
||||
.delete(config.API.registryNew("-employee") + `/${id}`)
|
||||
.then(async () => {
|
||||
queryParams.page = await updateCurrentPage(
|
||||
queryParams.page,
|
||||
maxPage.value,
|
||||
rows.value.length
|
||||
);
|
||||
await fetchList();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
|
|
@ -261,13 +262,13 @@ function onClickDelete(id: string) {
|
|||
|
||||
/**
|
||||
* ฟังก์ชันดูข้อมูลรายชื่อลูกจ้างชั่วคราว ไปยัง ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
* @param id รายชื่อลูกจ้างชั่วคราวที่ต้องการ
|
||||
* @param id รายชื่อลูกจ้างชั่วคราวที่ต้องการ
|
||||
*/
|
||||
function redirectToPageDetail(id: string) {
|
||||
router.push(`/registry-temp/${id}`);
|
||||
}
|
||||
|
||||
/** ฟังก์ชันเปิด popup เพิ่มข้อมูลลูกจ้างชั่วคราว*/
|
||||
/** ฟังก์ชันเปิด popup เพิ่มข้อมูลลูกจ้างชั่วคราว */
|
||||
function onClickAddEmployee() {
|
||||
modalAddEmployee.value = true;
|
||||
}
|
||||
|
|
@ -281,13 +282,13 @@ function onClickSelectPos(data: DataEmployee) {
|
|||
dataRow.value = data;
|
||||
}
|
||||
|
||||
/** ฟังก์ชันเปิด popup ส่งรายชื่อไปออกคำสั่ง*/
|
||||
/** ฟังก์ชันเปิด popup ส่งรายชื่อไปออกคำสั่ง */
|
||||
function onClickSendOrder() {
|
||||
modalSendOrder.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* ฟังก์ชันอัพเดต Pagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
|
|
@ -295,7 +296,7 @@ function updatePagination(newPagination: NewPagination) {
|
|||
queryParams.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** ทำงานเมื่อมีการเปลี่่ยนจำนวนข้อมูลต่อหน้า*/
|
||||
/** ทำงานเมื่อมีการเปลี่่ยนจำนวนข้อมูลต่อหน้า */
|
||||
watch(
|
||||
() => queryParams.pageSize,
|
||||
() => {
|
||||
|
|
@ -303,8 +304,7 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** ทำงานเมื่อมีการเรียกใข้ Components
|
||||
*/
|
||||
/** ทำงานเมื่อมีการเรียกใข้ Components */
|
||||
onMounted(async () => {
|
||||
await fetchList();
|
||||
});
|
||||
|
|
@ -467,7 +467,7 @@ onMounted(async () => {
|
|||
dense
|
||||
color="red"
|
||||
icon="mdi-delete"
|
||||
@click.pervent="onClickDelete(props.row.id)"
|
||||
@click.prevent="onClickDelete(props.row.id)"
|
||||
>
|
||||
<q-tooltip>ลบ </q-tooltip>
|
||||
</q-btn>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue