KPI => ประกาศผล, report

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-15 17:05:33 +07:00
parent 4419b41a39
commit 823fe93528
8 changed files with 372 additions and 147 deletions

View file

@ -8,8 +8,16 @@ import config from "@/app.config";
* importType
*/
import type { QTableProps } from "quasar";
import type { ResResults } from "@/modules/14_KPI/interface/response/Main";
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import type {
ResRound,
ResDevelopment,
} from "@/modules/14_KPI/interface/response/index";
/**
* importComponents
*/
import DialogIndividual from "@/modules/14_KPI/components/results/dialogIndividual.vue";
/**
* importStore
@ -21,26 +29,25 @@ import { useKpiDataStore } from "@/modules/14_KPI/store";
* use
*/
const $q = useQuasar();
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
date2Thai,
} = useCounterMixin();
const { showLoader, messageError, hideLoader } = useCounterMixin();
const store = useKpiDataStore();
/**
* props
*/
const tab = defineModel<string>("tab", { required: true });
const rows = ref<[]>([]); //
/**
* วแปร
*/
const rows = ref<ResDevelopment[]>([]); //
const page = ref<number>(1);
const pageSize = ref<number>(10);
const maxPage = ref<number>(1);
const total = ref<number>(1);
const keyword = ref<string>("");
const modalDetail = ref<boolean>(false);
const devId = ref<string>("");
/**
* Table
@ -62,17 +69,17 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "fullName",
format: (val, row) => {
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
return `${row.prefix ?? ""}${row.firstname ?? ""} ${row.lastname ?? ""}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
name: "developmentName",
align: "left",
label: "ความรู้/ทักษะ/สมรรถนะ ที่ต้องได้รับการพัฒนา",
sortable: true,
field: "name",
field: "developmentName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -99,7 +106,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ตำแหน่งประเภท",
sortable: true,
field: "position",
field: "posTypeName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -132,7 +139,6 @@ const visibleColumns = ref<string[]>([
"posLevelName",
"root",
]);
const pagination = ref({
page: page.value,
rowsPerPage: pageSize.value,
@ -142,53 +148,35 @@ const pagination = ref({
* function fetch รายการแผนพฒนาการปฏราชการรายบคคลยอนหล
*/
function fetcDataList() {
rows.value = [
{
id: "08dca241-ddfa-4678-89f4-62ad60c41aa8",
prefix: "นาย",
firstName: "ชัยชนะ",
lastName: "เรืองโรจน์",
root: "สำนักงานเขตพระนคร",
rootId: "e8493cd1-d371-402e-add6-566e68d5d1b3",
rootShortName: "ขพน.",
position: "นักวิเคราะห์นโยบายและแผน",
posTypeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe08071",
posTypeName: "วิชาการ",
posLevelId: "1526d9d3-d8b1-43ab-81b5-a84dfbe08562",
posLevelName: "ปฏิบัติการ",
createdAt: "2024-07-12T14:11:35.885071",
name: "พัฒนาการสื่อสาร",
organization: "ฝ่ายทะเบียน สำนักงานเขตพระนคร",
},
];
total.value = 1;
maxPage.value = Math.ceil(total.value / pageSize.value);
showLoader();
http
.post(config.API.achievementDev, {
page: page.value,
pageSize: pageSize.value,
keyword: keyword.value,
kpiPeriodId: store.formQuery.round ? store.formQuery.round : "",
})
.then((res) => {
const data = res.data.result;
console.log(data);
// showLoader();
// http
// .post(config.API.evaluationUser, {
// status: tab.value,
// page: page.value,
// pageSize: pageSize.value,
// keyword: keyword.value,
// kpiPeriodId: store.formQuery.round ? store.formQuery.round : "",
// })
// .then((res) => {
// const data = res.data.result;
// rows.value = data.data;
// total.value = data.total;
// maxPage.value = Math.ceil(total.value / pageSize.value);
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
rows.value = data.data;
total.value = data.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const year = ref<number | null>(new Date().getFullYear());
const roundOp = ref<DataOption[]>([]);
/**
* function fetch รอบการประเม
*/
function fetchRoundOption() {
showLoader();
http
@ -198,8 +186,10 @@ function fetchRoundOption() {
)
.then(async (res) => {
const data = await res.data.result.data;
console.log(res.data.result.data);
if (res.data.result.data.length > 0) {
const list = await data.map((e: any) => ({
const list = await data.map((e: ResRound) => ({
id: e.id,
name:
e.durationKPI === "OCT"
@ -252,7 +242,17 @@ watch(pagination, () => {
pageSize.value = pagination.value.rowsPerPage;
});
/**
* function รายละเอยดแผนพฒนาการปฏราชการรายบคคล
* @param id แผนพฒนาการปฏราชการรายบคคล
*/
function onClickView(id: string) {
modalDetail.value = true;
devId.value = id;
}
onMounted(() => {
store.formQuery.round = "";
fetchRoundOption();
});
</script>
@ -282,8 +282,6 @@ onMounted(() => {
hide-bottom-space
:model-value="!!year ? year + 543 : null"
:label="`${'ปีงบประมาณ'}`"
clearable
@clear="clearYear"
>
<template v-slot:prepend>
<q-icon
@ -310,20 +308,6 @@ onMounted(() => {
map-options
@update:model-value="changRound"
/>
<!-- <q-select
v-model="status"
outlined
label="สถานะการประเมิน"
dense
option-label="name"
option-value="id"
:options="store.statusOptions"
style="min-width: 180px"
emit-value
map-options
@update:model-value="changRound"
/> -->
</div>
<q-space />
@ -365,13 +349,17 @@ onMounted(() => {
:rows="rows"
row-key="id"
:selection="tab === 'COMPLETE' ? 'multiple' : null"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
:paging="true"
>
<template v-slot:header-selection="scope" v-if="tab === 'COMPLETE'">
<q-checkbox keep-color color="primary" dense v-model="scope.selected" />
<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-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
@ -387,10 +375,22 @@ onMounted(() => {
<div v-if="col.name == 'no'">
{{ (page - 1) * pageSize + props.rowIndex + 1 }}
</div>
<div v-else>
<div v-else class="table_ellipsis2">
{{ col.value ?? "-" }}
</div>
</q-td>
<q-td
><q-btn
flat
dense
round
color="info"
icon="mdi-eye-outline"
@click="onClickView(props.row.id)"
>
<q-tooltip>รายละเอยดแผนพฒนาการปฏราชการรายบคคล</q-tooltip>
</q-btn></q-td
>
</q-tr>
</template>
<template v-slot:pagination="scope">
@ -409,20 +409,8 @@ onMounted(() => {
</template>
</d-table>
</q-card-section>
<q-separator v-if="tab === 'COMPLETE'" />
<q-card-actions
align="right"
class="bg-white text-teal"
v-if="tab === 'COMPLETE'"
>
<q-btn
label="ประกาศผล"
color="public"
@click="onAnnounce"
:disable="selected.length === 0"
/>
</q-card-actions>
<DialogIndividual v-model:devId="devId" v-model:modal="modalDetail" />
</template>
<style scoped></style>