list Order

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-04 12:07:24 +07:00
parent c46f453f34
commit 92edcfb533
6 changed files with 658 additions and 512 deletions

View file

@ -1,6 +1,7 @@
import env from "../index"; import env from "../index";
const placement = `${env.API_PLACEMENT_URI}/placement`; const placement = `${env.API_PLACEMENT_URI}/placement`;
const orgTree = `${env.API_URI_ORG_TREE}`; const orgTree = `${env.API_URI_ORG_TREE}`;
const order = `${env.API_PLACEMENT_URI}`;
export default { export default {
MainDetail: (year: number) => `${placement}/exam/${year}`, MainDetail: (year: number) => `${placement}/exam/${year}`,
@ -47,7 +48,13 @@ export default {
// position // position
placementPosition: () => `${placement}/position/use`, placementPosition: () => `${placement}/position/use`,
// putPositiom // putPositiom
putPosition: (id:any) => `${placement}/position/${id}`, putPosition: (id: any) => `${placement}/position/${id}`,
// clear Position // clear Position
clearPosition: (personalId:string) => `${placement}/position/clear/${personalId}` clearPosition: (personalId: string) => `${placement}/position/clear/${personalId}`,
// order
yearOptionsOrder: () => `${order}/order/fiscal-year`,
listOrder: () => `${order}/order`,
typeOrder: () => `${order}/order/order-type`,
examroundOrder: () => `${order}/order/detail/exam-round`,
}; };

View file

@ -97,7 +97,7 @@
map-options map-options
option-label="name" option-label="name"
:options="OrderTypeOption" :options="OrderTypeOption"
option-value="id" option-value="name"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
:readonly="false" :readonly="false"
@ -115,7 +115,7 @@
map-options map-options
option-label="name" option-label="name"
:options="OrderStatusOption" :options="OrderStatusOption"
option-value="id" option-value="name"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
:readonly="false" :readonly="false"
@ -153,54 +153,30 @@
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr
<q-td :props="props"
key="Order" class="cursor-pointer"
:props="props" @click="redirectToPage(props.row.Order)"
@click="redirectToPage(props.row.Order)" >
> <q-td key="Order" :props="props">
{{ props.row.Order }} {{ props.row.Order }}
</q-td> </q-td>
<q-td <q-td key="OrderNum" :props="props">
key="OrderNum"
:props="props"
@click="redirectToPage(props.row.Order)"
>
{{ props.row.OrderNum }} {{ props.row.OrderNum }}
</q-td> </q-td>
<q-td <q-td key="OrderType" :props="props">
key="OrderType"
:props="props"
@click="redirectToPage(props.row.OrderType)"
>
{{ props.row.OrderType }} {{ props.row.OrderType }}
</q-td> </q-td>
<q-td <q-td key="OrderDate" :props="props">
key="OrderDate"
:props="props"
@click="redirectToPage(props.row.Order)"
>
{{ props.row.OrderDate }} {{ props.row.OrderDate }}
</q-td> </q-td>
<q-td <q-td key="OrderBy" :props="props">
key="OrderBy"
:props="props"
@click="redirectToPage(props.row.Order)"
>
{{ props.row.OrderBy }} {{ props.row.OrderBy }}
</q-td> </q-td>
<q-td <q-td key="Signer" :props="props">
key="Signer"
:props="props"
@click="redirectToPage(props.row.Order)"
>
{{ props.row.Signer }} {{ props.row.Signer }}
</q-td> </q-td>
<q-td <q-td key="OrderStatus" :props="props">
key="OrderStatus"
:props="props"
@click="redirectToPage(props.row.Order)"
>
{{ props.row.OrderStatus }} {{ props.row.OrderStatus }}
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
@ -210,7 +186,7 @@
flat flat
round round
color="red" color="red"
@click="clickDelete(props.row.id)" @click.stop="clickDelete(props.row.id)"
icon="mdi-delete" icon="mdi-delete"
> >
<q-tooltip>ลบขอม</q-tooltip> <q-tooltip>ลบขอม</q-tooltip>
@ -246,9 +222,16 @@ import { useCounterMixin } from "@/stores/mixin";
import { useOrderPlacementDataStore } from "@/modules/05_placement/store"; import { useOrderPlacementDataStore } from "@/modules/05_placement/store";
import router from "@/router"; import router from "@/router";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, dateText } = mixin;
const DataStore = useOrderPlacementDataStore(); const DataStore = useOrderPlacementDataStore();
const pagination = ref({ const pagination = ref({
sortBy: "desc", sortBy: "desc",
descending: false, descending: false,
@ -256,9 +239,6 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
const mixin = useCounterMixin();
const { dateText } = mixin;
// . . // . .
const textDate = (value: Date) => { const textDate = (value: Date) => {
return dateText(value); return dateText(value);
@ -518,13 +498,12 @@ onMounted(async () => {
const OriginalDataFetch = async () => { const OriginalDataFetch = async () => {
// API // API
// await http // await http.get(config.API.listOrder()).then((res: any) => {
// .get(config.API.// ) // console.log("list", res);
// .then((res: any) => { // });
// }) // .catch((e: any) => {
// .catch((e: any) => { // messageError($q, e);
// messageError($q, e); // })
// })
// .finally(async () => { // .finally(async () => {
// }); // });
await DataStore.DataMainOrder(rows.value); await DataStore.DataMainOrder(rows.value);
@ -533,9 +512,9 @@ const OriginalDataFetch = async () => {
}; };
// //
const redirectToPage = (id?: number) => { const redirectToPage = (id?: string) => {
// router.push({ name: "placementDetail" }); console.log(id);
router.push(`/placement/order/detail`); router.push(`/placement/order/detail/${id}`);
}; };
const clickDelete = (id: string) => { const clickDelete = (id: string) => {
@ -572,7 +551,7 @@ const clickDelete = (id: string) => {
// }; // };
const clickAdd = () => { const clickAdd = () => {
router.push({ name: "OrderplacementDetail" }); router.push({ name: "Orderplacementadd" });
}; };
// const viewDetail = (id: string, status: string) => { // const viewDetail = (id: string, status: string) => {
@ -588,6 +567,16 @@ const fiscalyear = ref<number | null>(0);
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedfiscalYearValues: number[] = []; const addedfiscalYearValues: number[] = [];
const fiscalYearFilter = async () => { const fiscalYearFilter = async () => {
await http.get(config.API.yearOptionsOrder()).then((res) => {
console.log(res);
const response = res.data.result;
fiscalyearOP.push(...response);
// const maxNumber = fiscalyearOP.reduce((max: any, e: any) => {
// return e.id > max ? e.id : max;
// }, "");
// fiscalyear.value = maxNumber;
// console.log(fiscalyear.value);
});
// API // API
// await http // await http
// .get(config.API.// ) // .get(config.API.// )
@ -600,25 +589,37 @@ const fiscalYearFilter = async () => {
// }) // })
// .finally(async () => { // .finally(async () => {
// }); // });
for (let data of OriginalData.value) { // for (let data of OriginalData.value) {
const year = data.fiscalYear; // console.log(OriginalData.value);
console.log(year);
if (fiscalyear.value === null || year > fiscalyear.value) { // const year = data.fiscalYear;
fiscalyear.value = year; // console.log(year);
}
if (!addedfiscalYearValues.includes(year)) { // if (fiscalyear.value === null || year > fiscalyear.value) {
fiscalyearOP.push({ id: year, name: year.toString() }); // fiscalyear.value = year;
addedfiscalYearValues.push(year); // }
}
} // if (!addedfiscalYearValues.includes(year)) {
// fiscalyearOP.push({ id: year, name: year.toString() });
// addedfiscalYearValues.push(year);
// }
// }
}; };
const OrderType = ref<string>(""); const OrderType = ref<string>("");
const OrderTypeOption = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const OrderTypeOption = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedOrderTypeValues: string[] = []; const addedOrderTypeValues: string[] = [];
const OrderTypeFilter = async () => { const OrderTypeFilter = async () => {
await http
.get(config.API.typeOrder())
.then((res) => {
console.log(res.data);
const response = res.data.result;
OrderTypeOption.push(...response);
})
.catch((e) => {
messageError($q, e);
});
// API // API
// await http // await http
// .get(config.API.// ) // .get(config.API.// )
@ -631,29 +632,29 @@ const OrderTypeFilter = async () => {
// }) // })
// .finally(async () => { // .finally(async () => {
// }); // });
for (let data of OriginalData.value) { // for (let data of OriginalData.value) {
const OrderTypeValue = data.OrderType; // const OrderTypeValue = data.OrderType;
console.log(OrderTypeValue); // console.log(OrderTypeValue);
// if (OrderTypeValue === null || OrderType > OrderTypeValue) { // if (OrderTypeValue === null || OrderType > OrderTypeValue) {
// OrderTypeValue = OrderType; // OrderTypeValue = OrderType;
// } // }
if (!addedOrderTypeValues.includes(OrderTypeValue)) { // if (!addedOrderTypeValues.includes(OrderTypeValue)) {
OrderTypeOption.push({ // OrderTypeOption.push({
// id: OrderTypeValue ?? 0, // // id: OrderTypeValue ?? 0,
id: OrderTypeOption.length, // id: OrderTypeOption.length,
name: OrderTypeValue, // name: OrderTypeValue,
}); // });
addedOrderTypeValues.push(OrderTypeValue); // addedOrderTypeValues.push(OrderTypeValue);
} // }
// if (!addedOrderTypeValues.includes(OrderTypeValue)) { // if (!addedOrderTypeValues.includes(OrderTypeValue)) {
// OrderTypeOption.push({ // OrderTypeOption.push({
// id: OrderTypeValue, // id: OrderTypeValue,
// name: OrderTypeValue.toString(), // name: OrderTypeValue.toString(),
// }); // });
// addedOrderTypeValues.push(OrderTypeValue); // addedOrderTypeValues.push(OrderTypeValue);
// } // }
} // }
}; };
const OrderStatus = ref<string>(""); const OrderStatus = ref<string>("");
const OrderStatusText = ref<FormOrderPlacementMainData[]>( const OrderStatusText = ref<FormOrderPlacementMainData[]>(
@ -697,8 +698,12 @@ const OrderStatusFilter = async () => {
}; };
// API // API
const searchfiscalyear = () => { const searchfiscalyear = async () => {
console.log("Input value changed:", fiscalyear.value); const yearNum = fiscalyear.value! + 543;
await DataStore.DataUpdateOrder(OrderType.value, OrderStatus.value, yearNum);
UpdataData.value = DataStore.DataMainUpdateOrder;
// API // API
// await http // await http
// .get(config.API.// ) // .get(config.API.// )
@ -722,6 +727,11 @@ const resetFilter = () => {
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const searchFilterTable = async () => { const searchFilterTable = async () => {
if (fiscalyear.value !== null && fiscalyear.value !== 0) {
fiscalyear.value += 543;
}
console.log(fiscalyear.value, OrderType.value, OrderStatus.value);
// console.log('Input value changed:', examTime.value, examType.value, expiredAccount.value); // console.log('Input value changed:', examTime.value, examType.value, expiredAccount.value);
await DataStore.DataUpdateOrder( await DataStore.DataUpdateOrder(
OrderType.value, OrderType.value,
@ -729,6 +739,7 @@ const searchFilterTable = async () => {
fiscalyear.value fiscalyear.value
); );
UpdataData.value = DataStore.DataMainUpdateOrder; UpdataData.value = DataStore.DataMainUpdateOrder;
console.log(UpdataData.value);
}; };
// UpdataData.value = DataStore.DataMainUpdate; // UpdataData.value = DataStore.DataMainUpdate;
// console.log("Input value changed:", OrderStatus.value, OrderType.value); // console.log("Input value changed:", OrderStatus.value, OrderType.value);

View file

@ -8,7 +8,7 @@
flat flat
color="primary" color="primary"
class="q-mr-sm" class="q-mr-sm"
@click="router.go(-1)" @click="router.go(-1), destroyLocalStorage()"
/> />
ออกคำส ออกคำส
</div> </div>
@ -61,7 +61,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { ref, defineAsyncComponent } from "vue"; import { ref, defineAsyncComponent, onMounted } from "vue";
import type { QStepper } from "quasar"; import type { QStepper } from "quasar";
const step01 = defineAsyncComponent( const step01 = defineAsyncComponent(
@ -87,11 +87,22 @@ const stepper = ref<QStepper>();
const nextStep = () => { const nextStep = () => {
stepper.value!.next(); stepper.value!.next();
localStorage.setItem("currentStep", step.value.toString());
}; };
const previousStep = () => { const previousStep = () => {
stepper.value!.previous(); stepper.value!.previous();
localStorage.setItem("currentStep", step.value.toString());
}; };
const destroyLocalStorage = () => {
localStorage.clear();
};
onMounted(() => {
const currentStep = localStorage.getItem("currentStep");
if (currentStep) {
step.value = Number(currentStep);
}
});
</script> </script>
<style> <style>
.q-stepper--horizontal .q-stepper__step-inner { .q-stepper--horizontal .q-stepper__step-inner {

View file

@ -92,7 +92,17 @@ export default [
}, },
}, },
{ {
path: "/placement/order/detail", path: "/placement/order/add",
name: "Orderplacementadd",
component: detailOrderReplace,
meta: {
Auth: true,
Key: [6.9],
Role: "placement",
},
},
{
path: "/placement/order/detail/:orderid",
name: "OrderplacementDetail", name: "OrderplacementDetail",
component: detailOrderReplace, component: detailOrderReplace,
meta: { meta: {

View file

@ -229,6 +229,8 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
) => { ) => {
DataMainUpdateOrder.value = []; DataMainUpdateOrder.value = [];
if (filter_1 === "" && filter_2 === "" && filterYear === 0) { if (filter_1 === "" && filter_2 === "" && filterYear === 0) {
DataMainUpdateOrder.value = DataMainOrigOrder.value; DataMainUpdateOrder.value = DataMainOrigOrder.value;
} else if (filter_1 !== "" && filter_2 === "" && filterYear === 0) { } else if (filter_1 !== "" && filter_2 === "" && filterYear === 0) {