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 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, "ลบข้อมูลสำเร็จ");
}) })

View file

@ -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;
} }

View file

@ -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"

View file

@ -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
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;
}