417 lines
14 KiB
Vue
417 lines
14 KiB
Vue
<script setup lang="ts">
|
|
import { ref, reactive } from "vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import type {
|
|
FormAddHistory,
|
|
FormAddHistoryProject,
|
|
} from "@/modules/15_development/interface/request/Main";
|
|
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
import DialogGov from "@/modules/15_development/components/history/DialogGov.vue"
|
|
import DialogProject from "@/modules/15_development/components/history/DialogProject.vue";
|
|
import { useQuasar, type QTableProps } from "quasar";
|
|
|
|
import http from "@/plugins/http";
|
|
import config from '@/app.config'
|
|
|
|
const $q = useQuasar()
|
|
const mixin = useCounterMixin()
|
|
const { dialogConfirm,showLoader,hideLoader,messageError } = mixin
|
|
const router = useRouter();
|
|
const store = useDevelopmentDataStore();
|
|
const modalDialogGov = ref<boolean>(false);
|
|
const modalDialogProject = ref<boolean>(false);
|
|
|
|
const order = ref<string>("");
|
|
const dateOrder = ref<string>("");
|
|
|
|
/** ตัวแปรข้อมูลข้าราชการ */
|
|
const formMain = reactive<FormAddHistory>({
|
|
citizenId: "1XXXXXXXXXXXX", //เลขประจําตัวประชาชน
|
|
name: "นางสาวรัชภรณ์ ภักดี", //ชื่อ - นามสกุล
|
|
position: "นักบริหาร", //ตําแหน่ง
|
|
type: "บริหาร", //ประเภทตําแหน่ง
|
|
level: "ชำนาญการพิเศษ", //ระดับตําแหน่ง
|
|
positionSide: "นักบริหาร", //ตําแหน่งทางการบริหาร
|
|
oc: "กลุ่มงานช่วยนักบริหาร", //หน่วยงานที่สังกัด
|
|
});
|
|
|
|
/** ตัวแปรข้อมูลโครงสร้าง */
|
|
const formMainProject = reactive<FormAddHistoryProject>({
|
|
project: "", //ชื่อโครงการ/หลักสูตรการฝึกอบรม
|
|
year: "", //ปีงบประมาณที่เข้ารับการฝึกอบรม
|
|
trainingStart: "", //วันเริ่มต้นการฝึกอบรม
|
|
trainingEnd: "", //วันสิ้นสุดการฝึกอบรม
|
|
totalTraining: "", //รวมระยะเวลาในการฝึกอบรม
|
|
location: "", //สถานที่ไปศึกษาดูงาน
|
|
topic: "", //หัวข้อการไปศึกษาดูงาน
|
|
studyStart: "", //วันเริ่มต้นการศึกษาดูงาน
|
|
studyEnd: "", //วันสิ้นสุดการศึกษาดูงาน
|
|
organizingTraining: "", //หน่วยงานที่รับผิดชอบจัดการอบรม
|
|
});
|
|
|
|
const fieldLabels = {
|
|
citizenId: "เลขประจําตัวประชาชน",
|
|
name: "ชื่อ - นามสกุล",
|
|
position: "ตําแหน่ง",
|
|
type: "ประเภทตําแหน่ง",
|
|
|
|
level: "ระดับตําแหน่ง",
|
|
positionSide: "ตําแหน่งทางการบริหาร",
|
|
oc: "หน่วยงานที่สังกัด",
|
|
};
|
|
|
|
const fieldLabelsProject = {
|
|
project: "ชื่อโครงการ/หลักสูตรการฝึกอบรม",
|
|
year: "ปีงบประมาณที่เข้ารับการฝึกอบรม",
|
|
trainingStart: "วันเริ่มต้นการฝึกอบรม",
|
|
trainingEnd: "วันสิ้นสุดการฝึกอบรม",
|
|
totalTraining: "รวมระยะเวลาในการฝึกอบรม",
|
|
|
|
location: "สถานที่ไปศึกษาดูงาน",
|
|
topic: "หัวข้อการไปศึกษาดูงาน",
|
|
studyStart: "วันเริ่มต้นการศึกษาดูงาน",
|
|
studyEnd: "วันสิ้นสุดการศึกษาดูงาน",
|
|
organizingTraining: "หน่วยงานที่รับผิดชอบจัดการอบรม",
|
|
};
|
|
|
|
const visibleColumnsGov = ref<string[]>([
|
|
"citizenId",
|
|
"name",
|
|
"position",
|
|
"type",
|
|
"level",
|
|
"positionSide",
|
|
]);
|
|
|
|
const visibleColumnsProject = ref<string[]>([
|
|
"project",
|
|
"year",
|
|
"organizingTraining",
|
|
]);
|
|
|
|
const columnsGov = ref<QTableProps["columns"]>([
|
|
{
|
|
name: "citizenId",
|
|
align: "left",
|
|
label: "เลขประจำตัวประชาชน",
|
|
sortable: true,
|
|
field: "citizenId",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "name",
|
|
align: "left",
|
|
label: "ชื่อ - นามสกุล",
|
|
sortable: true,
|
|
field: "name",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
|
|
{
|
|
name: "position",
|
|
align: "left",
|
|
label: "ตําแหน่ง",
|
|
sortable: true,
|
|
field: "position",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "type",
|
|
align: "left",
|
|
label: "ประเภทตำแหน่ง",
|
|
sortable: true,
|
|
field: "type",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "level",
|
|
align: "left",
|
|
label: "ระดับตำแหน่ง",
|
|
sortable: true,
|
|
field: "level",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "positionSide",
|
|
align: "left",
|
|
label: "ตําแหน่งทางการบริหาร",
|
|
sortable: true,
|
|
field: "positionSide",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
]);
|
|
|
|
const columnsProject = ref<QTableProps["columns"]>([
|
|
{
|
|
name: "project",
|
|
align: "left",
|
|
label: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
|
|
sortable: true,
|
|
field: "project",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
{
|
|
name: "year",
|
|
align: "left",
|
|
label: "ปีงบประมาณ",
|
|
sortable: true,
|
|
field: "year",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
|
|
{
|
|
name: "organizingTraining",
|
|
align: "left",
|
|
label: "หน่วยงานที่รับผิดชอบ",
|
|
sortable: true,
|
|
field: "organizingTraining",
|
|
headerStyle: "font-size: 14px",
|
|
style: "font-size: 14px",
|
|
},
|
|
]);
|
|
|
|
/** เปิด dialog ข้าราชการ*/
|
|
function openDialogGov() {
|
|
store.columns = columnsGov.value;
|
|
store.visibleColumns = visibleColumnsGov.value;
|
|
modalDialogGov.value = true;
|
|
}
|
|
|
|
/** เปิด dialog โครงการ */
|
|
function openDialogProject() {
|
|
store.columns = columnsProject.value;
|
|
store.visibleColumns = visibleColumnsProject.value;
|
|
|
|
modalDialogProject.value = true;
|
|
}
|
|
|
|
function getClass() {
|
|
return "inputgreen";
|
|
}
|
|
/** save */
|
|
function onSubmit() {
|
|
// const body = {
|
|
// citizenId:formMain.citizenId,
|
|
// name:formMain.name,
|
|
// position:formMain.position,
|
|
// type:formMain.type,
|
|
// level:formMain.level,
|
|
// positionSide:formMain.positionSide,
|
|
// oc:formMain.oc,
|
|
|
|
// project:formMainProject.project,
|
|
// year:formMainProject.year,
|
|
// trainingStart:formMainProject.trainingStart,
|
|
// trainingEnd:formMainProject.trainingEnd,
|
|
// totalTraining:formMainProject.totalTraining,
|
|
// location:formMainProject.location,
|
|
// topic:formMainProject.topic,
|
|
// studyStart:formMainProject.studyStart,
|
|
// studyEnd:formMainProject.studyEnd,
|
|
// organizingTraining:formMainProject.organizingTraining,
|
|
|
|
// order:order.value,
|
|
// dateOrder:dateOrder.value,
|
|
// }
|
|
// dialogConfirm($q,()=>{
|
|
// showLoader()
|
|
// http
|
|
// .post(config.API.,body)
|
|
// .then((res)=>{
|
|
|
|
// }).catch((e)=>{
|
|
// messageError($q,e)
|
|
// }).finally(()=>{
|
|
// hideLoader()
|
|
// })
|
|
// })
|
|
|
|
router.push(`/development/history`)
|
|
}
|
|
</script>
|
|
<template>
|
|
<div class="toptitle text-dark">
|
|
<q-btn
|
|
icon="mdi-arrow-left"
|
|
unelevated
|
|
round
|
|
dense
|
|
flat
|
|
color="primary"
|
|
class="q-mr-sm"
|
|
@click="router.go(-1)"
|
|
/>
|
|
<span class=""
|
|
>เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ</span
|
|
>
|
|
</div>
|
|
<q-card flat bordered>
|
|
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
|
<q-card-section>
|
|
<q-card flat bordered style="border: 1px solid #d6dee1">
|
|
<div class="col-12 text-weight-bold bg-grey-1 q-py-sm q-px-md">
|
|
ข้อมูลข้าราชการ
|
|
|
|
<q-btn
|
|
flat
|
|
class="btn-fixed-width"
|
|
color="teal"
|
|
label="เลือกข้าราชการ"
|
|
icon="add"
|
|
@click="openDialogGov()"
|
|
/>
|
|
</div>
|
|
<div class="col-12"><q-separator /></div>
|
|
<div class="row q-col-gutter-md q-pa-md">
|
|
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
|
|
<div
|
|
class="row"
|
|
v-for="(field, index) in Object.keys(fieldLabels).slice(0, 4)"
|
|
:key="index"
|
|
>
|
|
<div class="col-12 col-sm-12 col-md-4">
|
|
<span class="text-grey-6 text-weight-medium">{{
|
|
fieldLabels[field as keyof typeof fieldLabels]
|
|
}}</span>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-8">
|
|
<span>{{ formMain[field] ? formMain[field] : "-" }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
|
|
<div
|
|
class="row"
|
|
v-for="(field, index) in Object.keys(fieldLabels).slice(4, 7)"
|
|
:key="index"
|
|
>
|
|
<div class="col-12 col-sm-12 col-md-4">
|
|
<span class="text-grey-6 text-weight-medium">{{
|
|
fieldLabels[field as keyof typeof fieldLabels]
|
|
}}</span>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-8">
|
|
<span>{{ formMain[field] ? formMain[field] : "-" }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</q-card>
|
|
|
|
<q-card flat bordered class="q-mt-md" style="border: 1px solid #d6dee1">
|
|
<div class="col-12 text-weight-bold bg-grey-1 q-py-sm q-px-md">
|
|
ข้อมูลโครงการ
|
|
<q-btn
|
|
flat
|
|
class="btn-fixed-width"
|
|
color="teal"
|
|
label="เลือกโครงการ"
|
|
icon="add"
|
|
@click="openDialogProject()"
|
|
/>
|
|
</div>
|
|
<div class="col-12"><q-separator /></div>
|
|
<div class="row q-col-gutter-md q-pa-md">
|
|
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
|
|
<div
|
|
class="row"
|
|
v-for="(field, index) in Object.keys(fieldLabelsProject).slice(
|
|
0,
|
|
5
|
|
)"
|
|
:key="index"
|
|
>
|
|
<div class="col-12 col-sm-12 col-md-4">
|
|
<span class="text-grey-6 text-weight-medium">{{
|
|
fieldLabelsProject[field as keyof typeof fieldLabelsProject]
|
|
}}</span>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-8">
|
|
<span>{{
|
|
formMainProject[field] ? formMainProject[field] : "-"
|
|
}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12 col-sm-6 col-md-6 q-gutter-y-sm">
|
|
<div
|
|
class="row"
|
|
v-for="(field, index) in Object.keys(fieldLabelsProject).slice(
|
|
5,
|
|
10
|
|
)"
|
|
:key="index"
|
|
>
|
|
<div class="col-12 col-sm-12 col-md-4">
|
|
<span class="text-grey-6 text-weight-medium">{{
|
|
fieldLabelsProject[field as keyof typeof fieldLabelsProject]
|
|
}}</span>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-8">
|
|
<span>{{
|
|
formMainProject[field] ? formMainProject[field] : "-"
|
|
}}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</q-card>
|
|
|
|
<div class="row q-col-gutter-sm q-mt-md">
|
|
<div class="col-3">
|
|
<q-input
|
|
label="เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"
|
|
v-model="order"
|
|
dense
|
|
outlined
|
|
:class="getClass()"
|
|
hide-bottom-space
|
|
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง/เลขที่หนังสืออนุมัติ'}`,]"
|
|
/>
|
|
</div>
|
|
<div class="col-3">
|
|
<q-input
|
|
label="คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"
|
|
v-model="dateOrder"
|
|
dense
|
|
outlined
|
|
:class="getClass()"
|
|
hide-bottom-space
|
|
:rules="[(val:string) => !!val || `${'กรุณากรอกคำสั่งลงวันที่/หนังสืออนุมัติลงวันที่'}`,]"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</q-card-section>
|
|
<q-separator />
|
|
<div class="text-right q-pa-sm">
|
|
<q-btn
|
|
dense
|
|
unelevated
|
|
label="บันทึก"
|
|
id="onSubmit"
|
|
type="submit"
|
|
color="public"
|
|
class="q-px-md"
|
|
>
|
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
|
</q-btn>
|
|
</div>
|
|
</q-form>
|
|
</q-card>
|
|
|
|
<DialogGov v-model:modal="modalDialogGov" />
|
|
<DialogProject v-model:modal="modalDialogProject" />
|
|
</template>
|