UI เพิ่มประวัติการฝึกอบรม/ดูงานของข้าราชการกรุงเทพมหานครสามัญ(ยังไม่เสร็จดี)

This commit is contained in:
STW_TTTY\stwtt 2024-04-01 18:03:31 +07:00
parent ccf4e3d47d
commit 648c613f4f
6 changed files with 699 additions and 5 deletions

View file

@ -0,0 +1,236 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import type { FormAddHistory } from "@/modules/15_development/interface/request/Main";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import Dialog from "@/modules/15_development/components/history/Dialog.vue";
import type { QTableProps } from "quasar";
const router = useRouter();
const store = useDevelopmentDataStore();
const modalDialog = ref<boolean>(false);
const typeSelect = ref<string>("");
/** ตัวแปรข้อมูลหลัก */
const formMain = reactive<FormAddHistory>({
citizenId: "1XXXXXXXXXXXX", //
name: "นางสาวรัชภรณ์ ภักดี", // -
position: "นักบริหาร", //
type: "บริหาร", //
level: "ชำนาญการพิเศษ", //
positionSide: "นักบริหาร", //
oc: "กลุ่มงานช่วยนักบริหาร", //
});
const fieldLabels = {
citizenId: "เลขประจําตัวประชาชน",
name: "ชื่อ - นามสกุล",
position: "ตําแหน่ง",
type: "ประเภทตําแหน่ง",
level: "ระดับตําแหน่ง",
positionSide: "ตําแหน่งทางการบริหาร",
oc: "หน่วยงานที่สังกัด",
};
const visibleColumnsGov = ref<string[]>([
"citizenId",
"name",
"position",
"type",
"level",
"positionSide",
]);
const visibleColumnsProject = ref<string[]>(["project", "year", "oc"]);
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: "oc",
align: "left",
label: "หน่วยงานที่รับผิดชอบ",
sortable: true,
field: "oc",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** เปิด dialog ข้าราชการ/โครงการ */
function openDialog(select: string) {
if (select == "GOV") {
store.columns = columnsGov.value;
store.visibleColumns = visibleColumnsGov.value;
} else {
store.columns = columnsProject.value;
store.visibleColumns = visibleColumnsProject.value;
}
modalDialog.value = true;
typeSelect.value = select;
}
</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 class="q-pa-md">
<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="openDialog('GOV')"
/>
</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="openDialog('project')"
/>
</div>
<div class="col-12"><q-separator /></div>
</q-card>
</q-card>
<Dialog v-model:modal="modalDialog" v-model:type="typeSelect" />
</template>

View file

@ -0,0 +1,164 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import Header from "@/components/DialogHeader.vue";
import type { DataOption } from "@/modules/15_development/interface/index/Main";
import { useDevelopmentDataStore } from '@/modules/15_development/store/developmentStore'
const store = useDevelopmentDataStore()
const modal = defineModel<boolean>("modal", { required: true });
const type = defineModel<string>("type", { required: true });
const search = ref<string>("");
const inputSearch = ref<string>("");
const govOp = ref<DataOption[]>([
{
id: "citizenId",
name: "เลขประจำตัวประชาชน",
},
{
id: "prefix",
name: "คำนำหน้า",
},
{
id: "fullName",
name: "ชื่อ - นามสกุล",
},
]);
const projectOp = ref<DataOption[]>([
{
id: "ID1",
name: "ชื่อโครงการ",
},
{
id: "ID2",
name: "ปีงบประมาณ",
},
{
id: "ID3",
name: "ชื่อหน่วยงานที่รับผิดชอบ",
},
]);
/** save ข้อมูล */
function onSubmit() {}
/** ปิด dialog */
function closeDialog() {
modal.value = false;
}
/** class */
function getClass() {
return "inputgreen";
}
watch(
() => type.value,
() => {
if (type.value == "GOV") {
search.value = "citizenId";
} else {
search.value = "ID1";
}
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 60%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<Header
:tittle="type == 'GOV' ? 'เลือกข้าราชการ' : 'เลือกโครงการ'"
:close="closeDialog"
/>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-x-sm">
<div class="col-2">
<q-select
dense
outlined
label="ค้นหาจาก"
v-model="search"
option-label="name"
option-value="id"
:options="type == 'GOV' ? govOp : projectOp"
map-options
emit-value
:class="getClass()"
/>
</div>
<div class="col-8">
<q-input
dense
outlined
label="ค้นหา"
v-model="inputSearch"
:class="getClass()"
/>
</div>
<div class="col-2">
<q-btn
label="ค้นหา"
class="full-width full-height"
unelevated
color="teal"
>
</q-btn>
</div>
</div>
<div class="q-mt-sm">
<d-table
for="table"
ref="table"
:columns="store.columns"
:rows="store.rows"
row-key="subject"
flat
bordered
dense
class="custom-header-table"
:visible-columns="store.visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<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
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>