hrms-mgt/src/modules/14_KPI/components/competency/AddPage.vue

242 lines
7.9 KiB
Vue
Raw Normal View History

2024-04-05 14:08:20 +07:00
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";
2024-04-10 13:34:04 +07:00
import FormMain from "@/modules/14_KPI/components/competency/Forms/01_FormMain.vue";
import FormGroup from "@/modules/14_KPI/components/competency/Forms/02_FormGroup.vue";
import FormExecutive from "@/modules/14_KPI/components/competency/Forms/03_FormExecutive.vue";
import FormExecutivePosition from "@/modules/14_KPI/components/competency/Forms/04_FormExecutivePosition.vue";
import FormExecutiveLevel from "@/modules/14_KPI/components/competency/Forms/05_FormExecutiveLevel.vue";
2024-04-11 17:51:03 +07:00
import { useKPIDataStore } from "@/modules/14_KPI/store/KPIStore";
2024-04-10 13:34:04 +07:00
2024-04-05 14:08:20 +07:00
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import type { FormCompetency } from "@/modules/14_KPI/interface/request/Main";
const router = useRouter();
2024-04-11 17:51:03 +07:00
const store = useKPIDataStore();
2024-04-05 14:08:20 +07:00
const formData = reactive<FormCompetency>({
competencyType: "",
competencyName: "",
definition: "",
level_1: ["", "", "", "", "", ""],
2024-04-05 14:08:20 +07:00
level_2: "",
level_3: "",
level_4: "",
level_5: "",
evaluation: "",
});
const competencyTypeOp = ref<DataOption[]>([
{
id: "ID1",
name: "สมรรถนะหลัก",
},
{
id: "ID2",
name: "สมรรถนะประจำกลุ่มงาน",
},
{
id: "ID3",
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
},
{
id: "ID4",
2024-04-05 14:08:20 +07:00
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
},
{
id: "ID5",
2024-04-05 14:08:20 +07:00
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
},
]);
const itemsFormCard = ref<any>([
{
id: "",
name: "",
},
]);
function ocClickAdd() {
if (itemsFormCard.value.length !== 6) {
const data = {
id: "",
name: "",
};
itemsFormCard.value.push(data);
}
}
2024-04-05 14:08:20 +07:00
/** บันทึก */
function onSubmit() {
console.log(formData);
}
2024-04-05 14:08:20 +07:00
</script>
<template>
<div>
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
<span class="toptitle text-dark">เพมสมรรถนะ</span>
</div>
<q-card flat bordered>
2024-04-10 16:04:17 +07:00
<!-- @submit.prevent @validation-success="onSubmit" -->
<!-- <q-form greedy> -->
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-select
2024-04-11 17:51:03 +07:00
v-model="store.competencyType"
2024-04-10 16:04:17 +07:00
outlined
label="เลือกประเภทสมรรถนะ"
dense
option-label="name"
option-value="id"
:options="competencyTypeOp"
emit-value
map-options
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทสมรรถนะ'}`,]"
hide-bottom-space
2024-04-10 13:34:04 +07:00
/>
2024-04-10 16:04:17 +07:00
</div>
2024-04-10 13:34:04 +07:00
2024-04-11 17:51:03 +07:00
<FormMain v-if="store.competencyType === 'ID1'" />
<FormGroup v-else-if="store.competencyType === 'ID2'" />
<FormExecutive v-else-if="store.competencyType === 'ID3'" />
<FormExecutivePosition v-else-if="store.competencyType === 'ID4'" />
<FormExecutiveLevel v-else-if="store.competencyType === 'ID5'" />
2024-04-10 16:04:17 +07:00
<!-- <div class="col-12">
2024-04-05 14:08:20 +07:00
<q-input
v-model="formData.competencyName"
dense
outlined
label="ชื่อสมรรถนะ"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`,]"
hide-bottom-space
/>
</div>
<div class="col-12">
<q-input
v-model="formData.definition"
label="คำจำกัดความ"
dense
type="textarea"
outlined
:rules="[(val:string) => !!val || `${'กรุณากรอกคำจำกัดความ'}`,]"
hide-bottom-space
/>
</div>
<div class="col-12">
<q-card flat bordered>
<q-card-section class="bg-grey-4">
2024-04-05 14:08:20 +07:00
<div
class="row items-center text-dark text-body2 text-weight-medium"
>
<div class="col-3">
<div class="row items-center">
<div class="col-1">
<q-btn
dense
flat
round
color="primary"
icon="add"
@click="ocClickAdd"
>
<q-tooltip>เพ</q-tooltip></q-btn
>
</div>
<div class="col-11 text-center">
<span>ระดบสมรรถนะ</span>
</div>
</div>
2024-04-05 14:08:20 +07:00
</div>
<div class="col-4">
2024-04-05 14:08:20 +07:00
<span>คำอธบายระด/พฤตกรรมทคาดหว/พฤตกรรมยอย</span>
</div>
</div>
</q-card-section>
<q-card-section>
<div
class="row q-pa-sm"
v-for="(items, index) in itemsFormCard"
key="index"
>
2024-04-05 14:08:20 +07:00
<div
class="col-3 text-center self-center text-body1 text-weight-medium"
>
<span>{{ index + 1 }}</span>
2024-04-05 14:08:20 +07:00
</div>
<div class="col-9">
<q-editor
v-model="formData.level_1[index]"
:dense="$q.screen.lt.md"
2024-04-10 13:34:04 +07:00
min-height="5rem"
:toolbar="[
[
'bold',
'italic',
'strike',
'underline',
'subscript',
'superscript',
],
2024-04-10 13:34:04 +07:00
['unordered', 'ordered'],
]"
:fonts="{
arial: 'Arial',
arial_black: 'Arial Black',
comic_sans: 'Comic Sans MS',
courier_new: 'Courier New',
impact: 'Impact',
lucida_grande: 'Lucida Grande',
times_new_roman: 'Times New Roman',
verdana: 'Verdana',
}"
2024-04-05 14:08:20 +07:00
/>
</div>
</div>
</q-card-section>
2024-04-05 14:08:20 +07:00
</q-card>
2024-04-10 13:34:04 +07:00
</div> -->
2024-04-05 14:08:20 +07:00
2024-04-10 16:04:17 +07:00
<!-- <div class="col-12">
2024-04-05 14:08:20 +07:00
<q-input
v-model="formData.definition"
label="กำหนดเกณฑ์การประเมิน"
dense
type="textarea"
outlined
:rules="[(val:string) => !!val || `${'กรุณากรอกกำหนดเกณฑ์การประเมิน'}`,]"
hide-bottom-space
/>
2024-04-10 13:34:04 +07:00
</div> -->
2024-04-10 16:04:17 +07:00
</div>
</q-card-section>
<!-- <div class="text-right q-pa-sm">
2024-04-05 14:08:20 +07:00
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
2024-04-10 13:34:04 +07:00
</div> -->
2024-04-10 16:04:17 +07:00
<!-- </q-form> -->
2024-04-05 14:08:20 +07:00
</q-card>
</template>