Merge branch 'develop'
This commit is contained in:
commit
c38a71c745
5 changed files with 56 additions and 15 deletions
|
|
@ -6,6 +6,7 @@ import { useRouter } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { updateCurrentPage } from "@/utils/functions";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
|
@ -233,12 +234,17 @@ function openDialog() {
|
||||||
* @param id รายการผู้ใช้งาน
|
* @param id รายการผู้ใช้งาน
|
||||||
* ลบข้อมูลรายชื่อเสร็จแล้วทำการดึงข้อมูลรายชื่อผู้ใช้งานใหม่
|
* ลบข้อมูลรายชื่อเสร็จแล้วทำการดึงข้อมูลรายชื่อผู้ใช้งานใหม่
|
||||||
*/
|
*/
|
||||||
function onDeleteUser(id: string) {
|
async function onDeleteUser(id: string) {
|
||||||
dialogRemove($q, () => {
|
dialogRemove($q, () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.delete(config.API.managementUser + `/${id}`)
|
.delete(config.API.managementUser + `/${id}`)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
|
currentPage.value = await updateCurrentPage(
|
||||||
|
currentPage.value,
|
||||||
|
maxPage.value,
|
||||||
|
rows.value.length
|
||||||
|
);
|
||||||
await fetchListUsers();
|
await fetchListUsers();
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ interface ListOrder {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
category?: string;
|
category?: string;
|
||||||
|
code: string;
|
||||||
commandSysId: string;
|
commandSysId: string;
|
||||||
isUploadAttachment: boolean;
|
isUploadAttachment: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ const filteredTabs = computed(() =>
|
||||||
: tabs.value.filter((tab) => tab.value !== "attachment")
|
: tabs.value.filter((tab) => tab.value !== "attachment")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isCode = ref<string>(""); // ตัวแปรเก็บ code
|
||||||
const isActive = ref<boolean>(true); // สถานะของรายการคำสั่ง
|
const isActive = ref<boolean>(true); // สถานะของรายการคำสั่ง
|
||||||
const isAttachment = ref<boolean>(true); // บัญชีแนบท้าย
|
const isAttachment = ref<boolean>(true); // บัญชีแนบท้าย
|
||||||
const isSalary = ref<boolean>(true); // แก้ไขเงินเดือน
|
const isSalary = ref<boolean>(true); // แก้ไขเงินเดือน
|
||||||
|
|
@ -206,6 +207,12 @@ function onSubmit() {
|
||||||
* เก็บ id list คำสั่งที่เลือก เพื่อใช้ class
|
* เก็บ id list คำสั่งที่เลือก เพื่อใช้ class
|
||||||
*/
|
*/
|
||||||
function selectInbox(data: ListOrder) {
|
function selectInbox(data: ListOrder) {
|
||||||
|
isCode.value = data.code;
|
||||||
|
if (data.code === "C-PM-47") {
|
||||||
|
isAttachmentShow.value = false;
|
||||||
|
activeCommandId.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
store.currentTab =
|
store.currentTab =
|
||||||
!data.isAttachment && store.currentTab == "attachment"
|
!data.isAttachment && store.currentTab == "attachment"
|
||||||
? "cover"
|
? "cover"
|
||||||
|
|
@ -404,6 +411,15 @@ onMounted(async () => {
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="isCode == 'C-PM-47'"
|
||||||
|
style="height: auto; max-width: 100%; max-height: 90vh"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="absolute-center text-center text-grey-9"
|
||||||
|
style="width: 100%"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
<div v-else style="height: auto; max-width: 100%; max-height: 90vh">
|
<div v-else style="height: auto; max-width: 100%; max-height: 90vh">
|
||||||
<div
|
<div
|
||||||
class="absolute-center text-center text-grey-9"
|
class="absolute-center text-center text-grey-9"
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,13 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
||||||
const date = new Date(`${year}-${month + 1}-1`);
|
if (
|
||||||
|
month < 0 ||
|
||||||
|
month > 11 ||
|
||||||
|
!Number.isFinite(month) ||
|
||||||
|
!Number.isFinite(year)
|
||||||
|
)
|
||||||
|
return "";
|
||||||
const fullMonthThai = [
|
const fullMonthThai = [
|
||||||
"มกราคม",
|
"มกราคม",
|
||||||
"กุมภาพันธ์",
|
"กุมภาพันธ์",
|
||||||
|
|
@ -218,19 +224,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
"พ.ย.",
|
"พ.ย.",
|
||||||
"ธ.ค.",
|
"ธ.ค.",
|
||||||
];
|
];
|
||||||
let dstYear = 0;
|
|
||||||
if (date.getFullYear() > 2500) {
|
// assume year is in BE if > 2500
|
||||||
dstYear = date.getFullYear();
|
let dstYear = year > 2500 ? year : year + 543;
|
||||||
} else {
|
// month is already 0-based
|
||||||
dstYear = date.getFullYear() + 543;
|
let dstMonth = isFullMonth ? fullMonthThai[month] : abbrMonthThai[month];
|
||||||
}
|
return `${dstMonth} ${dstYear}`;
|
||||||
let dstMonth = "";
|
|
||||||
if (isFullMonth) {
|
|
||||||
dstMonth = fullMonthThai[date.getMonth()];
|
|
||||||
} else {
|
|
||||||
dstMonth = abbrMonthThai[date.getMonth()];
|
|
||||||
}
|
|
||||||
return dstMonth + " " + dstYear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateToISO(date: Date) {
|
function dateToISO(date: Date) {
|
||||||
|
|
|
||||||
19
src/utils/functions.ts
Normal file
19
src/utils/functions.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
* คำนวณหน้าที่จะแสดงหลังจากลบข้อมูล
|
||||||
|
*
|
||||||
|
* @param page หน้าปัจจุบัน
|
||||||
|
* @param maxPage หน้าสุดท้าย
|
||||||
|
* @param total จำนวนข้อมูลในหน้าปัจจุบัน
|
||||||
|
* @returns หน้าที่ควรแสดง
|
||||||
|
*/
|
||||||
|
export async function updateCurrentPage(
|
||||||
|
page: number,
|
||||||
|
maxPage: number,
|
||||||
|
total: number
|
||||||
|
) {
|
||||||
|
// ถ้าหน้าปัจจุบันไม่ใช่หน้าแรก และเป็นหน้าสุดท้าย และมีข้อมูลเหลือ 1 รายการ ให้กลับไปหน้าก่อนหน้า
|
||||||
|
if (page > 1 && page === maxPage && total === 1) {
|
||||||
|
return page - 1;
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue