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 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, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ interface ListOrder {
|
|||
isActive: boolean;
|
||||
isAttachment: boolean;
|
||||
category?: string;
|
||||
code: string;
|
||||
commandSysId: string;
|
||||
isUploadAttachment: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
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