refactor ออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-22 10:47:31 +07:00
parent 8dfa5ca02e
commit 3802d5d5a2
8 changed files with 526 additions and 916 deletions

View file

@ -121,7 +121,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
// ()
const rows = ref<FormOrderPlacementMainData[]>([]);
@ -135,7 +134,7 @@ onMounted(async () => {
OrderStatusFilter();
OrderTypeFilter();
});
//
const OriginalDataFetch = async () => {
showLoader();
await http
@ -186,61 +185,23 @@ const redirectToPage = (id?: string, status?: string) => {
}
router.push(`/order/detail/${id}?step=${step}`);
};
// const clickDelete = (id: string) => {
// dialogRemove(
// $q,
// () => deleteData(id),
// );
// };
// const deleteData = async (id: string) => {
// showLoader();
// await http
// .delete(config.API.deleteOrder(id))
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// hideLoader();
// await OriginalDataFetch();
// fiscalYearFilter();
// searchFilterTable();
// OrderStatusFilter();
// OrderTypeFilter();
// });
// };
//
const clickAdd = () => {
router.push({ name: "OrderAdd" });
};
// const viewDetail = (id: string, status: string) => {
// if (status == "checkPayment") {
// router.push(`${route.fullPath}/payment/${id}`);
// } else {
// router.push(`${route.fullPath}/profile/${id}`);
// }
// };
//
const fiscalyear = ref<number | null>(0);
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedfiscalYearValues: number[] = [];
const fiscalYearFilter = async () => {
await http.get(config.API.yearOptionsOrder()).then((res) => {
const response = res.data.result;
fiscalyearOP.push(...response);
});
};
//
const OrderType = ref<string>("");
const OrderTypeOption = reactive<DataOption1[]>([{ id: "", name: "ทั้งหมด" }]);
const addedOrderTypeValues: string[] = [];
const OrderTypeFilter = async () => {
await http
.get(config.API.typeOrder())
@ -253,9 +214,6 @@ const OrderTypeFilter = async () => {
});
};
const OrderStatus = ref<string>("");
const OrderStatusText = ref<FormOrderPlacementMainData[]>(
DataStore.DataMainOrigOrder
);
const OrderStatusOption = reactive<DataOption1[]>([
{ id: "", name: "ทั้งหมด" },
]);
@ -263,7 +221,6 @@ const addedOrderStatusValues: string[] = [];
const OrderStatusFilter = async () => {
for (let data of OriginalData.value) {
const OrderStatusValue = data.OrderStatus;
if (
OrderStatusValue === null ||
parseInt(OrderStatusValue) > parseInt(OrderStatusValue)
@ -290,7 +247,7 @@ const resetFilter = () => {
};
const attrs = ref<any>(useAttrs());
//
const searchFilterTable = async () => {
if (OrderType.value == "ทั้งหมด") {
OrderType.value = "";
@ -298,7 +255,6 @@ const searchFilterTable = async () => {
if (OrderStatus.value == "ทั้งหมด") {
OrderStatus.value = "";
}
await DataStore.DataUpdateOrder(
OrderType.value,
OrderStatus.value,
@ -489,12 +445,6 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td key="OrderStatus" :props="props">
{{ props.row.OrderStatus }}
</q-td>
<!-- <q-td auto-width>
<q-btn dense size="12px" flat round color="red" @click.stop="clickDelete(props.row.orderId)"
icon="mdi-delete">
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td> -->
</q-tr>
</template>
<template v-slot:pagination="scope">