Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-20 16:47:27 +07:00
commit 0a4c94b5cc
6 changed files with 83 additions and 19 deletions

View file

@ -238,7 +238,9 @@ function downloadFile(fileName: string) {
}); });
} }
onMounted(() => { onMounted(() => {
fetchListFile(); if (props.rootId) {
fetchListFile();
}
}); });
</script> </script>

View file

@ -355,9 +355,11 @@ function onClickDownload(data: DataOption) {
const modalDialogInfoCriteria = ref<boolean>(false); const modalDialogInfoCriteria = ref<boolean>(false);
onMounted(() => { onMounted(() => {
fetchDataQuota(store.groupId); if (props.rootId) {
fetchDataPeriod(store.groupId); fetchDataQuota(store.groupId);
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16; fetchDataPeriod(store.groupId);
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16;
}
}); });
const isRetire = ref<boolean | string>(false); const isRetire = ref<boolean | string>(false);

View file

@ -253,7 +253,9 @@ function sendAndRecommend(title: string, typeOrder: string) {
} }
onMounted(() => { onMounted(() => {
getListFile(); if (props.rootId) {
getListFile();
}
}); });
</script> </script>

View file

@ -356,9 +356,12 @@ function onClickDownload(data: DataOption) {
const modalDialogInfoCriteria = ref<boolean>(false); const modalDialogInfoCriteria = ref<boolean>(false);
onMounted(() => { onMounted(() => {
fetchDataQuota(store.groupId); console.log(props.rootId);
fetchDataPeriod(store.groupId); if (props.rootId) {
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16; fetchDataQuota(store.groupId);
fetchDataPeriod(store.groupId);
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16;
}
}); });
const isRetire = ref<boolean>(false); const isRetire = ref<boolean>(false);

View file

@ -34,9 +34,11 @@ const year = ref<number>(new Date().getFullYear());
const roundFilter = ref<any>(); const roundFilter = ref<any>();
const roundOptions = ref<DataOptionShort[]>([]); const roundOptions = ref<DataOptionShort[]>([]);
const agencyFilter = ref<string>(""); const agencyFilter = ref<string>("");
const agencyOptions = ref<DataOption[]>(); const agencyOptions = ref<DataOption[]>([]);
const agencyOptionsMain = ref<DataOption[]>([]);
const snapFilter = ref<string>(""); const snapFilter = ref<string>("");
const snapOptions = ref<DataOption[]>(); const snapOptions = ref<DataOption[]>([]);
const periodLatest = ref<DataPeriodLatest>(); const periodLatest = ref<DataPeriodLatest>();
const isLoad = ref<boolean>(false); const isLoad = ref<boolean>(false);
@ -153,7 +155,7 @@ async function getAgency(id: string) {
.get(config.API.activeOrganizationRootById(id)) .get(config.API.activeOrganizationRootById(id))
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
agencyOptions.value = await [ agencyOptionsMain.value = await [
{ {
id: "ALL", id: "ALL",
name: "ทั้งหมด", name: "ทั้งหมด",
@ -164,7 +166,7 @@ async function getAgency(id: string) {
name: x.orgRootName, name: x.orgRootName,
})) }))
); );
// agencyFilter.value = store.rootId; agencyOptions.value = agencyOptionsMain.value;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -210,7 +212,7 @@ async function getAgencyPosition(id: string) {
* @param snap id รอบ * @param snap id รอบ
*/ */
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
if (rootId !== "ALL") { if (rootId) {
showLoader(); showLoader();
isLoad.value = false; isLoad.value = false;
const body = { const body = {
@ -314,6 +316,20 @@ function getQuota() {
fetchSalalyPeriod(agencyFilter.value, roundFilter.value.id, snapFilter.value); fetchSalalyPeriod(agencyFilter.value, roundFilter.value.id, snapFilter.value);
} }
function filterSelector(val: any, update: Function, refData: string) {
switch (refData) {
case "agencyFilter":
update(() => {
agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
default:
break;
}
}
onMounted(() => { onMounted(() => {
getRound(); getRound();
}); });
@ -419,7 +435,18 @@ onMounted(() => {
bg-color="white" bg-color="white"
@update:model-value="onChangeAgency" @update:model-value="onChangeAgency"
:disable="!isDisable" :disable="!isDisable"
/> use-input
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'agencyFilter'
) "
>
<template v-if="agencyFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="agencyFilter = 'ALL'"
class="cursor-pointer"
/> </template
></q-select>
</div> </div>
<q-card flat bordered> <q-card flat bordered>

View file

@ -34,9 +34,10 @@ const year = ref<number>(new Date().getFullYear());
const roundFilter = ref<any>(); const roundFilter = ref<any>();
const roundOptions = ref<DataOptionShort[]>([]); const roundOptions = ref<DataOptionShort[]>([]);
const agencyFilter = ref<string>(""); const agencyFilter = ref<string>("");
const agencyOptions = ref<DataOption[]>(); const agencyOptionsMain = ref<DataOption[]>([]);
const agencyOptions = ref<DataOption[]>([]);
const snapFilter = ref<string>(""); const snapFilter = ref<string>("");
const snapOptions = ref<DataOption[]>(); const snapOptions = ref<DataOption[]>([]);
const periodLatest = ref<DataPeriodLatest>(); const periodLatest = ref<DataPeriodLatest>();
const isLoad = ref<boolean>(false); const isLoad = ref<boolean>(false);
@ -154,7 +155,7 @@ async function getAgency(id: string) {
.get(config.API.activeOrganizationRootById(id)) .get(config.API.activeOrganizationRootById(id))
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
agencyOptions.value = await [ agencyOptionsMain.value = await [
{ {
id: "ALL", id: "ALL",
name: "ทั้งหมด", name: "ทั้งหมด",
@ -165,6 +166,7 @@ async function getAgency(id: string) {
name: x.orgRootName, name: x.orgRootName,
})) }))
); );
agencyOptions.value = agencyOptionsMain.value;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -210,7 +212,7 @@ async function getAgencyPosition(id: string) {
* @param snap id รอบ * @param snap id รอบ
*/ */
function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) { function fetchSalalyPeriod(rootId: string, periodId: string, snap: string) {
if (rootId !== "ALL") { if (rootId) {
showLoader(); showLoader();
isLoad.value = false; isLoad.value = false;
const body = { const body = {
@ -335,6 +337,21 @@ function getQuota() {
}) })
.finally(() => {}); .finally(() => {});
} }
function filterSelector(val: any, update: Function, refData: string) {
switch (refData) {
case "agencyFilter":
update(() => {
agencyOptions.value = agencyOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
default:
break;
}
}
onMounted(() => { onMounted(() => {
getRound(); getRound();
}); });
@ -439,7 +456,18 @@ onMounted(() => {
bg-color="white" bg-color="white"
@update:model-value="onChangeAgency" @update:model-value="onChangeAgency"
:disable="!isDisable" :disable="!isDisable"
/> use-input
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'agencyFilter'
) "
>
<template v-if="agencyFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="agencyFilter = 'ALL'"
class="cursor-pointer"
/> </template
></q-select>
</div> </div>
<q-card flat bordered> <q-card flat bordered>