diff --git a/src/modules/04_registry/components/PopupHistory.vue b/src/modules/04_registry/components/PopupHistory.vue index 02f15e538..4f7746cbe 100644 --- a/src/modules/04_registry/components/PopupHistory.vue +++ b/src/modules/04_registry/components/PopupHistory.vue @@ -6,11 +6,13 @@ import config from "@/app.config"; import type { QForm } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; +import { useRouter } from "vue-router"; const myForm = ref(); const mixin = useCounterMixin(); -const { showLoader, hideLoader, messageError, date2Thai, notifyError } = mixin; +const { showLoader, hideLoader, messageError, date2Thai, dialogMessageNotify } = mixin; const $q = useQuasar(); +const router = useRouter(); const modal = ref(false); const employeeClass = ref(""); @@ -154,7 +156,7 @@ const clickSearch = async (type: string) => { date: date2Thai(e.date), })); } else { - notifyError($q, "ไม่มีข้อมูลที่ต้องการค้นหา"); + dialogMessageNotify($q, "ไม่มีข้อมูลที่ต้องการค้นหา"); rows.value = []; } }) @@ -183,6 +185,9 @@ const filterFn = (val: string, update: any) => { }); } }; +const clickRedirect = (id: string) => { + router.push(`/registry/${id}`); +}; const paging = ref(true); const pagination = ref({ @@ -353,10 +358,20 @@ const paginationLabel = (start: number, end: number, total: number) => { {{ props.rowIndex + 1 }} {{ props.row.order }} - {{ - props.row.citizenId - }} - {{ props.row.name }} + {{ props.row.citizenId }} + {{ props.row.name }} {{ props.row.posNo }} {{ diff --git a/src/modules/10_order/components/Main.vue b/src/modules/10_order/components/Main.vue index dfe38f765..f53327715 100644 --- a/src/modules/10_order/components/Main.vue +++ b/src/modules/10_order/components/Main.vue @@ -15,29 +15,16 @@ import config from "@/app.config"; import PopupHistory from "./PopupHistory.vue"; const $q = useQuasar(); //ใช้ noti quasar const mixin = useCounterMixin(); -const { - showLoader, - hideLoader, - messageError, - date2Thai, - dateText, - success, - dialogRemove, -} = mixin; +const { showLoader, hideLoader, messageError, date2Thai } = mixin; const DataStore = useOrderPlacementDataStore(); const pagination = ref({ - sortBy: "desc", - descending: false, + sortBy: "OrderDate", + descending: true, page: 1, rowsPerPage: 10, }); -// แปลงเวลา ค.ศ ให้เป็น พ.ศ -const textDate = (value: Date) => { - return dateText(value); -}; - const visibleColumns = ref([ "Order", "OrderType", @@ -46,7 +33,7 @@ const visibleColumns = ref([ "OrderBy", "Signer", "OrderStatus", -]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง +]); // หัวตาราง const columns = ref([ @@ -89,8 +76,7 @@ const columns = ref([ field: "OrderDate", headerStyle: "font-size: 14px", style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + sort: (a, b) => parseInt(a) - parseInt(b), }, { name: "OrderBy", @@ -151,10 +137,11 @@ onMounted(async () => { }); const OriginalDataFetch = async () => { + showLoader(); await http .get(config.API.listOrder()) .then((res: any) => { - console.log("list", res); + // console.log("list", res); rows.value = res.data.result.map((e: any) => ({ orderId: e.orderId, Order: e.orderName, @@ -172,9 +159,10 @@ const OriginalDataFetch = async () => { }) .catch((e: any) => { messageError($q, e); + }) + .finally(async () => { + hideLoader(); }); - // .finally(async () => { - // }); await DataStore.DataMainOrder(rows.value); OriginalData.value = await DataStore.DataMainOrigOrder; UpdataData.value = OriginalData.value; diff --git a/src/modules/10_order/components/PopupHistory.vue b/src/modules/10_order/components/PopupHistory.vue index 9d6e050ed..bbf1e0cf1 100644 --- a/src/modules/10_order/components/PopupHistory.vue +++ b/src/modules/10_order/components/PopupHistory.vue @@ -6,11 +6,13 @@ import config from "@/app.config"; import type { QForm } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; +import { useRouter } from "vue-router"; const myForm = ref(); const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, date2Thai, notifyError } = mixin; const $q = useQuasar(); +const router = useRouter(); const props = defineProps({ OrderTypeOption: Object, @@ -169,6 +171,9 @@ const filterFn = (val: string, update: any) => { } console.log(options.value); }; +const clickRedirect = (id: string) => { + router.push(`/registry/${id}`); +}; const paging = ref(true); const pagination = ref({ @@ -332,10 +337,20 @@ const paginationLabel = (start: number, end: number, total: number) => { {{ props.rowIndex + 1 }} {{ props.row.order }} - {{ - props.row.citizenId - }} - {{ props.row.name }} + {{ props.row.citizenId }} + {{ props.row.name }} {{ props.row.posNo }} {{