Merge branch 'nice_dev' into develop

# Conflicts:
#	src/modules/05_placement/components/OrderPlacement/MainOrderPlacement.vue
This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-04 12:50:21 +07:00
commit d40db2c752
6 changed files with 664 additions and 504 deletions

View file

@ -1,6 +1,7 @@
import env from "../index";
const placement = `${env.API_PLACEMENT_URI}/placement`;
const orgTree = `${env.API_URI_ORG_TREE}`;
const order = `${env.API_PLACEMENT_URI}`;
export default {
MainDetail: (year: number) => `${placement}/exam/${year}`,
@ -47,7 +48,13 @@ export default {
// position
placementPosition: () => `${placement}/position/use`,
// putPositiom
putPosition: (id:any) => `${placement}/position/${id}`,
putPosition: (id: any) => `${placement}/position/${id}`,
// 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
option-label="name"
:options="OrderTypeOption"
option-value="id"
option-value="name"
lazy-rules
hide-bottom-space
:readonly="false"
@ -115,7 +115,7 @@
map-options
option-label="name"
:options="OrderStatusOption"
option-value="id"
option-value="name"
lazy-rules
hide-bottom-space
:readonly="false"
@ -153,54 +153,38 @@
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
key="Order"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-tr
:props="props"
class="cursor-pointer"
@click="redirectToPage(props.row.Order)"
>
<q-td key="Order" :props="props">
{{ props.row.Order }}
</q-td>
<q-td
key="OrderNum"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-td key="OrderNum" :props="props">
{{ props.row.OrderNum }}
</q-td>
<<<<<<< HEAD
<q-td
key="OrderType"
:props="props"
@click="redirectToPage(props.row.Order)"
>
=======
<q-td key="OrderType" :props="props">
>>>>>>> nice_dev
{{ props.row.OrderType }}
</q-td>
<q-td
key="OrderDate"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-td key="OrderDate" :props="props">
{{ props.row.OrderDate }}
</q-td>
<q-td
key="OrderBy"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-td key="OrderBy" :props="props">
{{ props.row.OrderBy }}
</q-td>
<q-td
key="Signer"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-td key="Signer" :props="props">
{{ props.row.Signer }}
</q-td>
<q-td
key="OrderStatus"
:props="props"
@click="redirectToPage(props.row.Order)"
>
<q-td key="OrderStatus" :props="props">
{{ props.row.OrderStatus }}
</q-td>
<q-td auto-width>
@ -210,7 +194,7 @@
flat
round
color="red"
@click="clickDelete(props.row.id)"
@click.stop="clickDelete(props.row.id)"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>
@ -246,9 +230,16 @@ import { useCounterMixin } from "@/stores/mixin";
import { useOrderPlacementDataStore } from "@/modules/05_placement/store";
import router from "@/router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, dateText } = mixin;
const DataStore = useOrderPlacementDataStore();
const pagination = ref({
sortBy: "desc",
descending: false,
@ -256,9 +247,6 @@ const pagination = ref({
rowsPerPage: 10,
});
const mixin = useCounterMixin();
const { dateText } = mixin;
// . .
const textDate = (value: Date) => {
return dateText(value);
@ -518,13 +506,12 @@ onMounted(async () => {
const OriginalDataFetch = async () => {
// API
// await http
// .get(config.API.// )
// .then((res: any) => {
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// await http.get(config.API.listOrder()).then((res: any) => {
// console.log("list", res);
// });
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(async () => {
// });
await DataStore.DataMainOrder(rows.value);
@ -533,9 +520,15 @@ const OriginalDataFetch = async () => {
};
//
<<<<<<< HEAD
const redirectToPage = () => {
// router.push({ name: "placementDetail" });
router.push(`/placement/order/detail`);
=======
const redirectToPage = (id?: string) => {
console.log(id);
router.push(`/placement/order/detail/${id}`);
>>>>>>> nice_dev
};
const clickDelete = (id: string) => {
@ -572,7 +565,7 @@ const clickDelete = (id: string) => {
// };
const clickAdd = () => {
router.push({ name: "OrderplacementDetail" });
router.push({ name: "Orderplacementadd" });
};
// const viewDetail = (id: string, status: string) => {
@ -588,6 +581,16 @@ 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) => {
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
// await http
// .get(config.API.// )
@ -600,25 +603,37 @@ const fiscalYearFilter = async () => {
// })
// .finally(async () => {
// });
for (let data of OriginalData.value) {
const year = data.fiscalYear;
console.log(year);
// for (let data of OriginalData.value) {
// console.log(OriginalData.value);
if (fiscalyear.value === null || year > fiscalyear.value) {
fiscalyear.value = year;
}
// const year = data.fiscalYear;
// console.log(year);
if (!addedfiscalYearValues.includes(year)) {
fiscalyearOP.push({ id: year, name: year.toString() });
addedfiscalYearValues.push(year);
}
}
// if (fiscalyear.value === null || year > fiscalyear.value) {
// fiscalyear.value = year;
// }
// if (!addedfiscalYearValues.includes(year)) {
// fiscalyearOP.push({ id: year, name: year.toString() });
// addedfiscalYearValues.push(year);
// }
// }
};
const OrderType = ref<string>("");
const OrderTypeOption = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedOrderTypeValues: string[] = [];
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
// await http
// .get(config.API.// )
@ -631,29 +646,29 @@ const OrderTypeFilter = async () => {
// })
// .finally(async () => {
// });
for (let data of OriginalData.value) {
const OrderTypeValue = data.OrderType;
console.log(OrderTypeValue);
// for (let data of OriginalData.value) {
// const OrderTypeValue = data.OrderType;
// console.log(OrderTypeValue);
// if (OrderTypeValue === null || OrderType > OrderTypeValue) {
// OrderTypeValue = OrderType;
// }
if (!addedOrderTypeValues.includes(OrderTypeValue)) {
OrderTypeOption.push({
// id: OrderTypeValue ?? 0,
id: OrderTypeOption.length,
name: OrderTypeValue,
});
addedOrderTypeValues.push(OrderTypeValue);
}
// if (!addedOrderTypeValues.includes(OrderTypeValue)) {
// OrderTypeOption.push({
// id: OrderTypeValue,
// name: OrderTypeValue.toString(),
// });
// addedOrderTypeValues.push(OrderTypeValue);
// }
}
// if (OrderTypeValue === null || OrderType > OrderTypeValue) {
// OrderTypeValue = OrderType;
// }
// if (!addedOrderTypeValues.includes(OrderTypeValue)) {
// OrderTypeOption.push({
// // id: OrderTypeValue ?? 0,
// id: OrderTypeOption.length,
// name: OrderTypeValue,
// });
// addedOrderTypeValues.push(OrderTypeValue);
// }
// if (!addedOrderTypeValues.includes(OrderTypeValue)) {
// OrderTypeOption.push({
// id: OrderTypeValue,
// name: OrderTypeValue.toString(),
// });
// addedOrderTypeValues.push(OrderTypeValue);
// }
// }
};
const OrderStatus = ref<string>("");
const OrderStatusText = ref<FormOrderPlacementMainData[]>(
@ -697,8 +712,12 @@ const OrderStatusFilter = async () => {
};
// API
const searchfiscalyear = () => {
console.log("Input value changed:", fiscalyear.value);
const searchfiscalyear = async () => {
const yearNum = fiscalyear.value! + 543;
await DataStore.DataUpdateOrder(OrderType.value, OrderStatus.value, yearNum);
UpdataData.value = DataStore.DataMainUpdateOrder;
// API
// await http
// .get(config.API.// )
@ -722,6 +741,11 @@ const resetFilter = () => {
const attrs = ref<any>(useAttrs());
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);
await DataStore.DataUpdateOrder(
OrderType.value,
@ -729,6 +753,7 @@ const searchFilterTable = async () => {
fiscalyear.value
);
UpdataData.value = DataStore.DataMainUpdateOrder;
console.log(UpdataData.value);
};
// UpdataData.value = DataStore.DataMainUpdate;
// console.log("Input value changed:", OrderStatus.value, OrderType.value);

View file

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

View file

@ -95,7 +95,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",
component: detailOrderReplace,
meta: {

View file

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