fix เครื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-27 13:33:27 +07:00
parent 2b691a746d
commit 4586aef931
9 changed files with 86 additions and 134 deletions

View file

@ -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>