fixing
This commit is contained in:
parent
73d45a3d24
commit
0e87c63641
123 changed files with 310 additions and 10280 deletions
|
|
@ -0,0 +1,282 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type {
|
||||
DataOption,
|
||||
NewPagination,
|
||||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
import type { FormQueryCapacity } from "@/modules/01_masterdata/interface/request/Main";
|
||||
import type { ResDataCapacity } from "@/modules/01_masterdata/interface/response/Main";
|
||||
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
const total = ref<number>();
|
||||
const store = useKPIDataStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
|
||||
|
||||
const competencyTypeOp = ref<DataOption[]>([
|
||||
{
|
||||
id: "HEAD",
|
||||
name: "สมรรถนะหลัก",
|
||||
},
|
||||
{
|
||||
id: "GROUP",
|
||||
name: "สมรรถนะประจำกลุ่มงาน",
|
||||
},
|
||||
{
|
||||
id: "EXECUTIVE",
|
||||
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
|
||||
},
|
||||
{
|
||||
id: "DIRECTOR",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
|
||||
},
|
||||
{
|
||||
id: "INSPECTOR",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
|
||||
},
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อสมรรถนะ",
|
||||
sortable: true,
|
||||
field: "name",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<string[]>(["name"]);
|
||||
|
||||
const rows = ref<ResDataCapacity[]>([]);
|
||||
const formQuery = reactive<FormQueryCapacity>({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
});
|
||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function fetchList() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.kpiCapacity +
|
||||
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&type=${store.competencyTypeVal}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
total.value = res.data.result.total;
|
||||
const data: ResDataCapacity[] = res.data.result.data;
|
||||
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||
rows.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function onViewDetail(id: string) {
|
||||
router.push(`/masterdata/competency/${id}`);
|
||||
}
|
||||
|
||||
function deleteData(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
http
|
||||
.delete(config.API.kpiCapacity + `/${id}`)
|
||||
.then(() => {
|
||||
fetchList();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
|
||||
function onAdd() {
|
||||
router.push(`/masterdata/competency/add`);
|
||||
}
|
||||
|
||||
function fetchNewList() {
|
||||
formQuery.page = 1;
|
||||
fetchList();
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchNewList();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fetchList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-toolbar style="padding: 0">
|
||||
<q-select
|
||||
v-model="store.competencyTypeVal"
|
||||
outlined
|
||||
label="ประเภทสมรรถนะ"
|
||||
dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="competencyTypeOp"
|
||||
style="min-width: 200px"
|
||||
emit-value
|
||||
map-options
|
||||
@update:model-value="fetchNewList"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsCreate"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
icon="add"
|
||||
@click="onAdd()"
|
||||
>
|
||||
<q-tooltip> เพิ่มข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="row q-gutter-sm">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="formQuery.keyword"
|
||||
label="ค้นหา"
|
||||
@keyup.enter="fetchNewList()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="formQuery.keyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="formQuery.keyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="(formQuery.keyword = ''), fetchNewList()"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
<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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
/>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<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 auto-width>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsUpdate"
|
||||
color="edit"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="edit"
|
||||
clickable
|
||||
@click.stop="onViewDetail(props.row.id)"
|
||||
v-close-popup
|
||||
>
|
||||
<q-tooltip>แก้ไข</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="checkPermission($route)?.attrIsDelete"
|
||||
color="red"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="mdi-delete"
|
||||
clickable
|
||||
@click.stop="deleteData(props.row.id)"
|
||||
v-close-popup
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.id">
|
||||
{{ col.value }}
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</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>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,353 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import dialogHeader from "@/components/DialogHeader.vue";
|
||||
import type {
|
||||
DataOption,
|
||||
NewPagination,
|
||||
} from "@/modules/14_KPI/interface/index/Main";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const total = ref<number>();
|
||||
const modal = ref<boolean>(false);
|
||||
const rows = ref<any[]>([]);
|
||||
const groupName = ref<string>("");
|
||||
|
||||
const editStatus = ref<boolean>(false);
|
||||
const editId = ref<string>("");
|
||||
const competencyTypeOp = ref<DataOption[]>([
|
||||
{
|
||||
id: "ID1",
|
||||
name: "สมรรถนะหลัก",
|
||||
},
|
||||
{
|
||||
id: "ID2",
|
||||
name: "สมรรถนะประจำกลุ่มงาน",
|
||||
},
|
||||
{
|
||||
id: "ID3",
|
||||
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
|
||||
},
|
||||
{
|
||||
id: "ID4",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
|
||||
},
|
||||
{
|
||||
id: "ID5",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
|
||||
},
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "nameGroupKPI",
|
||||
align: "left",
|
||||
label: "รายการกลุ่มงาน",
|
||||
sortable: true,
|
||||
field: "nameGroupKPI",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogRemove,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
} = mixin;
|
||||
|
||||
const visibleColumns = ref<string[]>(["nameGroupKPI"]);
|
||||
|
||||
const formQuery = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
});
|
||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function fetchData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.kpiGroup +
|
||||
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
total.value = res.data.result.total;
|
||||
const data = res.data.result;
|
||||
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||
rows.value = data.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) {
|
||||
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) {
|
||||
await http
|
||||
.delete(config.API.kpiGroupById(id))
|
||||
.then(() => {
|
||||
fetchData();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
|
||||
function onAdd() {
|
||||
modal.value = true;
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
editStatus.value = false;
|
||||
groupName.value = "";
|
||||
}
|
||||
|
||||
function onEdit(data: any) {
|
||||
modal.value = true;
|
||||
editStatus.value = true;
|
||||
groupName.value = data.nameGroupKPI;
|
||||
editId.value = data.id;
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
editStatus.value ? editData(editId.value) : addData();
|
||||
closeDialog();
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
function fetchNewList() {
|
||||
formQuery.page = 1;
|
||||
fetchData();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchNewList();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
fetchData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-toolbar style="padding: 0">
|
||||
<q-btn flat round color="primary" icon="add" @click="onAdd()">
|
||||
<q-tooltip> เพิ่มข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="row q-gutter-sm">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="formQuery.keyword"
|
||||
label="ค้นหา"
|
||||
@keyup.enter="fetchNewList()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="formQuery.keyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="formQuery.keyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="(formQuery.keyword = ''), fetchNewList()"
|
||||
/> </template
|
||||
></q-input>
|
||||
<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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
/>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<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 auto-width>
|
||||
<q-btn
|
||||
color="edit"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
class="q-mr-xs"
|
||||
size="12px"
|
||||
icon="edit"
|
||||
clickable
|
||||
@click="onEdit(props.row)"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
color="red"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="mdi-delete"
|
||||
clickable
|
||||
@click.stop="
|
||||
dialogRemove($q, async () => await deleteData(props.row.id))
|
||||
"
|
||||
v-close-popup
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.id">
|
||||
{{ col.value }}
|
||||
</q-td>
|
||||
|
||||
</q-tr>
|
||||
</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="fetchData"
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card flat bordered style="min-width: 50vh">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<dialog-header
|
||||
:tittle="editStatus ? 'แก้ไขกลุ่มงาน' : 'เพิ่มกลุ่มงาน'"
|
||||
:close="closeDialog"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<q-input
|
||||
label="กลุ่มงาน"
|
||||
v-model="groupName"
|
||||
outlined
|
||||
dense
|
||||
class="inputgreen"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกกลุ่มงาน'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
type="submit"
|
||||
for="#submitForm"
|
||||
class="q-px-md items-center"
|
||||
color="public"
|
||||
label="บันทึก"
|
||||
/>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,586 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, watch } 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 type {
|
||||
DataOption,
|
||||
NewPagination,
|
||||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const total = ref<number>();
|
||||
const id = ref<string>("");
|
||||
const modal = ref<boolean>(false);
|
||||
const rows = ref<any[]>([]);
|
||||
const editStatus = ref<boolean>(false);
|
||||
const groupName = ref<any>();
|
||||
const position = ref<any>();
|
||||
const competency = ref<any>();
|
||||
|
||||
const groupNameOp = ref<DataOption[]>([]);
|
||||
const groupNameOpMain = ref<DataOption[]>([]);
|
||||
const positionOp = ref<DataOption[]>([]);
|
||||
const positionMainOp = ref<DataOption[]>([]);
|
||||
const competencyOp = ref<DataOption[]>([]);
|
||||
const competencyOpMain = ref<DataOption[]>([]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "groupName",
|
||||
align: "left",
|
||||
label: "กลุ่มงาน",
|
||||
sortable: true,
|
||||
field: "groupName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "positions",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "positions",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "capacitys",
|
||||
align: "left",
|
||||
label: "สมรรถนะประจำกลุ่มงาน",
|
||||
sortable: true,
|
||||
field: "capacitys",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogRemove,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
success,
|
||||
dialogConfirm,
|
||||
} = mixin;
|
||||
|
||||
const competencyType = ref<string>("ID1");
|
||||
const filterKeyword = ref<string>("");
|
||||
|
||||
const visibleColumns = ref<string[]>(["groupName", "positions", "capacitys"]);
|
||||
|
||||
const formQuery = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
});
|
||||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(
|
||||
config.API.kpiLink +
|
||||
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
|
||||
)
|
||||
.then((res) => {
|
||||
total.value = res.data.result.total;
|
||||
const data = res.data.result;
|
||||
totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||
rows.value = data.data;
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteData(id: string) {
|
||||
await http
|
||||
.delete(config.API.kpiLink + `/${id}`)
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
close();
|
||||
getData();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getListGroup() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.kpiGroup + `?pageSize=50`)
|
||||
.then(async (res) => {
|
||||
const dataOp = res.data.result.data;
|
||||
const uniqueNames = new Set();
|
||||
const filteredData = dataOp
|
||||
.filter((item: any) => {
|
||||
if (!uniqueNames.has(item.id)) {
|
||||
uniqueNames.add(item.nameGroupKPI);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: item.nameGroupKPI,
|
||||
}));
|
||||
|
||||
groupNameOpMain.value = filteredData;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getCompetency() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.kpiCapacity + `?type=GROUP&pageSize=50`)
|
||||
.then(async (res) => {
|
||||
const dataOp = res.data.result.data;
|
||||
const uniqueNames = new Set();
|
||||
const filteredData = dataOp
|
||||
.filter((item: any) => {
|
||||
if (!uniqueNames.has(item.id)) {
|
||||
uniqueNames.add(item.name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
}));
|
||||
|
||||
competencyOpMain.value = filteredData;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
|
||||
function onAdd() {
|
||||
getOptions();
|
||||
getListGroup();
|
||||
getCompetency();
|
||||
modal.value = true;
|
||||
}
|
||||
|
||||
async function onEdit(data: any) {
|
||||
id.value = data;
|
||||
await getOptions();
|
||||
await getListGroup();
|
||||
await getCompetency();
|
||||
await getDataEdit(id.value);
|
||||
modal.value = true;
|
||||
editStatus.value = true;
|
||||
}
|
||||
|
||||
function getDataEdit(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiLink + `/${id}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
groupName.value = {
|
||||
id: data.groupId,
|
||||
name: data.groupName,
|
||||
};
|
||||
position.value = data.positions.map((i: any) => i.name);
|
||||
competency.value = data.capacitys.map((i: any) => ({
|
||||
id: i.id,
|
||||
name: i.name,
|
||||
}));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
const url = editStatus.value
|
||||
? config.API.kpiLink + `/${id.value}`
|
||||
: config.API.kpiLink;
|
||||
const body = {
|
||||
kpiGroupId: groupName.value.id,
|
||||
positions: position.value,
|
||||
kpiCapacityIds: competency.value.map((i: any) => i.id),
|
||||
};
|
||||
dialogConfirm($q, () => {
|
||||
http[editStatus.value ? "put" : "post"](url, body)
|
||||
.then(() => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
close();
|
||||
getData();
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
modal.value = false;
|
||||
editStatus.value = false;
|
||||
groupName.value = "";
|
||||
position.value = null;
|
||||
competency.value = null;
|
||||
}
|
||||
|
||||
function getOptions() {
|
||||
http.get(config.API.orgSalaryPosition).then((res) => {
|
||||
const dataOp = res.data.result;
|
||||
const uniqueNames = new Set();
|
||||
const filteredData = dataOp
|
||||
.filter((item: any) => {
|
||||
if (!uniqueNames.has(item.positionName)) {
|
||||
uniqueNames.add(item.positionName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.map((item: any) => ({
|
||||
id: item.positionName,
|
||||
name: item.positionName,
|
||||
}));
|
||||
|
||||
positionMainOp.value = filteredData;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ต้นหาข้อมูลของ Option
|
||||
* @param val ค่าที่ต้องการฟิลเตอร์
|
||||
* @param update อัพเดทค่า
|
||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||
*/
|
||||
function filterOptionGroup(val: any, update: Function) {
|
||||
update(() => {
|
||||
groupNameOp.value = groupNameOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ต้นหาข้อมูลของ Option
|
||||
* @param val ค่าที่ต้องการฟิลเตอร์
|
||||
* @param update อัพเดทค่า
|
||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||
*/
|
||||
function filterOption(val: any, update: Function) {
|
||||
update(() => {
|
||||
positionOp.value = positionMainOp.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ต้นหาข้อมูลของ Option
|
||||
* @param val ค่าที่ต้องการฟิลเตอร์
|
||||
* @param update อัพเดทค่า
|
||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||
*/
|
||||
function filterOptionCompetency(val: any, update: Function) {
|
||||
update(() => {
|
||||
competencyOp.value = competencyOpMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
function fetchNewList() {
|
||||
formQuery.page = 1;
|
||||
getData();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchNewList();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-toolbar style="padding: 0">
|
||||
<q-btn flat round color="primary" icon="add" @click="onAdd()">
|
||||
<q-tooltip> เพิ่มข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="row q-gutter-sm">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="formQuery.keyword"
|
||||
label="ค้นหา"
|
||||
@keyup.enter="fetchNewList()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="formQuery.keyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="formQuery.keyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="(formQuery.keyword = ''), fetchNewList()"
|
||||
/> </template
|
||||
></q-input>
|
||||
<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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
:separator="'cell'"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<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 auto-width>
|
||||
<q-btn
|
||||
color="edit"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
class="q-mr-xs"
|
||||
size="12px"
|
||||
icon="edit"
|
||||
clickable
|
||||
@click="onEdit(props.row.id)"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
color="red"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="mdi-delete"
|
||||
clickable
|
||||
@click.stop="
|
||||
dialogRemove($q, async () => await deleteData(props.row.id))
|
||||
"
|
||||
v-close-popup
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.id" class="vertical-top">
|
||||
<div v-if="col.name == 'positions'">
|
||||
<div v-if="col.value.length !== 0">
|
||||
<div v-for="(pos, index) in col.value" :key="pos.id">
|
||||
{{ pos ? `- ${pos.name}` : "-" }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>-</div>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'capacitys'">
|
||||
<div v-if="col.value.length !== 0">
|
||||
<div v-for="competency in col.value" :key="competency.id">
|
||||
{{ competency ? `- ${competency.name}` : "-" }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>-</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</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="getData"
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card flat bordered style="min-width: 80vh">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<Header
|
||||
:tittle="
|
||||
editStatus ? 'แก้ไขกลุ่มงานและตำแหน่ง' : 'เพิ่มกลุ่มงานและตำแหน่ง'
|
||||
"
|
||||
:close="close"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
dense
|
||||
v-model="groupName"
|
||||
label="กลุ่มงาน"
|
||||
outlined
|
||||
class="inputgreen"
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="groupNameOp"
|
||||
use-input
|
||||
@filter="(inputValue:any,doneFn:Function) => filterOptionGroup(inputValue, doneFn) "
|
||||
hide-bottom-space
|
||||
lazy-rules
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกกลุ่มงาน'}`,]"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template></q-select
|
||||
>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
dense
|
||||
v-model="position"
|
||||
label="ตำแหน่ง"
|
||||
outlined
|
||||
multiple
|
||||
emit-value
|
||||
map-options
|
||||
class="inputgreen"
|
||||
option-label="name"
|
||||
option-value="name"
|
||||
:options="positionOp"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`,]"
|
||||
hide-bottom-space
|
||||
lazy-rules
|
||||
use-input
|
||||
@filter="(inputValue:any,doneFn:Function) => filterOption(inputValue, doneFn) "
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template></q-select
|
||||
>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-select
|
||||
dense
|
||||
class="inputgreen"
|
||||
v-model="competency"
|
||||
label="สมรรถนะประจำกลุ่ม"
|
||||
outlined
|
||||
multiple
|
||||
map-options
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสมรรถนะประจำกลุ่ม'}`,]"
|
||||
hide-bottom-space
|
||||
lazy-rules
|
||||
:options="competencyOp"
|
||||
use-input
|
||||
@filter="(inputValue:any,doneFn:Function) => filterOptionCompetency(inputValue, doneFn) "
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template></q-select
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
type="submit"
|
||||
for="#submitForm"
|
||||
class="q-px-md items-center"
|
||||
color="public"
|
||||
label="บันทึก"
|
||||
/>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
const dataLevel = ref<any>();
|
||||
const { showLoader, hideLoader, success } = useCounterMixin();
|
||||
const fieldLabels = {
|
||||
score5: "5",
|
||||
score4: "4",
|
||||
score3: "3",
|
||||
score2: "2",
|
||||
score1: "1",
|
||||
};
|
||||
|
||||
const formScore = reactive<any>({
|
||||
score5: "",
|
||||
score4: "",
|
||||
score3: "",
|
||||
score2: "",
|
||||
score1: "",
|
||||
});
|
||||
|
||||
interface FormScore {
|
||||
score5: string;
|
||||
score4: string;
|
||||
score3: string;
|
||||
score2: string;
|
||||
score1: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
const body = {
|
||||
formScore: dataLevel.value.map((item: any) => {
|
||||
const { level, ...rest } = item;
|
||||
return rest;
|
||||
}),
|
||||
};
|
||||
|
||||
http
|
||||
.put(config.API.kpiEvaluation, body.formScore)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiEvaluation)
|
||||
.then((res) => {
|
||||
dataLevel.value = res.data.result.data;
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-card>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<q-card-section>
|
||||
<q-card flat bordered>
|
||||
<q-card-section class="bg-grey-3">
|
||||
<div class="row text-dark text-body2 text-weight-medium">
|
||||
<div class="text-center col-8">เกณฑ์การประเมิน</div>
|
||||
<div class="text-center col-4">ระดับคะแนน</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none">
|
||||
<div v-for="(field, index) in dataLevel" :key="field.id">
|
||||
<div class="row q-pa-sm">
|
||||
<div class="col-8 text-left">
|
||||
<q-field
|
||||
class="q_field_p_none"
|
||||
ref="fieldRef"
|
||||
v-model="field.description"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[(val) => !!val || 'กรุณากรอกมาตรฐานพฤติกรรม']"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
class="full-width"
|
||||
v-model="field.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>
|
||||
<!-- <q-input
|
||||
v-model="formScore[field]"
|
||||
dense
|
||||
outlined
|
||||
class="inputgreen"
|
||||
label="กรอกข้อความเพื่อไว้ใช้อ้างอิงเท่านั้น"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกข้อความเพื่อไว้ใช้อ้างอิงเท่านั้น'}`,]"
|
||||
hide-bottom-space
|
||||
/> -->
|
||||
</div>
|
||||
<div
|
||||
class="col-4 text-center text-body1 text-weight-bold self-center"
|
||||
>
|
||||
{{ field.level }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col-12"
|
||||
v-if="index !== Object.keys(fieldLabels).length - 1"
|
||||
>
|
||||
<q-separator />
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</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>
|
||||
</template>
|
||||
328
src/modules/01_masterdata/components/competency/05ListDetail.vue
Normal file
328
src/modules/01_masterdata/components/competency/05ListDetail.vue
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div class="display-table">
|
||||
<q-card flat bordered class="q-mb-lg">
|
||||
<q-card-section>
|
||||
<div class="text-h6 text-bold">ประเภทสมรรถนะ</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="q-pt-none">
|
||||
ให้ประเมินจากสมรรถนะที่เกี่ยวข้องกับการปฏิบัติราชการตามที่ ก.ก. กำหนด
|
||||
มีรายละเอียดดังนี้
|
||||
</q-card-section>
|
||||
|
||||
<q-separator inset />
|
||||
<div style="border: 1px solid black">
|
||||
<div class="row text-center" style="background-color: #e0e4f4">
|
||||
<div class="col-3 text-bold flex justify-center items-center">
|
||||
ประเภทสมรรถนะ
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="row text-bold flex justify-center">
|
||||
ประเภทและระดับตำแหน่ง
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="text-bold">ทั่วไป</div>
|
||||
<div>ปฏิบัติงาน</div>
|
||||
<div>ชำนาญงาน</div>
|
||||
<div>อาวุโส</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="text-bold">วิชาการ</div>
|
||||
<div>ปฏิบัติการ</div>
|
||||
<div>ชำนาญการ</div>
|
||||
<div>ชำนาญการพิเศษ</div>
|
||||
<div>เชี่ยวชาญ</div>
|
||||
<div>ทรงคุณวุฒิ</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="text-bold">อำนวยการ</div>
|
||||
<div>ต้น สูง</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="text-bold">บริหาร</div>
|
||||
<div>ต้น สูง</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row text-bold flex justify-center">ผู้ดำรงตำแหน่ง</div>
|
||||
<div class="row" style="flex-grow: 1">
|
||||
<div class="col-6">
|
||||
ผู้ตรวจราชการกรุงเทพมหานครและผู้ตรวจราชการ
|
||||
</div>
|
||||
<div class="col-6 flex justify-center">ผู้อำนวยการเขต</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold">สมรรถนะหลัก</div>
|
||||
<div>(5 สมรรถนะ)</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-6 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold">สมรรถนะประจำกลุ่มงาน</div>
|
||||
<div>(3 สมรรถนะ ตามกลุ่มงาน)</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6"></div>
|
||||
<div class="col-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold">สมรรถนะประจำผู้บริหารกรุงเทพมหานคร</div>
|
||||
<div>(7 สมรรถนะ)</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-3 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6"></div>
|
||||
<div class="col-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold">สมรรถนะเฉพาะสำหรับตำแหน่งผู้อำนวยการเขต</div>
|
||||
<div>(4 สมรรถนะ)</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6"></div>
|
||||
<div class="col-6 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold">
|
||||
สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการกรุงเทพมหานครและผู้ตรวจราชการ
|
||||
</div>
|
||||
<div>(2 สมรรถนะ)</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
<div class="col-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6 flex items-center justify-center">
|
||||
<q-icon name="check" size="32px" />
|
||||
</div>
|
||||
<div class="col-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-bold">
|
||||
<div class="col-3 q-pa-sm">
|
||||
<div class="text-bold flex justify-end">รวมสมรรถนะ</div>
|
||||
</div>
|
||||
<div class="col-5 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-3 flex justify-center items-center">8</div>
|
||||
<div class="col-3 flex justify-center items-center">8</div>
|
||||
<div class="col-3 flex justify-center items-center">12</div>
|
||||
<div class="col-3 flex justify-center items-center">12</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 column">
|
||||
<div class="row col-grow">
|
||||
<div class="col-6 flex justify-center items-center">7</div>
|
||||
<div class="col-6 flex justify-center items-center">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<q-card flat bordered>
|
||||
<q-card-section>
|
||||
<div class="text-h6 text-bold">ระดับสมรรถนะ</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="q-pt-none">
|
||||
สมรรถนะหลักและสมรรถนะประจำกลุ่มงาน
|
||||
กำหนดระดับสมรรถนะที่คาดหวังจำแนกตามประเภทและระดับตำแหน่งของข้าราชการกรุงเทพมหานครสามัญ
|
||||
มีรายละเอียดดังนี้
|
||||
</q-card-section>
|
||||
|
||||
<q-separator inset />
|
||||
<div style="border: 1px solid black">
|
||||
<div
|
||||
class="row text-bold text-center"
|
||||
style="background-color: #c0d4ec"
|
||||
>
|
||||
<div class="col-3">ประเภทตำแหน่ง</div>
|
||||
<div class="col-3">ระดับตำแหน่ง</div>
|
||||
<div class="col-3">สมรรถนะหลัก</div>
|
||||
<div class="col-3">สมรรถนะประจำกลุ่มงาน</div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col-3 flex justify-center items-center">บริหาร</div>
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<div class="col-6">สูง</div>
|
||||
<div class="col-6">5</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">ต้น</div>
|
||||
<div class="col-6">4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3" style="background-color: #bcbcc4"></div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col-3 flex justify-center items-center">อำนวยการ</div>
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<div class="col-6">สูง</div>
|
||||
<div class="col-6">4</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">ต้น</div>
|
||||
<div class="col-6">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3" style="background-color: #bcbcc4"></div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col-3 flex justify-center items-center">วิชาการ</div>
|
||||
<div class="col-9">
|
||||
<div class="row">
|
||||
<div class="col-4">ทรงคุณวุฒิ</div>
|
||||
<div class="col-4">5</div>
|
||||
<div class="col-4">5</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">เชี่ยวชาญ</div>
|
||||
<div class="col-4">4</div>
|
||||
<div class="col-4">4</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ชำนาญการพิเศษ</div>
|
||||
<div class="col-4">3</div>
|
||||
<div class="col-4">4</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ชำนาญการ</div>
|
||||
<div class="col-4">2</div>
|
||||
<div class="col-4">3</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ปฏิบัติการ</div>
|
||||
<div class="col-4">1</div>
|
||||
<div class="col-4">2</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col-3 flex justify-center items-center">ทั่วไป</div>
|
||||
<div class="col-9">
|
||||
<div class="row">
|
||||
<div class="col-4">ทักษะพิเศษ</div>
|
||||
<div class="col-4">4</div>
|
||||
<div class="col-4">4</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">อาวุโส</div>
|
||||
<div class="col-4">3</div>
|
||||
<div class="col-4">3</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ชำนาญงาน</div>
|
||||
<div class="col-4">2</div>
|
||||
<div class="col-4">2</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">ปฏิบัติงาน</div>
|
||||
<div class="col-4">1</div>
|
||||
<div class="col-4">1</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.display-table {
|
||||
& .row:not(:last-child) {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
& [class^="col-"]:not(:last-child) {
|
||||
border-right: 1px solid black;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
110
src/modules/01_masterdata/components/competency/AddPage.vue
Normal file
110
src/modules/01_masterdata/components/competency/AddPage.vue
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import Main from "@/modules/01_masterdata/components/competency/Forms/Main.vue";
|
||||
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
|
||||
import type { DataOption } from "@/modules/01_masterdata/interface/index/Main";
|
||||
import type { FormCompetency } from "@/modules/01_masterdata/interface/request/Main";
|
||||
|
||||
const router = useRouter();
|
||||
const store = useKPIDataStore();
|
||||
|
||||
const formData = reactive<FormCompetency>({
|
||||
competencyType: "",
|
||||
competencyName: "",
|
||||
definition: "",
|
||||
level_1: ["", "", "", "", "", ""],
|
||||
level_2: "",
|
||||
level_3: "",
|
||||
level_4: "",
|
||||
level_5: "",
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
const competencyTypeOp = ref<DataOption[]>([
|
||||
{
|
||||
id: "HEAD",
|
||||
name: "สมรรถนะหลัก",
|
||||
},
|
||||
{
|
||||
id: "GROUP",
|
||||
name: "สมรรถนะประจำกลุ่มงาน",
|
||||
},
|
||||
{
|
||||
id: "EXECUTIVE",
|
||||
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
|
||||
},
|
||||
{
|
||||
id: "DIRECTOR",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
|
||||
},
|
||||
{
|
||||
id: "INSPECTOR",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
|
||||
},
|
||||
]);
|
||||
|
||||
const itemsFormCard = ref<any>([
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
]);
|
||||
|
||||
function ocClickAdd() {
|
||||
if (itemsFormCard.value.length !== 6) {
|
||||
const data = {
|
||||
id: "",
|
||||
name: "",
|
||||
};
|
||||
itemsFormCard.value.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
/** บันทึก */
|
||||
function onSubmit() {
|
||||
console.log(formData);
|
||||
}
|
||||
</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>
|
||||
<q-card-section>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<q-select
|
||||
v-model="store.competencyTypeVal"
|
||||
outlined
|
||||
label="เลือกประเภทสมรรถนะ"
|
||||
dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="competencyTypeOp"
|
||||
emit-value
|
||||
map-options
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทสมรรถนะ'}`,]"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<Main />
|
||||
</q-card>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive } from "vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/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: "",
|
||||
},
|
||||
],
|
||||
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
function ocClickAdd() {
|
||||
if (formData.levels.length !== 6) {
|
||||
const levelName = formData.levels.length + 1;
|
||||
const data = {
|
||||
level: levelName.toString(),
|
||||
description: "",
|
||||
};
|
||||
formData.levels.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
competencyType: store.competencyTypeVal,
|
||||
competencyName: formData.competencyName,
|
||||
definition: formData.definition,
|
||||
levels: formData.levels,
|
||||
evaluation: formData.evaluation,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit" class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<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 formData.levels"
|
||||
key="index"
|
||||
>
|
||||
<div
|
||||
class="col-3 text-center self-center text-body1 text-weight-medium"
|
||||
>
|
||||
<span>{{ items.level }}</span>
|
||||
</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-input
|
||||
v-model="formData.evaluation"
|
||||
label="กำหนดเกณฑ์การประเมิน"
|
||||
dense
|
||||
type="textarea"
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12"><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>
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/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();
|
||||
|
||||
interface DetailLevelType {
|
||||
level_01: any;
|
||||
level_02: any;
|
||||
level_03: any;
|
||||
level_04: any;
|
||||
level_05: any;
|
||||
}
|
||||
|
||||
interface FormGroup {
|
||||
name: string;
|
||||
definition: string;
|
||||
detailLevel: DetailLevelType[];
|
||||
evaluation: string;
|
||||
}
|
||||
|
||||
const fieldLabels = {
|
||||
score1: "1",
|
||||
score2: "2",
|
||||
score3: "3",
|
||||
score4: "4",
|
||||
score5: "5",
|
||||
};
|
||||
|
||||
const formScore = reactive<any>({
|
||||
score1: "",
|
||||
score2: "",
|
||||
score3: "",
|
||||
score4: "",
|
||||
score5: "",
|
||||
});
|
||||
|
||||
const formData = reactive<FormGroup>({
|
||||
name: "",
|
||||
definition: "",
|
||||
detailLevel: [],
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
competencyType: store.competencyTypeVal,
|
||||
competencyName: formData.definition,
|
||||
definition: formData.definition,
|
||||
levels1: formScore.score1,
|
||||
levels2: formScore.score2,
|
||||
levels3: formScore.score3,
|
||||
levels4: formScore.score4,
|
||||
levels5: formScore.score5,
|
||||
evaluation: formData.evaluation,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit" class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
label="ชื่อสมรรถนะ"
|
||||
outlined
|
||||
v-model="formData.name"
|
||||
dense
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
label="คำจำกัดความ"
|
||||
outlined
|
||||
v-model="formData.definition"
|
||||
dense
|
||||
type="textarea"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกคำจำกัดความ'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-card flat bordered>
|
||||
<q-card-section class="bg-grey-4 q-pa-sm">
|
||||
<div class="row text-dark text-body2 text-weight-medium">
|
||||
<div class="text-center col-4">ระดับ</div>
|
||||
<div class="col-8">มาตรฐานพฤติกรรม</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none">
|
||||
<div
|
||||
v-for="(field, index) in Object.keys(fieldLabels)"
|
||||
:key="index + 1"
|
||||
>
|
||||
<div class="row q-pa-sm">
|
||||
<div
|
||||
class="col-4 text-center text-body1 text-weight-bold self-center"
|
||||
>
|
||||
{{ fieldLabels[field as keyof typeof fieldLabels] }}
|
||||
</div>
|
||||
<div class="col-8 text-left">
|
||||
<q-field
|
||||
class="q_field_p_none"
|
||||
ref="fieldRef"
|
||||
v-model="formScore[field]"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[(val) => !!val || 'กรุณากรอกมาตรฐานพฤติกรรม']"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
class="full-width"
|
||||
v-model="formScore[field]"
|
||||
: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>
|
||||
<div
|
||||
class="col-12"
|
||||
v-if="index !== Object.keys(fieldLabels).length - 1"
|
||||
>
|
||||
<q-separator />
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
v-model="formData.evaluation"
|
||||
label="กำหนดเกณฑ์การประเมิน"
|
||||
dense
|
||||
type="textarea"
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12"><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>
|
||||
|
|
@ -0,0 +1,309 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const $q = useQuasar();
|
||||
const { dialogConfirm, showLoader, success, hideLoader, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
const router = useRouter;
|
||||
const store = useKPIDataStore();
|
||||
const formData = reactive({
|
||||
competencyType: "",
|
||||
competencyName: "",
|
||||
definition: "",
|
||||
level: ["", "", "", "", "", ""],
|
||||
form: [
|
||||
{
|
||||
posType: "",
|
||||
posLevel: "",
|
||||
description: "",
|
||||
description2: "",
|
||||
},
|
||||
],
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
const dataLevel = ref<any>([]);
|
||||
const typeOp = ref<any>([]);
|
||||
const levelOp = ref<any>([]);
|
||||
const typeOpsMain = ref<any>([]);
|
||||
const levelOpsMain = ref<any>([]);
|
||||
|
||||
function ocClickAdd() {
|
||||
if (formData.form.length !== 6) {
|
||||
const data = {
|
||||
posType: "",
|
||||
posLevel: "",
|
||||
description: "",
|
||||
description2: "",
|
||||
};
|
||||
formData.form.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
/** function เรียกรายการประเภทตำแหน่ง */
|
||||
function fetchType() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgPosType)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
dataLevel.value = data;
|
||||
typeOpsMain.value = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.posTypeName,
|
||||
}));
|
||||
typeOp.value = typeOpsMain.value;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function updateSelectType(val: string, index: number) {
|
||||
const listLevel = dataLevel.value.find((e: any) => e.id === val);
|
||||
levelOpsMain.value = listLevel.posLevels.map((e: any) => ({
|
||||
id: e.id,
|
||||
name: e.posLevelName,
|
||||
}));
|
||||
levelOp.value = levelOpsMain.value;
|
||||
formData.form[index].posLevel = "";
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
competencyType: store.competencyTypeVal,
|
||||
competencyName: formData.competencyName,
|
||||
definition: formData.definition,
|
||||
postype: formData.form,
|
||||
evaluation: formData.evaluation,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchType();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit" class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<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-3 text-center">
|
||||
<span>ระดับ</span>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<span>มาตรฐานพฤติกรรม</span>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<div
|
||||
class="row q-pa-sm q-col-gutter-sm"
|
||||
v-for="(items, index) in formData.form"
|
||||
key="index"
|
||||
>
|
||||
<div class="col-3 text-center">
|
||||
<q-select
|
||||
v-model="formData.form[index].posType"
|
||||
outlined
|
||||
label="ประเภทตำแหน่ง"
|
||||
dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="typeOp"
|
||||
emit-value
|
||||
map-options
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทตำแหน่ง'}`,]"
|
||||
hide-bottom-space
|
||||
@update:model-value="
|
||||
updateSelectType(formData.form[index].posType, index)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
<q-select
|
||||
v-model="formData.form[index].posLevel"
|
||||
outlined
|
||||
label="ระดับตำแหน่ง"
|
||||
dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="levelOp"
|
||||
emit-value
|
||||
map-options
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-field
|
||||
class="q_field_p_none"
|
||||
ref="fieldRef"
|
||||
v-model="formData.form[index].description"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[(val) => !!val || 'กรุณากรอกมาตรฐานพฤติกรรม']"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
class="full-width"
|
||||
v-model="formData.form[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>
|
||||
<q-field
|
||||
class="q_field_p_none"
|
||||
ref="fieldRef"
|
||||
v-model="formData.form[index].description2"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[(val) => !!val || 'กรุณากรอกมาตรฐานพฤติกรรม']"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
class="full-width"
|
||||
v-model="formData.form[index].description2"
|
||||
: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 class="col-12"><q-separator /></div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
v-model="formData.evaluation"
|
||||
label="กำหนดเกณฑ์การประเมิน"
|
||||
dense
|
||||
type="textarea"
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12"><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>
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const router = useRouter();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
const mode = ref<string>("table");
|
||||
const {
|
||||
dialogRemove,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
|
||||
const store = useKPIDataStore();
|
||||
const formData = reactive({
|
||||
competencyType: "",
|
||||
competencyName: "",
|
||||
definition: "",
|
||||
level1: "",
|
||||
level2: "",
|
||||
level3: "",
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
competencyType: store.competencyTypeVal,
|
||||
competencyName: formData.competencyName,
|
||||
definition: formData.definition,
|
||||
levels1: formData.level1,
|
||||
levels2: formData.level2,
|
||||
levels3: formData.level3,
|
||||
evaluation: formData.evaluation,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="full-width">
|
||||
<q-form @submit.prevent greedy @validation-success="onSubmit()">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="formData.competencyName"
|
||||
dense
|
||||
label="ชื่อสมรรถนะ"
|
||||
hide-bottom-space
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`]"
|
||||
/>
|
||||
</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 q-py-sm">
|
||||
<div class="row text-dark text-body2 text-weight-medium">
|
||||
<div class="col-6 q-pl-xl">ระบบตำแหน่ง</div>
|
||||
<div class="col-6">
|
||||
คำอธิบายระดับ/พฤติกรรมที่คาดหวัง/พฤติกรรมย่อย
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<div class="row items-center">
|
||||
<q-card-section class="q-pa-none q-pl-xl col-6">
|
||||
<span class="text-dark text-subtitle1 text-weight-medium">
|
||||
L1 ระดับ หัวหน้าฝ่ายในสังกัด
|
||||
</span>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none col-6">
|
||||
<div class="q-mr-md">
|
||||
<q-field
|
||||
ref="fieldRef"
|
||||
v-model="formData.level1"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val || 'กรุณาระบุคำอธิบาย L1 ระดับ หัวหน้าฝ่ายในสังกัด',
|
||||
]"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
v-model="formData.level1"
|
||||
:dense="$q.screen.lt.md"
|
||||
min-height="5rem"
|
||||
class="full-width"
|
||||
: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>
|
||||
<div class="row items-center">
|
||||
<q-card-section class="q-pa-none q-pl-xl col-6">
|
||||
<span class="text-dark text-subtitle1 text-weight-medium">
|
||||
L2 ระดับ ผู้ช่วยผู้อำนวยการเขต
|
||||
</span>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none col-6">
|
||||
<div class="q-mr-md">
|
||||
<q-field
|
||||
ref="fieldRef"
|
||||
v-model="formData.level2"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val ||
|
||||
'กรุณาระบุคำอธิบาย L2 ระดับ ผู้ช่วยผู้อำนวยการเขต',
|
||||
]"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
v-model="formData.level2"
|
||||
:dense="$q.screen.lt.md"
|
||||
min-height="5rem"
|
||||
class="full-width"
|
||||
: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>
|
||||
<div class="row items-center">
|
||||
<q-card-section class="q-pa-none q-pl-xl col-6">
|
||||
<span class="text-dark text-subtitle1 text-weight-medium">
|
||||
L3 ระดับ ผู้อำนวยการเขต
|
||||
</span>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none col-6">
|
||||
<div class="q-mr-md">
|
||||
<q-field
|
||||
ref="fieldRef"
|
||||
v-model="formData.level3"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val || 'กรุณาระบุคำอธิบาย L3 ระดับ ผู้อำนวยการเขต',
|
||||
]"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
v-model="formData.level3"
|
||||
:dense="$q.screen.lt.md"
|
||||
min-height="5rem"
|
||||
class="full-width"
|
||||
: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>
|
||||
</q-card>
|
||||
<div class="col-12 q-mt-md">
|
||||
<q-input
|
||||
v-model="formData.evaluation"
|
||||
label="กำหนดเกณฑ์การประเมิน"
|
||||
dense
|
||||
type="textarea"
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<q-separator color="grey-4" />
|
||||
<div class="col-12 row justify-end q-mt-md">
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
class="q-px-md"
|
||||
type="submit"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-form>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,249 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const router = useRouter();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
const mode = ref<string>("table");
|
||||
const {
|
||||
dialogRemove,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
const store = useKPIDataStore();
|
||||
const formData = reactive({
|
||||
competencyType: "",
|
||||
competencyName: "",
|
||||
definition: "",
|
||||
level1: "",
|
||||
level2: "",
|
||||
evaluation: "",
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
const body = {
|
||||
competencyType: store.competencyTypeVal,
|
||||
competencyName: formData.competencyName,
|
||||
definition: formData.definition,
|
||||
levels1: formData.level1,
|
||||
levels2: formData.level2,
|
||||
evaluation: formData.evaluation,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="full-width">
|
||||
<q-form @submit.prevent greedy @validation-success="onSubmit()">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
v-model="formData.competencyName"
|
||||
dense
|
||||
hide-bottom-space
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`]"
|
||||
label="ชื่อสมรรถนะ"
|
||||
/>
|
||||
</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 q-py-sm">
|
||||
<div class="row text-dark text-body2 text-weight-medium">
|
||||
<div class="col-6 q-pl-xl">ระบบตำแหน่ง</div>
|
||||
<div class="col-6">
|
||||
คำอธิบายระดับ/พฤติกรรมที่คาดหวัง/พฤติกรรมย่อย
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<div class="row items-center">
|
||||
<q-card-section class="q-pa-none q-pl-xl col-6">
|
||||
<span class="text-dark text-subtitle1 text-weight-medium">
|
||||
L1 ประเภทอำนวยการ ระดับสูง
|
||||
</span>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none col-6">
|
||||
<div class="q-mr-md">
|
||||
<q-field
|
||||
ref="fieldRef"
|
||||
v-model="formData.level1"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val || 'กรุณาระบุคำอธิบาย L1 ประเภทอำนวยการ ระดับสูง',
|
||||
]"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
v-model="formData.level1"
|
||||
:dense="$q.screen.lt.md"
|
||||
min-height="5rem"
|
||||
class="full-width"
|
||||
: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>
|
||||
<div class="row items-center">
|
||||
<q-card-section class="q-pa-none q-pl-xl col-6">
|
||||
<span class="text-dark text-subtitle1 text-weight-medium">
|
||||
L2 ประเภทบริหาร ระดับสูง
|
||||
</span>
|
||||
</q-card-section>
|
||||
<q-card-section class="q-pa-none col-6">
|
||||
<div class="q-mr-md">
|
||||
<q-field
|
||||
ref="fieldRef"
|
||||
v-model="formData.level2"
|
||||
label-slot
|
||||
borderless
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val || 'กรุณาระบุคำอธิบาย L2 ประเภทบริหาร ระดับสูง',
|
||||
]"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #control>
|
||||
<q-editor
|
||||
v-model="formData.level2"
|
||||
:dense="$q.screen.lt.md"
|
||||
min-height="5rem"
|
||||
class="full-width"
|
||||
: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>
|
||||
</q-card>
|
||||
<div class="col-12 q-mt-md">
|
||||
<q-input
|
||||
v-model="formData.evaluation"
|
||||
outlined
|
||||
label="กำหนดเกณฑ์การประเมิน"
|
||||
type="textarea"
|
||||
dense
|
||||
/>
|
||||
</div>
|
||||
<q-separator color="grey-4" />
|
||||
<div class="col-12 row justify-end q-mt-md">
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
class="q-px-md"
|
||||
type="submit"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-form>
|
||||
</div>
|
||||
</template>
|
||||
292
src/modules/01_masterdata/components/competency/Forms/Main.vue
Normal file
292
src/modules/01_masterdata/components/competency/Forms/Main.vue
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKPIDataStore } from "@/modules/01_masterdata/stores/KPIStore";
|
||||
|
||||
/**use*/
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, showLoader, hideLoader, success, messageError } = mixin;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const store = useKPIDataStore();
|
||||
|
||||
const competencyId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
|
||||
const formData = reactive({
|
||||
competencyType: "",
|
||||
competencyName: "",
|
||||
definition: "",
|
||||
levels: [
|
||||
{
|
||||
level: "1",
|
||||
description: "",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
function fetchDetail() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiCapacity + `/${competencyId.value}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
formData.competencyType = data.type;
|
||||
formData.competencyName = data.name;
|
||||
formData.definition = data.description;
|
||||
formData.levels = data.capacityDetails;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function onClickAddLevels() {
|
||||
const levelName = formData.levels.length + 1;
|
||||
const data = {
|
||||
level:
|
||||
(store.competencyTypeVal === "HEAD" ||
|
||||
store.competencyTypeVal === "GROUP") &&
|
||||
levelName <= 6
|
||||
? levelName.toString()
|
||||
: "",
|
||||
description: "",
|
||||
};
|
||||
levelName <= 6 && formData.levels.push(data);
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const formBody = {
|
||||
type: store.competencyTypeVal,
|
||||
name: formData.competencyName,
|
||||
description: formData.definition,
|
||||
capacityDetails: formData.levels,
|
||||
};
|
||||
try {
|
||||
const url = competencyId.value
|
||||
? config.API.kpiCapacity + `/${competencyId.value}`
|
||||
: config.API.kpiCapacity;
|
||||
const method = competencyId.value ? "put" : "post";
|
||||
await http[method](url, formBody);
|
||||
if (!competencyId.value) {
|
||||
router.push(`/masterdata/competency`);
|
||||
} else {
|
||||
fetchDetail();
|
||||
}
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onDeleteLevels(index: number) {
|
||||
formData.levels.splice(index, 1);
|
||||
}
|
||||
onMounted(() => {
|
||||
if (competencyId.value) {
|
||||
fetchDetail();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit" class="col-12">
|
||||
<q-card-section class="q-pt-none">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
v-model="formData.competencyName"
|
||||
dense
|
||||
outlined
|
||||
label="ชื่อสมรรถนะ"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อสมรรถนะ'}`,]"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<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>
|
||||
|
||||
<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="onClickAddLevels"
|
||||
>
|
||||
<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.competencyTypeVal === 'HEAD' ||
|
||||
store.competencyTypeVal === 'GROUP'
|
||||
"
|
||||
v-model="formData.levels[index].level"
|
||||
dense
|
||||
outlined
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับสมรรถนะ'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-9">
|
||||
<div class="row q-col-gutter-md">
|
||||
<div class="col-11">
|
||||
<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'],
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</q-field>
|
||||
</div>
|
||||
<div class="col-1 text-center">
|
||||
<q-btn
|
||||
dense
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
icon="delete"
|
||||
@click="onDeleteLevels(index)"
|
||||
v-if="
|
||||
(store.competencyTypeVal === 'HEAD' && index > 4) ||
|
||||
(store.competencyTypeVal === 'GROUP' && index > 4) ||
|
||||
((store.competencyTypeVal === 'EXECUTIVE' ||
|
||||
store.competencyTypeVal === 'DIRECTOR' ||
|
||||
store.competencyTypeVal === 'INSPECTOR') &&
|
||||
index > 0)
|
||||
"
|
||||
>
|
||||
<q-tooltip>ลบ</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<div class="col-12"><q-separator /></div>
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn label="บันทึก" color="public" class="q-px-md" type="submit">
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue