refactor code (ยังไม่หมด)

This commit is contained in:
setthawutttty 2024-01-15 17:52:25 +07:00
parent ab4189e6ed
commit 32d4de7075
21 changed files with 309 additions and 109 deletions

View file

@ -198,7 +198,26 @@ const OrderType = ref<string>("");
const OrderTypeFilter1 = ref<any>([]);
const OrderTypeOption = ref<DataOption1[]>([{ id: "", name: "ทั้งหมด" }]);
const OrderTypeFilter = async () => {
//
const OrderStatus = ref<string>("ทั้งหมด");
const OrderStatusOption = ref<DataOption1[]>([
{ id: "ทั้งหมด", name: "ทั้งหมด" },
]);
const OrderStatusFilter1 = ref<DataOption1[]>([
{ id: "ทั้งหมด", name: "ทั้งหมด" },
]);
const addedOrderStatusValues: string[] = [];
//
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
function resetFilter(){
filterKeyword.value = "";
filterRef.value.focus();
};
async function OrderTypeFilter(){
await http
.get(config.API.typeOrder())
.then((res) => {
@ -218,16 +237,12 @@ const OrderTypeFilter = async () => {
});
};
//
const OrderStatus = ref<string>("ทั้งหมด");
const OrderStatusOption = ref<DataOption1[]>([
{ id: "ทั้งหมด", name: "ทั้งหมด" },
]);
const OrderStatusFilter1 = ref<DataOption1[]>([
{ id: "ทั้งหมด", name: "ทั้งหมด" },
]);
const addedOrderStatusValues: string[] = [];
const OrderStatusFilter = async () => {
/** ฟังชั่นฟิลเตอร์ตามค่า ประเภท สถานะ ปี */
async function searchFilterTable(){
stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value);
};
async function OrderStatusFilter(){
for (let data of stroe.mainData) {
const OrderStatusValue = data.orderStatusName;
@ -248,19 +263,13 @@ const OrderStatusFilter = async () => {
}
};
//
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
const searchFilterTable = async () => {
stroe.filterListOrder(OrderType.value, OrderStatus.value, fiscalyear.value);
};
const filterSelector = (val: any, update: Function, refData: string) => {
/**
* ลเตอรอมลจาก input
* @param val าทอนให input
* @param update function จาก quasar
* @param refData type กำหนด ของ input นๆ
*/
function filterSelector(val: any, update: Function, refData: string){
switch (refData) {
case "fiscalyearOP":
update(() => {

View file

@ -185,7 +185,11 @@ const pagination = ref({
rowsPerPage: 10,
});
// redirect step
/**
* งช redirect
* @param id id ออกคำส
* @param status status
*/
const redirectToPage = (id?: string, status?: string) => {
let step = 1;
switch (status) {