Merge branch 'develop' into devTee

# Conflicts:
#	src/api/14_KPI/api.KPI.ts
This commit is contained in:
STW_TTTY\stwtt 2024-04-19 14:19:06 +07:00
commit 7f0411e710
19 changed files with 1338 additions and 1192 deletions

View file

@ -18,23 +18,23 @@ const rows = ref<any>();
const competencyTypeOp = ref<DataOption[]>([
{
id: "ID1",
id: "HEAD",
name: "สมรรถนะหลัก",
},
{
id: "ID2",
id: "GROUP",
name: "สมรรถนะประจำกลุ่มงาน",
},
{
id: "ID3",
id: "EXECUTIVE",
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
},
{
id: "ID4",
id: "DIRECTOR",
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
},
{
id: "ID5",
id: "INSPECTOR",
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
},
]);
@ -64,11 +64,11 @@ const visibleColumns = ref<string[]>(["competency"]);
async function getData() {
const data = [
{
id: "ID1",
id: "1",
competency: "รายการสมรรถะ 1",
},
{
id: "ID2",
id: "2",
competency: "รายการสมรรถะ 2",
},
];

View file

@ -3,21 +3,19 @@ import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import Header from "@/components/DialogHeader.vue";
import dialogHeader from "@/components/DialogHeader.vue";
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import type { ResponseObject } from "@/modules/14_KPI/interface/response/KpiGroup";
import http from "@/plugins/http";
import config from "@/app.config";
const modal = ref<boolean>(false);
const router = useRouter();
const rows = ref<any>();
const rows = ref<ResponseObject[]>([]);
const groupName = ref<string>("");
const editStatus = ref<boolean>(false);
const editId = ref<string>("");
const competencyTypeOp = ref<DataOption[]>([
{
id: "ID1",
@ -42,11 +40,11 @@ const competencyTypeOp = ref<DataOption[]>([
]);
const columns = ref<QTableProps["columns"]>([
{
name: "groupName",
name: "nameGroupKPI",
align: "left",
label: "รายการกลุ่มงาน",
sortable: true,
field: "groupName",
field: "nameGroupKPI",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -56,71 +54,81 @@ const columns = ref<QTableProps["columns"]>([
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
const competencyType = ref<string>("ID1");
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = mixin;
const filterKeyword = ref<string>("");
const visibleColumns = ref<string[]>(["groupName"]);
const visibleColumns = ref<string[]>(["nameGroupKPI"]);
/** ดึงข้อมูล */
async function getData() {
const data = [
{
id: "ID1",
groupName: "กลุ่มงาน 1",
},
{
id: "ID2",
groupName: "กลุ่มงาน 2",
},
];
rows.value = data;
// showLoader();
// await http
// .get(config.API.orgPrefix)
// .then(async (res) => {
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
async function fetchData() {
showLoader();
await http
.get(config.API.kpiGroup)
.then(async (res) => {
rows.value = res.data.result.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function addData() {
await http
.post(config.API.kpiGroup, {
nameGroupKPI: groupName.value,
})
.then(() => {
fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function editData(id: string) {
console.log(id);
// await http
// .put(config.API.orgPrefixId(id), {
// name: prefix.value,
// })
// .then(() => {
// getData();
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
await http
.put(config.API.kpiGroupById(id), {
nameGroupKPI: groupName.value,
})
.then(() => {
fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function deleteData(id: string) {
console.log(id);
// await http
// .delete(config.API.orgPrefixId(id))
// .then(() => {
// getData();
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();w
// });
await http
.delete(config.API.kpiGroupById(id))
.then(() => {
fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
@ -128,42 +136,38 @@ function onAdd() {
modal.value = true;
}
function close() {
function closeDialog() {
modal.value = false;
editStatus.value = false;
groupName.value = ''
groupName.value = "";
}
function onEdit(data: any) {
modal.value = true;
editStatus.value = true;
groupName.value = data.groupName
groupName.value = data.nameGroupKPI;
editId.value = data.id;
}
function onSubmit() {
console.log("save");
close()
async function onSubmit() {
dialogConfirm(
$q,
async () => {
editStatus.value ? editData(editId.value) : addData();
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
onMounted(async () => {
getData();
fetchData();
});
</script>
<template>
<q-toolbar style="padding: 0">
<!-- <q-select
v-model="competencyType"
outlined
label="ประเภทสมรรถนะ"
dense
option-label="name"
option-value="id"
:options="competencyTypeOp"
style="min-width: 200px"
emit-value
map-options
/> -->
<q-btn flat round color="primary" icon="add" @click="onAdd()">
<q-tooltip> เพมขอม </q-tooltip>
</q-btn>
@ -210,15 +214,11 @@ onMounted(async () => {
</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="onEdit(props.row)"
>
<q-td v-for="col in props.cols" :key="col.id">
{{ col.value }}
</q-td>
<q-td auto-width>
<!-- <q-btn
<q-btn
color="edit"
flat
dense
@ -227,17 +227,10 @@ onMounted(async () => {
size="12px"
icon="edit"
clickable
@click.stop="
() => {
dialogStatus = 'edit';
dialog = true;
prefix = props.row.name;
editId = props.row.id;
}
"
@click="onEdit(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn> -->
</q-btn>
<q-btn
color="red"
flat
@ -261,9 +254,9 @@ onMounted(async () => {
<q-dialog v-model="modal" persistent>
<q-card flat bordered style="min-width: 50vh">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<Header
<dialog-header
:tittle="editStatus ? 'แก้ไขกลุ่มงาน' : 'เพิ่มกลุ่มงาน'"
:close="close"
:close="closeDialog"
/>
<q-separator />
<q-card-section>

View file

@ -2,11 +2,12 @@
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";
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";
import Main from "@/modules/14_KPI/components/competency/Forms/Main.vue";
// 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";
import { useKPIDataStore } from "@/modules/14_KPI/store/KPIStore";
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
@ -29,23 +30,23 @@ const formData = reactive<FormCompetency>({
const competencyTypeOp = ref<DataOption[]>([
{
id: "ID1",
id: "HEAD",
name: "สมรรถนะหลัก",
},
{
id: "ID2",
id: "GROUP",
name: "สมรรถนะประจำกลุ่มงาน",
},
{
id: "ID3",
id: "EXECUTIVE",
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
},
{
id: "ID4",
id: "DIRECTOR",
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
},
{
id: "ID5",
id: "INSPECTOR",
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
},
]);
@ -108,134 +109,13 @@ function onSubmit() {
/>
</div>
<FormMain v-if="store.competencyType === 'ID1'" />
<Main />
<!-- <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'" />
<!-- <div class="col-12">
<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">
<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>
</div>
<div class="col-4">
<span>คำอธบายระด/พฤตกรรมทคาดหว/พฤตกรรมยอย</span>
</div>
</div>
</q-card-section>
<q-card-section>
<div
class="row q-pa-sm"
v-for="(items, index) in itemsFormCard"
key="index"
>
<div
class="col-3 text-center self-center text-body1 text-weight-medium"
>
<span>{{ index + 1 }}</span>
</div>
<div class="col-9">
<q-editor
v-model="formData.level_1[index]"
:dense="$q.screen.lt.md"
min-height="5rem"
:toolbar="[
[
'bold',
'italic',
'strike',
'underline',
'subscript',
'superscript',
],
['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',
}"
/>
</div>
</div>
</q-card-section>
</q-card>
</div> -->
<!-- <div class="col-12">
<q-input
v-model="formData.definition"
label="กำหนดเกณฑ์การประเมิน"
dense
type="textarea"
outlined
:rules="[(val:string) => !!val || `${'กรุณากรอกกำหนดเกณฑ์การประเมิน'}`,]"
hide-bottom-space
/>
</div> -->
<FormExecutiveLevel v-else-if="store.competencyType === 'ID5'" /> -->
</div>
</q-card-section>
<!-- <div class="text-right q-pa-sm">
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</div> -->
<!-- </q-form> -->
</q-card>
</template>

View file

@ -0,0 +1,240 @@
div
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useKPIDataStore } from "@/modules/14_KPI/store/KPIStore";
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, success, messageError } = mixin;
const router = useRouter();
const store = useKPIDataStore();
const formData = reactive({
competencyType: "",
competencyName: "",
definition: "",
levels: [
{
level: "1",
description: "",
},
],
});
function ocClickAdd() {
// if (formData.levels.length !== 6) {
const levelName = formData.levels.length + 1;
const data = {
level: levelName.toString(),
description: "",
};
formData.levels.push(data);
formData.levels[formData.levels.length].level = levelName.toString();
// }
}
function onSubmit() {
dialogConfirm($q, () => {
const body = {
competencyType: store.competencyType,
competencyName: formData.competencyName,
definition: formData.definition,
levels: formData.levels,
};
// showLoader()
// http
// .put(config.API.???,body)
// .then((res)=>{
// success($q,'')
// router.push(`/KPI-competency`)
// }).catch((e)=>{
// messageError($q,e)
// }).finally(()=>{
// hideLoader()
// })
console.log(body);
});
}
</script>
<template>
<q-form greedy @submit.prevent @validation-success="onSubmit" class="col-12">
<div class="row">
<div class="col-12">
<q-input
v-model="formData.competencyName"
dense
outlined
label="ชื่อสมรรถนะ"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`,]"
hide-bottom-space
/>
</div>
<q-card-section class="col-12 q-px-none">
<div>
<q-field
class="q_field_p_none"
ref="fieldRef"
v-model="formData.definition"
label-slot
borderless
:rules="[(val) => !!val || 'กรุณากรอกคำจำกัดความสมรรถนะ']"
hide-bottom-space
>
<template #control>
<q-editor
class="full-width"
v-model="formData.definition"
:dense="$q.screen.lt.md"
min-height="7rem"
placeholder="คำจำกัดความสมรรถนะ"
:toolbar="[
[
'bold',
'italic',
'strike',
'underline',
'subscript',
'superscript',
],
['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',
}"
/>
</template>
</q-field>
</div>
</q-card-section>
<div class="col-12">
<q-card flat bordered>
<q-card-section class="bg-grey-4">
<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>
</div>
<div class="col-4">
<span>พฤตกรรมทคาดหว/พฤตกรรมยอย</span>
</div>
</div>
</q-card-section>
<q-card-section>
<div
class="row q-pa-sm"
v-for="(items, index) in formData.levels"
key="index"
>
<div class="col-3 align-center q-pr-lg">
<q-input
:readonly="
store.competencyType === 'HEAD' ||
store.competencyType === 'GROUP'
"
v-model="formData.levels[index].level"
dense
outlined
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับสมรรถนะ'}`,]"
hide-bottom-space
/>
</div>
<div class="col-9">
<q-field
class="q_field_p_none"
ref="fieldRef"
v-model="formData.levels[index].description"
label-slot
borderless
:rules="[
(val) =>
!!val || 'กรุณากรอกพฤติกรรมที่คาดหวัง/พฤติกรรมย่อย',
]"
hide-bottom-space
>
<template #control>
<q-editor
class="full-width"
v-model="formData.levels[index].description"
:dense="$q.screen.lt.md"
min-height="5rem"
:toolbar="[
[
'bold',
'italic',
'strike',
'underline',
'subscript',
'superscript',
],
['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',
}"
/>
</template>
</q-field>
</div>
</div>
</q-card-section>
</q-card>
</div>
<div class="col-12 q-my-sm"><q-separator /></div>
<div class="col-12 row justify-end">
<q-btn
dense
unelevated
label="บันทึก"
color="public"
class="q-px-md"
type="submit"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</div>
</div>
</q-form>
</template>
<style scoped></style>

View file

@ -101,11 +101,15 @@ function updateSelected(data: any) {
planData.strategyChildPlannedId = data.id;
planData.strategyChildPlannedNode = data.level;
}
function updateSelectedAgency(data: any) {
planData.agencyId = data.orgTreeId;
planData.agencyLevel = data.orgLevel;
}
onMounted(() => {
onMounted(async () => {
// fetchData();
fetchTree();
fetchOrganizationActive();
await fetchTree();
await fetchOrganizationActive();
setTimeout(async () => {
store.activeId && (await fetchDataTree(store.activeId));
}, 200);
@ -116,38 +120,6 @@ onMounted(() => {
<q-form @submit.prevent greedy @validation-success="onSubmit()">
<div>
<div class="row q-col-gutter-md q-pa-md">
<div class="col-8">
<q-input
outlined
v-model="planData.tree"
label="หน่วยงาน/ส่วนราชการ"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'หน่วยงาน/ส่วนราชการ'}`]"
hide-bottom-space
/>
</div>
<div class="col-2">
<q-select
dense
outlined
v-model="planData.round"
:options="roundOp"
label="รอบการประเมิน"
hide-bottom-space
option-label="name"
option-value="id"
map-options
emit-value
lazy-rules
class="inputgreen"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกรอบการประเมิน'}`,
]"
/>
</div>
<div class="col-2">
<datepicker
menu-class-name="modalfix"
@ -179,7 +151,27 @@ onMounted(() => {
</template>
</datepicker>
</div>
<div class="col-3">
<div class="col-2">
<q-select
dense
outlined
v-model="planData.round"
:options="roundOp"
label="รอบการประเมิน"
hide-bottom-space
option-label="name"
option-value="id"
map-options
emit-value
lazy-rules
class="inputgreen"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกรอบการประเมิน'}`,
]"
/>
</div>
<div class="col-2">
<q-input
outlined
v-model="planData.Data1"
@ -257,11 +249,11 @@ onMounted(() => {
<q-input
outlined
v-model="planData.point5"
label="ระดับคะแนน"
label="กรอกผลสำเร็จของงาน"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกระดับคะแนน'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผลสำเร็จของงาน'}`]"
hide-bottom-space
/>
</div>
@ -274,11 +266,11 @@ onMounted(() => {
<q-input
outlined
v-model="planData.point4"
label="ระดับคะแนน"
label="กรอกผลสำเร็จของงาน"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกระดับคะแนน'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผลสำเร็จของงาน'}`]"
hide-bottom-space
/>
</div>
@ -291,11 +283,11 @@ onMounted(() => {
<q-input
outlined
v-model="planData.point3"
label="ระดับคะแนน"
label="กรอกผลสำเร็จของงาน"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกระดับคะแนน'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผลสำเร็จของงาน'}`]"
hide-bottom-space
/>
</div>
@ -308,11 +300,11 @@ onMounted(() => {
<q-input
outlined
v-model="planData.point2"
label="ระดับคะแนน"
label="กรอกผลสำเร็จของงาน"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกระดับคะแนน'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผลสำเร็จของงาน'}`]"
hide-bottom-space
/>
</div>
@ -325,11 +317,11 @@ onMounted(() => {
<q-input
outlined
v-model="planData.point1"
label="ระดับคะแนน"
label="กรอกผลสำเร็จของงาน"
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกระดับคะแนน'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผลสำเร็จของงาน'}`]"
hide-bottom-space
/>
</div>
@ -367,7 +359,7 @@ onMounted(() => {
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
หนวยงาน
หนวยงาน/วนราชการ
</div>
<q-separator />
@ -384,11 +376,12 @@ onMounted(() => {
</template>
</q-input>
<q-tree
style="height: 350px; overflow: scroll"
dense
:nodes="nodeAgency"
node-key="orgTreeId"
label-key="labelName"
default-expand-all
selected-color="primary"
:filter="filterAgency"
:no-results-label="notFound"
:no-nodes-label="noData"
@ -397,8 +390,8 @@ onMounted(() => {
<template v-slot:default-header="prop">
<q-item
clickable
@click.stop="updateSelectedAgency(prop.node)"
:active="nodeId == prop.node.orgTreeId"
@click.stop="updateSelected(prop.node)"
active-class="my-list-link text-primary text-weight-medium"
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
>
@ -445,6 +438,7 @@ onMounted(() => {
</template>
</q-input>
<q-tree
style="height: 350px; overflow: scroll"
dense
:nodes="nodeplan"
selected-color="primary"