fix CurrentPage ==> อัตราเงินเดือน
This commit is contained in:
parent
1faa8e798a
commit
014bcdf180
1 changed files with 27 additions and 37 deletions
|
|
@ -1,15 +1,15 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { updateCurrentPage } from "@/utils/function";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
/** importType */
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
NewPagination,
|
||||
|
|
@ -18,17 +18,13 @@ import type {
|
|||
import type { SalaryRate } from "@/modules/13_salary/interface/response/Main";
|
||||
import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main";
|
||||
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
/** importComponents */
|
||||
import DialogFormRate from "@/modules/13_salary/components/01_Salary/DialogFormRate.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
/** use composables */
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
|
@ -38,12 +34,12 @@ const { dialogRemove, success, messageError, showLoader, hideLoader } =
|
|||
const isActive = ref<boolean>(false);
|
||||
const posType = ref<string>("");
|
||||
|
||||
const salaryId = ref<string>(route.params.id.toString());
|
||||
const salaryId = ref<string>(route.params.id.toString()); // id รายการผังบัญชีเงินเดือน
|
||||
|
||||
/** modalDialog*/
|
||||
/** modalDialog */
|
||||
const modalDialogFormRate = ref<boolean>(false);
|
||||
|
||||
/** Table*/
|
||||
/** Table */
|
||||
const rows = ref<SalaryRate[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -102,7 +98,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
/** List Mune*/
|
||||
/** List Menu */
|
||||
const itemMenu = ref<ItemsMenu[]>([
|
||||
{
|
||||
label: "แก้ไข",
|
||||
|
|
@ -119,7 +115,7 @@ const itemMenu = ref<ItemsMenu[]>([
|
|||
},
|
||||
]);
|
||||
|
||||
/** queryString*/
|
||||
/** queryString */
|
||||
const formQuery = reactive<FormQuerySalary>({
|
||||
page: 1, //*หน้า
|
||||
pageSize: 100, //*จำนวนแถวต่อหน้า
|
||||
|
|
@ -135,9 +131,7 @@ const pagination = ref({
|
|||
const typeAction = ref<string>(""); //ประเภทการกระทำ
|
||||
const dataSalaryRate = ref<SalaryRate>(); //ข้อมูลรายการ
|
||||
|
||||
/**
|
||||
* fetch รายการอัตราเงินเดือน
|
||||
*/
|
||||
/** ฟังก์ชันดึงข้อมูลรายการอัตราเงินเดือน*/
|
||||
async function fetchListSalaryRate() {
|
||||
const page = formQuery.page.toString();
|
||||
const pageSize = formQuery.pageSize.toString();
|
||||
|
|
@ -159,8 +153,8 @@ async function fetchListSalaryRate() {
|
|||
}
|
||||
|
||||
/**
|
||||
* function openDialog เพิ่ม,แก้ไข อัตราเงินเดือน
|
||||
* @param type ประเภท แก่ไข,เพิ่ม
|
||||
* ฟังก์ชัน openDialog เพิ่ม,แก้ไข อัตราเงินเดือน
|
||||
* @param type ประเภท แก้ไข,เพิ่ม
|
||||
* @param data ข้อมูลอัตราเงินเดือน
|
||||
*/
|
||||
function onClickSalaryRate(type: string, data: SalaryRate | null) {
|
||||
|
|
@ -178,15 +172,15 @@ function onClickSalaryRate(type: string, data: SalaryRate | null) {
|
|||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
formQuery.page =
|
||||
formQuery.page !== 1 &&
|
||||
formQuery.page === maxPage.value &&
|
||||
rows.value.length === 1
|
||||
? formQuery.page - 1
|
||||
: formQuery.page;
|
||||
await http
|
||||
.delete(config.API.salaryRateListByid(id))
|
||||
.then(async () => {
|
||||
formQuery.page = await updateCurrentPage(
|
||||
formQuery.page,
|
||||
maxPage.value,
|
||||
rows.value.length
|
||||
);
|
||||
|
||||
await fetchListSalaryRateNew();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
|
|
@ -199,9 +193,7 @@ function onClickDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดาวน์โหลดไฟล์
|
||||
*/
|
||||
/** ฟังก์ชันดาวน์โหลดรายงานอัตราเงินเดือน */
|
||||
function clickDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -218,9 +210,7 @@ function clickDownload() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลอัตราเงินเดือน
|
||||
*/
|
||||
/** ฟังก์ชันดึงข้อมูลอัตราเงินเดือน */
|
||||
function fetchDataSalary() {
|
||||
http
|
||||
.get(config.API.salaryChartByid(salaryId.value))
|
||||
|
|
@ -235,7 +225,7 @@ function fetchDataSalary() {
|
|||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* ฟังก์ชัน updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
|
|
@ -243,6 +233,7 @@ function updatePagination(newPagination: NewPagination) {
|
|||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** ฟังก์ชันดึงข้อมูลรายการอัตราเงินเดือนใหม่ */
|
||||
async function fetchListSalaryRateNew() {
|
||||
try {
|
||||
showLoader();
|
||||
|
|
@ -254,9 +245,7 @@ async function fetchListSalaryRateNew() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อมีการ เปลี่ยนหน้าหรือ แถว
|
||||
*/
|
||||
/** ฟังก์ชันติดตามการเปลี่ยนแปลงขนาดหน้า */
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
async () => {
|
||||
|
|
@ -264,6 +253,7 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** Hook ที่ทำงานเมื่อ component ถูก mount */
|
||||
onMounted(async () => {
|
||||
try {
|
||||
showLoader();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue