Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-01-24 14:38:36 +07:00
commit 6f23d896c1
7 changed files with 1655 additions and 6 deletions

View file

@ -162,7 +162,13 @@ const Ops = ref<DisciplineOps>({
{ id: "4", name: "ร้ายแรง", disable: true },
{ id: "ปลดออก", name: "ปลดออก", disable: false },
{ id: "ไล่ออก", name: "ไล่ออก", disable: false },
{ id: "อื่นๆ", name: "อื่นๆ", disable: false },
{ id: "5", name: "อื่นๆ", disable: true },
{ id: "พักราชการ", name: "พักราชการ", disable: false },
{
id: "ให้ออกจากราชการไว้ก่อน",
name: "ให้ออกจากราชการไว้ก่อน",
disable: false,
},
],
});
const OpsFilter = ref<DisciplineOps>({
@ -182,7 +188,13 @@ const OpsFilter = ref<DisciplineOps>({
{ id: "4", name: "ร้ายแรง", disable: true },
{ id: "ปลดออก", name: "ปลดออก", disable: false },
{ id: "ไล่ออก", name: "ไล่ออก", disable: false },
{ id: "อื่นๆ", name: "อื่นๆ", disable: false },
{ id: "5", name: "อื่นๆ", disable: true },
{ id: "พักราชการ", name: "พักราชการ", disable: false },
{
id: "ให้ออกจากราชการไว้ก่อน",
name: "ให้ออกจากราชการไว้ก่อน",
disable: false,
},
],
});

View file

@ -0,0 +1,516 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** props*/
const isLeave = defineModel<boolean>("isLeave", {
required: true,
});
/** Table*/
const rows = ref<any[]>([]); //
const rowsMain = ref<any[]>([]); //
const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "dateStart",
align: "left",
label: "วันที่เริ่มต้น",
sortable: true,
field: "dateStart",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateEnd",
align: "left",
label: "วันที่สิ้นสุด",
sortable: true,
field: "dateEnd",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
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: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.status ? "Active" : "NoActive";
},
},
]);
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"posNo",
"position",
"status",
]);
/** Dialog*/
const isStarusEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowId = ref<string>("");
const formData = reactive({
dateStart: null,
dateEnd: null,
posNo: "",
position: "",
status: false,
});
/** ฟังก์ค้นหาข้อมูลรายการ */
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function fetchData() {
const data = [
{
id: "1",
dateStart: new Date(),
dateEnd: new Date(),
posNo: "ขพน. 1",
position: "ผู้อำนวยการ",
status: true,
},
];
rows.value = data;
rowsMain.value = data;
}
function onSubmit() {
dialogConfirm($q, () => {
success($q, "รอ API");
closeDialogForm();
});
}
function openEditDialog(data: any) {
modal.value = true;
isStarusEdit.value = true;
rowId.value = data.id;
formData.dateStart = data.dateStart;
formData.dateEnd = data.dateEnd;
formData.posNo = data.posNo;
formData.position = data.position;
formData.status = data.status;
}
function showHistoryDialog(id: string) {
modalHistory.value = true;
rowId.value = id;
}
function closeDialogForm() {
modal.value = false;
isStarusEdit.value = false;
rowId.value = "";
formData.dateStart = null;
formData.dateEnd = null;
formData.posNo = "";
formData.position = "";
formData.status = false;
}
onMounted(() => {
fetchData();
});
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click.stop.prevent="modal = true"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-space />
<q-input
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-if="mode == 'table'"
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
<q-btn-toggle
v-model="mode"
dense
class="no-shadow toggle-borderd"
toggle-color="grey-4"
:options="[
{ value: 'table', slot: 'table' },
{ value: 'card', slot: 'card' },
]"
>
<template v-slot:table>
<q-icon
name="format_list_bulleted"
size="24px"
:style="{
color: mode === 'table' ? '#787B7C' : '#C9D3DB',
}"
/>
</template>
<template v-slot:card>
<q-icon
name="mdi-view-grid-outline"
size="24px"
:style="{
color: mode === 'card' ? '#787B7C' : '#C9D3DB',
}"
/>
</template>
</q-btn-toggle>
</div>
<d-table
:card-container-class="mode === 'card' ? 'q-col-gutter-md' : ''"
:grid="mode === 'card'"
ref="table"
row-key="id"
flat
bordered
dense
:columns="columns"
:rows="rows"
:paging="true"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width></q-th>
<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" v-if="mode === 'table'">
<q-tr :props="props">
<q-td auto-width>
<q-btn
flat
dense
round
color="deep-purple"
icon="mdi-history"
@click.stop.prevent="showHistoryDialog(props.row.id)"
>
<q-tooltip>ประวแกไขว</q-tooltip>
</q-btn>
<q-btn
flat
dense
round
color="edit"
icon="edit"
@click.stop.prevent="openEditDialog(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:item="props" v-else>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-card flat bordered class="q-pa-none">
<div class="row bg-grey-3">
<q-space />
<div>
<q-btn
color="deep-purple"
icon="mdi-history"
flat
round
@click.stop.prevent="showHistoryDialog(props.row.id)"
>
<q-tooltip>ประวแกไขว</q-tooltip>
</q-btn>
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
color="edit"
icon="edit"
flat
round
@click.stop.prevent="openEditDialog(props.row)"
>
<q-tooltip>แกไข</q-tooltip>
</q-btn>
</div>
</div>
<q-separator />
<q-card-section class="q-pa-none">
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
นทเรมต
</div>
<div class="col-3">
{{ props.row.dateStart ? date2Thai(props.row.dateStart) : "-" }}
</div>
<div class="col-3 text-grey-6 text-weight-medium">
นทนส
</div>
<div class="col-3">
{{ props.row.dateEnd ? date2Thai(props.row.dateEnd) : "-" }}
</div>
</div>
<q-separator />
<div class="row q-pa-sm bg-grey-2">
<div class="col-3 text-grey-6 text-weight-medium">
ตำแหนงเลขท
</div>
<div class="col-3">
{{ props.row.posNo ? props.row.posNo : "-" }}
</div>
<div class="col-3 text-grey-6 text-weight-medium">ตำแหน</div>
<div class="col-3">
{{ props.row.position ? props.row.position : "-" }}
</div>
</div>
<q-separator />
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">สถานะ</div>
<div class="col-3">
{{ props.row.status ? "Active" : "NoActive" }}
</div>
</div>
<q-separator />
</q-card-section>
</q-card>
</div>
</template>
</d-table>
<q-dialog v-model="modal" persistent>
<q-card style="width: 700px; max-width: 80vw">
<q-form @submit.prevent greedy @validation-success="onSubmit()">
<DialogHeader
:tittle="
isStarusEdit
? 'แก้ไขข้อมูลรายการรักษาการในตำแหน่ง'
: 'เพิ่มข้อมูลรายการรักษาการในตำแหน่ง'
"
:close="closeDialogForm"
/>
<q-separator />
<q-card-section style="max-height: 50vh">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
v-model="formData.dateStart"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
:max-date="formData.dateEnd"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
ref="dateRef"
class="full-width inputgreen cursor-pointer"
outlined
dense
:model-value="date2Thai(formData.dateStart)"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่เริ่มต้น'}`]"
hide-bottom-space
:label="`${'วันที่เริ่มต้น'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
v-model="formData.dateEnd"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
:min-date="formData.dateStart"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
ref="dateRef"
class="full-width inputgreen cursor-pointer"
outlined
dense
:model-value="date2Thai(formData.dateEnd)"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่สิ้นสุด'}`]"
hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
v-model="formData.posNo"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งเลขที่'}`]"
hide-bottom-space
:label="`${'ตำแหน่งเลขที่'}`"
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
v-model="formData.position"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง'}`"
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-checkbox
v-model="formData.status"
label="Active"
keep-color="primary"
/>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
</template>
<style scoped></style>

View file

@ -0,0 +1,242 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
import { useRoute } from "vue-router";
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //data history
const rowsMain = ref<ResponseObject[]>([]); //data history
const columns = ref<QTableProps["columns"]>([
{
name: "dateStart",
align: "left",
label: "วันที่เริ่มต้น",
sortable: true,
field: "dateStart",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateEnd",
align: "left",
label: "วันที่สิ้นสุด",
sortable: true,
field: "dateEnd",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
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: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v, false, true),
},
]);
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"posNo",
"position",
"status",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/** function fetch ข้อมูลประวติการแก้ไขข้อมูล*/
function fetchDataHistory() {
// showLoader();
// http
// .get(config.API.profileNewDutyHisByDutyId(id.value, empType.value))
// .then((res) => {
// let data = res.data.result;
// rows.value = [];
// data.map((e: ResponseObject) => {
// rows.value.push({
// id: e.id,
// dateStart: new Date(e.dateStart),
// dateEnd: new Date(e.dateEnd),
// detail: e.detail,
// reference: e.reference,
// refCommandNo: e.refCommandNo,
// refCommandDate:
// e.refCommandDate == null ? null : new Date(e.refCommandDate),
// createdFullName: e.createdFullName,
// createdAt: new Date(e.createdAt),
// lastUpdateFullName: e.lastUpdateFullName,
// lastUpdatedAt: e.lastUpdatedAt,
// });
// });
// rowsMain.value = rows.value;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* การเปลยนแปลงของ modal
* modal เป true เรยก fetchDataHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
fetchDataHistory();
filterKeyword.value = "";
} else {
filterKeyword.value = "";
}
});
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขรักษาการในตำแหน่ง"
:close="() => ((modal = false), (rows = []))"
/>
<q-separator />
<q-card-section style="max-height: 60vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</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"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columns"
:rows="rows"
:paging="true"
v-model:pagination="historyPagination"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="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">
<q-td v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template>

View file

@ -0,0 +1,617 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernmentHistory.vue";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** props*/
const isLeave = defineModel<boolean>("isLeave", {
required: true,
});
/** Table*/
const rows = ref<any[]>([]); //
const rowsMain = ref<any[]>([]); //
const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "orgHelpGovernment",
align: "left",
label: "หน่วยงานที่ให้ช่วยราชการ",
sortable: true,
field: "orgHelpGovernment",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateStart",
align: "left",
label: "วันเริ่มช่วยราชการ",
sortable: true,
field: "dateStart",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateEnd",
align: "left",
label: "วันสิ้นสุดการช่วยราชการ",
sortable: true,
field: "dateEnd",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "refNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refNo",
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",
},
]);
const visibleColumns = ref<String[]>([
"orgHelpGovernment",
"dateStart",
"dateEnd",
"refNo",
"document",
]);
/** Dialog*/
const isStarusEdit = ref<boolean>(false);
const rowId = ref<string>("");
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const formData = reactive({
org: "",
dateStart: null,
dateEnd: null,
refNo: "",
document: "",
});
const fileUpload = ref<File>();
/** ฟังก์ค้นหาข้อมูลรายการ */
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function fetchData() {
const data = [
{
id: "1",
orgHelpGovernment: "สำนักงานเขตพระนคร",
dateStart: new Date(),
dateEnd: new Date(),
refNo: "งด. 5013/2568",
document: "เลื่อนเงินเดือนคำสั่ง สนท.ที่ 91/2544 ลว.21 พ.ย. 44",
isUpload: true,
},
];
rows.value = data;
rowsMain.value = data;
}
function onSubmit() {
dialogConfirm($q, () => {
success($q, "รอ API");
closeDialogForm();
});
}
function openEditDialog(data: any) {
modal.value = true;
isStarusEdit.value = true;
rowId.value = data.id;
formData.org = data.orgHelpGovernment;
formData.dateStart = data.dateStart;
formData.dateEnd = data.dateEnd;
formData.refNo = data.refNo;
formData.document = data.document;
}
function showHistoryDialog(id: string) {
modalHistory.value = true;
rowId.value = id;
}
function closeDialogForm() {
modal.value = false;
isStarusEdit.value = false;
rowId.value = "";
formData.org = "";
formData.dateStart = null;
formData.dateEnd = null;
formData.refNo = "";
formData.document = "";
fileUpload.value = undefined;
}
onMounted(() => {
fetchData();
});
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click.stop.prevent="modal = true"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-space />
<q-input
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-if="mode == 'table'"
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
<q-btn-toggle
v-model="mode"
dense
class="no-shadow toggle-borderd"
toggle-color="grey-4"
:options="[
{ value: 'table', slot: 'table' },
{ value: 'card', slot: 'card' },
]"
>
<template v-slot:table>
<q-icon
name="format_list_bulleted"
size="24px"
:style="{
color: mode === 'table' ? '#787B7C' : '#C9D3DB',
}"
/>
</template>
<template v-slot:card>
<q-icon
name="mdi-view-grid-outline"
size="24px"
:style="{
color: mode === 'card' ? '#787B7C' : '#C9D3DB',
}"
/>
</template>
</q-btn-toggle>
</div>
<d-table
:card-container-class="mode === 'card' ? 'q-col-gutter-md' : ''"
:grid="mode === 'card'"
ref="table"
row-key="id"
flat
bordered
dense
:columns="columns"
:rows="rows"
:paging="true"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
>
>
<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-th auto-width />
</q-tr>
</template>
<template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props">
<q-td auto-width>
<q-btn
flat
dense
round
color="deep-purple"
icon="mdi-history"
@click.stop.prevent="showHistoryDialog(props.row.id)"
>
<q-tooltip>ประวแกไขว</q-tooltip>
</q-btn>
<q-btn
flat
dense
round
color="edit"
icon="edit"
@click.stop.prevent="openEditDialog(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td auto-width>
<q-btn
flat
dense
round
color="green"
icon="mdi-file-document-outline"
v-if="props.row.isUpload"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
<template v-slot:item="props" v-else>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-card flat bordered class="q-pa-none">
<div class="row bg-grey-3">
<q-space />
<div>
<q-btn
color="deep-purple"
icon="mdi-history"
flat
round
@click.stop.prevent="showHistoryDialog(props.row.id)"
>
<q-tooltip>ประวแกไขว</q-tooltip>
</q-btn>
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
color="edit"
icon="edit"
flat
round
@click.stop.prevent="openEditDialog(props.row)"
>
<q-tooltip>แกไข</q-tooltip>
</q-btn>
</div>
</div>
<q-separator />
<q-card-section class="q-pa-none">
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
หนวยงานทใหวยราชการ
</div>
<div class="col-9">
{{
props.row.orgHelpGovernment
? props.row.orgHelpGovernment
: "-"
}}
</div>
</div>
<div class="row q-pa-sm bg-grey-2">
<div class="col-3 text-grey-6 text-weight-medium">
นทเรมต
</div>
<div class="col-3">
{{ props.row.dateStart ? date2Thai(props.row.dateStart) : "-" }}
</div>
<div class="col-3 text-grey-6 text-weight-medium">
นทนส
</div>
<div class="col-3">
{{ props.row.dateEnd ? date2Thai(props.row.dateEnd) : "-" }}
</div>
</div>
<q-separator />
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
เลขทคำส
</div>
<div class="col-9">
{{ props.row.refNo ? props.row.refNo : "-" }}
</div>
</div>
<q-separator />
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
เอกสารอางอ
</div>
<div class="col-9">
{{ props.row.document ? props.row.document : "-" }}
</div>
</div>
<q-separator />
</q-card-section>
</q-card>
</div>
</template>
</d-table>
<q-dialog v-model="modal" persistent>
<q-card style="width: 700px; max-width: 80vw">
<q-form @submit.prevent greedy @validation-success="onSubmit()">
<DialogHeader
:tittle="
isStarusEdit
? 'แก้ไขข้อมูลรายการช่วยราชการ'
: 'เพิ่มข้อมูลรายการช่วยราชการ'
"
:close="closeDialogForm"
/>
<q-separator />
<q-card-section style="max-height: 50vh">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
v-model="formData.org"
:rules="[(val:string) => !!val || `${'กรุณากรอกหน่วยงานที่ให้ช่วยราชการ'}`]"
hide-bottom-space
:label="`${'หน่วยงานที่ให้ช่วยราชการ'}`"
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
v-model="formData.dateStart"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
:max-date="formData.dateEnd"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
ref="dateRef"
class="full-width inputgreen cursor-pointer"
outlined
dense
:model-value="date2Thai(formData.dateStart)"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่เริ่มต้น'}`]"
hide-bottom-space
:label="`${'วันที่เริ่มต้น'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
v-model="formData.dateEnd"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
:min-date="formData.dateStart"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
ref="dateRef"
class="full-width inputgreen cursor-pointer"
outlined
dense
:model-value="date2Thai(formData.dateEnd)"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่สิ้นสุด'}`]"
hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
v-model="formData.refNo"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
v-model="formData.document"
hide-bottom-space
:label="`${'เอกสารอ้างอิง'}`"
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-uploader
color="gray"
type="file"
flat
ref="uploader"
class="full-width"
text-color="white"
:max-size="10000000"
accept=".pdf,"
bordered
label="[ไฟล์ pdf ขนาดไม่เกิน 10MB]"
@added="(v:any) => (fileUpload = v[0])"
>
<template v-slot:header="scope">
<div class="row no-wrap items-center q-pa-sm q-gutter-xs">
<q-btn
v-if="scope.queuedFiles.length > 0"
icon="clear_all"
@click="scope.removeQueuedFiles"
round
dense
flat
>
<q-tooltip>ลบทงหมด</q-tooltip>
</q-btn>
<q-btn
v-if="scope.uploadedFiles.length > 0"
icon="done_all"
@click="scope.removeUploadedFiles"
round
dense
flat
>
<q-tooltip>ลบไฟลปโหลด</q-tooltip>
</q-btn>
<q-spinner
v-if="scope.isUploading"
class="q-uploader__spinner"
/>
<div class="col">
<div class="q-uploader__title">
{{ "[ไฟล์ pdf ขนาดไม่เกิน 10MB]" }}
</div>
<div class="q-uploader__subtitle">
{{ scope.uploadSizeLabel }} /
{{ scope.uploadProgressLabel }}
</div>
</div>
<q-btn
v-if="scope.canAddFiles"
type="a"
icon="add_box"
@click="scope.pickFiles"
round
dense
flat
>
<q-uploader-add-trigger />
<q-tooltip>เลอกไฟล</q-tooltip>
</q-btn>
<q-btn
v-if="scope.isUploading"
icon="clear"
@click="scope.abort"
round
dense
flat
>
<q-tooltip>ยกเลกการอปโหลด</q-tooltip>
</q-btn>
</div>
</template>
</q-uploader>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
</template>
<style scoped></style>

View file

@ -0,0 +1,242 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
import { useRoute } from "vue-router";
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //data history
const rowsMain = ref<ResponseObject[]>([]); //data history
const columns = ref<QTableProps["columns"]>([
{
name: "orgHelpGovernment",
align: "left",
label: "หน่วยงานที่ให้ช่วยราชการ",
sortable: true,
field: "orgHelpGovernment",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateStart",
align: "left",
label: "วันเริ่มช่วยราชการ",
sortable: true,
field: "dateStart",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateEnd",
align: "left",
label: "วันสิ้นสุดการช่วยราชการ",
sortable: true,
field: "dateEnd",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "refNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refNo",
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: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v, false, true),
},
]);
const visibleColumns = ref<String[]>([
"orgHelpGovernment",
"dateStart",
"dateEnd",
"refNo",
"document",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/** function fetch ข้อมูลประวติการแก้ไขข้อมูล*/
function fetchDataHistory() {
// showLoader();
// http
// .get(config.API.profileNewDutyHisByDutyId(id.value, empType.value))
// .then((res) => {
// let data = res.data.result;
// rows.value = [];
// data.map((e: ResponseObject) => {
// rows.value.push({
// id: e.id,
// dateStart: new Date(e.dateStart),
// dateEnd: new Date(e.dateEnd),
// detail: e.detail,
// reference: e.reference,
// refCommandNo: e.refCommandNo,
// refCommandDate:
// e.refCommandDate == null ? null : new Date(e.refCommandDate),
// createdFullName: e.createdFullName,
// createdAt: new Date(e.createdAt),
// lastUpdateFullName: e.lastUpdateFullName,
// lastUpdatedAt: e.lastUpdatedAt,
// });
// });
// rowsMain.value = rows.value;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* การเปลยนแปลงของ modal
* modal เป true เรยก fetchDataHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
fetchDataHistory();
filterKeyword.value = "";
} else {
filterKeyword.value = "";
}
});
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขรายการช่วยราชการ"
:close="() => ((modal = false), (rows = []))"
/>
<q-separator />
<q-card-section style="max-height: 60vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</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"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columns"
:rows="rows"
:paging="true"
v-model:pagination="historyPagination"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="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">
<q-td v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template>

View file

@ -6,6 +6,8 @@ import Info from "@/modules/04_registryPerson/components/detail/GovernmentInform
import Discipline from "@/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue"; //
import Leave from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_Leave.vue"; //
import PerformSpecialWork from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue"; //
import ActingPos from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue"; //
import HelpGovernmentDetail from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue"; //
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
@ -35,21 +37,29 @@ const storeRegistry = useRegistryNewDataStore();
<q-tab name="2" label="วินัย" />
<q-tab name="3" label="การลา" />
<q-tab name="4" label="ปฏิบัติราชการพิเศษ" />
<q-tab name="5" label="รักษาการในตำแหน่ง" />
<q-tab name="6" label="ช่วยราชการ" />
</q-tabs>
<q-separator />
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="1">
<Info :is-leave="storeRegistry.isLeave"/>
<Info :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
<q-tab-panel name="2">
<Discipline :is-leave="storeRegistry.isLeave"/>
<Discipline :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
<q-tab-panel name="3">
<Leave :is-leave="storeRegistry.isLeave"/>
<Leave :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
<q-tab-panel name="4">
<PerformSpecialWork :is-leave="storeRegistry.isLeave"/>
<PerformSpecialWork :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
<q-tab-panel name="5">
<ActingPos :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
<q-tab-panel name="6">
<HelpGovernmentDetail :is-leave="storeRegistry.isLeave" />
</q-tab-panel>
</q-tab-panels>
</template>

View file

@ -38,6 +38,7 @@ const visibleColumns = ref<string[]>([
"profileType",
"title",
"name",
"position",
"positionType",
"positionLevel",
"organization",
@ -89,6 +90,15 @@ const columns = ref<QTableProps["columns"]>([
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: "positionLevel",
align: "left",