UI => IDP

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-26 13:46:04 +07:00
parent 311ff2d15c
commit d9ff26ac4a
7 changed files with 1198 additions and 396 deletions

View file

@ -0,0 +1,412 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type {
DataOption,
Pagination,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { DateRequest } from "@/modules/04_registryPerson/interface/response/Main";
/**
* importComponents
*/
import DialogStatus from "@/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue";
/**
* use
*/
const $q = useQuasar();
const router = useRouter();
const store = useRequestEditStore();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* Table
*/
const rows = ref<DateRequest[]>([]); //
const page = ref<number>(1); //
const pageSize = ref<number>(10); //
const rowsTotal = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "createdAt",
align: "left",
label: "วันที่ยื่นขอ",
sortable: true,
field: "createdAt",
format: (v) => (v ? date2Thai(v, false, true) : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: false,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "topic",
align: "left",
label: "ชื่อเรื่อง",
sortable: true,
field: "topic",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "detail",
align: "left",
label: "รายละเอียด",
sortable: true,
field: "detail",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "document",
align: "left",
label: "หลักฐานอ้างอิง",
sortable: true,
field: "document",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะคำร้อง",
sortable: true,
field: "status",
format: (v) => store.convertStatus(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"createdAt",
"fullname",
"topic",
"detail",
"document",
"status",
"remark",
]);
/**
* วแปร
*/
const status = ref<string>("PENDING"); //
const keyword = ref<string>(""); //
const statusOption = ref<DataOption[]>(store.optionStatus); //
const modalStatus = ref<boolean>(false); //
const requestId = ref<string>(""); //id
/**
* function fetch รายการคำรองขอแกไขทะเบยนประว
*/
function fetchListRequset() {
showLoader();
http
.get(config.API.requestEdit + `admin`, {
params: {
page: page.value,
pageSize: pageSize.value,
status: status.value,
keyword: keyword.value,
},
})
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / pageSize.value);
rowsTotal.value = data.total;
rows.value = data.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function เลอกสถานะคำรอง
*/
function updateStatusValue() {
page.value = 1;
// fetch
fetchListRequset();
}
/**
* function เคลยร สถานะคำรอง
*/
function clearStatus() {
status.value = "";
statusOption.value = store.optionStatus;
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
/**
* funciton แกไขคำรอง
* @param id รายการคำรอง
*/
function onclickEdit(id: string) {
modalStatus.value = true;
requestId.value = id;
}
/**
* function เลอกแถวตอหน
* @param newPagination
*/
function updatePageSizePagination(newPagination: Pagination) {
page.value = 1;
pageSize.value = newPagination.rowsPerPage;
}
/**
* function หาชอไฟล
* @param id รายการยนคำรองขอแกไขขอม
*/
function onDownloadFile(id: string) {
showLoader();
http
.get(
config.API.file(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐานคำร้องขอแก้ไขข้อมูล",
id
)
)
.then(async (res) => {
if (res.data.length !== 0) {
await downloadUrl(id, res.data[0].fileName);
} else {
hideLoader();
}
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
/**
* function โหลดไฟล
* @param id รายการยนคำรองขอแกไขขอม
* @param fileName อไฟล
*/
async function downloadUrl(id: string, fileName: string) {
await http
.get(
config.API.fileByFile(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐานคำร้องขอแก้ไขข้อมูล",
id,
fileName
)
)
.then((res) => {
window.open(res.data.downloadUrl, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* การเปลยนแปลงของ pageSize
*
* เมอมการเปลยนแปลงจำทำการ งชอมลรายการคำรองขอแกไขทะเบยนประวตามจำนวน pageSize
*/
watch(
() => pageSize.value,
() => {
fetchListRequset();
}
);
onMounted(() => {
fetchListRequset();
});
</script>
<template>
<q-card class="q-pa-md">
<div class="row q-mb-sm q-col-gutter-sm">
<div class="col-xs-10 col-md-3">
<q-select
style="max-width: 250px"
v-model="status"
label="สถานะคำร้อง"
dense
outlined
emit-value
map-options
option-label="name"
option-value="id"
:options="statusOption"
@update:model-value="updateStatusValue"
:clearable="status !== ''"
@clear="clearStatus"
use-input
@filter="(inputValue:string,
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>
<q-space />
<q-input
v-model="keyword"
outlined
clearable
dense
label="ค้นหา"
style="width: 250px"
@keydown.enter="updateStatusValue()"
>
</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
class="col-xs-12 col-sm-3 col-md-2"
/>
</div>
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"
row-key="id"
:rows-per-page-options="[10, 25, 50, 100]"
:paging="true"
:visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination"
>
<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">
<q-td auto-width>
<q-btn
icon="edit"
round
dense
flat
color="edit"
@click.pervent="onclickEdit(props.row.id)"
>
<q-tooltip>แกไขสถานะคำรอง</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name === 'document'">
<q-btn
icon="mdi-download"
round
dense
flat
color="primary"
@click.pervent="onDownloadFile(props.row.id)"
>
<q-tooltip>หลกฐานอางอ</q-tooltip>
</q-btn>
</div>
<div v-else class="table_ellipsis2">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ rowsTotal }} รายการ
<q-pagination
v-model="page"
active-color="primary"
color="dark"
:max="Number(maxPage)"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="fetchListRequset()"
></q-pagination>
</template>
</d-table>
</div>
</q-card>
<DialogStatus
v-model:modal="modalStatus"
:fetch-data="fetchListRequset"
:request-id="requestId"
/>
</template>
<style scoped></style>

View file

@ -0,0 +1,326 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import type { QTableProps } from "quasar";
import type {
DataOption,
Pagination,
} from "@/modules/04_registryPerson/interface/index/Main";
import DialogEditIDP from "@/modules/04_registryPerson/components/requestEdit/Dialog02_EditIDP.vue";
const store = useRequestEditStore();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* วแปร
*/
const status = ref<string>("PENDING"); //
const keyword = ref<string>(""); //
const statusOption = ref<DataOption[]>(store.optionStatus); //
const modalEdit = ref<boolean>(false); //
const requestId = ref<string>(""); //id
/**
* Table
*/
const rows = ref<any[]>([]); //
const page = ref<number>(1); //
const pageSize = ref<number>(10); //
const rowsTotal = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "createdAt",
align: "left",
label: "วันที่ยื่นขอ",
sortable: true,
field: "createdAt",
format: (v) => (v ? date2Thai(v, false, true) : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "knowledgeSkills",
align: "left",
label: "ความรู้ / ทักษะ / สมรรถนะที่ต้องได้รับการพัฒนา",
sortable: true,
field: "knowledgeSkills",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "developmentProjects",
align: "left",
label: "วิธีการพัฒนา",
sortable: true,
field: "developmentProjects",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "developmentTarget",
align: "left",
label: "เป้าหมายการพัฒนา",
sortable: true,
field: "developmentTarget",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "developmentResults",
align: "left",
label: "วิธีการวัดผลการพัฒนา",
sortable: true,
field: "developmentResults",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "developmentReport",
align: "left",
label: "รายงานผลการพัฒนา",
sortable: true,
field: "developmentReport",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "document",
align: "left",
label: "หลักฐานอ้างอิง",
sortable: true,
field: "document",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะคำร้อง",
sortable: true,
field: "status",
format: (v) => store.convertStatus(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"createdAt",
"knowledgeSkills",
"developmentProjects",
"developmentTarget",
"developmentResults",
"developmentReport",
"document",
"status",
"remark",
]);
function fetchData() {
const data = [
{
id: "1",
createdAt: "2024-09-17T08:21:21.600Z",
status: "PENDING",
knowledgeSkills: "ความรู้",
developmentProjects: "การพัฒนา",
developmentTarget: "เป้าหมาย",
developmentResults: "ผล",
developmentReport: "รายงาน",
},
];
rows.value = data;
}
/**
* function เลอกสถานะคำรอง
*/
function updateStatusValue() {
page.value = 1;
// fetch
// function fetchData() {
}
/**
* function เคลยร สถานะคำรอง
*/
function clearStatus() {
status.value = "";
statusOption.value = store.optionStatus;
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
/**
* function เลอกแถวตอหน
* @param newPagination
*/
function updatePageSizePagination(newPagination: Pagination) {
page.value = 1;
pageSize.value = newPagination.rowsPerPage;
}
/**
* funciton แกไขคำรอง
* @param id รายการคำรอง
*/
function onclickEdit(id: string) {
modalEdit.value = true;
requestId.value = id;
}
onMounted(() => {
fetchData();
});
</script>
<template>
<q-card class="q-pa-md">
<div class="row q-mb-sm q-col-gutter-sm">
<div class="col-xs-10 col-md-3">
<q-select
style="max-width: 250px"
v-model="status"
label="สถานะคำร้อง"
dense
outlined
emit-value
map-options
option-label="name"
option-value="id"
:options="statusOption"
@update:model-value="updateStatusValue"
:clearable="status !== ''"
@clear="clearStatus"
use-input
@filter="(inputValue:string,
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>
<q-space />
<q-input
v-model="keyword"
outlined
clearable
dense
label="ค้นหา"
style="width: 250px"
@keydown.enter="updateStatusValue()"
>
</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
class="col-xs-12 col-sm-3 col-md-2"
/>
</div>
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"
row-key="id"
:rows-per-page-options="[10, 25, 50, 100]"
:paging="true"
:visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination"
>
<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">
<q-td auto-width>
<q-btn
icon="edit"
round
dense
flat
color="edit"
@click.pervent="onclickEdit(props.row.id)"
>
<q-tooltip>แกไขสถานะคำรอง</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name === 'document'">
<q-btn icon="mdi-download" round dense flat color="primary">
<q-tooltip>หลกฐานอางอ</q-tooltip>
</q-btn>
</div>
<div v-else class="table_ellipsis2">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ rowsTotal }} รายการ
<q-pagination
v-model="page"
active-color="primary"
color="dark"
:max="Number(maxPage)"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="fetchData"
></q-pagination>
</template>
</d-table>
</div>
</q-card>
<DialogEditIDP v-model:modal="modalEdit" v-model:request-id="requestId" />
</template>
<style scoped></style>

View file

@ -0,0 +1,406 @@
<script setup lang="ts">
import { reactive, ref } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import type {
DataOption,
DataItemsDevelopment,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { FormDataIDP } from "@/modules/04_registryPerson/interface/request/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const store = useRequestEditStore();
const { dialogConfirm, showLoader, hideLoader, messageError, success } =
useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true }); //, popup
const requestId = defineModel<string>("requestId", { required: true }); // id
const isReadOnly = ref<boolean>(false);
const formData = reactive<FormDataIDP>({
topic: "",
development: [],
otherAction: "",
otherPerson: "",
otherTraining: "",
developmentTarget: "",
developmentResults: "",
developmentReport: "",
status: "",
remark: "",
});
//70 ()
const itemsDevelopmentAction = ref<DataItemsDevelopment[]>([
{
value: "on_the_job_training",
label: "การฝึกปฏิบัติในงาน (On the job training)",
},
{
value: "job_project_assignment",
label: "การมอบหมายงาน/โครงการ (Job/Project assignment)",
},
{
value: "job_shadowing",
label: "การติดตามเรียนรู้รูปแบบการทำงานของผู้บริหาร (Job shadowing)",
},
{
value: "job_enlargement",
label: "การมอบหมายงานเพิ่มขึ้น (Job enlargement)",
},
{
value: "internal_trainer",
label: "การเป็นวิทยากรภายในหน่วยงาน (Internal trainer)",
},
{
value: "rotation",
label: "การหมุนเวียนงาน (Rotation)",
},
{
value: "activity",
label: "การทำกิจกรรม (Activity)",
},
{
value: "site_visit",
label: "การศึกษาดูงานนอกสถานที่ (Site visit)",
},
{
value: "benchmarking",
label: "การแลกเปลี่ยน เทียบเคียงความรู้ ประสมการณ์ (Benchmarking)",
},
{
value: "problem_solving",
label: "การแก้ปัญหา (Problem-solving)",
},
{
value: "team_working",
label: "การทำงานเป็นทีม (Team working)",
},
{
value: "other1",
label: "อื่น ๆ (ระบุ)",
},
]);
//20 (Coach/Mentor/Consulting)
const itemsDevelopmentPerson = ref<DataItemsDevelopment[]>([
{ value: "coaching", label: "การสอนงาน (Coaching)" },
{ value: "mentoring", label: "การเป็นพี่เลี้ยง (Mentoring)" },
{ value: "team_meeting", label: "การประชุมทีม (Team meeting)" },
{ value: "consulting", label: "การให้คำปรึกษา (Consulting)" },
{ value: "feedback", label: "การให้ข้อคิดเห็น/เสนอแนะ (Feedback)" },
{ value: "other2", label: "อื่น ๆ (ระบุ)" },
]);
//10
const itemsDevelopmentTraining = ref<DataItemsDevelopment[]>([
{
value: "self_learning",
label: "การเรียนรู้ด้วยตนเอง แบบ online/offline (Self learning)",
},
{ value: "classroom_training", label: "การฝึกอบรม (Classroom training)" },
{
value: "in_house_training",
label: "การฝึกอบรมภายในองค์กร (In house training)",
},
{
value: "public_training",
label: "การฝึกอบรมจากองค์กรภายนอก (Public training)",
},
{
value: "e_training",
label: "การฝึกอบรมผ่าน online (e training / e learning)",
},
{ value: "meeting", label: "การประชุม (Meeting)" },
{ value: "seminar", label: "การสัมมนา (Seminar)" },
{ value: "other3", label: "อื่น ๆ (ระบุ)" },
]);
//
const statusOptionMain = ref<DataOption[]>(
store.optionStatus.filter((e: DataOption) => e.id !== "")
);
const statusOption = ref<DataOption[]>(statusOptionMain.value); //
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
formData.status = val ? "" : formData.status;
statusOption.value = statusOptionMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
function onSubmit() {
dialogConfirm($q, () => {});
}
/**
* function popup
*/
function closeDialog() {
modal.value = false;
formData.topic = "";
formData.development = [];
formData.otherAction = "";
formData.otherPerson = "";
formData.otherTraining = "";
formData.developmentTarget = "";
formData.developmentResults = "";
formData.developmentReport = "";
formData.status = "";
formData.remark = "";
}
/**
* class inpui
* @param val าสถานะ
*/
function classInput(val: boolean) {
return {
"full-width cursor-pointer ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 90%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader tittle="ข้อมูลการพัฒนารายบุคคล" :close="closeDialog" />
<q-separator />
<q-card-section style="max-height: 84vh" class="scroll">
<div class="row q-col-gutter-sm">
<div class="col-md-3 col-xs-12">
<div class="row q-col-gutter-sm">
<!-- สถานะ -->
<div class="col-12">
<q-select
:class="classInput(isReadOnly)"
v-model="formData.status"
label="สถานะ"
dense
outlined
emit-value
map-options
:options="statusOption"
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
lazy-rules
hide-bottom-space
use-input
option-label="name"
option-value="id"
@filter="(inputValue:string,
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-12">
<q-input
:class="classInput(isReadOnly)"
v-model="formData.remark"
label="หมายเหตุ"
dense
outlined
type="textarea"
hide-bottom-space
/>
</div>
</div>
</div>
<div class="col-md-9 col-xs-12">
<div class="row q-col-gutter-sm">
<div class="col-12">
<q-input
:class="classInput(isReadOnly)"
readonly
outlined
v-model="formData.topic"
label="ชื่อเรื่อง/เนื้อเรื่อง/หัวข้อการพัฒนา"
dense
/>
</div>
<div class="col-12">
<q-label class="q-mb-sm text-weight-medium text-body2"
>การพฒนา
</q-label>
<div class="row col-12 q-ml-md q-col-gutter-sm">
<!-- 70 การลงมอปฏ (โดยผงคบบญชามอบหมาย) -->
<div class="col-4">
<q-label class="q-mb-sm text-weight-medium text-body2"
>70 การลงมอปฏ (โดยผงคบบญชามอบหมาย)</q-label
>
<q-option-group
disable
class="check_box q-mt-sm"
keep-color
color="primary"
dense
v-model="formData.development"
:options="itemsDevelopmentAction"
type="checkbox"
/>
<div
class="row"
v-if="formData.development.includes('other1')"
>
<div class="col-8 q-mt-sm relative-position">
<div class="other_custom_input">
<q-input
readonly
v-model="formData.otherAction"
dense
outlined
class="inputgreen"
label="กรุณาระบุ"
></q-input>
</div>
</div>
</div>
</div>
<!-- 20 การเรยนรจากผ (Coach/Mentor/Consulting) -->
<div class="col-4">
<q-label class="q-mb-sm text-weight-medium text-body2"
>20 การเรยนรจากผ
(Coach/Mentor/Consulting)</q-label
>
<q-option-group
disable
class="check_box q-mt-sm"
keep-color
color="primary"
dense
v-model="formData.development"
:options="itemsDevelopmentPerson"
type="checkbox"
/>
<div
class="row"
v-if="formData.development.includes('other2')"
>
<div class="col-8 q-mt-sm relative-position">
<div class="other_custom_input">
<q-input
readonly
v-model="formData.otherPerson"
dense
outlined
label="กรุณาระบุ"
></q-input>
</div>
</div>
</div>
</div>
<!-- 10 การฝกอบรมอนๆ -->
<div class="col-4">
<q-label class="q-mb-sm text-weight-medium text-body2"
>10 การฝกอบรมอนๆ</q-label
>
<q-option-group
disable
class="check_box q-mt-sm"
keep-color
color="primary"
dense
v-model="formData.development"
:options="itemsDevelopmentTraining"
type="checkbox"
/>
<div
class="row"
v-if="formData.development.includes('other3')"
>
<div class="offset-4 col-8 q-mt-sm relative-position">
<div class="other_custom_input">
<q-input
readonly
v-model="formData.otherTraining"
dense
outlined
label="กรุณาระบุ"
></q-input>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- เปาหมายการนำไปพฒนางาน -->
<div class="col-12">
<q-input
readonly
outlined
v-model="formData.developmentTarget"
label="เป้าหมายการนำไปพัฒนางาน"
dense
type="textarea"
/>
</div>
<!-- การวดผลการพฒนา -->
<div class="col-12">
<q-input
readonly
outlined
v-model="formData.developmentResults"
label="วิธีการวัดผลการพัฒนา"
dense
type="textarea"
/>
</div>
<!-- รายงานผลการพฒนา -->
<div class="col-12">
<q-input
readonly
outlined
v-model="formData.developmentReport"
label="รายงานผลการพัฒนา"
dense
type="textarea"
/>
</div>
</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นท</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<style scoped></style>

View file

@ -67,6 +67,11 @@ interface ItemTab {
label: string;
}
interface DataItemsDevelopment {
value: string;
label: string;
}
export type {
Pagination,
DataOption,
@ -80,4 +85,5 @@ export type {
ItemTab,
DataOptionEducation,
DataOptionEducationLevel,
DataItemsDevelopment,
};

View file

@ -66,6 +66,19 @@ interface FormChangeName {
documentId: string | null | undefined;
}
interface FormDataIDP {
topic: string;
development: string[];
otherAction: string;
otherPerson: string;
otherTraining: string;
developmentTarget: string;
developmentResults: string;
developmentReport: string;
status: string;
remark: string;
}
export type {
FormFilter,
FormAddPerson,
@ -73,4 +86,5 @@ export type {
DataNodeData,
QueryParams,
FormChangeName,
FormDataIDP,
};

View file

@ -1,278 +1,20 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import { ref } from "vue";
import { useRouter } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type {
DataOption,
Pagination,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { DateRequest } from "@/modules/04_registryPerson/interface/response/Main";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
/**
* importComponents
*/
import DialogStatus from "@/modules/04_registryPerson/components/requestEdit/DialogStatus.vue";
import TabInformation from "@/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue";
import TabIDP from "@/modules/04_registryPerson/components/requestEdit/02_TabIDP.vue";
/**
* use
*/
const $q = useQuasar();
const router = useRouter();
const store = useRequestEditStore();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* Table
*/
const rows = ref<DateRequest[]>([]); //
const page = ref<number>(1); //
const pageSize = ref<number>(10); //
const rowsTotal = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่ยื่นขอ",
sortable: true,
field: "lastUpdatedAt",
format: (v) => (v ? date2Thai(v, false, true) : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: false,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "topic",
align: "left",
label: "ชื่อเรื่อง",
sortable: true,
field: "topic",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "detail",
align: "left",
label: "รายละเอียด",
sortable: true,
field: "detail",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "document",
align: "left",
label: "หลักฐานอ้างอิง",
sortable: true,
field: "document",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะคำร้อง",
sortable: true,
field: "status",
format: (v) => store.convertStatus(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
format: (v) => (v ? v : "-"),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
const tabs = ref<string>("Main");
const tabsManu = ref<DataOption[]>([
{ name: "ข้อมูลส่วนตัว", id: "Main" },
{ name: "ข้อมูลการพัฒนารายบุคคล (IDP)", id: "IDP" },
]);
const visibleColumns = ref<string[]>([
"lastUpdatedAt",
"fullname",
"topic",
"detail",
"document",
"status",
"remark",
]);
/**
* วแปร
*/
const status = ref<string>("PENDING"); //
const keyword = ref<string>(""); //
const statusOption = ref<DataOption[]>(store.optionStatus); //
const modalStatus = ref<boolean>(false); //
const requestId = ref<string>(""); //id
/**
* function fetch รายการคำรองขอแกไขทะเบยนประว
*/
function fetchListRequset() {
showLoader();
http
.get(config.API.requestEdit + `admin`, {
params: {
page: page.value,
pageSize: pageSize.value,
status: status.value,
keyword: keyword.value,
},
})
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / pageSize.value);
rowsTotal.value = data.total;
rows.value = data.data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function เลอกสถานะคำรอง
*/
function updateStatusValue() {
page.value = 1;
// fetch
fetchListRequset();
}
/**
* function เคลยร สถานะคำรอง
*/
function clearStatus() {
status.value = "";
statusOption.value = store.optionStatus;
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
* @param update Function
*/
function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
/**
* funciton แกไขคำรอง
* @param id รายการคำรอง
*/
function onclickEdit(id: string) {
modalStatus.value = true;
requestId.value = id;
}
/**
* function เลอกแถวตอหน
* @param newPagination
*/
function updatePageSizePagination(newPagination: Pagination) {
page.value = 1;
pageSize.value = newPagination.rowsPerPage;
}
/**
* function หาชอไฟล
* @param id รายการยนคำรองขอแกไขขอม
*/
function onDownloadFile(id: string) {
showLoader();
http
.get(
config.API.file(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐานคำร้องขอแก้ไขข้อมูล",
id
)
)
.then(async (res) => {
if (res.data.length !== 0) {
await downloadUrl(id, res.data[0].fileName);
} else {
hideLoader();
}
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
/**
* function โหลดไฟล
* @param id รายการยนคำรองขอแกไขขอม
* @param fileName อไฟล
*/
function downloadUrl(id: string, fileName: string) {
http
.get(
config.API.fileByFile(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐานคำร้องขอแก้ไขข้อมูล",
id,
fileName
)
)
.then((res) => {
window.open(res.data.downloadUrl, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* การเปลยนแปลงของ pageSize
*
* เมอมการเปลยนแปลงจำทำการ งชอมลรายการคำรองขอแกไขทะเบยนประวตามจำนวน pageSize
*/
watch(
() => pageSize.value,
() => {
fetchListRequset();
}
);
onMounted(() => {
fetchListRequset();
});
</script>
<template>
@ -291,139 +33,35 @@ onMounted(() => {
รายการคำรองขอแกไขทะเบยนประว
</div>
</div>
<q-card flat bordered class="q-pa-md">
<div class="row q-mb-sm q-col-gutter-sm">
<div class="col-xs-10 col-md-3">
<q-select
style="max-width: 250px"
v-model="status"
label="สถานะคำร้อง"
dense
outlined
emit-value
map-options
option-label="name"
option-value="id"
:options="statusOption"
@update:model-value="updateStatusValue"
:clearable="status !== ''"
@clear="clearStatus"
use-input
@filter="(inputValue:string,
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>
<q-space />
<q-input
v-model="keyword"
outlined
clearable
dense
label="ค้นหา"
style="width: 250px"
@keydown.enter="updateStatusValue()"
>
</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
class="col-xs-12 col-sm-3 col-md-2"
/>
</div>
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"
row-key="id"
:rows-per-page-options="[10, 25, 50, 100]"
:paging="true"
:visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination"
<q-card class="q-mt-sm">
<q-card-section style="padding: 0px">
<q-separator />
<q-tabs
v-model="tabs"
inline-label
align="left"
indicator-color="primary"
active-color="primary bg-teal-1"
>
<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">
<q-td auto-width>
<q-btn
icon="edit"
round
dense
flat
color="edit"
@click.pervent="onclickEdit(props.row.id)"
>
<q-tooltip>แกไขสถานะคำรอง</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'document'">
<q-btn
icon="mdi-download"
round
dense
flat
color="primary"
@click.pervent="onDownloadFile(props.row.id)"
>
<q-tooltip>หลกฐานอางอ</q-tooltip>
</q-btn>
</div>
<div v-else class="table_ellipsis2">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ rowsTotal }} รายการ
<q-pagination
v-model="page"
active-color="primary"
color="dark"
:max="Number(maxPage)"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="fetchListRequset()"
></q-pagination>
</template>
</d-table>
</div>
<q-tab
v-for="(tab, index) in tabsManu"
:key="index"
:name="tab.id"
:label="tab.name"
/>
</q-tabs>
<q-separator />
<q-tab-panels v-model="tabs" animated>
<q-tab-panel style="padding: 0px" name="Main">
<TabInformation />
</q-tab-panel>
<q-tab-panel style="padding: 0px" name="IDP"> <TabIDP /> </q-tab-panel>
</q-tab-panels>
</q-card-section>
</q-card>
<DialogStatus
v-model:modal="modalStatus"
:fetch-data="fetchListRequset"
:request-id="requestId"
/>
</template>
<style scoped></style>