Merge branch 'develop' into devTee
# Conflicts: # src/modules/08_KPI/views/form.vue
This commit is contained in:
commit
06d2b19b99
7 changed files with 222 additions and 21 deletions
|
|
@ -35,6 +35,4 @@ export default {
|
||||||
kpiEvaluationCheck: `${kpiEvaluation}/check`,
|
kpiEvaluationCheck: `${kpiEvaluation}/check`,
|
||||||
|
|
||||||
/**ประเมิน*/
|
/**ประเมิน*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,25 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
import type { FormComment } from "@/modules/08_KPI/interface/request/index";
|
||||||
|
import type { ResEvaluator } from "@/modules/08_KPI/interface/response/index";
|
||||||
|
|
||||||
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
const $q = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
|
const { showLoader, hideLoader, messageError, dialogConfirm, success } =
|
||||||
|
useCounterMixin();
|
||||||
|
|
||||||
|
const evaluatorId = ref<string>(route.params.id.toString());
|
||||||
|
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
|
|
@ -20,9 +38,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "topic",
|
field: "topic",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px;",
|
||||||
sort: (a: string, b: string) =>
|
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "reason",
|
name: "reason",
|
||||||
|
|
@ -31,22 +47,114 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "reason",
|
field: "reason",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px;",
|
||||||
sort: (a: string, b: string) =>
|
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const rows = ref<any[]>([]);
|
const rows = ref<ResEvaluator[]>([]);
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
|
|
||||||
|
const modal = ref<boolean>(false);
|
||||||
|
const formComment = reactive<FormComment>({
|
||||||
|
topic: "",
|
||||||
|
reason: "",
|
||||||
|
});
|
||||||
|
const optionTopicMain = ref<string[]>([
|
||||||
|
"เห็นชอบตัวชี้วัดผลสัมฤทธิ์ของงาน รายการสมรรถนะ และน้ำหนักคะแนนของผู้ใต้บังคับบัญชา",
|
||||||
|
"ส่งกลับให้แก้ไข",
|
||||||
|
"บันทึกคำปรึกษาแนะนำ",
|
||||||
|
"บันทึกความเห็น",
|
||||||
|
"เห็นด้วยกับผลการประเมิน",
|
||||||
|
"บันทึกข้อเสนอแนะการพัฒนา",
|
||||||
|
]);
|
||||||
|
const optionTopic = ref<string[]>(optionTopicMain.value);
|
||||||
|
|
||||||
|
function fetchList() {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.get(config.API.kpiEvaluation + `/${props.type}/${evaluatorId.value}`)
|
||||||
|
.then((res) => {
|
||||||
|
rows.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDialog() {
|
||||||
|
modal.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
modal.value = false;
|
||||||
|
formComment.topic = "";
|
||||||
|
formComment.reason = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function createValue(val: string, done: Function) {
|
||||||
|
if (val.length > 0) {
|
||||||
|
if (!optionTopic.value.includes(val)) {
|
||||||
|
optionTopic.value.push(val);
|
||||||
|
}
|
||||||
|
done(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterFn(val: string, update: Function) {
|
||||||
|
update(() => {
|
||||||
|
optionTopic.value = optionTopicMain.value.filter(
|
||||||
|
(v: string) => v.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubmit() {
|
||||||
|
dialogConfirm($q, () => {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.put(
|
||||||
|
config.API.kpiEvaluation + `/${props.type}/${evaluatorId.value}`,
|
||||||
|
formComment
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
fetchList();
|
||||||
|
closeDialog();
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const pagination = ref({
|
||||||
|
sortBy: "desc",
|
||||||
|
descending: false,
|
||||||
|
page: 1,
|
||||||
|
rowsPerPage: 10,
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(props.type);
|
fetchList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="q-pa-md">
|
<div class="q-pa-md">
|
||||||
<q-toolbar style="padding: 0px">
|
<q-toolbar style="padding: 0px">
|
||||||
<q-btn flat round dense icon="add" color="blue-4">
|
<q-btn
|
||||||
|
v-if="isReadonly"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
icon="add"
|
||||||
|
color="blue-4"
|
||||||
|
@click="openDialog"
|
||||||
|
>
|
||||||
<q-tooltip>เสนอความคิดเห็น</q-tooltip>
|
<q-tooltip>เสนอความคิดเห็น</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
@ -88,11 +196,11 @@ onMounted(() => {
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
dense
|
dense
|
||||||
hide-pagination
|
|
||||||
class="custom-table"
|
class="custom-table"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
:rows-per-page-options="[20]"
|
:rows-per-page-options="[10, 20, 50, 100]"
|
||||||
no-data-label="ไม่มีข้อมูล"
|
no-data-label="ไม่มีข้อมูล"
|
||||||
|
v-model:pagination="pagination"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
@ -103,16 +211,82 @@ onMounted(() => {
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id" style="width: 50%">
|
||||||
<div>
|
{{ col.value ? col.value : "-" }}
|
||||||
{{ col.value ? col.value : "-" }}
|
|
||||||
</div>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:pagination="scope">
|
||||||
|
ทั้งหมด {{ rows.length }} รายการ
|
||||||
|
<q-pagination
|
||||||
|
v-model="pagination.page"
|
||||||
|
active-color="primary"
|
||||||
|
color="dark"
|
||||||
|
:max="scope.pagesNumber"
|
||||||
|
:max-pages="5"
|
||||||
|
size="sm"
|
||||||
|
boundary-links
|
||||||
|
direction-links
|
||||||
|
></q-pagination>
|
||||||
|
</template>
|
||||||
</q-table>
|
</q-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<q-dialog v-model="modal" persistent>
|
||||||
|
<q-card style="width: 700px; max-width: 80vw">
|
||||||
|
<DialogHeader :tittle="'เสนอความคิดเห็น'" :close="closeDialog" />
|
||||||
|
<q-separator />
|
||||||
|
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||||
|
<q-card-section>
|
||||||
|
<div class="row q-col-gutter-md">
|
||||||
|
<div class="col-12">
|
||||||
|
<q-select
|
||||||
|
class="inputgreen"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
v-model="formComment.topic"
|
||||||
|
use-input
|
||||||
|
input-debounce="0"
|
||||||
|
@new-value="createValue"
|
||||||
|
:options="optionTopic"
|
||||||
|
@filter="filterFn"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
label="หัวข้อ"
|
||||||
|
:rules="[
|
||||||
|
(val:string) =>
|
||||||
|
!!val || `${'กรุณาเลือกหัวข้อ'}`,
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<q-input
|
||||||
|
v-model="formComment.reason"
|
||||||
|
class="inputgreen"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
type="textarea"
|
||||||
|
label="ควาดคิดเห็น"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
:rules="[
|
||||||
|
(val:string) =>
|
||||||
|
!!val || `${'กรุณากรอกความคิดเห็น'}`,
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-actions align="right">
|
||||||
|
<q-btn label="บันทึก" color="secondary" type="submit"
|
||||||
|
><q-tooltip>บันทึกข้อมูล</q-tooltip></q-btn
|
||||||
|
>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,7 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
|
v-if="!isReadonly"
|
||||||
size="12px"
|
size="12px"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,19 @@ interface ListCapacity {
|
||||||
id: string;
|
id: string;
|
||||||
level: number;
|
level: number;
|
||||||
description: string;
|
description: string;
|
||||||
capacityId:string
|
capacityId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { FormProfile, FormDataAssigned, FormCapacityList,ListCriteria,ListCapacity };
|
interface FormComment {
|
||||||
|
topic: string;
|
||||||
|
reason: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type {
|
||||||
|
FormProfile,
|
||||||
|
FormDataAssigned,
|
||||||
|
FormCapacityList,
|
||||||
|
ListCriteria,
|
||||||
|
ListCapacity,
|
||||||
|
FormComment,
|
||||||
|
};
|
||||||
|
|
|
||||||
15
src/modules/08_KPI/interface/response/index.ts
Normal file
15
src/modules/08_KPI/interface/response/index.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
interface ResEvaluator {
|
||||||
|
createdAt: string;
|
||||||
|
createdFullName: string;
|
||||||
|
createdUserId: string;
|
||||||
|
id: string;
|
||||||
|
kpiUserEvaluationId: string;
|
||||||
|
lastUpdateFullName: string;
|
||||||
|
lastUpdateUserId: string;
|
||||||
|
lastUpdatedAt: string;
|
||||||
|
reason: string;
|
||||||
|
topic: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ResEvaluator };
|
||||||
|
|
@ -73,7 +73,6 @@ function fetchEvaluation() {
|
||||||
formProfile.status = store.convertStatus(data.evaluationStatus);
|
formProfile.status = store.convertStatus(data.evaluationStatus);
|
||||||
formProfile.result = store.convertResults(data.evaluationResults);
|
formProfile.result = store.convertResults(data.evaluationResults);
|
||||||
fetchProfile(data.profileId);
|
fetchProfile(data.profileId);
|
||||||
console.log(store.dataEvaluation);
|
|
||||||
|
|
||||||
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
|
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
|
||||||
rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
|
rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,8 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageError = (q: any, e: any = "", text: string = "") => {
|
const messageError = (q: any, e: any = "", text: string = "") => {
|
||||||
|
console.log(e);
|
||||||
|
|
||||||
if (e == "" && text != "") {
|
if (e == "" && text != "") {
|
||||||
q.dialog({
|
q.dialog({
|
||||||
component: CustomComponent,
|
component: CustomComponent,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue