api เครื่องราชฯ ส่วนจัดการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-22 15:58:34 +07:00
parent 8f16fadeea
commit 7bac2037be
6 changed files with 179 additions and 357 deletions

View file

@ -31,7 +31,7 @@ const visibleColumns = ref<string[]>([
"position",
"level",
"salary",
"organization",
"insigniaType",
"insigniaSend",
"insigniaLevel",
@ -92,15 +92,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "หน่วยงาน",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "insigniaType",
align: "left",
@ -139,63 +130,11 @@ const columns = ref<QTableProps["columns"]>([
},
]);
// ()
const rows = ref<any[]>([
{
no: "1",
citizenId: "1xxxxxxxxxx",
name: "นายใจดี ยอดใจ ",
position: "นักวิชาการพัสดุ",
level: "1",
salary: "15000",
organization: "บริหาร",
insigniaType: "ทวีติยาภรณ์ช้างเผือก",
insigniaSend: "ตริตาภรณ์ช้างเผือก",
insigniaLevel: "ต่ำกว่าสายสะพาย",
dateSend: "31 ม.ค. 2566",
},
{
no: "2",
citizenId: "1xxxxxxxxxx",
name: "นายจักกริน บัณฑิต",
position: "นักวิชาการพัสดุ",
level: "ปฏิบัติการ",
salary: "15000",
organization: "บริหาร",
insigniaType: "ทวีติยาภรณ์ช้างเผือก",
insigniaSend: "ตริตาภรณ์ช้างเผือก",
insigniaLevel: "ต่ำกว่าสายสะพาย",
dateSend: "31 ม.ค. 2566",
},
{
no: "3",
citizenId: "1xxxxxxxxxx",
name: "นางสาวกัณฐิมา กาฬสินธุ์",
position: "นักจัดการงานทั่วไป",
level: "ปฏิบัติการ",
salary: "15000",
organization: "บริหาร",
insigniaType: "ทวีติยาภรณ์ช้างเผือก",
insigniaSend: "ตริตาภรณ์ช้างเผือก",
insigniaLevel: "ต่ำกว่าสายสะพาย",
dateSend: "31 ม.ค. 2566",
},
{
no: "4",
citizenId: "1xxxxxxxxxx",
name: "นางสาวเมขลา กระจ่างมนตรี",
position: "นักจัดการงานทั่วไป",
level: "ปฏิบัติการ",
salary: "15000",
organization: "บริหาร",
insigniaType: "ทวีติยาภรณ์ช้างเผือก",
insigniaSend: "ตริตาภรณ์ช้างเผือก",
insigniaLevel: "ต่ำกว่าสายสะพาย",
dateSend: "31 ม.ค. 2566",
},
]);
onMounted(async () => {
organizationOptions.value = DataStore.optionsTypeOc;
organization.value = organizationOptions.value[0].id;
DataStore.typeOc = organization.value;
// if (props.fecthInsigniaAll) {
// await props.fecthInsigniaAll(props.roundId, props.tab);
// }
@ -207,7 +146,6 @@ onMounted(async () => {
"officer",
props.tab
);
filtertypeInsignia();
}
}
});
@ -222,35 +160,6 @@ const changtypeOc = () => {
}
};
const typeinsignia = ref<number | string>("all");
const typeinsigniaOptions = reactive<any>([{ id: "all", name: "ทั้งหมด" }]);
const typeinsigniaValues: Set<number> = new Set();
const listinsignia = ref<any>([]);
const filtertypeInsignia = async () => {
listinsignia.value = rows.value;
for (const data of listinsignia.value) {
const Type = data.insigniaType;
if (Type !== null && !typeinsigniaValues.has(Type)) {
typeinsigniaOptions.push({
id: Type.toString(),
name: Type.toString(),
});
typeinsigniaValues.add(Type);
}
}
};
const searchFilterTable = async () => {
if (typeinsignia.value !== undefined && typeinsignia.value !== null) {
if (typeinsignia.value === "all") {
rows.value = listinsignia.value;
} else {
rows.value = listinsignia.value.filter(
(e) => e.insigniaType === typeinsignia.value
);
}
}
};
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
@ -272,6 +181,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<!-- {{ DataStore.typeinsigniaOptions }} -->
<div class="row col-12 q-col-gutter-sm">
<q-select
v-model="organization"
@ -292,12 +202,12 @@ const paginationLabel = (start: string, end: string, total: string) => {
@update:model-value="changtypeOc"
/>
<q-select
v-model="typeinsignia"
v-model="DataStore.typeinsignia"
label="ปรเภทเครื่องราชฯ"
dense
emit-value
map-options
:options="typeinsigniaOptions"
:options="DataStore.typeinsigniaOptions"
option-value="id"
option-label="name"
lazy-rules
@ -307,7 +217,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
@update:model-value="searchFilterTable"
@update:model-value="DataStore.searchFilterTable"
/>
<q-space />
@ -352,7 +262,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-table
ref="table"
:columns="columns"
:rows="rows"
:rows="DataStore.rows"
:filter="filterKeyword"
row-key="name"
flat
@ -395,9 +305,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td key="salary" :props="props">
{{ props.row.salary }}
</q-td>
<q-td key="organization" :props="props">
{{ props.row.organization }}
</q-td>
<q-td key="insigniaType" :props="props">
{{ props.row.insigniaType }}
</q-td>