no message

This commit is contained in:
setthawutttty 2023-07-10 09:03:56 +07:00
parent 2ff53b5fa6
commit 07976376bb
3 changed files with 82 additions and 38 deletions

View file

@ -3,7 +3,7 @@ import { onMounted, reactive, ref, useAttrs } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
import type { DataOption } from "@/modules/05_placement/interface/index/Main";
import type { DataOption,DataOption1 } from "@/modules/05_placement/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
import { usePlacementDataStore } from "@/modules/05_placement/store";
import router from "@/router";
@ -132,12 +132,13 @@ const OriginalDataFetch = async (year: number) => {
console.log("🚀 ~ file: Main.vue:160 ~ .then ~ res:", apiData);
await DataStore.DataMain(apiData);
OriginalData.value = await DataStore.DataMainOrig;
UpdataData.value = OriginalData.value;
UpdataData.value = OriginalData.value.filter((data) => data.fiscalYear === year); // fiscalYear
} catch (error) {
messageError($q, error);
}
};
onMounted(async () => {
await fiscalYearFilter();
await OriginalDataFetch(fiscalyear.value);
@ -154,43 +155,63 @@ const redirectToPage = (examId?: number) => {
//-------------------||-----------------------//
const fiscalyear = ref<number>(0);
const fiscalyearOP = reactive<DataOption[]>([{ id: null, name: "ทั้งหมด" }]);
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedfiscalYearValues: number[] = [];
const fiscalYearFilter = async () => {
let maxYear = 0; // maxYear
await http
.get(config.API.yearOptions())
.then((res: any) => {
console.log("🚀 ", res.data.result);
for (let data of res.data.result) {
fiscalyearOP.push(data);
let maxYear = 0;
try {
const response = await http.get(config.API.yearOptions());
const dataOptions = response.data.result;
console.log("🚀 ", dataOptions);
for (let data of dataOptions) {
fiscalyearOP.push(data);
if (data.id > maxYear) {
maxYear = data.id; // maxYear
}
if (data.id > maxYear) {
maxYear = data.id;
}
})
.catch((e: any) => {
messageError($q, e);
})
.finally(async () => {
// fiscalyear
fiscalyear.value = maxYear;
});
}
fiscalyear.value = maxYear;
console.log("Selected Year:", fiscalyear.value);
await OriginalDataFetch(fiscalyear.value); // fiscalyear
} catch (e) {
messageError($q, e);
}
};
//-------------------| API|--------------------//
interface YearOption {
id: number;
name: number;
}
const searchfiscalyear = async () => {
// API
await http
.get(config.API.yearOptions())
.then((res: any) => {})
.catch((e: any) => {
messageError($q, e);
})
.finally(async () => {});
try {
const response = await http.get(config.API.yearOptions());
const dataOptions: YearOption[] = response.data.result;
console.log("🚀 ~ file: Main.vue:189 ~ .then ~ dataOptions:", dataOptions);
if (fiscalyear.value === 0) {
// Perform any desired operations for selecting "" option
// console.log
console.log("All Year Objects:", dataOptions);
} else {
// Find the selected object based on the chosen year
const selectedYearObject = dataOptions.find((option: YearOption) => option.id === fiscalyear.value);
if (selectedYearObject) {
console.log("Selected Year Object:", selectedYearObject);
// Perform any desired operations with the selected object here
} else {
console.log("No Selected Year Object");
}
}
} catch (e) {
messageError($q, e);
}
};
//-------------------||-----------------//
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
@ -214,7 +235,7 @@ const visibleColumns = ref<any[]>([
//-------------------||------------------------------//
const examTime = ref<number | string>("all");
const examTimeOP = reactive<DataOption[]>([]);
const examTimeOP = reactive<DataOption1[]>([]);
const addedExamTimeValues: Set<number> = new Set();
const examTimeFilter = async () => {
@ -236,7 +257,7 @@ const examTimeFilter = async () => {
//
const examType = ref<string | null>("all");
const examTypeOP = ref<DataOption[]>([{ id: "all", name: "ทั้งหมด" }]);
const examTypeOP = ref<DataOption1[]>([{ id: "all", name: "ทั้งหมด" }]);
const addedExamTypeValues: Set<string> = new Set();
const examTypeFilter = () => {
for (const data of OriginalData.value) {

View file

@ -1,10 +1,14 @@
import type { zipCodeOption } from "../../components/PersonalDetail/profileType";
interface DataOption {
id: number|null;
name:string|null;
disable?: boolean;
}
interface DataOption1 {
id: string|null;
name:string|null;
disable?: boolean;
}
interface DataOptionInsignia {
id: string;
name: string;
@ -61,6 +65,7 @@ export type {
AddressOps,
Pagination,
EduOps,
DataOption1,
InsigniaOps,
CheckboxItem,
};

View file

@ -1,6 +1,5 @@
interface TableName {
personalId: string;
profileID: string;
position: number;
fullName: string;
dateOfBirth: string;
@ -8,14 +7,20 @@ interface TableName {
ExamOrder: number;
unitId: string;
UnitGroup: string;
positionNumber:string;
positionPath:string;
Unit: string;
ReportingDate: string; //วันที่รายงานตัว
BMAOfficer: string;
Status: string;
reportingDate: string; //วันที่รายงานตัว
bmaOfficer: string;
statusId: string;
checkList: any;
address: string;
university: string;
degree: string;
disclaim: string;
profilePhoto:string;
organizationName:string;
organizationShortName:string;
major: string;
remark: string;
number: number;
@ -32,5 +37,18 @@ interface TableName {
examResult: string;
};
}
export type { TableName };
interface PartialTableName {
personalId: string;
fullName: string;
idCard: string;
profilePhoto: string;
organizationName: string;
organizationShortName: string;
positionNumber: string;
positionPath: string;
reportingDate: string;
bmaOfficer: string;
statusId: string;
disclaim: string;
}
export type { TableName ,PartialTableName};