ปรับ รายการเงินเดือน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-28 11:16:44 +07:00
parent f806417157
commit 6c936c2b97
5 changed files with 152 additions and 89 deletions

View file

@ -28,6 +28,10 @@ const {
success,
} = useCounterMixin();
const props = defineProps({
periodLatest: { type: Object as () => DataPeriodLatest, require: true },
});
const splitterModel = ref<number>(13);
const itemsTabGroup = ref([
{
@ -90,47 +94,6 @@ const itemsCard = ref([
},
]);
const rootId = ref<string>("");
async function fetchKeycloakPosition() {
showLoader();
await http
.get(config.API.keycloakPosition)
.then((res) => {
const data = res.data.result;
rootId.value = data.rootId;
store.rootId = data.rootId
fetchSalalyPeriod(rootId.value);
})
.catch((err) => {
console.log(err);
})
.finally(() => {
hideLoader();
});
}
const dataPeriod = ref<DataPeriodLatest>();
async function fetchSalalyPeriod(id: string) {
showLoader();
await http
.get(config.API.salaryListPeriodLatest(id))
.then(async (res) => {
dataPeriod.value = res.data.result;
dataPeriod.value &&
store.fetchPeriodLatest(dataPeriod.value, store.tabGroup);
store.groupId && fetchDataQuota(store.groupId);
store.groupId && fetchDataPeriod(store.groupId);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchDataQuota(id: string) {
showLoader();
await http
@ -185,7 +148,8 @@ async function changeTabGroup() {
formFilter.pageSize = 10;
formFilter.keyword = "";
store.tabType = "PENDING";
dataPeriod.value && store.fetchPeriodLatest(dataPeriod.value, store.tabGroup);
props.periodLatest &&
store.fetchPeriodLatest(props?.periodLatest, store.tabGroup);
store.groupId && fetchDataQuota(store.groupId);
store.groupId && fetchDataPeriod(store.groupId);
}
@ -202,7 +166,8 @@ function updatePagination() {
}
onMounted(async () => {
await fetchKeycloakPosition();
await fetchDataQuota(store.groupId);
await fetchDataPeriod(store.groupId);
});
</script>
@ -275,18 +240,21 @@ onMounted(async () => {
v-for="(item, index) in itemsTabType"
:key="index"
class="row"
:style="index==1?'border-top: 1px solid #ccc;':index==3?'border-bottom: 1px solid #ccc':''"
:style="
index == 1
? 'border-top: 1px solid #ccc;'
: index == 3
? 'border-bottom: 1px solid #ccc'
: ''
"
>
<q-tab
class="col-12"
style="justify-content: left"
:name="item.type"
:label="item.lable"
@click="changeTabType()"
/>
<q-tab
class="col-12"
style="justify-content: left"
:name="item.type"
:label="item.lable"
@click="changeTabType()"
/>
</div>
</q-tabs>
</template>