fix เครื่องราช
This commit is contained in:
parent
2b691a746d
commit
4586aef931
9 changed files with 86 additions and 134 deletions
|
|
@ -72,21 +72,24 @@ async function fecthlistRound() {
|
|||
id: e.period_id,
|
||||
year: e.period_year,
|
||||
name: e.period_name,
|
||||
period_revision: e.period_revision,
|
||||
}));
|
||||
|
||||
//มีรอบการเสนอขอพระราชทานเครื่องแสดง UI
|
||||
if (optionRound.value.length !== 0) {
|
||||
DataStore.optionRound = optionRound.value;
|
||||
const lastValue = optionRound.value[0];
|
||||
await fetchListOrg(lastValue.period_revision);
|
||||
await fecthAgency(lastValue.period_revision);
|
||||
if (DataStore.roundId) {
|
||||
round.value = DataStore.roundId; // รอบการเสนอให้ใช้รอบที่เลือก
|
||||
} else {
|
||||
round.value = lastValue.id.toString(); // รอบการเสนอให้ใช้รอบล่าสุด
|
||||
}
|
||||
await fecthStat(round.value);
|
||||
DataStore.roundId = round.value;
|
||||
roundName.value = lastValue.name;
|
||||
loadview.value = true;
|
||||
await fecthStat(round.value);
|
||||
} else {
|
||||
hideLoader();
|
||||
}
|
||||
|
|
@ -111,35 +114,25 @@ async function fecthStat(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch โครองสร้างปัจจุบัน
|
||||
*/
|
||||
function fetchActiveId() {
|
||||
http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
fetchListOrg(data.activeId);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลโครองสร้างปัจจุบัน
|
||||
* @param id โครงสร้างปัจจุบัน
|
||||
*/
|
||||
async function fetchListOrg(id: string) {
|
||||
await http
|
||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||
.get(config.API.orgByIdSystemRoot(id, route.meta.Key as string))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result.map((item: DataStructureTree) => ({
|
||||
id: item.orgTreeId,
|
||||
name: item.orgName,
|
||||
}));
|
||||
optiontypeOc.value = data;
|
||||
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||
const data = res.data.result;
|
||||
if (data.length !== 0) {
|
||||
optiontypeOc.value = await res.data.result.map(
|
||||
(item: DataStructureTree) => ({
|
||||
id: item.orgTreeId,
|
||||
name: item.orgName,
|
||||
})
|
||||
);
|
||||
|
||||
await DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -149,9 +142,13 @@ async function fetchListOrg(id: string) {
|
|||
/**
|
||||
* funcion เช็คหน่วยงาน
|
||||
*/
|
||||
async function fecthAgency() {
|
||||
async function fecthAgency(id: string) {
|
||||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.get(config.API.keycloakPosition(), {
|
||||
params: {
|
||||
revisionId: id,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
DataStore.agency = res.data.result.rootId;
|
||||
DataStore.typeOc = DataStore.agency;
|
||||
|
|
@ -183,19 +180,23 @@ async function fecthInsignia() {
|
|||
*/
|
||||
async function changround() {
|
||||
DataStore.roundId = round.value;
|
||||
fecthStat(round.value); //เรียกดู Stat รอบที่เลือก
|
||||
var organization =
|
||||
DataStore.agency != null //ถ้ามี agency เรียกข้อมูลตาม agency ถ้าไม่มีเรียนตาม Oc ที่เลือก
|
||||
? DataStore.agency
|
||||
: DataStore.typeOc;
|
||||
await fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
// get round name
|
||||
const roundFilter = optionRound.value.find((x: any) => round.value === x.id);
|
||||
await fecthStat(round.value); //เรียกดู Stat รอบที่เลือก
|
||||
const roundFilter = optionRound.value.find(
|
||||
(x: OptionRound) => x.id === round.value
|
||||
);
|
||||
if (roundFilter) {
|
||||
await fetchListOrg(roundFilter?.period_revision);
|
||||
await fecthAgency(roundFilter?.period_revision);
|
||||
roundName.value = `รอบการเสนอขอพระราชทานเครื่องราชฯ ปี ${
|
||||
roundFilter.year + 543
|
||||
}`;
|
||||
}
|
||||
await fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -431,13 +432,7 @@ async function uploadFile(event: any) {
|
|||
*/
|
||||
onMounted(async () => {
|
||||
tab.value = DataStore.mainTab ?? "";
|
||||
await Promise.all([
|
||||
fecthlistRound(),
|
||||
fecthInsignia(),
|
||||
fecthInsignia(),
|
||||
fetchActiveId(),
|
||||
fecthAgency(),
|
||||
]);
|
||||
await Promise.all([fecthlistRound(), fecthInsignia(), fecthInsignia()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -536,7 +531,7 @@ onMounted(async () => {
|
|||
</q-banner>
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
dense
|
||||
|
|
@ -597,7 +592,7 @@ onMounted(async () => {
|
|||
<tab4 :tab="tab" :round-id="round" />
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</div>
|
||||
|
||||
|
||||
<q-toolbar class="q-py-md text-right">
|
||||
<q-file
|
||||
|
|
@ -731,51 +726,4 @@ onMounted(async () => {
|
|||
border: 1px solid #ffa800;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.filter-card {
|
||||
background-color: #f1f1f1b0;
|
||||
}
|
||||
|
||||
.toggle-expired-account {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 150%;
|
||||
color: #35373c;
|
||||
}
|
||||
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
}
|
||||
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* this will be the loading indicator */
|
||||
.q-table thead tr:last-child th {
|
||||
/* height of all previous header rows */
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue