Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-07-18 15:59:16 +07:00
commit c38a71c745
5 changed files with 56 additions and 15 deletions

View file

@ -6,6 +6,7 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { updateCurrentPage } from "@/utils/functions";
/** importType*/
import type { QTableProps } from "quasar";
@ -233,12 +234,17 @@ function openDialog() {
* @param id รายการผใชงาน
* ลบขอมลรายชอเสรจแลวทำการดงขอมลรายชอผใชงานใหม
*/
function onDeleteUser(id: string) {
async function onDeleteUser(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.managementUser + `/${id}`)
.then(async () => {
currentPage.value = await updateCurrentPage(
currentPage.value,
maxPage.value,
rows.value.length
);
await fetchListUsers();
success($q, "ลบข้อมูลสำเร็จ");
})

View file

@ -30,6 +30,7 @@ interface ListOrder {
isActive: boolean;
isAttachment: boolean;
category?: string;
code: string;
commandSysId: string;
isUploadAttachment: boolean;
}

View file

@ -54,6 +54,7 @@ const filteredTabs = computed(() =>
: tabs.value.filter((tab) => tab.value !== "attachment")
);
const isCode = ref<string>(""); // code
const isActive = ref<boolean>(true); //
const isAttachment = ref<boolean>(true); //
const isSalary = ref<boolean>(true); //
@ -206,6 +207,12 @@ function onSubmit() {
* เก id list คำสงทเลอก เพอใช class
*/
function selectInbox(data: ListOrder) {
isCode.value = data.code;
if (data.code === "C-PM-47") {
isAttachmentShow.value = false;
activeCommandId.value = "";
return;
}
store.currentTab =
!data.isAttachment && store.currentTab == "attachment"
? "cover"
@ -404,6 +411,15 @@ onMounted(async () => {
</q-tab-panel>
</q-tab-panels>
</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
class="absolute-center text-center text-grey-9"

View file

@ -189,7 +189,13 @@ export const useCounterMixin = defineStore("mixin", () => {
};
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 = [
"มกราคม",
"กุมภาพันธ์",
@ -218,19 +224,12 @@ export const useCounterMixin = defineStore("mixin", () => {
"พ.ย.",
"ธ.ค.",
];
let dstYear = 0;
if (date.getFullYear() > 2500) {
dstYear = date.getFullYear();
} else {
dstYear = date.getFullYear() + 543;
}
let dstMonth = "";
if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()];
} else {
dstMonth = abbrMonthThai[date.getMonth()];
}
return dstMonth + " " + dstYear;
// assume year is in BE if > 2500
let dstYear = year > 2500 ? year : year + 543;
// month is already 0-based
let dstMonth = isFullMonth ? fullMonthThai[month] : abbrMonthThai[month];
return `${dstMonth} ${dstYear}`;
}
function dateToISO(date: Date) {

19
src/utils/functions.ts Normal file
View 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;
}