This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-28 15:25:03 +07:00
parent b27a3cb20e
commit 9f5147b923
3 changed files with 371 additions and 157 deletions

View file

@ -111,6 +111,57 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
return competency?.name; return competency?.name;
} }
const statusOptions = ref<DataOptions[]>([
{
id: "",
name: "ทั้งหมด",
},
{
id: "NEW",
name: "จัดทำข้อตกลง",
},
{
id: "NEW_EVALUATOR",
name: "รอผู้ประเมินตรวจสอบข้อตกลง",
},
{
id: "NEW_COMMANDER",
name: "รอผู้บังคับบัญชาเหนือขึ้นไปตรวจสอบข้อตกลง",
},
{
id: "NEW_COMMANDER_HIGH",
name: "รอผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่งตรวจสอบข้อตกลง",
},
{
id: "APPROVE",
name: "รายงานความก้าวหน้า",
},
{
id: "EVALUATING",
name: "รายงานผลสำเร็จของงาน",
},
{
id: "EVALUATING_EVALUATOR",
name: "รอผู้ประเมินตรวจสอบผล",
},
{
id: "EVALUATING_COMMANDER",
name: "รอผู้บังคับบัญชาเหนือขึ้นไปตรวจสอบผล",
},
{
id: "EVALUATING_COMMANDER_HIGH",
name: "รอผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่งตรวจสอบผล",
},
{
id: "COMPLETE",
name: "รอประกาศผลการประเมิน",
},
{
id: "KP7",
name: "ประกาศและลงทะเบียนประวัติแล้ว",
},
]);
function convertStatus(val: string) { function convertStatus(val: string) {
switch (val) { switch (val) {
case "NEW": case "NEW":
@ -142,6 +193,45 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
} }
} }
const resultsOptions = ref<DataOptions[]>([
{
id: "",
name: "ทั้งหมด",
},
{
id: "PENDING",
name: "รอดำเนินการ",
},
{
id: "PASSED",
name: "ผ่านการประเมิน",
},
{
id: "NOTPASSED",
name: "ไม่ผ่านการประเมิน",
},
{
id: "EXCELLENT",
name: "ดีเด่น",
},
{
id: "VERY_GOOD",
name: "ดีมาก",
},
{
id: "GOOD",
name: "ดี",
},
{
id: "FAIR",
name: "พอใช้",
},
{
id: "IMPROVEMENT",
name: "ต้องปรับปรุง",
},
]);
function convertResults(val: string) { function convertResults(val: string) {
switch (val) { switch (val) {
case "EXCELLENT": case "EXCELLENT":
@ -159,7 +249,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
} }
} }
const defaultCompetencyCoreLevel = ref<number|null>(null); const defaultCompetencyCoreLevel = ref<number | null>(null);
const defaultCompetencyGroupLevel = ref<number | null>(null); const defaultCompetencyGroupLevel = ref<number | null>(null);
function checkCompetencyDefaultCompetencyLevel() { function checkCompetencyDefaultCompetencyLevel() {
const posTypeName = dataEvaluation.value.posTypeName; const posTypeName = dataEvaluation.value.posTypeName;
@ -422,5 +512,8 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
selected, selected,
work, work,
isUpdate, isUpdate,
resultsOptions,
statusOptions,
}; };
}); });

View file

@ -115,6 +115,9 @@ const evaluatorIdMainOp = ref<DataOptions[]>([]);
const commanderIdMainOp = ref<DataOptions[]>([]); const commanderIdMainOp = ref<DataOptions[]>([]);
const commanderHighMainOp = ref<DataOptions[]>([]); const commanderHighMainOp = ref<DataOptions[]>([]);
const statusOp = ref<DataOptions[]>(store.statusOptions);
const resultOp = ref<DataOptions[]>(store.resultsOptions);
/** Dialog*/ /** Dialog*/
const modalDialog = ref<boolean>(false); const modalDialog = ref<boolean>(false);
const yearDialog = ref<number | null>(null); const yearDialog = ref<number | null>(null);
@ -137,6 +140,8 @@ const formRound = reactive({
const formQuery = reactive({ const formQuery = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
status: "",
results: "",
}); });
const total = ref<number>(0); const total = ref<number>(0);
const totalList = ref<number>(1); const totalList = ref<number>(1);
@ -151,7 +156,7 @@ const pagination = ref({
/** /**
* งขอมลรอบการประเม * งขอมลรอบการประเม
* @param type * @param type
*/ */
async function fetchRoundOption(type: string) { async function fetchRoundOption(type: string) {
const y = type === "main" ? year.value : yearDialog.value; const y = type === "main" ? year.value : yearDialog.value;
@ -194,11 +199,17 @@ async function fetchRoundOption(type: string) {
*/ */
async function fetchList() { async function fetchList() {
showLoader(); showLoader();
let queryParams = {
page: formQuery.page,
pageSize: formQuery.pageSize,
kpiPeriodId: round.value,
status: formQuery.status === "" ? undefined : formQuery.status,
results: formQuery.results === "" ? undefined : formQuery.results,
};
await http await http
.get( .get(config.API.kpiEvaluation, {
config.API.kpiEvaluation + params: queryParams,
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&kpiPeriodId=${round.value}` })
)
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
total.value = data.total; total.value = data.total;
@ -369,6 +380,21 @@ function filterOption(val: string, update: Function, refData: string) {
); );
}); });
break; break;
case "status":
update(() => {
statusOp.value = store.statusOptions.filter(
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
case "result":
update(() => {
resultOp.value = store.resultsOptions.filter(
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
default: default:
break; break;
} }
@ -405,161 +431,239 @@ onMounted(async () => {
<div class="col-12"> <div class="col-12">
<q-card bordered class="q-pa-md"> <q-card bordered class="q-pa-md">
<div class="row q-col-gutter-sm q-mb-sm"> <div class="col-12 q-col-gutter-sm">
<div class="col-xs-12 col-md-3"> <div class="row col-12 q-col-gutter-sm">
<datepicker <div class="col-xs-12 col-md-1">
menu-class-name="modalfix" <datepicker
v-model="year" menu-class-name="modalfix"
:locale="'th'" v-model="year"
autoApply :locale="'th'"
year-picker autoApply
:enableTimePicker="false" year-picker
@update:model-value=" formQuery.page = 1,fetchRoundOption('main')" :enableTimePicker="false"
> @update:model-value="
<template #year="{ year }">{{ year + 543 }}</template> (formQuery.page = 1), fetchRoundOption('main')
<template #year-overlay-value="{ value }">{{ "
parseInt(value + 543) >
}}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #trigger> <template #year-overlay-value="{ value }">{{
<q-input parseInt(value + 543)
dense }}</template>
lazy-rules <template #trigger>
outlined <q-input
hide-bottom-space dense
:model-value="!!year ? year + 543 : null" lazy-rules
:label="`${'ปีงบประมาณ'}`" outlined
> hide-bottom-space
<template v-slot:prepend> :model-value="!!year ? year + 543 : null"
<q-icon :label="`${'ปีงบประมาณ'}`"
name="event" >
class="cursor-pointer" <template v-slot:prepend>
style="color: var(--q-primary)" <q-icon
> name="event"
</q-icon> class="cursor-pointer"
</template> style="color: var(--q-primary)"
</q-input> >
</template> </q-icon>
</datepicker> </template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-2 col-md-2">
<q-btn
flat
round
color="primary"
icon="add"
@click="onClickAddList"
>
<q-tooltip> เพมขอม </q-tooltip>
</q-btn>
</div>
<q-space />
<div class="col-xs-12 col-md-2">
<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"
style="min-width: 140px"
/>
</div>
</div> </div>
<div class="col-xs-10 col-md-3"> <div class="col-12">
<q-select <q-card bordered class="col-12 filter-card q-pa-sm">
v-model="round" <div class="items-center col-12 row q-col-gutter-sm">
outlined <div class="col-xs-12 col-md-2">
label="รอบการประเมิน" <q-select
dense v-model="round"
option-label="name" outlined
option-value="id" label="รอบการประเมิน"
:options="roundMainOp" dense
emit-value option-label="name"
map-options option-value="id"
@update:model-value="changRound" :options="roundMainOp"
/> emit-value
</div> map-options
@update:model-value="changRound"
/>
</div>
<div class="col-xs-2 col-md-2"> <div class="col-xs-12 col-md-3">
<q-btn <q-select
flat v-model="formQuery.status"
round label="สถานะการประเมิน"
color="primary" class="select_ellipsis2"
icon="add" dense
@click="onClickAddList" emit-value
> map-options
<q-tooltip> เพมขอม </q-tooltip> :options="statusOp"
</q-btn> option-value="id"
</div> option-label="name"
lazy-rules
<q-space /> hide-bottom-space
<div class="col-xs-12 col-md-2"> outlined
<q-select use-input
v-model="visibleColumns" input-debounce="0"
multiple @update:model-value="(formQuery.page = 1), fetchList()"
outlined :clearable="formQuery.status !== ''"
dense @clear="
options-dense (formQuery.status = ''),
:display-value="$q.lang.table.columns" (statusOp = store.statusOptions)
emit-value "
map-options @filter="(inputValue: string,
:options="columns" doneFn: Function) => filterOption(inputValue, doneFn, 'status'
option-value="name" )"
><template v-slot:no-option>
style="min-width: 140px" <q-item>
/> <q-item-section class="text-grey">
</div> ไมอม
</div> </q-item-section>
</q-item>
<div class="col-12"> </template>
<d-table </q-select>
ref="table" </div>
:columns="columns" <div class="col-xs-12 col-md-3">
:rows="rows" <q-select
:filter="filterKeyword" v-model="formQuery.results"
row-key="id" label="ผลการประเมิน"
flat class="select_ellipsis3"
bordered dense
:paging="true" emit-value
dense map-options
:rows-per-page-options="[10, 25, 50, 100]" :options="resultOp"
:visible-columns="visibleColumns" option-value="id"
v-model:pagination="pagination" option-label="name"
@update:pagination="updatePagination" lazy-rules
> hide-bottom-space
<template v-slot:header="props"> outlined
<q-tr :props="props"> @update:model-value="(formQuery.page = 1), fetchList()"
<q-th use-input
v-for="col in props.cols" @clear="
:key="col.name" (formQuery.results = ''),
:props="props" (resultOp = store.resultsOptions)
> "
<span class="text-weight-medium">{{ col.label }}</span> input-debounce="0"
</q-th> :clearable="formQuery.results !== ''"
</q-tr> @filter="(inputValue: string,
</template> doneFn: Function) => filterOption(inputValue, doneFn, 'result'
<template v-slot:body="props"> )"
<q-tr :props="props" class="cursor-pointer"> ><template v-slot:no-option>
<q-td <q-item>
v-for="col in props.cols" <q-item-section class="text-grey">
:key="col.id" ไมอม
@click="redirectViewDetail(props.row.id)" </q-item-section>
> </q-item>
<div> </template>
{{ col.value ? col.value : "-" }} </q-select>
</div> </div>
</q-td>
</q-tr>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list @click="redirectViewDetail(props.row.id)">
<q-item v-for="col in props.cols" :key="col.name">
<q-item-section>
<q-item-label caption>{{ col.label }}</q-item-label>
<q-item-label>
{{ col.value ? col.value : "-" }}</q-item-label
>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div> </div>
</template> </q-card>
<template v-slot:pagination="scope"> </div>
งหมด {{ total }} รายการ
<q-pagination <div class="col-12">
v-model="formQuery.page" <d-table
active-color="primary" ref="table"
color="dark" :columns="columns"
:max="Number(totalList)" :rows="rows"
size="sm" :filter="filterKeyword"
boundary-links row-key="id"
direction-links flat
:max-pages="5" bordered
@update:model-value="fetchList" :paging="true"
></q-pagination> dense
</template> :rows-per-page-options="[10, 25, 50, 100]"
</d-table> :visible-columns="visibleColumns"
v-model:pagination="pagination"
@update:pagination="updatePagination"
>
<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.id"
@click="redirectViewDetail(props.row.id)"
>
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list @click="redirectViewDetail(props.row.id)">
<q-item v-for="col in props.cols" :key="col.name">
<q-item-section>
<q-item-label caption>{{ col.label }}</q-item-label>
<q-item-label>
{{ col.value ? col.value : "-" }}</q-item-label
>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="formQuery.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchList"
></q-pagination>
</template>
</d-table>
</div>
</div> </div>
</q-card> </q-card>
</div> </div>

View file

@ -114,3 +114,20 @@ input.input-alert
overflow: visible overflow: visible
white-space: normal white-space: normal
transition: width 2s transition: width 2s
.select_ellipsis3 .q-field__native > span
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
width: auto
max-width: 60ch
.select_ellipsis2 .q-field__native > span
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
width: auto
max-width: 30ch
.filter-card
background-color: #f1f1f1b0