เงินเดือน => 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

@ -348,6 +348,7 @@ const columnsSpeciel = ref<QTableProps["columns"]>([
format: (v) => Number(v).toLocaleString(),
},
]);
const columns = computed(() => {
const columnsss =
store.roundMainCode === "APR"
@ -371,8 +372,9 @@ const visibleColumns = ref<string[]>(
"remainingAmount",
"totalBackup",
]
: []
: ["org", "total", "chosen", "totalBackup"]
);
const filter = ref<string>("");
function fetchDataDashboard() {
showLoader();
@ -462,59 +464,75 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
</q-card-section>
</q-card>
</div>
<!-- <div class="row col justify-end self-center">
<q-btn-dropdown color="blue-5" label="ดาวน์โหลด">
<q-list>
<q-item
v-for="(item, index) in store.roundMainCode === 'APR'
? store.itemDownloadApr
: store.roundMainCode === 'OCT'
? store.itemDownloadOct
: []"
:key="index"
clickable
v-close-popup
@click="onClickDownload(item)"
>
<q-item-section>
<q-item-label>{{ item.name }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div> -->
</div>
</div>
<q-separator />
<div class="col-12 q-pa-md">
<d-table
for="table"
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
dense
class="custom-header-table"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
<div class="row q-pa-md">
<div class="col-12">
<q-toolbar style="padding: 0px">
<q-space />
<div class="row q-col-gutter-sm">
<q-input
borderless
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
outlined
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
</q-toolbar>
</div>
<div class="col-12">
<d-table
for="table"
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
dense
class="custom-header-table"
:filter="filter"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</template>

View file

@ -360,6 +360,22 @@ const columnsSpeciel = ref<QTableProps["columns"]>([
format: (v) => Number(v).toLocaleString(),
},
]);
const visibleColumns = ref<string[]>(
store.roundMainCode === "APR"
? ["org", "total", "chosen", "totalBackup"]
: store.roundMainCode === "OCT"
? [
"org",
"currentAmount",
"sixPercentAmount",
"spentAmount",
"sixPercentSpentAmount",
"useAmount",
"remainingAmount",
"totalBackup",
]
: ["org", "total", "fifteenPercent", "chosen", "remaining", "totalBackup"]
);
const columns = computed(() => {
const columnsss =
store.roundMainCode === "APR"
@ -369,6 +385,7 @@ const columns = computed(() => {
: columnsSpeciel.value;
return columnsss;
});
const filter = ref<string>("");
/** function fetch ข้อมูลสถิติ*/
function fetchDataDashboard() {
@ -500,58 +517,74 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
</q-card-section>
</q-card>
</div>
<!-- <div class="row col justify-end self-center">
<q-btn-dropdown color="blue-5" label="ดาวน์โหลด">
<q-list>
<q-item
v-for="(item, index) in store.roundMainCode === 'APR'
? store.itemDownloadApr
: store.roundMainCode === 'OCT'
? store.itemDownloadOct
: []"
:key="index"
clickable
v-close-popup
@click="onClickDownload(item)"
>
<q-item-section>
<q-item-label>{{ item.name }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div> -->
</div>
</div>
<q-separator />
<div class="col-12 q-pa-md">
<d-table
for="table"
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
dense
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
<div class="row q-pa-md">
<div class="col-12">
<q-toolbar style="padding: 0px">
<q-space />
<div class="row q-col-gutter-sm">
<q-input
borderless
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
outlined
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
</q-toolbar>
</div>
<div class="col-12">
<d-table
for="table"
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
dense
:filter="filter"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</template>

View file

@ -356,7 +356,6 @@ function onClickDownload(data: DataOption) {
const modalDialogInfoCriteria = ref<boolean>(false);
onMounted(() => {
console.log(props.rootId);
if (props.rootId) {
fetchDataQuota(store.groupId);
fetchDataPeriod(store.groupId);

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>