Edit valiable and type

This commit is contained in:
watcharanondh 2023-06-12 09:11:22 +07:00
parent 377086ff28
commit d6010bf0f1
4 changed files with 154 additions and 154 deletions

View file

@ -29,62 +29,62 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "ExamRound", name: "examRound",
align: "left", align: "left",
label: "รอบการสอบ", label: "รอบการสอบ",
sortable: true, sortable: true,
field: "ExamRound", field: "examRound",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "ExamOrder", name: "examOrder",
align: "left", align: "left",
label: "ครั้งที่", label: "ครั้งที่",
sortable: true, sortable: true,
field: "ExamOrder", field: "examOrder",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "FiscalYear", name: "fiscalYear",
align: "left", align: "left",
label: "ปีงบประมาณ", label: "ปีงบประมาณ",
sortable: true, sortable: true,
field: "FiscalYear", field: "fiscalYear",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "NumberofCandidates", name: "numberofCandidates",
align: "left", align: "left",
label: "จำนวนผู้สอบได้", label: "จำนวนผู้สอบได้",
sortable: false, sortable: false,
field: "NumberofCandidates", field: "numberofCandidates",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "ExamType", name: "examType",
align: "left", align: "left",
label: "ประเภทการสอบ", label: "ประเภทการสอบ",
sortable: false, sortable: false,
field: "ExamType", field: "examType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "AccountExpirationDate", name: "accountExpirationDate",
align: "left", align: "left",
label: "วันที่บัญชีหมดอายุ", label: "วันที่บัญชีหมดอายุ",
sortable: true, sortable: true,
field: "AccountExpirationDate", field: "accountExpirationDate",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -96,48 +96,48 @@ const columns = ref<QTableProps["columns"]>([
// () // ()
const rows = ref<FormPlacementMainData[]>([{ const rows = ref<FormPlacementMainData[]>([{
id: 1, id: 1,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 3, examOrder: 3,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 8, numberofCandidates: 8,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
}, },
{ {
id: 2, id: 2,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 12, numberofCandidates: 12,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
}, },
{ {
id: 3, id: 3,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 20, numberofCandidates: 20,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-01-31T14:47:04.1785384Z" accountExpirationDate: "2023-01-31T14:47:04.1785384Z"
}, },
{ {
id: 4, id: 4,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2022, fiscalYear: 2022,
NumberofCandidates: 16, numberofCandidates: 16,
ExamType: 2, examType: 2,
AccountExpirationDate: "2023-11-30T14:47:04.1785384Z" accountExpirationDate: "2023-11-30T14:47:04.1785384Z"
}, },
{ {
id: 5, id: 5,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 1, examOrder: 1,
FiscalYear: 2021, fiscalYear: 2021,
NumberofCandidates: 20, numberofCandidates: 20,
ExamType: 2, examType: 2,
AccountExpirationDate: "2024-05-21T14:47:04.1785384Z", accountExpirationDate: "2024-05-21T14:47:04.1785384Z",
}, },
]); ]);
@ -181,7 +181,7 @@ const redirectToPage = (id: number) => {
// //
const fiscalyear = ref<number | null>(0); 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 () => {
// API // API
// await http // await http
@ -196,21 +196,21 @@ const fiscalYearFilter = async () => {
// .finally(async () => { // .finally(async () => {
// }); // });
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const year = data.FiscalYear + 543; const year = data.fiscalYear + 543;
if (fiscalyear.value === null || year > fiscalyear.value) { if (fiscalyear.value === null || year > fiscalyear.value) {
fiscalyear.value = year; fiscalyear.value = year;
} }
if (!addedFiscalYearValues.includes(year)) { if (!addedfiscalYearValues.includes(year)) {
fiscalyearOP.push({ id: year, name: year.toString() }); fiscalyearOP.push({ id: year, name: year.toString() });
addedFiscalYearValues.push(year); addedfiscalYearValues.push(year);
} }
} }
} }
// API // API
const searchFiscalyear = () => { const searchfiscalyear = () => {
console.log('Input value changed:', fiscalyear.value); console.log('Input value changed:', fiscalyear.value);
// API // API
// await http // await http
@ -233,15 +233,15 @@ const resetFilter = () => {
}; };
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const visibleColumns = ref<string[]>(['id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) // const visibleColumns = ref<string[]>(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //
// //
const examTime = ref<number | null>(null); const examTime = ref<number | null>(null);
const examTimeOP = ref<number[]>([]); const examTimeOP = ref<number[]>([]);
const examTimeFilter = async () => { const examTimeFilter = async () => {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
if (!examTimeOP.value.includes(data.ExamOrder)) { if (!examTimeOP.value.includes(data.examOrder)) {
examTimeOP.value.push(data.ExamOrder); examTimeOP.value.push(data.examOrder);
} }
} }
examTimeOP.value.sort((a, b) => a - b); // examTimeOP.value.sort((a, b) => a - b); //
@ -250,16 +250,16 @@ const examTimeFilter = async () => {
// //
const examType = ref<number | null>(0); const examType = ref<number | null>(0);
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedExamTypeValues: number[] = []; const addedexamTypeValues: number[] = [];
const examTypeFilter = async () => { const examTypeFilter = async () => {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const examTypeValue = data.ExamType; const examTypeValue = data.examType;
if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) { if (examTypeValue == 1 && !addedexamTypeValues.includes(1)) {
examTypeOP.push({ id: 1, name: "คัดเลือก" }); examTypeOP.push({ id: 1, name: "คัดเลือก" });
addedExamTypeValues.push(1); addedexamTypeValues.push(1);
} else if (examTypeValue == 2 && !addedExamTypeValues.includes(2)) { } else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) {
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" }); examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
addedExamTypeValues.push(2); addedexamTypeValues.push(2);
} }
} }
} }
@ -275,7 +275,7 @@ const expiredAccount = ref<boolean>(false);
const expiredAccountFilter = async () => { const expiredAccountFilter = async () => {
const currentDate = new Date(); const currentDate = new Date();
const updatedRows = OriginalData.value.map((data) => { const updatedRows = OriginalData.value.map((data) => {
let expirationDate = new Date(data.AccountExpirationDate); let expirationDate = new Date(data.accountExpirationDate);
let isExpired = expirationDate < currentDate; let isExpired = expirationDate < currentDate;
return { ...data, isExpired }; return { ...data, isExpired };
@ -302,7 +302,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
<q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP" <q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP"
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false" option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFiscalyear" /> :outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-6"></div> <div class="col-xs-12 col-sm-3 col-md-6"></div>
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
@ -349,23 +349,23 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td key="id" :props="props"> <q-td key="id" :props="props">
{{ props.row.id }} {{ props.row.id }}
</q-td> </q-td>
<q-td key="ExamRound" :props="props"> <q-td key="examRound" :props="props">
{{ props.row.ExamRound }} {{ props.row.examRound }}
</q-td> </q-td>
<q-td key="ExamOrder" :props="props"> <q-td key="examOrder" :props="props">
{{ props.row.ExamOrder }} {{ props.row.examOrder }}
</q-td> </q-td>
<q-td key="FiscalYear" :props="props"> <q-td key="fiscalYear" :props="props">
{{ props.row.FiscalYear + 543 }} {{ props.row.fiscalYear + 543 }}
</q-td> </q-td>
<q-td key="NumberofCandidates" :props="props"> <q-td key="numberofCandidates" :props="props">
{{ props.row.NumberofCandidates }} {{ props.row.numberofCandidates }}
</q-td> </q-td>
<q-td key="ExamType" :props="props"> <q-td key="examType" :props="props">
{{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} {{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
</q-td> </q-td>
<q-td key="AccountExpirationDate" :props="props"> <q-td key="accountExpirationDate" :props="props">
{{ textDate(props.row.AccountExpirationDate) }} {{ textDate(props.row.accountExpirationDate) }}
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>

View file

@ -29,62 +29,62 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "ExamRound", name: "examRound",
align: "left", align: "left",
label: "รอบการสอบ", label: "รอบการสอบ",
sortable: true, sortable: true,
field: "ExamRound", field: "examRound",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "ExamOrder", name: "examOrder",
align: "left", align: "left",
label: "ครั้งที่", label: "ครั้งที่",
sortable: true, sortable: true,
field: "ExamOrder", field: "examOrder",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "FiscalYear", name: "fiscalYear",
align: "left", align: "left",
label: "ปีงบประมาณ", label: "ปีงบประมาณ",
sortable: true, sortable: true,
field: "FiscalYear", field: "fiscalYear",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "NumberofCandidates", name: "numberofCandidates",
align: "left", align: "left",
label: "จำนวนผู้สอบได้", label: "จำนวนผู้สอบได้",
sortable: false, sortable: false,
field: "NumberofCandidates", field: "numberofCandidates",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "ExamType", name: "examType",
align: "left", align: "left",
label: "ประเภทการสอบ", label: "ประเภทการสอบ",
sortable: false, sortable: false,
field: "ExamType", field: "examType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "AccountExpirationDate", name: "accountExpirationDate",
align: "left", align: "left",
label: "วันที่บัญชีหมดอายุ", label: "วันที่บัญชีหมดอายุ",
sortable: true, sortable: true,
field: "AccountExpirationDate", field: "accountExpirationDate",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -96,48 +96,48 @@ const columns = ref<QTableProps["columns"]>([
// () // ()
const rows = ref<FormPlacementMainData[]>([{ const rows = ref<FormPlacementMainData[]>([{
id: 1, id: 1,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 3, examOrder: 3,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 8, numberofCandidates: 8,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
}, },
{ {
id: 2, id: 2,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 12, numberofCandidates: 12,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
}, },
{ {
id: 3, id: 3,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2023, fiscalYear: 2023,
NumberofCandidates: 20, numberofCandidates: 20,
ExamType: 1, examType: 1,
AccountExpirationDate: "2023-01-31T14:47:04.1785384Z" accountExpirationDate: "2023-01-31T14:47:04.1785384Z"
}, },
{ {
id: 4, id: 4,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 2, examOrder: 2,
FiscalYear: 2022, fiscalYear: 2022,
NumberofCandidates: 16, numberofCandidates: 16,
ExamType: 2, examType: 2,
AccountExpirationDate: "2023-11-30T14:47:04.1785384Z" accountExpirationDate: "2023-11-30T14:47:04.1785384Z"
}, },
{ {
id: 5, id: 5,
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
ExamOrder: 1, examOrder: 1,
FiscalYear: 2021, fiscalYear: 2021,
NumberofCandidates: 20, numberofCandidates: 20,
ExamType: 2, examType: 2,
AccountExpirationDate: "2024-05-21T14:47:04.1785384Z", accountExpirationDate: "2024-05-21T14:47:04.1785384Z",
}, },
]); ]);
@ -181,7 +181,7 @@ const redirectToPage = (id: number) => {
// //
const fiscalyear = ref<number | null>(0); 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 () => {
// API // API
// await http // await http
@ -196,21 +196,21 @@ const fiscalYearFilter = async () => {
// .finally(async () => { // .finally(async () => {
// }); // });
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const year = data.FiscalYear + 543; const year = data.fiscalYear + 543;
if (fiscalyear.value === null || year > fiscalyear.value) { if (fiscalyear.value === null || year > fiscalyear.value) {
fiscalyear.value = year; fiscalyear.value = year;
} }
if (!addedFiscalYearValues.includes(year)) { if (!addedfiscalYearValues.includes(year)) {
fiscalyearOP.push({ id: year, name: year.toString() }); fiscalyearOP.push({ id: year, name: year.toString() });
addedFiscalYearValues.push(year); addedfiscalYearValues.push(year);
} }
} }
} }
// API // API
const searchFiscalyear = () => { const searchfiscalyear = () => {
console.log('Input value changed:', fiscalyear.value); console.log('Input value changed:', fiscalyear.value);
// API // API
// await http // await http
@ -233,15 +233,15 @@ const resetFilter = () => {
}; };
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const visibleColumns = ref<string[]>(['id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) // const visibleColumns = ref<string[]>(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //
// //
const examTime = ref<number | null>(null); const examTime = ref<number | null>(null);
const examTimeOP = ref<number[]>([]); const examTimeOP = ref<number[]>([]);
const examTimeFilter = async () => { const examTimeFilter = async () => {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
if (!examTimeOP.value.includes(data.ExamOrder)) { if (!examTimeOP.value.includes(data.examOrder)) {
examTimeOP.value.push(data.ExamOrder); examTimeOP.value.push(data.examOrder);
} }
} }
examTimeOP.value.sort((a, b) => a - b); // examTimeOP.value.sort((a, b) => a - b); //
@ -250,16 +250,16 @@ const examTimeFilter = async () => {
// //
const examType = ref<number | null>(0); const examType = ref<number | null>(0);
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedExamTypeValues: number[] = []; const addedexamTypeValues: number[] = [];
const examTypeFilter = async () => { const examTypeFilter = async () => {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const examTypeValue = data.ExamType; const examTypeValue = data.examType;
if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) { if (examTypeValue == 1 && !addedexamTypeValues.includes(1)) {
examTypeOP.push({ id: 1, name: "คัดเลือก" }); examTypeOP.push({ id: 1, name: "คัดเลือก" });
addedExamTypeValues.push(1); addedexamTypeValues.push(1);
} else if (examTypeValue == 2 && !addedExamTypeValues.includes(2)) { } else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) {
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" }); examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
addedExamTypeValues.push(2); addedexamTypeValues.push(2);
} }
} }
} }
@ -275,7 +275,7 @@ const expiredAccount = ref<boolean>(false);
const expiredAccountFilter = async () => { const expiredAccountFilter = async () => {
const currentDate = new Date(); const currentDate = new Date();
const updatedRows = OriginalData.value.map((data) => { const updatedRows = OriginalData.value.map((data) => {
let expirationDate = new Date(data.AccountExpirationDate); let expirationDate = new Date(data.accountExpirationDate);
let isExpired = expirationDate < currentDate; let isExpired = expirationDate < currentDate;
return { ...data, isExpired }; return { ...data, isExpired };
@ -302,7 +302,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
<q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP" <q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP"
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false" option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFiscalyear" /> :outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-6"></div> <div class="col-xs-12 col-sm-3 col-md-6"></div>
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
@ -349,23 +349,23 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td key="id" :props="props"> <q-td key="id" :props="props">
{{ props.row.id }} {{ props.row.id }}
</q-td> </q-td>
<q-td key="ExamRound" :props="props"> <q-td key="examRound" :props="props">
{{ props.row.ExamRound }} {{ props.row.examRound }}
</q-td> </q-td>
<q-td key="ExamOrder" :props="props"> <q-td key="examOrder" :props="props">
{{ props.row.ExamOrder }} {{ props.row.examOrder }}
</q-td> </q-td>
<q-td key="FiscalYear" :props="props"> <q-td key="fiscalYear" :props="props">
{{ props.row.FiscalYear + 543 }} {{ props.row.fiscalYear + 543 }}
</q-td> </q-td>
<q-td key="NumberofCandidates" :props="props"> <q-td key="numberofCandidates" :props="props">
{{ props.row.NumberofCandidates }} {{ props.row.numberofCandidates }}
</q-td> </q-td>
<q-td key="ExamType" :props="props"> <q-td key="examType" :props="props">
{{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} {{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
</q-td> </q-td>
<q-td key="AccountExpirationDate" :props="props"> <q-td key="accountExpirationDate" :props="props">
{{ textDate(props.row.AccountExpirationDate) }} {{ textDate(props.row.accountExpirationDate) }}
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>

View file

@ -1,12 +1,12 @@
// ข้อมูลรายการสอบแข่งขัน/คัดเลือก // ข้อมูลรายการสอบแข่งขัน/คัดเลือก
interface FormPlacementMainData { interface FormPlacementMainData {
id: number; id: number;
ExamRound: string; examRound: string;
ExamOrder: number; examOrder: number;
FiscalYear: number; fiscalYear: number;
NumberofCandidates: number; numberofCandidates: number;
ExamType: number; examType: number;
AccountExpirationDate: string; accountExpirationDate: string;
isExpired?: boolean; isExpired?: boolean;
} }

View file

@ -41,16 +41,16 @@ export const usePlacementDataStore = defineStore("placement", () => {
return DataMainUpdate.value = DataMainOrig.value; return DataMainUpdate.value = DataMainOrig.value;
} else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) { } else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) {
// console.log('case 2'); // console.log('case 2');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1);
} else if (filter_1 !== null && filter_2 === null && filter_3 === false) { } else if (filter_1 !== null && filter_2 === null && filter_3 === false) {
// console.log('case 2.1'); // console.log('case 2.1');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1);
} else if (filter_1 !== null && filter_2 !== 0 && filter_3 === false) { } else if (filter_1 !== null && filter_2 !== 0 && filter_3 === false) {
// console.log('case 2.2'); // console.log('case 2.2');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1 && item.ExamType === filter_2); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.examType === filter_2);
} else if (filter_1 === null && filter_2 !== 0 && filter_3 === false) { } else if (filter_1 === null && filter_2 !== 0 && filter_3 === false) {
// console.log('case 3'); // console.log('case 3');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamType === filter_2); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType === filter_2);
} else if (filter_1 === null && filter_2 === 0 && filter_3 === true) { } else if (filter_1 === null && filter_2 === 0 && filter_3 === true) {
// console.log('case 3.1'); // console.log('case 3.1');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
@ -59,16 +59,16 @@ export const usePlacementDataStore = defineStore("placement", () => {
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
} else if (filter_1 !== null && filter_2 === 0 && filter_3 === true) { } else if (filter_1 !== null && filter_2 === 0 && filter_3 === true) {
// console.log('case 3.3'); // console.log('case 3.3');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder == filter_1 && item.isExpired == filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder == filter_1 && item.isExpired == filter_3);
} else if (filter_1 !== null && filter_2 === null && filter_3 === true) { } else if (filter_1 !== null && filter_2 === null && filter_3 === true) {
// console.log('case 3.4'); // console.log('case 3.4');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder == filter_1 && item.isExpired == filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder == filter_1 && item.isExpired == filter_3);
} else if (filter_1 !== null && filter_2 !== 0 && filter_3 === true) { } else if (filter_1 !== null && filter_2 !== 0 && filter_3 === true) {
// console.log('case 3.5'); // console.log('case 3.5');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder == filter_1 && item.ExamType == filter_2 && item.isExpired == filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder == filter_1 && item.examType == filter_2 && item.isExpired == filter_3);
} else if (filter_1 === null && filter_2 !== 0 && filter_3 === true) { } else if (filter_1 === null && filter_2 !== 0 && filter_3 === true) {
// console.log('case 3.6'); // console.log('case 3.6');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamType == filter_2 && item.isExpired == filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType == filter_2 && item.isExpired == filter_3);
} }
} }