no message

This commit is contained in:
STW_TTTY\stwtt 2024-04-22 11:35:33 +07:00
parent 304168f337
commit 4ffde198d6
2 changed files with 130 additions and 23 deletions

View file

@ -74,13 +74,7 @@ const positionOp = ref<DataOption[]>([]);
const positionMainOp = ref<DataOption[]>([]); const positionMainOp = ref<DataOption[]>([]);
/** Option รอบการประเมิน*/ /** Option รอบการประเมิน*/
const roundOp = ref<DataOption[]>([ const roundOp = ref<DataOption[]>([]);
{ id: "APR", name: "รอบเมษายน" },
{
id: "OCT",
name: "รอบตุลาคม",
},
]);
/** /**
* function นหาขอมลของ Option * function นหาขอมลของ Option
@ -245,7 +239,41 @@ function updateSelected(data: any) {
form.orgRevisionId = data.orgRevisionId; form.orgRevisionId = data.orgRevisionId;
} }
function getRound() {
showLoader();
http
.get(
config.API.kpiPeriod +
`?year=${form.year}`
)
.then((res) => {
const data = res.data.result.data;
roundOp.value = data.map((item: any) => ({
id: item.id,
name: statusTothai(item.durationKPI),
}))
console.log(roundOp.value)
})
.finally(() => {
hideLoader()
});
}
function statusTothai(val: string) {
switch (val) {
case "SPECIAL":
return "รอบพิเศษ";
case "APR":
return "รอบเมษายน";
case "OCT":
return "รอบตุลาคม";
default:
return "-";
}
}
onMounted(() => { onMounted(() => {
getRound()
fetchActive(); fetchActive();
getOptions(); getOptions();
if (id.value !== "") { if (id.value !== "") {
@ -319,7 +347,7 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
outlined outlined
:model-value=" :model-value="
form.year === 0 ? null : Number(form.year) + 543 form.year === null ? null : Number(form.year) + 543
" "
:label="`${'ปีงบประมาณ'}`" :label="`${'ปีงบประมาณ'}`"
> >

View file

@ -58,8 +58,9 @@ const formFilter = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
position: "", position: "",
round: "APR", round: "",
keyword: "", keyword: "",
year: new Date().getFullYear(),
}); });
const pagination = ref({ const pagination = ref({
page: formFilter.page, page: formFilter.page,
@ -67,20 +68,13 @@ const pagination = ref({
}); });
/** Option รอบการประเมิน*/ /** Option รอบการประเมิน*/
const roundOp = ref<DataOption[]>([ const roundOp = ref<DataOption[]>([]);
{ id: "APR", name: "รอบเมษายน" },
{
id: "OCT",
name: "รอบตุลาคม",
},
]);
function fetchList() { function fetchList() {
showLoader();
http http
.get( .get(
config.API.kpiRoleMainList + config.API.kpiRoleMainList +
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&round=${formFilter.round}&position=${formFilter.position}` `?page=${formFilter.page}&pageSize=${formFilter.pageSize}&kpiPeriodId=${formFilter.round}&position=${formFilter.position}`
) )
.then((res) => { .then((res) => {
console.log(res); console.log(res);
@ -144,6 +138,7 @@ function filterOption(val: any, update: Function) {
/** ดึงข้อมูลตำแหน่ง */ /** ดึงข้อมูลตำแหน่ง */
function getOptions() { function getOptions() {
showLoader();
http.get(config.API.orgSalaryPosition).then((res) => { http.get(config.API.orgSalaryPosition).then((res) => {
const dataOp = res.data.result; const dataOp = res.data.result;
const uniqueNames = new Set(); const uniqueNames = new Set();
@ -164,9 +159,43 @@ function getOptions() {
}); });
} }
onMounted(() => { function getRound() {
fetchList(); showLoader();
getOptions(); http
.get(
config.API.kpiPeriod +
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}&year=${formFilter.year}`
)
.then((res) => {
const data = res.data.result.data;
roundOp.value = data.map((item: any) => ({
id: item.id,
name: statusTothai(item.durationKPI),
}))
console.log(roundOp.value)
})
.finally(() => {
hideLoader()
});
}
function statusTothai(val: string) {
switch (val) {
case "SPECIAL":
return "รอบพิเศษ";
case "APR":
return "รอบเมษายน";
case "OCT":
return "รอบตุลาคม";
default:
return "-";
}
}
onMounted(async () => {
await getOptions();
await getRound();
await fetchList();
}); });
</script> </script>
@ -192,7 +221,7 @@ onMounted(() => {
use-input use-input
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) " @filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
@update:model-value="fetchList" @update:model-value="fetchList"
> >
<template v-slot:no-option> <template v-slot:no-option>
<q-item> <q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section> <q-item-section class="text-grey"> ไมอม </q-item-section>
@ -201,7 +230,10 @@ onMounted(() => {
<template v-if="formFilter.position" v-slot:append> <template v-if="formFilter.position" v-slot:append>
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent="formFilter.position = '';fetchList()" @click.stop.prevent="
formFilter.position = '';
fetchList();
"
class="cursor-pointer" class="cursor-pointer"
/> />
</template> </template>
@ -218,6 +250,52 @@ onMounted(() => {
emit-value emit-value
map-options map-options
/> --> /> -->
<datepicker
menu-class-name="modalfix"
v-model="formFilter.year"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:model-value="(formFilter.page = 1),formFilter.round = '',getRound(),fetchList()"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
lazy-rules
outlined
class="inputgreen"
:model-value="
formFilter.year === 0
? 'ทั้งหมด'
: Number(formFilter.year) + 543
"
:label="`${'ปีงบประมาณ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
<!-- <template v-if="formFilter.year" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
(formFilter.year = 0), (formFilter.page = 1), getRound(),fetchList()
"
class="cursor-pointer"
/>
</template> -->
</q-input>
</template>
</datepicker>
<q-select <q-select
dense dense
outlined outlined
@ -229,6 +307,7 @@ onMounted(() => {
emit-value emit-value
map-options map-options
@update:model-value="fetchList" @update:model-value="fetchList"
style="width: 200px;"
/> />
</div> </div>
<q-toolbar-title> <q-toolbar-title>