Refactoring code module 04_registryPerson

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-18 17:24:21 +07:00
parent 1164d79122
commit eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions

View file

@ -1,20 +1,21 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
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 type {
RequestItemsHistoryObject,
FormMain,
} from "@/modules/04_registryPerson/interface/index/government";
import DialogHeader from "@/components/DialogHeader.vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** ฟังชั่นกลาง */
import DialogHeader from "@/components/DialogHeader.vue";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
@ -42,7 +43,6 @@ const formMain = reactive<FormMain>({
positionExecutiveSide: "", //
positionType: "", //
positionPathSide: "", ///
containDate: null, //
workDate: null, //
reasonSameDate: "",
@ -56,13 +56,7 @@ const formMain = reactive<FormMain>({
age: 0, //
});
/** dialog */
const modalEdit = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<RequestItemsHistoryObject[]>([]);
const filterKeyword = ref<string>("");
const modalEdit = ref<boolean>(false); // popup
const containDate = ref<Date | null>(null);
const workDate = ref<Date | null>(null);
const reasonSameDate = ref<string | null>(null);
@ -70,6 +64,10 @@ const containDateRef = ref<object | null>(null);
const workDateRef = ref<object | null>(null);
const reasonSameDateRef = ref<object | null>(null);
//
const filterKeyword = ref<string>(""); //
const modalHistory = ref<boolean>(false); // popup ;
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //
const visibleColumnsHistory = ref<String[]>([
"dateAppoint",
"dateStart",
@ -77,7 +75,6 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "dateAppoint",
@ -206,12 +203,12 @@ function onSubmit() {
/**
* งขอมลราชการ
*/
function getData() {
async function getData() {
showLoader();
http
await http
.get(config.API.profileNewGovernmentById(profileId.value, empType.value))
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
formMain.ocId = data.org ?? "-"; //
formMain.positionId = data.position ?? "-"; //
formMain.positionLine = data.positionField ?? "-"; //
@ -242,12 +239,12 @@ function getData() {
/**
* งขอมลประว
*/
function getDataHistory() {
async function getDataHistory() {
showLoader();
http
await http
.get(config.API.profileNewGovernmentHistory(profileId.value, empType.value))
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
rowsHistory.value = [];
data.map((e: RequestItemsHistoryObject) => {
rowsHistory.value.push({
@ -277,13 +274,15 @@ function getDataHistory() {
})
.catch((e) => {
messageError($q, e);
modalHistory.value = false;
})
.finally(() => {
hideLoader();
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
getData();
});
@ -547,7 +546,7 @@ onMounted(() => {
: null
"
:rules="[
(val) => !!val || 'กรุณาเลือก วัน/เดือน/ปี ที่บรรจุ',
(val:string) => !!val || 'กรุณาเลือก วัน/เดือน/ปี ที่บรรจุ',
]"
label="วัน/เดือน/ปี ที่บรรจุ"
>
@ -588,7 +587,7 @@ onMounted(() => {
? date2Thai(workDate as Date)
: null
"
:rules="[(val) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ']"
label="วัน/เดือน/ปี เริ่มปฎิบัติราชการ"
>
<template v-slot:prepend>
@ -615,7 +614,7 @@ onMounted(() => {
outlined
dense
hide-bottom-space
:rules="[(val) => !!val || 'กรุณากรอก เหตุผลกรณีไม่ตรงกัน']"
:rules="[(val:string) => !!val || 'กรุณากรอก เหตุผลกรณีไม่ตรงกัน']"
v-model="reasonSameDate"
/>
</div>

View file

@ -1,23 +1,24 @@
<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 type {
RequestItemsObject,
FormFilter,
DisciplineOps,
DataOption,
} from "@/modules/04_registryPerson/interface/index/discipline";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/02_DisciplineHistory.vue";
import { useRoute } from "vue-router";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
@ -35,42 +36,20 @@ const profileId = ref<string>(
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
//
const disciplineData = reactive<RequestItemsObject>({
date: null,
level: "",
detail: "",
unStigma: "",
refCommandNo: "",
date: null, ////
level: "", //
detail: "", //
unStigma: "", //
refCommandNo: "", //
profileId: profileId.value,
refCommandDate: null,
refCommandDate: null, // ()
});
const rows = ref<RequestItemsObject[]>([]);
const mode = ref<string>("table");
const filterKeyword = ref<string>("");
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
]);
const rows = ref<RequestItemsObject[]>([]); //
const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -141,19 +120,25 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const dateRef = ref<object | null>(null);
const detailRef = ref<object | null>(null);
const refCommandNoRef = ref<object | null>(null);
const edit = ref<boolean>(false); //
const modal = ref<boolean>(false); //
const modalHistory = ref<boolean>(false); //
const id = ref<string>(""); //id
/** dialog */
const edit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const id = ref<string>("");
const Ops = ref<any>({
const Ops = ref<DisciplineOps>({
levelOptions: [
{ id: "0", name: "ไม่ร้ายแรง", disable: true },
{ id: "ภาคทัณฑ์", name: "ภาคทัณฑ์", disable: false },
@ -173,7 +158,7 @@ const Ops = ref<any>({
{ id: "อื่นๆ", name: "อื่นๆ", disable: false },
],
});
const OpsFilter = ref<any>({
const OpsFilter = ref<DisciplineOps>({
levelOptions: [
{ id: "0", name: "ไม่ร้ายแรง", disable: true },
{ id: "ภาคทัณฑ์", name: "ภาคทัณฑ์", disable: false },
@ -349,6 +334,9 @@ function onSubmit() {
);
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData(profileId.value);
});
@ -490,12 +478,7 @@ onMounted(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
}}
</div>
<div v-else>
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>

View file

@ -1,17 +1,15 @@
<script setup lang="ts">
import { ref, watch, reactive } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import { useRoute } from "vue-router";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/discipline";
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
@ -19,26 +17,16 @@ const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>("");
const rows = ref<RequestItemsObject[]>([]); //select data history
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true }); //
const id = defineModel<string>("id", { required: true }); //id
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
"createdFullName",
"createdAt",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>(""); //
const rows = ref<RequestItemsObject[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -132,18 +120,34 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
"createdFullName",
"createdAt",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* fetch อมลประวการแกไขขอมลว
*/
function getHistory() {
async function getHistory() {
showLoader();
http
await http
.get(
config.API.profileNewDisciplineHisByDisciplineId(id.value, empType.value)
)
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
rows.value = [];
data.map((e: RequestItemsObject) => {
rows.value.push({
@ -166,6 +170,11 @@ function getHistory() {
});
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไขว
*/
watch(modal, (status) => {
if (status == true) {
getHistory();
@ -179,7 +188,10 @@ watch(modal, (status) => {
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%">
<DialogHeader tittle="ประวัติแก้ไขวินัย" :close="() => (modal = false)" />
<DialogHeader
tittle="ประวัติแก้ไขวินัย"
:close="() => ((modal = false), (rows = []))"
/>
<q-separator color="grey-4" />
<q-card-section style="max-height: 60vh" class="scroll">

View file

@ -1,25 +1,27 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { ref, onMounted } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
DetailData,
DataOptionLeave,
DataOption,
ResponseTotalObject,
} from "@/modules/04_registryPerson/interface/index/leave";
import type {
DataLeave,
DataLeaveType,
} from "@/modules/04_registryPerson/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue";
import http from "@/plugins/http";
import config from "@/app.config";
const rowsTotal = ref<ResponseTotalObject[]>([]);
const id = ref<string>("");
const route = useRoute();
const $q = useQuasar();
@ -39,7 +41,8 @@ const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const rowsTotal = ref<ResponseTotalObject[]>([]);
const id = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
@ -47,21 +50,18 @@ const pagination = ref({
const mode = ref<string>("table");
const filterKeyword = ref<string>("");
const rows = ref<DetailData[]>([]);
const modal = ref<boolean>(false);
const edit = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const typeLeave = ref<DataOptionLeave | undefined | null>(); //
const dateRange = ref<[Date, Date]>([new Date(), new Date()]); //
const numLeave = ref<number>(1); //
const statLeave = ref<string>(""); //
const reason = ref<string>(""); //
const numLeave = ref<number>(1);
const dateRange = ref<[Date, Date]>([new Date(), new Date()]);
const numUsedLeave = ref<number>(0);
const typeLeave = ref<any>();
const numUsedLeave = ref<number | undefined>(0);
const typeLeaveOption = ref<DataOptionLeave[]>([]);
const typeLeaveOptionFilter = ref<DataOptionLeave[]>([]);
const statLeave = ref<string>("");
const statLeaveOption = ref<DataOption[]>([
{ id: "approve", name: "ผ่านการอนุมัติ" },
{ id: "reject", name: "ไม่ผ่านการอนุมัติ" },
@ -75,39 +75,8 @@ const statLeaveOptionFilter = ref<DataOption[]>([
{ id: "waitting", name: "รออนุมัติ" },
]);
const statusLeave = (val: string) => {
switch (val) {
case "waitting":
return "รออนุมัติ";
case "reject":
return "ไม่ผ่านการอนุมัติ";
case "approve":
return "ผ่านการอนุมัติ";
case "cancel":
return "ยกเลิก";
default:
return "-";
}
};
const clickEditRowType = () => {
const filter = typeLeaveOptionFilter.value.filter(
(v: DataOptionLeave) => v.id == typeLeave.value
);
if (filter.length > 0) {
numUsedLeave.value = filter[0].totalLeave;
}
};
const visibleColumns = ref<String[]>([
"no",
"typeLeave",
"dateLeave",
"numLeave",
"status",
"reason",
]);
//Table
const rows = ref<DetailData[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -176,6 +145,38 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"no",
"typeLeave",
"dateLeave",
"numLeave",
"status",
"reason",
]);
const statusLeave = (val: string) => {
switch (val) {
case "waitting":
return "รออนุมัติ";
case "reject":
return "ไม่ผ่านการอนุมัติ";
case "approve":
return "ผ่านการอนุมัติ";
case "cancel":
return "ยกเลิก";
default:
return "-";
}
};
const clickEditRowType = () => {
const filter = typeLeaveOptionFilter.value.filter(
(v: DataOptionLeave) => v.id == typeLeave.value?.id
);
if (filter.length > 0) {
numUsedLeave.value = filter[0].totalLeave;
}
};
/**
* function เป dialog อมลการลา
@ -187,7 +188,7 @@ function openDialogAdd() {
http
.get(config.API.profileNewLeaveType())
.then((res) => {
const dataOp = res.data.result.map((item: any) => ({
const dataOp = res.data.result.map((item: DataLeaveType) => ({
id: item.id,
name: item.name,
code: item.code,
@ -271,7 +272,7 @@ function closeDialog() {
modal.value = false;
edit.value = false;
id.value = "";
typeLeave.value = "";
typeLeave.value = null;
statLeave.value = "";
reason.value = "";
dateRange.value = [new Date(), new Date()];
@ -285,7 +286,7 @@ function closeDialog() {
* @param update function
* @param filtername type select
*/
function filterSelector(val: any, update: Function, filtername: string) {
function filterSelector(val: string, update: Function, filtername: string) {
switch (filtername) {
case "typeLeaveOption":
update(() => {
@ -350,7 +351,7 @@ function saveData() {
showLoader();
http
.post(config.API.profileNewLeave(empType.value), {
leaveTypeId: typeLeave.value.id,
leaveTypeId: typeLeave.value?.id,
dateLeaveStart: dateToISO(dateRange.value[0]),
dateLeaveEnd: dateToISO(dateRange.value[1]),
leaveDays: numLeave.value,
@ -377,11 +378,11 @@ function saveData() {
/**
* นทกแกไขขอม
*/
const editData = async () => {
async function editData() {
showLoader();
http
.patch(config.API.profileNewLeaveById(id.value, empType.value), {
leaveTypeId: typeLeave.value.id,
leaveTypeId: typeLeave.value?.id,
dateLeaveStart: dateToISO(dateRange.value[0]),
dateLeaveEnd: dateToISO(dateRange.value[1]),
leaveDays: numLeave.value,
@ -401,19 +402,18 @@ const editData = async () => {
.finally(() => {
hideLoader();
});
};
}
/**
* function fetch อมลรายการ
* function fetch อมลรายการลา
*/
function getData() {
async function getData() {
showLoader();
http
await http
.get(config.API.profileNewLeaveById(profileId.value, empType.value))
.then((res) => {
console.log(res.data.result);
const data = res.data.result;
rows.value = data.map((item: any) => ({
.then(async (res) => {
const data = await res.data.result;
rows.value = data.map((item: DataLeave) => ({
id: item.id,
typeLeave: item.leaveType.name,
code: item.leaveType.refCommandDate,
@ -433,6 +433,9 @@ function getData() {
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
getData();
});

View file

@ -1,10 +1,9 @@
<script setup lang="ts">
import { ref, watch, reactive } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import { useRoute } from "vue-router";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -12,6 +11,9 @@ import type {
DetailData,
FormFilter,
} from "@/modules/04_registryPerson/interface/index/leave";
import type { DataLeave } from "@/modules/04_registryPerson/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
@ -25,7 +27,7 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>("");
const rows = ref<DetailData[]>([]); //select data history
const rows = ref<DetailData[]>([]); //data history
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
@ -39,22 +41,6 @@ const formFilter = reactive<FormFilter>({
isProbation: false,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"no",
"typeLeave",
"dateLeave",
"numLeave",
"sumLeave",
"totalLeave",
"status",
"reason",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -146,18 +132,34 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"no",
"typeLeave",
"dateLeave",
"numLeave",
"sumLeave",
"totalLeave",
"status",
"reason",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* function fetch อมลประวการแกไขการลา
*/
function getHistory() {
async function getHistory() {
showLoader();
http
await http
.get(config.API.profileNewLeaveHistory(id.value, empType.value))
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
rows.value = [];
data.map((e: any) => {
data.map((e: DataLeave) => {
rows.value.push({
...e,
id: e.id,
@ -215,6 +217,11 @@ function statusLeave(val: string) {
}
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
getHistory();
@ -228,7 +235,10 @@ watch(modal, (status) => {
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%">
<DialogHeader tittle="ประวัติแก้ไขการลา" :close="() => (modal = false)" />
<DialogHeader
tittle="ประวัติแก้ไขการลา"
:close="() => ((modal = false), (rows = []))"
/>
<q-separator color="grey-4" />
<q-card-section style="max-height: 60vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">

View file

@ -1,26 +1,19 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar, type QTableProps } from "quasar";
import type {
FormFilter,
RequestItemsObject,
} from "@/modules/04_registryPerson/interface/index/performSpecialWork";
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 { useCounterMixin } from "@/stores/mixin";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWorkHistory.vue";
import { useRoute } from "vue-router";
const route = useRoute();
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const $q = useQuasar();
const mixin = useCounterMixin();
@ -34,53 +27,29 @@ const {
pathRegistryEmp,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const modal = ref<boolean>(false);
const edit = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const id = ref<string>("");
const id = ref<string>(""); //id
const modal = ref<boolean>(false); // popup
const modalHistory = ref<boolean>(false); // popup
const edit = ref<boolean>(false); //
//
const dutyData = reactive<RequestItemsObject>({
profileId: profileId.value,
dateStart: new Date(),
dateEnd: null,
detail: "",
reference: "",
refCommandNo: "",
refCommandDate: null,
dateStart: new Date(), //
dateEnd: null, //
detail: "", //
reference: "", //
refCommandNo: "", //
refCommandDate: null, //' ()'
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const rows = ref<RequestItemsObject[]>([]);
const filterKeyword = ref<string>("");
const mode = ref<string>("table");
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
]);
const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); //
const rows = ref<RequestItemsObject[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "dateStart",
@ -152,6 +121,18 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/** เปิด dialog */
function openDialogAdd() {
@ -184,7 +165,6 @@ function openDialogHistory(idOrder: string) {
function closeDialog() {
modal.value = false;
edit.value = false;
dutyData.dateStart = new Date();
dutyData.dateEnd = null;
dutyData.detail = "";
@ -196,12 +176,12 @@ function closeDialog() {
/**
* fetch อมลรายการพเศษ
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewDutyByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -278,6 +258,9 @@ function onSubmit() {
);
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData(profileId.value);
});
@ -418,13 +401,7 @@ onMounted(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
}}
</div>
<div v-else>
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -541,7 +518,7 @@ onMounted(() => {
outlined
dense
:model-value="date2Thai(dutyData.dateStart)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
hide-bottom-space
:label="`${'วันที่เริ่มต้น'}`"
>
@ -580,7 +557,7 @@ onMounted(() => {
dense
outlined
:model-value="date2Thai(dutyData.dateEnd)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>
@ -605,7 +582,7 @@ onMounted(() => {
lazy-rules
autogrow
v-model="dutyData.reference"
:rules="[(val) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]"
hide-bottom-space
:label="`${'เอกสารอ้างอิง'}`"
/>
@ -619,7 +596,7 @@ onMounted(() => {
lazy-rules
autogrow
v-model="dutyData.detail"
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
hide-bottom-space
:label="`${'รายละเอียด'}`"
/>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch, reactive } from "vue";
import { ref, watch } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
@ -7,10 +7,7 @@ import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
FormFilter,
ResponseObject,
} from "@/modules/04_registryPerson/interface/index/performSpecialWork";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
import { useRoute } from "vue-router";
const modal = defineModel<boolean>("modal", { required: true });
@ -24,23 +21,8 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>("");
const rows = ref<ResponseObject[]>([]); //select data history
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const filterKeyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //data history
const columns = ref<QTableProps["columns"]>([
{
name: "dateStart",
@ -135,6 +117,20 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"dateStart",
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* function fetch อมลประวตการแกไขขอม
@ -171,6 +167,11 @@ function getHistory() {
});
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
getHistory();
@ -186,7 +187,7 @@ watch(modal, (status) => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขปฏิบัติราชการพิเศษ"
:close="() => (modal = false)"
:close="() => ((modal = false), (rows = []))"
/>
<q-card-section style="max-height: 60vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">

View file

@ -2,10 +2,10 @@
import { ref } from "vue";
/** importComponents*/
import Info from "@/modules/04_registryPerson/components/detail/GovernmentInformation/01_Info.vue";
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 Info from "@/modules/04_registryPerson/components/detail/GovernmentInformation/01_Info.vue"; //
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"; //
const tab = ref<string>("1");
</script>