เงินเดือน => fix bug

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-06-27 17:30:44 +07:00
parent e4912c45de
commit e7547d98df
5 changed files with 176 additions and 146 deletions

View file

@ -154,6 +154,8 @@ async function getAgency(id: string) {
(await http
.get(config.API.activeOrganizationRootById(id))
.then(async (res) => {
agencyOptions.value = [];
agencyOptionsMain.value = [];
const data = res.data.result;
agencyOptionsMain.value = await [
{
@ -247,13 +249,14 @@ async function onChangeRound() {
await getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId);
// await getAgencyPosition(roundFilter.value.revisionId);
await getAgencyPosition(roundFilter.value.revisionId);
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
fetchSalalyPeriod(
agencyFilter.value,
roundFilter.value.id,
snapFilter.value
);
// fetchSalalyPeriod(
// agencyFilter.value,
// roundFilter.value.id,
// snapFilter.value
// );
store.tabType = "PENDING";
store.roundMainCode = roundFilter.value.shortCode;
} else {
@ -320,6 +323,7 @@ function filterSelector(val: any, update: Function, refData: string) {
switch (refData) {
case "agencyFilter":
update(() => {
agencyFilter.value = "";
agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);

View file

@ -89,8 +89,6 @@ function getRound() {
store.roundYear = roundFilter.value.year;
store.isClosedRound = roundFilter.value.isClose;
console.log(roundFilter.value);
await getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId);
await getAgencyPosition(roundFilter.value.revisionId);
@ -157,6 +155,8 @@ async function getAgency(id: string) {
.get(config.API.activeOrganizationRootById(id))
.then(async (res) => {
const data = res.data.result;
agencyOptions.value = [];
agencyOptionsMain.value = [];
agencyOptionsMain.value = await [
{
id: "ALL",
@ -189,14 +189,12 @@ async function getAgencyPosition(id: string) {
.get(config.API.keycloakPositionByid(id))
.then(async (res) => {
const data = await res.data.result;
store.rootId = data.rootId;
const position = agencyOptions.value?.find(
(e: DataOption) => e.id === data.rootId
);
agencyFilter.value = position ? position.id : "ALL";
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
fetchSalalyPeriod(
agencyFilter.value,
@ -266,12 +264,8 @@ async function onChangeRound() {
}
getSnap(roundFilter.value.shortCode);
await getAgency(roundFilter.value.revisionId);
await getAgencyPosition(roundFilter.value.revisionId);
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
fetchSalalyPeriod(
agencyFilter.value,
roundFilter.value.id,
snapFilter.value
);
store.tabType = "PENDING";
store.roundMainCode = roundFilter.value.shortCode;
store.roundYear = roundFilter.value.year;
@ -282,6 +276,7 @@ async function onChangeRound() {
/** function เปลี่ยนรอบ*/
async function onChangeSnap() {
agencyFilter.value = "";
if (agencyFilter.value && roundFilter.value.id && snapFilter.value) {
await fetchSalalyPeriod(
agencyFilter.value,
@ -307,29 +302,6 @@ async function onChangeAgency() {
}
}
/** function onScrollSelect รอบการขึ้นเงินเดือน*/
function onScroll({ to, ref }: { to: number; ref: any }) {
const lastIndex = roundOptions.value.length - 1;
if (
loading.value !== true &&
nextPage.value < lastPage.value &&
to === lastIndex
) {
loading.value = true;
setTimeout(() => {
nextPage.value++;
page.value = nextPage.value;
getRound();
nextTick(() => {
ref.refresh();
loading.value = false;
});
}, 500);
}
}
/** function fetch PeriodQuota*/
function getQuota() {
http
@ -340,8 +312,7 @@ function getQuota() {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
});
}
/**
@ -354,6 +325,7 @@ function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "agencyFilter":
update(() => {
agencyFilter.value = "";
agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
@ -422,8 +394,6 @@ onMounted(() => {
hide-bottom-space
bg-color="white"
@update:model-value="onChangeRound"
:loading="loading"
@virtual-scroll="onScroll"
:disable="!isDisable"
>
<template v-slot:option="scope">
@ -452,6 +422,7 @@ onMounted(() => {
@update:model-value="onChangeSnap"
:disable="!isDisable"
/>
<q-select
class="q-ml-xs"
v-model="agencyFilter"
@ -463,7 +434,6 @@ onMounted(() => {
option-label="name"
option-value="id"
:options="agencyOptions"
lazy-rules
hide-bottom-space
bg-color="white"
@update:model-value="onChangeAgency"
@ -473,13 +443,19 @@ onMounted(() => {
doneFn:Function) => filterSelector(inputValue, doneFn,'agencyFilter'
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
<template v-if="agencyFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="agencyFilter = 'ALL'"
class="cursor-pointer"
/> </template
></q-select>
/>
</template>
</q-select>
</div>
<q-card flat bordered>