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