ออกคำสั่ง === fix filter

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-02 17:02:54 +07:00
parent 8ede2c6d09
commit 810115eb41
13 changed files with 227 additions and 2517 deletions

View file

@ -6,17 +6,91 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
DataListCommand,
DataCommandType,
} from "@/modules/18_command/interface/response/Main";
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const { showLoader, hideLoader, date2Thai, messageError } = useCounterMixin();
export const useCommandListStore = defineStore("commandListStore", () => {
const tabsMain = ref<string>("DRAFT");
const rows = ref<DataListCommand[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "commandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: false,
field: "commandNo",
format(val, row) {
return val ? `${val}/${row.commandYear + 543}` : "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "issue",
align: "left",
label: "ชื่อคำสั่ง",
sortable: true,
field: "issue",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "commandAffectDate",
align: "left",
label: "วันที่ลงนาม",
sortable: false,
field: "commandAffectDate",
format(val) {
return val ? date2Thai(val) : "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "commandExcecuteDate",
align: "left",
label: "วันที่คำสั่งมีผล",
sortable: false,
field: "commandExcecuteDate",
format(val) {
return val ? date2Thai(val) : "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdFullName",
align: "left",
label: "ผู้สร้าง",
sortable: false,
field: "createdFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "assignFullName",
align: "left",
label: "ผู้ลงนาม",
sortable: false,
field: "assignFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"commandNo",
"issue",
"commandAffectDate",
"commandExcecuteDate",
"createdFullName",
"assignFullName",
]);
const total = ref<number>(0);
const maxPage = ref<number>(0);
@ -30,7 +104,7 @@ export const useCommandListStore = defineStore("commandListStore", () => {
async function fetchCommandType() {
//เช็คค่าของ listCommand
if (listCommand.value.length === 0) {
showLoader();
// showLoader();
try {
const res = await http.get(config.API.commandType);
const data = res.data.result;
@ -44,7 +118,7 @@ export const useCommandListStore = defineStore("commandListStore", () => {
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
// hideLoader();
}
} else {
return listCommand.value;
@ -54,6 +128,8 @@ export const useCommandListStore = defineStore("commandListStore", () => {
return {
tabsMain,
rows,
columns,
visibleColumns,
total,
maxPage,
fetchCommandType,