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,389 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, watch, reactive } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { DataType } from "@/modules/04_registryPerson/interface/response/Main";
import type {
FormAddPerson,
MyObjectRef,
} from "@/modules/04_registryPerson/interface/request/Main";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import DialogHeader from "@/components/DialogHeader.vue";
/** importStore*/
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
const profileStore = useProfileDataStore();
const $q = useQuasar();
const store = useRegistryNewDataStore();
const {
dialogConfirm,
success,
messageError,
hideLoader,
dialogMessageNotify,
date2Thai,
} = useCounterMixin();
const { calculateAge } = profileStore;
const modal = defineModel<boolean>("modal", { required: true });
const empType = defineModel<string>("empType", { required: true });
const props = defineProps({
fetchData: { type: Function },
fetchType: { type: Function },
});
const prefixOps = ref<DataOption[]>([]);
const rankOps = ref<DataOption[]>([]);
const levelOps = ref<DataType[]>([]);
const age = ref<string | null>("");
const formData = reactive<FormAddPerson>({
prefix: "",
firstName: "",
lastName: "",
citizenId: "",
position: "",
posTypeId: "",
posLevelId: "",
rank: "",
birthDate: null,
});
function fetchPrefix() {
http
.get(config.API.orgPrefix)
.then((res) => {
prefixOps.value = res.data.result.map((v: any) => ({
id: v.name,
name: v.name,
}));
})
.catch((err) => {
messageError($q, err);
});
}
function fetchRank() {
http
.get(config.API.orgRank)
.then((res) => {
rankOps.value = res.data.result.map((v: any) => ({
id: v.name,
name: v.name,
}));
})
.catch((err) => {
messageError($q, err);
});
}
/**
* function ตรวจสอบเลขประจำตวประชาชน
* @param citizenId เลขประจำตวประชาชน
*/
function changeCardID(citizenId: string | number | null) {
if (citizenId != null && typeof citizenId == "string") {
if (citizenId.length == 13 && citizenId) {
http
.put(config.API.profileNewCitizenId(citizenId), {
citizenId: citizenId,
})
.then(() => {})
.catch((err) => {
if (err.response.data.status === 500) {
dialogMessageNotify($q, err.response.data.message);
} else {
messageError($q, err);
}
});
}
}
}
function fetchLevel(id: string) {
const listLevel = store.posTypeMain.find((e: DataType) => e.id === id);
levelOps.value = listLevel?.posLevels;
const checkLevel = levelOps.value.filter(
(e: DataType) => e.id === formData.posLevelId
);
if (checkLevel.length === 0) {
formData.posLevelId = "";
}
}
function closeDialog() {
modal.value = false;
clearFormData();
}
const calculateMaxDate = () => {
const today = new Date();
today.setFullYear(today.getFullYear() - 18);
return today;
};
function clearFormData() {
formData.prefix = "";
formData.firstName = "";
formData.lastName = "";
formData.citizenId = "";
formData.position = "";
formData.posTypeId = "";
formData.posLevelId = "";
formData.rank = "";
age.value = "";
formData.birthDate = null;
}
async function onSubmit() {
dialogConfirm($q, async () => {
const type = empType.value !== "officer" ? "-employee" : "";
await http
.post(config.API.registryNew(type), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchData?.();
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
watch(
() => modal.value,
() => {
if (modal.value) {
fetchPrefix();
fetchRank();
props.fetchType?.();
}
}
);
watch(
() => formData.birthDate,
(v) => {
if (v) {
age.value = calculateAge(v);
}
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 350px">
<q-form @submit.prevent @validation-success="onSubmit()" greedy>
<DialogHeader tittle="เพิ่มข้อมูล" :close="closeDialog" />
<q-separator />
<q-card-section class="q-pa-md q-col-gutter-md">
<div class="row q-gutter-sm">
<div class="col">
<q-select
bg-color="white"
v-model="formData.prefix"
label="คำนำหน้าชื่อ"
outlined
dense
lazy-rules
:options="prefixOps"
option-label="name"
option-value="id"
map-options
hide-bottom-space
:rules="[
(val) => {
return val.length > 0 || 'กรุณาเลือกคำนำหน้าชื่อ';
},
]"
emit-value
/>
</div>
<div class="col">
<q-select
bg-color="white"
v-model="formData.rank"
label="ยศ"
outlined
dense
:options="rankOps"
option-label="name"
option-value="id"
map-options
hide-bottom-space
emit-value
/>
</div>
</div>
<q-input
bg-color="white"
outlined
v-model="formData.firstName"
label="ชื่อ"
dense
lazy-rules
borderless
:rules="[(val) => val.length > 0 || 'กรุณากรอกชื่อ']"
hide-bottom-space
/>
<q-input
bg-color="white"
outlined
v-model="formData.lastName"
label="นามสกุล"
dense
lazy-rules
borderless
:rules="[(val) => val.length > 0 || 'กรุณากรอกนามสกุล']"
hide-bottom-space
/>
<q-input
bg-color="white"
outlined
v-model="formData.citizenId"
label="เลขประจำตัวประชาชน"
dense
lazy-rules
borderless
:rules="[
(val: string) => !!val || `${'กรุณากรอกเลขประจำตัวประชาชน'}`,
(val: string) =>
val.length >= 13 ||
`${'กรุณากรอกเลขประจำตัวประชาชนให้ครบ'}`,
]"
maxlength="13"
hide-bottom-space
mask="#############"
@update:model-value="changeCardID"
/>
<div class="row q-col-gutter-sm">
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
borderless
week-start="0"
:max-date="calculateMaxDate()"
:enableTimePicker="false"
menu-class-name="modalfix"
v-model="formData.birthDate"
:locale="'th'"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
for="inputDatereceive"
outlined
dense
hide-bottom-space
class="inputgreen"
:model-value="
formData.birthDate != null
? date2Thai(formData.birthDate)
: null
"
label="วัน/เดือน/ปี เกิด"
:rules="[
(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`,
]"
>
<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-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
readonly
class="inputgreen"
v-model="age"
label="อายุ"
/>
</div>
</div>
<q-input
bg-color="white"
outlined
v-model="formData.position"
label="ตำแหน่งในสายงาน"
dense
lazy-rules
borderless
:rules="[(val) => val.length > 0 || 'กรุณากรอกตำแหน่ง']"
hide-bottom-space
/>
<q-select
bg-color="white"
v-model="formData.posTypeId"
label="ตำแหน่งประเภท"
outlined
:options="store.posTypeOps"
dense
options-cover
map-options
emit-value
option-label="name"
option-value="id"
hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกตำแหน่งประเภท']"
@update:model-value="fetchLevel"
/>
<q-select
bg-color="white"
v-model="formData.posLevelId"
label="ระดับ"
:options="levelOps"
outlined
dense
map-options
emit-value
option-label="posLevelName"
option-value="id"
options-cover
hide-bottom-space
:rules="[(val) => !!val || 'กรุณาเลือกระดับ']"
/>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
id="onSubmit"
type="submit"
label="บันทึก"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<style scoped></style>

View file

@ -1,9 +1,11 @@
<script setup lang="ts">
import { ref } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
/**
* importType*
@ -21,11 +23,6 @@ import type {
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
@ -37,12 +34,12 @@ const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true });
const modal = defineModel<boolean>("modal", { required: true }); // popup
/**
* วแปร
*/
const employeeClass = ref<string>("");
const employeeClass = ref<string>(""); //
const typeKeyword = ref<string>("");
const Keyword = ref<string>("");
const positionKeyword = ref<string>("");

View file

@ -1,7 +1,9 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRouter } from "vue-router";
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
/**
*importType
@ -14,10 +16,6 @@ import type { FormFilter } from "@/modules/04_registryPerson/interface/request/M
*/
import DialogHistory from "@/modules/04_registryPerson/components/DialogHistory.vue";
/**
* importStore
*/
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
/**
* use
*/
@ -27,10 +25,10 @@ const router = useRouter();
/**
* props
*/
const formFilter = defineModel<FormFilter>("formFilter", { required: true });
const maxPage = defineModel<Number>("maxPage", { required: true });
const empType = defineModel<string>("empType", { required: true });
const isFilter = defineModel<boolean>("isFilter", { required: true });
const formFilter = defineModel<FormFilter>("formFilter", { required: true }); //
const maxPage = defineModel<Number>("maxPage", { required: true }); //
const empType = defineModel<string>("empType", { required: true }); // ,
const isFilter = defineModel<boolean>("isFilter", { required: true }); //
const props = defineProps({
rows: { type: Array },
fetchData: { type: Function },
@ -207,6 +205,11 @@ function redirectToPagePetition() {
router.push(`/registry-officer/request-edit`);
}
/**
* การเปลยนแปลงของ formFilter.value.pageSize
*
* เมอมการเปลยนแปลงจำทำการดงขอมลรายการทะเบยนประวใหมตามจำนวน formFilter.value.pageSize
*/
watch(
() => formFilter.value.pageSize,
() => {
@ -294,6 +297,7 @@ watch(
</q-btn-toggle>
</div>
</div>
<d-table
ref="table"
row-key="id"
@ -478,15 +482,6 @@ watch(
</q-card-section>
</q-card>
</q-card-section>
<!-- <q-separator inset v-if="checkPermission($route)?.attrIsGet" />
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
color="black"
label="ดูเพิ่มเติม"
class="hover-button full-width q-pa-md"
@click="onClickViewDetail(props.row.id)"
/> -->
</q-card>
</div>
</template>
@ -526,13 +521,7 @@ watch(
</template>
</d-table>
<!-- <DialogAddData
v-model:modal="modalDialogAdd"
:fetchData="props.fetchData"
:fetchType="props.fetchType"
:empType="empType"
/> -->
<!-- ประวอครองตำแหน -->
<DialogHistory v-model:modal="modalHistory" />
</template>

View file

@ -1,15 +1,20 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { QForm, useQuasar } from "quasar";
import { useRoute } from "vue-router";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/ProfesLicense";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/ProfesLicense";
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 } from "@/modules/04_registryPerson/interface/request/ProfesLicense";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/ProfesLicense";
import dialogHeader from "@/components/DialogHeader.vue";
const route = useRoute();
const mixin = useCounterMixin();
const $q = useQuasar();
const {
@ -22,17 +27,18 @@ const {
pathRegistryEmp,
} = mixin;
const historyDialog = ref<boolean>(false);
const mode = ref<string>("table");
const dialog = ref<boolean>(false);
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const dialogStatus = ref<string>("create");
const editId = ref<string>("");
const keyword = ref<string>("");
const historyKeyword = ref<string>("");
const mode = ref<string>("table"); // Table,Card
const dialog = ref<boolean>(false); // popup
const historyDialog = ref<boolean>(false); // popup
const dialogStatus = ref<string>("create"); //
const editId = ref<string>(""); //id
//Table Main
const rows = ref<ResponseObject[]>([]); //
const keyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "certificateType",
@ -92,7 +98,21 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"certificateType",
"issuer",
"certificateNo",
"issueDate",
"expireDate",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const historyRows = ref<ResponseObject[]>([]); //
const historyKeyword = ref<string>(""); //
const historyColumns = ref<QTableProps["columns"]>([
{
name: "certificateType",
@ -175,37 +195,6 @@ const historyColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const profesLicenseData = reactive<RequestItemsObject>({
certificateType: "",
issuer: "",
certificateNo: "",
issueDate: new Date(),
expireDate: null,
profileId: id.value,
});
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<string[]>([
"certificateType",
"issuer",
"certificateNo",
"issueDate",
"expireDate",
]);
const historyVisibleColumns = ref<string[]>([
"certificateType",
"issuer",
@ -215,6 +204,19 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const profesLicenseData = reactive<RequestItemsObject>({
certificateType: "", //
issuer: "", //
certificateNo: "", //
issueDate: new Date(), //
expireDate: null, //
profileId: id.value,
});
/**
* นยนการบนทกขอม
@ -242,17 +244,18 @@ function closeDialog() {
*/
function closeHistoryDialog() {
historyDialog.value = false;
historyRows.value = [];
}
/**
* fetch อมลรายการใบอนญาตประกอบวชาช
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewCertificateByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -357,6 +360,9 @@ function fetchHistoryData(id: string) {
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData(id.value);
});
@ -433,6 +439,7 @@ onMounted(() => {
</template>
</q-btn-toggle>
</div>
<d-table
:grid="mode === 'card'"
ref="table"
@ -569,7 +576,7 @@ onMounted(() => {
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อใบอนุญาต'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกชื่อใบอนุญาต'}`]"
hide-bottom-space
/>
</div>
@ -582,7 +589,7 @@ onMounted(() => {
dense
class="inputgreen"
:rules="[
(val) => !!val || `${'กรุณากรอกหน่วยงานผู้ออกใบอนุญาต'}`,
(val:string) => !!val || `${'กรุณากรอกหน่วยงานผู้ออกใบอนุญาต'}`,
]"
hide-bottom-space
/>
@ -597,7 +604,7 @@ onMounted(() => {
bg-color="white"
class="inputgreen"
dense
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่ใบอนุญาต'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่ใบอนุญาต'}`]"
hide-bottom-space
/>
</div>
@ -628,7 +635,7 @@ onMounted(() => {
: ''
"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่ออกใบอนุญาต'}`,
(val:string) => !!val || `${'กรุณาเลือกวันที่ออกใบอนุญาต'}`,
]"
:label="`${'วันที่ออกใบอนุญาต'}`"
>

View file

@ -1,20 +1,23 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { QForm, useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Training";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Training";
import { QForm, useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Training";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Training";
import dialogHeader from "@/components/DialogHeader.vue";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
@ -24,12 +27,36 @@ const {
pathRegistryEmp,
} = mixin;
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const dialog = ref<boolean>(false);
const mode = ref<string>("table");
const mode = ref<string>("table"); // Table,Card
const dialog = ref<boolean>(false); // popup /
const dialogStatus = ref<string>("create"); //
const editId = ref<string>(""); //id
const historyDialog = ref<boolean>(false); // popup
const isDate = ref<string>("false"); // ,//
const trainData = reactive<RequestItemsObject>({
profileId: id.value,
name: "", ///
topic: "", ///
startYear: new Date().getFullYear(), ///
finishYear: new Date().getFullYear(), ///
startDate: new Date(), ///
endDate: new Date(), ///
yearly: null, //
place: "", ///
duration: "", ///
department: "", ///
numberOrder: "", ///
dateOrder: null, ///
isDate: isDate.value === "false" ? false : true,
});
//Table Main
const rows = ref<ResponseObject[]>([]);
const keyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "name",
@ -148,6 +175,26 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"name", //
"topic", //
"yearly", //
"place", //
"duration", //
"department", //
"numberOrder", //
"dateOrder", //
"startDate", //
"endDate", //
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const historyRows = ref<ResponseObject[]>([]);
const historyKeyword = ref<string>("");
const historyColumns = ref<QTableProps["columns"]>([
{
name: "name",
@ -289,55 +336,6 @@ const historyColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const isDate = ref<string>("false");
const dialogStatus = ref<string>("create");
const historyDialog = ref<boolean>(false);
const editId = ref<string>("");
const keyword = ref<string>("");
const historyKeyword = ref<string>("");
const trainData = reactive<RequestItemsObject>({
profileId: id.value,
name: "",
topic: "",
yearly: null,
place: "",
duration: "",
department: "",
numberOrder: "",
dateOrder: null,
startDate: new Date(),
endDate: new Date(),
startYear: new Date().getFullYear(),
finishYear: new Date().getFullYear(),
isDate: isDate.value === "false" ? false : true,
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
const visibleColumns = ref<string[]>([
"name", //
"topic", //
"yearly", //
"place", //
"duration", //
"department", //
"numberOrder", //
"dateOrder", //
"startDate", //
"endDate", //
]);
const historyVisibleColumns = ref<string[]>([
"name", //
"topic", //
@ -352,6 +350,10 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName", //
"lastUpdatedAt", //
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* นยนการบนทกขอม
@ -422,8 +424,8 @@ function addData() {
})
.then(async () => {
await fetchData(id.value);
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -449,8 +451,8 @@ function editData(idData: string) {
})
.then(async () => {
await fetchData(id.value);
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -473,17 +475,18 @@ function closeDialog() {
*/
function closeHistoryDialog() {
historyDialog.value = false;
historyRows.value = [];
}
/**
* fetch รายการการฝกอบรม/งาน
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewTrainingByProfileId(id, empType.value))
.then((res) => {
rows.value = res.data.result;
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -511,6 +514,9 @@ function fetchHistoryData(id: string) {
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData(id.value);
});
@ -725,7 +731,7 @@ onMounted(() => {
dense
class="inputgreen"
:rules="[
(val) =>
(val:string) =>
!!val || `${'กรุณากรอกชื่อโครงการ/หลักสูตรการฝึกอบรม'}`,
]"
hide-bottom-space
@ -740,7 +746,7 @@ onMounted(() => {
bg-color="white"
dense
:rules="[
(val) => !!val || `${'กรุณากรอกหัวข้อการฝึกอบรม/ดูงาน'}`,
(val:string) => !!val || `${'กรุณากรอกหัวข้อการฝึกอบรม/ดูงาน'}`,
]"
hide-bottom-space
/>

View file

@ -1,15 +1,15 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { onMounted, ref, reactive } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps, QForm } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/04_registryPerson/stores/insignia";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
DataOption,
DataOptionInsignia,
@ -18,6 +18,8 @@ import type {
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Insignia";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Insignia";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const store = useInsigniaDataStore();
@ -32,54 +34,46 @@ const {
dialogConfirm,
pathRegistryEmp,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const id = ref<string>("");
const insigniaType = ref<string>("");
const id = ref<string>(""); //id
const insigniaType = ref<string>(""); //
const insigniaForm = reactive<RequestItemsObject>({
year: 0,
no: "",
volume: "",
section: "",
page: "",
receiveDate: null,
insigniaId: "",
dateAnnounce: null,
issue: "",
volumeNo: "",
refCommandDate: null,
refCommandNo: "",
note: "",
year: 0, //
receiveDate: null, //
insigniaId: "", //
no: "", //
issue: "", //
volumeNo: "", //
volume: "", //
section: "", //
page: "", //
dateAnnounce: null, //
refCommandNo: "", //
refCommandDate: null, //' ( //)'
note: "", //
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modeView = ref<string>("table");
const filterSearch = ref("");
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<RequestItemsObject[]>([]);
const Ops = ref<InsigniaOps>({
insigniaOptions: [],
});
const isEdit = ref<boolean>(false); //
const modal = ref<boolean>(false); // popup
const modeView = ref<string>("table"); // Table,Card
const modalHistory = ref<boolean>(false); // popup
//
const OpsFilter = ref<InsigniaOps>({
insigniaOptions: [],
});
//
const Ops = ref<InsigniaOps>({
insigniaOptions: [],
});
//Table Main
const rows = ref<ResponseObject[]>([]);
const filterSearch = ref("");
const columns = ref<QTableProps["columns"]>([
{
name: "year",
@ -239,6 +233,30 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"insignia",
"insigniaType",
"year",
"no",
"issue",
"volumeNo",
"volume",
"section",
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"note",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const rowsHistory = ref<RequestItemsObject[]>([]);
const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "year",
@ -410,22 +428,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"insignia",
"insigniaType",
"year",
"no",
"issue",
"volumeNo",
"volume",
"section",
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"note",
]);
const visibleColumnsHistory = ref<String[]>([
"insignia",
"insigniaType",
@ -443,6 +445,10 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* fetch อมลรายการเครองราชอสรยาภรณ
@ -629,6 +635,9 @@ function clearData() {
insigniaForm.note = "";
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
await fetchData();
store.insigniaOption.length === 0 ? await fetchInsignia() : "";
@ -1145,7 +1154,7 @@ onMounted(async () => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขเครื่องราชอิสริยาภรณ์"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
<q-separator />

View file

@ -1,17 +1,19 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps, QForm } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/DeclarationHonor";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/DeclarationHonor";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
@ -24,32 +26,31 @@ const {
dialogConfirm,
pathRegistryEmp,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const id = ref<string>("");
const issueDateYear = ref<number>(0);
const id = ref<string>(""); //id
const issueDateYear = ref<number>(0); //
const declHonorForm = reactive<RequestItemsObject>({
isDate: "false",
issuer: "",
detail: "",
issueDate: null,
refCommandNo: "",
refCommandDate: null,
isDate: "false", //
issuer: "", //
detail: "", //
issueDate: null, //
refCommandNo: "", //
refCommandDate: null, //' ()'
});
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modeView = ref<string>("table");
const filterSearch = ref("");
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<ResponseObject[]>([]);
const isEdit = ref<boolean>(false); //
const modal = ref<boolean>(false); // popup
const modeView = ref<string>("table"); // Table,Card
const modalHistory = ref<boolean>(false); // popup
//Table Main
const rows = ref<ResponseObject[]>([]);
const filterSearch = ref("");
const columns = ref<QTableProps["columns"]>([
{
name: "issueDate",
@ -109,6 +110,21 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"issuer",
"detail",
"issueDate",
"refCommandNo",
"refCommandDate",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const rowsHistory = ref<ResponseObject[]>([]);
const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "issueDate",
@ -191,15 +207,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"issuer",
"detail",
"issueDate",
"refCommandNo",
"refCommandDate",
]);
const visibleColumnsHistory = ref<String[]>([
"issuer",
"detail",
@ -209,12 +216,6 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
@ -354,6 +355,9 @@ function clearData() {
declHonorForm.isDate = "false";
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData();
});
@ -767,7 +771,7 @@ onMounted(() => {
<q-card-section class="flex justify-between" style="padding: 0">
<DialogHeader
tittle="ประวัติแก้ไขประกาศเกียรติคุณ"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
</q-card-section>

View file

@ -1,20 +1,21 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { onMounted, ref, reactive } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps, QForm } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useResultsPerformDataStore } from "@/modules/04_registryPerson/stores/ResultsPerformance";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogDevelop from "@/modules/04_registryPerson/components/DialogDevelopmant.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/ResultsPerformance";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/ResultsPerformance";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogDevelop from "@/modules/04_registryPerson/components/detail/Achievement/DialogDevelopmance.vue";
const $q = useQuasar();
const route = useRoute();
const store = useResultsPerformDataStore();
@ -29,38 +30,36 @@ const {
dialogConfirm,
pathRegistryEmp,
} = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const id = ref<string>("");
const id = ref<string>(""); //id
const isEdit = ref<boolean>(false); //
const modal = ref<boolean>(false); // popup
const modalDevelop = ref<boolean>(false); // popup
const modeView = ref<string>("table"); // Table,Card
const modeViewPlan = ref<string>("table"); // Table,Card
const modalHistory = ref<boolean>(false); // popup
const kpiDevelopmentId = ref<string>(""); // id
const resPerformForm = reactive<RequestItemsObject>({
name: "",
point1Total: 0,
point1: 0,
point2Total: 0,
point2: 0,
pointSumTotal: 0,
pointSum: 0,
date: null,
point1Total: 0, //1 ()
point1: 0, //1 ()
point2Total: 0, // 2 ()
point2: 0, //2 ()
pointSumTotal: 0, // ()
pointSum: 0, // ()
date: null, //
});
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modalDevelop = ref<boolean>(false);
const modeView = ref<string>("table");
const modeViewPlan = ref<string>("table");
const filterSearch = ref("");
const kpiDevelopmentId = ref<string>("");
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const rowsHistory = ref<ResponseObject[]>([]);
const filterSearchPlan = ref("");
//Table
const rows = ref<ResponseObject[]>([]);
const rowsPlan = ref<any[]>([]);
const filterSearch = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -150,6 +149,107 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"point1Total",
"point1",
"point2Total",
"point2",
"pointSumTotal",
"pointSum",
"name",
"date",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table (Individual Development Plan)
const rowsPlan = ref<any[]>([]);
const filterSearchPlan = ref<string>("");
const columnsPlan = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
},
{
name: "name",
align: "left",
label: "ความรู้ / ทักษะ / สมรรถนะที่ต้องได้รับการพัฒนา",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "developmentProjects",
align: "left",
label: "วิธีการพัฒนา",
sortable: true,
field: "developmentProjects",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "target",
align: "left",
label: "เป้าหมายการพัฒนา",
sortable: true,
field: "target",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "developmentResults",
align: "left",
label: "วิธีการวัดผลการพัฒนา",
sortable: true,
field: "developmentResults",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "point",
align: "left",
label: "รายงานผลการพัฒนา",
sortable: true,
field: "point",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumnsPlan = ref<String[]>([
"no",
"name",
"developmentProjects",
"target",
"developmentResults",
"point",
]);
const paginationPlan = ref({
page: 1,
rowsPerPage: 10,
});
//Table
const rowsHistory = ref<ResponseObject[]>([]);
const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "date",
@ -272,103 +372,6 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const visibleColumns = ref<String[]>([
"point1Total",
"point1",
"point2Total",
"point2",
"pointSumTotal",
"pointSum",
"name",
"date",
]);
const visibleColumnsPlan = ref<String[]>([
"no",
"name",
"developmentProjects",
"target",
"developmentResults",
"point",
]);
const columnsPlan = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
},
{
name: "name",
align: "left",
label: "ความรู้ / ทักษะ / สมรรถนะที่ต้องได้รับการพัฒนา",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "developmentProjects",
align: "left",
label: "วิธีการพัฒนา",
sortable: true,
field: "developmentProjects",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "target",
align: "left",
label: "เป้าหมายการพัฒนา",
sortable: true,
field: "target",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "developmentResults",
align: "left",
label: "วิธีการวัดผลการพัฒนา",
sortable: true,
field: "developmentResults",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "point",
align: "left",
label: "รายงานผลการพัฒนา",
sortable: true,
field: "point",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const paginationPlan = ref({
page: 1,
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
@ -379,7 +382,6 @@ const historyPagination = ref({
*/
async function fetchData() {
if (!profileId.value) return;
showLoader();
try {
const res = await http.get(
@ -396,12 +398,14 @@ async function fetchData() {
}
}
/**
* fetch รายการการพฒนารายบคคล (Individual Development Plan)
*/
async function getDevelop() {
if (!profileId.value) return;
await http
.get(config.API.developMentPlan + `/${profileId.value}`)
.then((res) => {
console.log(res.data.result);
const data = res.data.result;
rowsPlan.value = data;
})
@ -450,7 +454,6 @@ async function addEditData(editStatus: boolean = false) {
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true;
isEdit.value = editStatus;
if (editStatus && row) {
id.value = row.id;
resPerformForm.name = row.name;
@ -480,7 +483,6 @@ async function clickClose() {
async function clickHistory(row: ResponseObject) {
modalHistory.value = true;
filterSearch.value = "";
showLoader();
try {
const res = await http.get(
@ -1177,7 +1179,7 @@ onMounted(async () => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขผลการประเมินการปฏิบัติราชการ"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
<q-separator />
<q-card-section style="max-height: 60vh" class="scroll">

View file

@ -1,21 +1,33 @@
<script setup lang="ts">
import DialogHeader from "@/components/DialogHeader.vue";
import { ref, reactive, watch, computed } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import type {
DataOptionTechnique,
ProjectYearOp,
} from "@/modules/14_KPI/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const props = defineProps({
getAll: Function,
});
const route = useRoute();
const idKpi = ref<string>(route.params.id.toLocaleString());
const development = ref<any[]>([]);
const reasonDevelopment70 = ref<string>("");
const reasonDevelopment20 = ref<string>("");
@ -30,22 +42,6 @@ const checkOtherBox13 = computed<boolean>(() => {
return development.value.includes("other3");
});
const isDevelopment70 = computed(() => {
return projectTechniquesOp1.value.some((txt) =>
development.value.includes(txt.value)
);
});
const isDevelopment20 = computed(() => {
return projectTechniquesOp2.value.some((txt) =>
development.value.includes(txt.value)
);
});
const isDevelopment10 = computed(() => {
return projectTechniquesOp3.value.some((txt) =>
development.value.includes(txt.value)
);
});
const projectTechniquesOp1 = ref<DataOptionTechnique[]>([
{
value: "on_the_job_training",
@ -86,7 +82,6 @@ const projectTechniquesOp2 = ref<DataOptionTechnique[]>([
{ value: "feedback", label: "การให้ข้อคิดเห็น/เสนอแนะ (Feedback)" },
{ value: "other2", label: "อื่น ๆ (ระบุ)" },
]);
const projectTechniquesOp3 = ref<DataOptionTechnique[]>([
{
value: "self_learning",
@ -118,19 +113,7 @@ const choiceOp = ref<DataOptionTechnique[]>([
{ value: "PROJECT", label: "เลือกจากโครงการ/หลักสูตรการฝึกอบรม" },
{ value: "MANUAL", label: "กรอกเอง" },
]);
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
dialogConfirm,
messageError,
success,
dialogMessageNotify,
} = mixin;
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const emType = computed(() => {
return route.name
? route.name === "registryNewByid"
@ -140,6 +123,7 @@ const emType = computed(() => {
: "employee"
: "";
});
const formData = reactive<{
year: number | null;
point: number | null;
@ -194,62 +178,6 @@ function close() {
id.value = "";
}
watch(
() => id.value,
(i) => {
if (i) {
showLoader();
http
.get(
config.API.kpiAchievementDevelop +
`/registry/${emType.value}/${id.value}`
)
.then(async (res) => {
const data = res.data.result;
formData.year = data.selectTypeYear;
await getDataByYear();
setTimeout(() => {
choice.value = data.selectType;
projectName.value = projectOpMain.value.find(
(i: any) => i.id == data.selectTypeId
);
formData.name = data.name;
formData.group = data.group;
formData.target = data.target;
formData.isDevelopment70 = data.isDevelopment70;
formData.isDevelopment20 = data.isDevelopment20;
formData.isDevelopment10 = data.isDevelopment10;
formData.achievement10 = data.achievement10;
formData.achievement5 = data.achievement5;
formData.achievement0 = data.achievement0;
development.value = data.developmentProjects;
reasonDevelopment70.value = data.developmentProjects.includes(
"other1"
)
? data.reasonDevelopment70
: "";
reasonDevelopment20.value = data.developmentProjects.includes(
"other2"
)
? data.reasonDevelopment20
: "";
reasonDevelopment10.value = data.developmentProjects.includes(
"other3"
)
? data.reasonDevelopment10
: "";
}, 500);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
}
);
const customPosition = () => ({ top: "385px", left: "410px" });
async function getDataByYear() {
if (formData.year) {
@ -316,6 +244,62 @@ function filterOptionFn(val: string, update: Function) {
);
});
}
watch(
() => id.value,
(i) => {
if (i) {
showLoader();
http
.get(
config.API.kpiAchievementDevelop +
`/registry/${emType.value}/${id.value}`
)
.then(async (res) => {
const data = res.data.result;
formData.year = data.selectTypeYear;
await getDataByYear();
setTimeout(() => {
choice.value = data.selectType;
projectName.value = projectOpMain.value.find(
(i: any) => i.id == data.selectTypeId
);
formData.name = data.name;
formData.group = data.group;
formData.target = data.target;
formData.isDevelopment70 = data.isDevelopment70;
formData.isDevelopment20 = data.isDevelopment20;
formData.isDevelopment10 = data.isDevelopment10;
formData.achievement10 = data.achievement10;
formData.achievement5 = data.achievement5;
formData.achievement0 = data.achievement0;
development.value = data.developmentProjects;
reasonDevelopment70.value = data.developmentProjects.includes(
"other1"
)
? data.reasonDevelopment70
: "";
reasonDevelopment20.value = data.developmentProjects.includes(
"other2"
)
? data.reasonDevelopment20
: "";
reasonDevelopment10.value = data.developmentProjects.includes(
"other3"
)
? data.reasonDevelopment10
: "";
}, 500);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
}
);
</script>
<template>
<q-dialog persistent v-model="modal">
@ -389,7 +373,6 @@ function filterOptionFn(val: string, update: Function) {
<q-select
outlined
dense
readonly
:rules="[(val:string) => !!val || `${'กรุณาเลือกโครงการ/หลักสูตรการฝึกอบรม'}`,]"
class="inputgreen"
label="โครงการ/หลักสูตรการฝึกอบรม"

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>

View file

@ -1,19 +1,18 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { ref, onMounted, reactive } from "vue";
import type {
RowList,
FormFilter,
MyObjectRef,
} from "@/modules/04_registryPerson/interface/index/other";
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 { RowList } from "@/modules/04_registryPerson/interface/index/other";
import DialogHeader from "@/components/DialogHeader.vue";
import { useRoute } from "vue-router";
import DialogHistory from "@/modules/04_registryPerson/components/detail/Other/01_OtherInformationHistory.vue";
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
@ -29,28 +28,22 @@ const {
const id = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const mode = ref<string>("table");
const filterKeyword = ref<string>("");
const mode = ref<string>("table"); // Table,Card
const modal = ref<boolean>(false); // popup
const modalHistory = ref<boolean>(false); // popup
const edit = ref<boolean>(false); //
const date = ref<Date | null>(null); //
const detail = ref<string>(""); //
//Table
const rows = ref<RowList[]>([]);
/** modal */
const modal = ref<boolean>(false);
const edit = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const date = ref<Date | null>(null);
const detail = ref<string>();
const visibleColumns = ref<String[]>(["date", "detail"]);
const filterKeyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -74,8 +67,33 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>(["date", "detail"]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/** เปิด dialog */
/**
* fetch รายการขอมลอนๆ
*/
async function getData() {
showLoader();
await http
.get(config.API.profileNewOtherByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* เป dialog อมลอนๆ
*/
function openDialogAdd() {
modal.value = true;
}
@ -91,7 +109,9 @@ function openDialogEdit(props: RowList) {
date.value = props.date;
detail.value = props.detail;
}
/** dialog
/**
* dialog ประต
* @param id id รายการ
*/
function openDialogHistory(idOrder: string) {
@ -99,7 +119,9 @@ function openDialogHistory(idOrder: string) {
modalHistory.value = true;
}
/** ปิด dialog */
/**
* dialog
*/
function closeDialog() {
modal.value = false;
edit.value = false;
@ -107,7 +129,9 @@ function closeDialog() {
detail.value = "";
}
/** validate check*/
/**
* validate check
*/
function validateForm() {
dialogConfirm(
$q,
@ -171,24 +195,6 @@ function editData() {
});
}
/**
* fetch รายการขอมลอนๆ
*/
function getData() {
showLoader();
http
.get(config.API.profileNewOtherByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
getData();
});

View file

@ -1,56 +1,32 @@
<script setup lang="ts">
import { ref, watch, reactive } from "vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { ref, watch } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import { useRoute } from "vue-router";
import type { RowList } from "@/modules/04_registryPerson/interface/index/other";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
RequestItemsObject,
FormFilter,
} from "@/modules/04_registryPerson/interface/index/discipline";
import type { RowList } from "@/modules/04_registryPerson/interface/index/other";
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();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
mixin;
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const filterKeyword = ref<string>("");
const rows = ref<RowList[]>([]); //select data history
const formFilter = reactive<FormFilter>({
page: 1,
pageSize: 12,
keyword: "",
type: "",
posType: "",
posLevel: "",
retireYear: "",
rangeYear: { min: 0, max: 60 },
isShowRetire: false,
isProbation: false,
});
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const visibleColumns = ref<String[]>([
"date",
"detail",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const rows = ref<RowList[]>([]); // data history
const filterKeyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -97,6 +73,16 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<String[]>([
"date",
"detail",
"lastUpdateFullName",
"lastUpdatedAt",
]);
/**
* งกนดงขอมลประวการแกไขขอม
*/
function getHistory() {
showLoader();
http
@ -122,12 +108,18 @@ function getHistory() {
});
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
getHistory();
filterKeyword.value = "";
} else {
filterKeyword.value = "";
rows.value = [];
}
});
</script>

View file

@ -1,14 +1,16 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import axios from "axios";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { ArrayFileList } from "@/modules/04_registryPerson/interface/index/document";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
@ -21,12 +23,15 @@ const {
dialogRemove,
} = mixin;
const documentFile = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]);
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const documentFile = ref<any>(null);
const fileList = ref<ArrayFileList[]>([]); //
/**
* งกนดงขอมลรายการเอกสารหลกฐาน
*/
async function getData() {
showLoader();
await http
@ -45,31 +50,8 @@ async function getData() {
}
/**
* งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน
* งกนสาง Path ำหรบอพโหลดไฟลเอกสารหลกฐาน
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();
Data.append("file", documentFile.value);
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(async () => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
documentFile.value = null;
});
}
function clickUpload(file: any) {
const fileName = { fileName: file.name };
dialogConfirm(
@ -109,6 +91,32 @@ function clickUpload(file: any) {
);
}
/**
* งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน
*/
async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData();
Data.append("file", documentFile.value);
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(async () => {
await getData();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
documentFile.value = null;
});
}
/**
* ดาวนโหลดลงกไฟล
* @param fileName file name

View file

@ -1,15 +1,18 @@
<script setup lang="ts">
import { onMounted, watch, ref, reactive } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type { QTableColumn, QForm } from "quasar";
import type { QTableColumn } from "quasar";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
@ -18,12 +21,6 @@ import type { ResponseObject } from "@/modules/04_registryPerson/interface/respo
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
/**
* use
*/
@ -59,14 +56,14 @@ const empType = ref<string>(
: "-employee"
);
const modal = ref<boolean>(false);
const informaData = ref<ResponseObject>();
const rowsHistory = ref<ResponseObject[]>([]);
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const id = ref<string>("");
const age = ref<string | null>("");
const formData = reactive<RequestObject>(store.defaultProfile);
const modal = ref<boolean>(false); //
const informaData = ref<ResponseObject>(); //
const rowsHistory = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); //
const modalHistory = ref<boolean>(false); //
const age = ref<string | null>(""); //
const formData = reactive<RequestObject>(store.defaultProfile); //
/** ข้อมูล Label*/
const dataLabel = {
@ -81,7 +78,6 @@ const dataLabel = {
religion: "ศาสนา",
bloodGroup: "หมู่เลือด",
phone: "เบอร์โทร",
prefix: "คำนำหน้าชื่อ",
rank: "ยศ",
firstName: "ชื่อ",
@ -286,16 +282,18 @@ const pagination = ref({
/**
* function เรยกขอมลขอมลสวนต
*
*/
function getData() {
async function getData() {
showLoader();
http
await http
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => {
informaData.value = res.data.result;
id.value = res.data.result.id;
if (res.data.result.birthDate) {
//
age.value = calculateAge(res.data.result.birthDate);
}
})
@ -347,8 +345,8 @@ function onSubmit() {
.then(async () => {
await props.fetchDataPersonal?.();
await getData();
modal.value = false;
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
@ -365,13 +363,13 @@ function onSubmit() {
/**
* function อมลประวแกไขขอมลสวนต
*/
function clickHistory() {
async function clickHistory() {
modalHistory.value = true;
filterHistory.value = "";
http
await http
.get(config.API.profileNewProfileHisById(id.value, empType.value))
.then((res) => {
rowsHistory.value = res.data.result;
.then(async (res) => {
rowsHistory.value = await res.data.result;
})
.catch((e) => {
messageError($q, e);
@ -413,6 +411,9 @@ function calculateMaxDate() {
return today;
}
/**
* การเปลยนแปลงของวนเกดเมอมการเปลยนแปลงจะคำนวนอายใหม
*/
watch(
() => formData.birthDate,
(v) => {
@ -422,6 +423,9 @@ watch(
}
);
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
const promises = [];
@ -837,7 +841,7 @@ onMounted(() => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขข้อมูลส่วนตัว"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
<q-separator />

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { onMounted, ref, useAttrs, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import axios from "axios";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -12,18 +15,14 @@ import config from "@/app.config";
*/
import type { QTableProps } from "quasar";
import type { ResponseObject } from "@/components/information/interface/response/OldName";
import type { DataProfile } from "@/modules/04_registryPerson/interface/response/Main";
import type { FormChangeName } from "@/modules/04_registryPerson/interface/request/Main";
/**
* importComponents
*/
import dialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
@ -49,36 +48,35 @@ const props = defineProps({
fetchDataPersonal: { type: Function, require: true },
});
const submitDisable = ref<boolean>(true);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const profileId = ref<string>(route.params.id.toString()); //id Profile
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); //
const submitDisable = ref<boolean>(true); //
const editId = ref<string>("");
const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("create");
const filterSearch = ref("");
const historyDialog = ref<boolean>(false);
const historyKeyword = ref<string>("");
const changeNameData = reactive({
const dialog = ref<boolean>(false); // popup -
const dialogStatus = ref<string>("create"); //
const filterSearch = ref<string>(""); //
const historyDialog = ref<boolean>(false); //
const historyKeyword = ref<string>(""); //
//
const changeNameData = reactive<FormChangeName>({
profileId: profileId.value,
prefixId: "",
prefix: "",
firstName: "",
lastName: "",
status: "",
documentId: "",
prefixId: "", // id
prefix: "", //
firstName: "", //
lastName: "", //
status: "", //
documentId: "", //
});
const selection = ref<string[]>([]);
const prefixChange = ref<string>("");
const firstNameChange = ref<string>("");
const lastNameChange = ref<string>("");
const selection = ref<string[]>([]); //
const prefixChange = ref<string | null | undefined>(""); //
const firstNameChange = ref<string | null | undefined>(""); //
const lastNameChange = ref<string | null | undefined>(""); //
const profileInfo = ref<any>([]);
const profileInfo = ref<DataProfile>(); // Profile
const statusOption = ref([
const statusOption = ref<string[]>([
"เปลี่ยนคำนำหน้าชื่อ",
"เปลี่ยนชื่อ",
"เปลี่ยนนามสกุล",
@ -87,7 +85,7 @@ const statusOption = ref([
"เปลี่ยนคำนำหน้าชื่อ และนามสกุล",
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
]);
const statusOptionFilter = ref([
const statusOptionFilter = ref<string[]>([
"เปลี่ยนคำนำหน้าชื่อ",
"เปลี่ยนชื่อ",
"เปลี่ยนนามสกุล",
@ -97,25 +95,9 @@ const statusOptionFilter = ref([
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
]);
const alertUpload = ref<boolean>(false);
const visibleColumns = ref<string[]>([
"prefix",
"firstName",
"lastName",
"lastUpdateFullName",
"lastUpdatedAt",
// "status",
]);
const historyVisibleColumns = ref<String[]>([
"prefix",
"firstName",
"lastName",
"status",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
// Table
const rows = ref<ResponseObject[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "prefix",
@ -150,17 +132,7 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
// {
// name: "status",
// align: "left",
// label: "",
// sortable: true,
// field: "status",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
// },
{
name: "lastUpdateFullName",
align: "left",
@ -185,77 +157,14 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const historyColumns = ref<QTableProps["columns"]>([
{
name: "prefix",
align: "left",
label: "คำนำหน้าชื่อ",
sortable: true,
field: "prefix",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "firstName",
align: "left",
label: "ชื่อ",
sortable: true,
field: "firstName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastName",
align: "left",
label: "นามสกุล",
sortable: true,
field: "lastName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "status",
align: "left",
label: "สถานะการเปลี่ยนชื่อ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v, false, true),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
const visibleColumns = ref<string[]>([
"prefix",
"firstName",
"lastName",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const uploadUrl = ref<string>("");
const subId = ref<string>("");
const fileUpload = ref<File>();
const pagination = ref({
@ -263,42 +172,54 @@ const pagination = ref({
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
// function editForm(row: any) {
// submitDisable.value = true;
// dialogStatus.value = "edit";
// editId.value = row.id;
// subId.value = row.id;
// changeNameData.prefix = row.prefix;
// changeNameData.firstName = row.firstName;
// changeNameData.lastName = row.lastName;
// changeNameData.status = row.status;
// prefixChange.value = changeNameData.prefix;
// firstNameChange.value = changeNameData.firstName;
// lastNameChange.value = changeNameData.lastName;
// dialog.value = true;
// }
function closeDialog() {
selection.value = [];
alertUpload.value = false;
dialog.value = false;
/**
* งกนดงขอมลสวนต
*/
async function fetchDataPersonal() {
showLoader();
await http
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then(async (res) => {
const data = await res.data.result;
profileInfo.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนดงขอมลรายการประวการเปลยนช-นามสก
*
* @param id id profile
*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.profileNewChangeNameByProfileId(id, empType.value))
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนยนยนการบนทกขอม
*/
function onSubmit() {
if (!!fileUpload.value || dialogStatus.value === "edit") {
dialogConfirm(
$q,
() => {
showLoader();
dialogStatus.value === "create" ? addData() : editData(editId.value);
// if (!!fileUpload.value) {
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -306,7 +227,12 @@ function onSubmit() {
}
}
/**
* งกนสราง Path ปโหลดไฟล
* @param id
*/
async function uploadProfile(id: string) {
showLoader();
await http
.post(
config.API.subFile(
@ -334,6 +260,11 @@ async function uploadProfile(id: string) {
});
}
/**
* งกนอปโหลดำไฟล
* @param uploadUrl Path ปโหลดไฟล
* @param file ไฟลเอกสาร
*/
async function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
await axios
@ -353,22 +284,11 @@ async function uploadFileURL(uploadUrl: string, file: any) {
});
}
async function fetchDataPersonal() {
showLoader();
await http
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => {
profileInfo.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchProfile(id: string) {
/**
* งกนโหลไฟลเอกสารหลกฐาน
* @param id รายการทองการโหลด
*/
async function onDownloadFile(id: string) {
showLoader();
await http
.get(
@ -392,7 +312,11 @@ async function fetchProfile(id: string) {
});
}
/**
* งกชนเพมการเปลยนช - นามสก
*/
async function addData() {
showLoader();
await http
.post(config.API.profileNewChangeName(empType.value), {
profileId: empType.value === "" ? profileId.value : undefined,
@ -407,11 +331,11 @@ async function addData() {
.then(async (res) => {
subId.value = await res.data.result;
await uploadProfile(res.data.result);
fetchData(profileId.value);
props?.fetchDataPersonal?.();
fetchDataPersonal();
await fetchData(profileId.value);
await props?.fetchDataPersonal?.();
await fetchDataPersonal();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -421,7 +345,12 @@ async function addData() {
});
}
/**
* งกชนแกไขการเปลยนช - นามสก
* @param idData id องการแกไช
*/
function editData(idData: string) {
showLoader();
http
.patch(
config.API.profileNewChangeNameByChangeNameId(idData, empType.value),
@ -430,13 +359,13 @@ function editData(idData: string) {
profileId: undefined,
}
)
.then(() => {
uploadProfile(subId.value);
fetchData(profileId.value);
props.fetchDataPersonal?.();
fetchDataPersonal();
.then(async () => {
await uploadProfile(subId.value);
await fetchData(profileId.value);
await props.fetchDataPersonal?.();
await fetchDataPersonal();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -446,40 +375,12 @@ function editData(idData: string) {
});
}
async function fetchHistoryData(id: string) {
showLoader();
await http
.get(config.API.profileNewChangeNameHisByChangeNameId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function closeHistoryDialog() {
historyDialog.value = false;
}
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.profileNewChangeNameByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกชนคนหาขอมลใน select
* @param val คำทองการคนหา
* @param update function
* @param refData ประเภทตวเลอก
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "statusOptions":
@ -501,7 +402,37 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
/**
* งกนป popup เปลยนช-นามสก
*/
function closeDialog() {
selection.value = [];
alertUpload.value = false;
dialog.value = false;
}
/**
* การเปลยนแปลงของขอมลฟอร เปลยนช-นามสก
*/
watch(
() => [
changeNameData.prefix,
changeNameData.firstName,
changeNameData.lastName,
],
() => {
submitDisable.value =
changeNameData.prefix === prefixChange.value &&
changeNameData.firstName === firstNameChange.value &&
changeNameData.lastName === lastNameChange.value;
}
);
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
//
if (
store.Ops.prefixOps.length === 0 ||
store.Ops.genderOps.length === 0 ||
@ -512,42 +443,8 @@ onMounted(async () => {
await fetchPerson();
}
fetchData(profileId.value);
fetchDataPersonal();
await Promise.all([fetchData(profileId.value), fetchDataPersonal()]);
});
watch(
() => changeNameData.prefix,
() => {
if (changeNameData.prefix !== prefixChange.value) {
submitDisable.value = false;
} else {
submitDisable.value = true;
}
}
);
watch(
() => changeNameData.firstName,
() => {
if (changeNameData.firstName !== firstNameChange.value) {
submitDisable.value = false;
} else {
submitDisable.value = true;
}
}
);
watch(
() => changeNameData.lastName,
() => {
if (changeNameData.lastName !== lastNameChange.value) {
submitDisable.value = false;
} else {
submitDisable.value = true;
}
}
);
</script>
<template>
@ -561,9 +458,9 @@ watch(
icon="add"
@click="
() => {
changeNameData.prefix = profileInfo.prefix;
changeNameData.firstName = profileInfo.firstName;
changeNameData.lastName = profileInfo.lastName;
changeNameData.prefix = profileInfo?.prefix;
changeNameData.firstName = profileInfo?.firstName;
changeNameData.lastName = profileInfo?.lastName;
prefixChange = changeNameData.prefix;
firstNameChange = changeNameData.firstName;
lastNameChange = changeNameData.lastName;
@ -645,7 +542,7 @@ watch(
dense
round
icon="mdi-file-document-outline"
@click="fetchProfile(props.row.id)"
@click="onDownloadFile(props.row.id)"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
@ -843,84 +740,6 @@ watch(
</q-form>
</q-card>
</q-dialog>
<q-dialog v-model="historyDialog" class="dialog" persistent>
<q-card style="min-width: 70%">
<dialog-header
tittle="ประวัติแก้ไขการเปลี่ยนชื่อ-นามสกุล"
:close="closeHistoryDialog"
/>
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<q-toolbar style="padding: 0px" class="text-primary q-mb-sm">
<q-space />
<q-input
dense
outlined
bg-color="white"
v-model="historyKeyword"
label="ค้นหา"
class="q-mr-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="historyVisibleColumns"
multiple
outlined
dense
bg-color="white"
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="historyColumns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</q-toolbar>
<d-table
ref="table"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
bordered
:paging="true"
dense
:filter="historyKeyword"
v-model:pagination="historyPagination"
:rows-per-page-options="[20, 50, 100]"
class="custom-header-table"
:visible-columns="historyVisibleColumns"
>
<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-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value === "" ? "-" : col.value }}
</div>
</q-td>
<q-td auto-width> </q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template>
<style scoped></style>

View file

@ -1,20 +1,21 @@
<script setup lang="ts">
import { onMounted, ref, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import { useAddressDataStore } from "@/modules/04_registryPerson/stores/Address";
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useAddressDataStore } from "@/modules/04_registryPerson/stores/Address";
import type { QTableProps } from "quasar";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Address";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Address";
import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const store = useAddressDataStore();
const mixin = useCounterMixin();
@ -35,17 +36,13 @@ const {
dialogConfirm,
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 modalHistory = ref<boolean>(false);
const rowsHistory = ref<ResponseObject[]>([]);
const filterHistory = ref<string>("");
const id = ref<string>("");
const modal = ref<boolean>(false); // Popup
const rawSameAddress = ref<string>("0");
const sameAddress = ref<string>("0");
const addressData = reactive<ResponseObject>(store.defaultAddress);
@ -55,7 +52,6 @@ const adsName = reactive({
regisP: "",
regisD: "",
regisSD: "",
currentP: "",
currentD: "",
currentSD: "",
@ -67,16 +63,17 @@ const dataLabel = {
registrationDistrict: "เขต/อำเภอ",
registrationSubDistrict: "แขวง / ตำบล",
registrationZipCode: "รหัสไปรษณีย์",
currentAddress: "ที่อยู่ปัจจุบัน",
currentProvince: "จังหวัด",
currentDistrict: "เขต/อำเภอ",
currentSubDistrict: "แขวง / ตำบล",
currentZipCode: "รหัสไปรษณีย์",
registrationSame: "ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้าน",
};
const modalHistory = ref<boolean>(false); // Popup
const rowsHistory = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); //
const visibleColumnsHistory = ref<String[]>([
"currentAddress",
"currentDistrict",
@ -91,7 +88,6 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "registrationAddress",
@ -123,7 +119,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "registrationDistrict",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// format: (v) => (v ? v.name : "-"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -135,7 +130,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "registrationSubDistrict",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// format: (v) => (v ? v.name : "-"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -184,7 +178,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "currentProvince",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// format: (v) => (v ? v.name : "-"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -196,7 +190,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "currentDistrict",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// format: (v) => (v ? v.name : "-"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -208,7 +202,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
field: "currentSubDistrict",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// format: (v) => (v ? v.name : "-"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
@ -248,17 +242,20 @@ const columnsHistory = ref<QTableProps["columns"]>([
},
]);
/**
* งกนดงขอมลทอย
*
* งขอมลทอย อมลจงหว อม เขต / อำเภอ และขอม แขวง / ตำบล
*/
async function getData() {
showLoader();
await http
.get(
config.API.profileNewAddressByProfileId(profileId.value, empType.value)
)
.then((res) => {
.then(async (res) => {
Object.assign(addressData, res.data.result);
if (addressData) {
id.value = addressData.id;
addressData.currentAddress === addressData.registrationAddress &&
addressData.currentZipCode === addressData.registrationZipCode &&
addressData.currentAddress &&
@ -269,6 +266,24 @@ async function getData() {
: (rawSameAddress.value = "0");
}
sameAddress.value = rawSameAddress.value;
if (
store.Ops.provinceOps.length === 0 ||
store.Ops.districtOps.length === 0 ||
store.Ops.districtCOps.length === 0 ||
store.Ops.subdistrictOps.length === 0 ||
store.Ops.subdistrictCOps.length === 0 ||
store.profileIdBefore !== profileId.value
) {
await Promise.all([
fetchProvince(),
fetchDistrict(addressData.registrationProvinceId, "1"),
fetchDistrict(addressData.currentProvinceId, "2"),
fetchSubDistrict(addressData.registrationDistrictId, "1"),
fetchSubDistrict(addressData.currentDistrictId, "2"),
]);
store.profileIdBefore = profileId.value;
}
})
.catch((e) => {
messageError($q, e);
@ -278,6 +293,11 @@ async function getData() {
});
}
/**
* งกนเลอกจงหว
* @param e งหวดทเลอก
* @param name 1 อยตามทะเบยนบาน 2 อยจจ
*/
async function selectProvince(e: string | null, name: string) {
if (!e) return;
if (name == "1") {
@ -292,6 +312,11 @@ async function selectProvince(e: string | null, name: string) {
await fetchDistrict(e, name);
}
/**
* งกนเลอก เขต / อำเภอ
* @param e แขวง/ตำบลทเลอก
* @param name 1 อยตามทะเบยนบาน 2 อยจจ
*/
async function selectDistrict(e: string | null, name: string) {
if (!e) return;
if (name == "1") {
@ -304,6 +329,11 @@ async function selectDistrict(e: string | null, name: string) {
await fetchSubDistrict(e, name);
}
/**
* งกนเลอก แขวง / ตำบล
* @param e แขวง / ตำบล เลอก
* @param name 1 อยตามทะเบยนบาน 2 อยจจ
*/
function selectSubDistrict(e: string | null, name: string) {
if (!e) return;
if (name == "1") {
@ -317,26 +347,16 @@ function selectSubDistrict(e: string | null, name: string) {
}
}
/**
* งกนดงขอมลทงหมด
*
*
*/
async function fetchAll() {
await getData();
if (!store.profileIdBefore) {
store.profileIdBefore = profileId.value;
}
if (
store.Ops.provinceOps.length === 0 ||
store.Ops.districtOps.length === 0 ||
store.Ops.districtCOps.length === 0 ||
store.Ops.subdistrictOps.length === 0 ||
store.Ops.subdistrictCOps.length === 0 ||
store.profileIdBefore !== profileId.value
) {
await fetchProvince();
await fetchDistrict(addressData.registrationProvinceId, "1");
await fetchDistrict(addressData.currentProvinceId, "2");
await fetchSubDistrict(addressData.registrationDistrictId, "1");
await fetchSubDistrict(addressData.currentDistrictId, "2");
store.profileIdBefore = profileId.value;
}
adsName.regisP = findData(
store.Ops.provinceOps,
@ -365,45 +385,65 @@ async function fetchAll() {
).name;
}
async function editData() {
showLoader();
await http
.patch(config.API.profileNewAddressById(id.value, empType.value), {
...formData,
id: undefined,
})
.then(async (res) => {
await fetchAll();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function clickClose() {
Object.assign(formData, store.defaultAddressForm);
modal.value = false;
/**
* งกนบนทกขอมลขอมลทอย
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
if (sameAddress.value === "1") {
formData.currentAddress = formData.registrationAddress;
formData.currentProvinceId = formData.registrationProvinceId;
formData.currentDistrictId = formData.registrationDistrictId;
formData.currentSubDistrictId = formData.registrationSubDistrictId;
formData.currentZipCode = formData.registrationZipCode;
store.Ops.districtCOps = store.Ops.districtOps;
store.Ops.subdistrictCOps = store.Ops.subdistrictOps;
}
showLoader();
await http
.patch(
config.API.profileNewAddressById(profileId.value, empType.value),
{
...formData,
id: undefined,
}
)
.then(async () => {
await fetchAll();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* งกนเป popup การแกไขขอมลขอมลทอย
*/
async function onClickOpenDialog() {
if (!addressData) return;
await Object.assign(formData, addressData);
const checkDistrict = await store.Ops.districtOps.some(
(e: any) => e.id === addressData.registrationDistrictId
Object.assign(formData, addressData);
const checkDistrict = store.Ops.districtOps.some(
(e: DataOption) => e.id === addressData.registrationDistrictId
);
const checkSubDistrict = await store.Ops.subdistrictOps.some(
(e: any) => e.id === addressData.registrationSubDistrictId
const checkSubDistrict = store.Ops.subdistrictOps.some(
(e: DataOption) => e.id === addressData.registrationSubDistrictId
);
const checkDistrictC = await store.Ops.districtCOps.some(
(e: any) => e.id === addressData.currentDistrictId
const checkDistrictC = store.Ops.districtCOps.some(
(e: DataOption) => e.id === addressData.currentDistrictId
);
const checkSubDistrictC = await store.Ops.subdistrictCOps.some(
(e: any) => e.id === addressData.currentSubDistrictId
const checkSubDistrictC = store.Ops.subdistrictCOps.some(
(e: DataOption) => e.id === addressData.currentSubDistrictId
);
modal.value = true;
@ -419,12 +459,26 @@ async function onClickOpenDialog() {
}
}
/**
* งกนป Popup การแกไขขอมลทอย
*/
function clickClose() {
Object.assign(formData, store.defaultAddressForm);
modal.value = false;
}
/**
* งกนเป popup ประวแกไขขอมลทอย
*
* และดงขอมลรายการประวแกไขขอมลทอย
*/
async function clickHistory() {
showLoader();
modalHistory.value = true;
await http
.get(config.API.profileNewAddressHisById(id.value, empType.value))
.then((res) => {
rowsHistory.value = res.data.result;
.get(config.API.profileNewAddressHisById(profileId.value, empType.value))
.then(async (res) => {
rowsHistory.value = await res.data.result;
})
.catch((e) => {
messageError($q, e);
@ -434,27 +488,10 @@ async function clickHistory() {
});
}
function onSubmit() {
dialogConfirm(
$q,
async () => {
if (sameAddress.value === "1") {
formData.currentAddress = formData.registrationAddress;
formData.currentProvinceId = formData.registrationProvinceId;
formData.currentDistrictId = formData.registrationDistrictId;
formData.currentSubDistrictId = formData.registrationSubDistrictId;
formData.currentZipCode = formData.registrationZipCode;
store.Ops.districtCOps = store.Ops.districtOps;
store.Ops.subdistrictCOps = store.Ops.subdistrictOps;
}
editData();
modal.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* งกนกำหนดทอยจจ
* @param v
*/
function sameAddressToggle(v: string) {
if (v === "0") {
formData.currentAddress = "";
@ -467,6 +504,9 @@ function sameAddressToggle(v: string) {
}
}
/**
* การเปลยนแปลงทอยจจนตรงกบทอยตามทะเบยนบาน
*/
watch(
() => sameAddress.value,
(v) => {
@ -474,6 +514,9 @@ watch(
}
);
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
await fetchAll();
});
@ -849,7 +892,7 @@ onMounted(async () => {
<q-card style="min-width: 80%">
<DialogHeader
tittle="ประวัติแก้ไขข้อมูลที่อยู่"
:close="() => (modalHistory = false)"
:close="() => ((modalHistory = false), (rowsHistory = []))"
/>
<q-separator color="grey-4" />

View file

@ -1,9 +1,11 @@
<script setup lang="ts">
import { reactive, ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -16,12 +18,8 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const store = useProfileDataStore();
const { filterSelector } = store;
const {
@ -171,7 +169,6 @@ const childData = ref<FormChildren[]>([]);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const filterHistory = ref<string>("");
const titleForm = ref<string>("");
const typeForm = ref<string>("");
const isEdit = ref<boolean>(false);
@ -477,6 +474,9 @@ async function fetchHistory(id: string, type: string) {
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
showLoader();
await Promise.all([
@ -872,7 +872,7 @@ onMounted(async () => {
hidden-space
dense
class="inputgreen"
:rules="[(val) => !!val || 'กรุณาเลือกสถานภาพการสมรส']"
:rules="[(val:string) => !!val || 'กรุณาเลือกสถานภาพการสมรส']"
label="สถานภาพการสมรส"
v-model="fromData.statusMarital"
use-input
@ -900,8 +900,8 @@ onMounted(async () => {
:rules="
typeForm !== 'couple'
? [
(val) => !!val || 'กรุณากรอกเลขบัตรประชาชน',
(val) =>
(val:string) => !!val || 'กรุณากรอกเลขบัตรประชาชน',
(val:string) =>
val.length === 13 ||
'กรุณากรอกเลขบัตรประชาชนให้ครบ 13 หลัก',
]
@ -921,7 +921,7 @@ onMounted(async () => {
class="inputgreen"
:rules="
typeForm !== 'couple'
? [(val) => !!val || 'กรุณาเลือกคำนำหน้าชื่อ']
? [(val:string) => !!val || 'กรุณาเลือกคำนำหน้าชื่อ']
: []
"
label="คำนำหน้าชื่อ"
@ -948,7 +948,7 @@ onMounted(async () => {
v-model="fromData.firstName"
:rules="
typeForm !== 'couple'
? [(val) => !!val || 'กรุณากรอกชื่อ']
? [(val:string) => !!val || 'กรุณากรอกชื่อ']
: []
"
label="ชื่อ"
@ -965,7 +965,7 @@ onMounted(async () => {
v-model="fromData.lastName"
:rules="
typeForm !== 'couple'
? [(val) => !!val || 'กรุณากรอกนามสกุล']
? [(val:string) => !!val || 'กรุณากรอกนามสกุล']
: []
"
label="นามสกุล"

View file

@ -1,21 +1,30 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { ref, reactive, onMounted } from "vue";
import { QForm, useQuasar } from "quasar";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Education";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Education";
import { QForm, useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
import type { QTableProps } from "quasar";
import type {
DataOptionEducation,
DataOptionEducationLevel,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Education";
import type {
ResponseObject,
DataEducationLevel,
} from "@/modules/04_registryPerson/interface/response/Education";
import dialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
@ -25,9 +34,14 @@ const {
pathRegistryEmp,
} = mixin;
const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("create");
const mode = ref<string>("table");
const id = ref<string>(route.params.id.toString()); //id profile
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const dialog = ref<boolean>(false); // popup
const dialogStatus = ref<string>("create"); //
const mode = ref<string>("table"); // Table card
//Table
const rows = ref<ResponseObject[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "educationLevel",
@ -201,6 +215,9 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
//Table
const historyRows = ref<ResponseObject[]>([]);
const historyColumns = ref<QTableProps["columns"]>([
{
name: "educationLevel",
@ -398,26 +415,20 @@ const historyColumns = ref<QTableProps["columns"]>([
},
]);
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
const editId = ref<string>("");
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const editId = ref<string>(""); //id
const isDate = ref<string>("false");
const educationOption = ref([
const educationOption = ref<DataOptionEducation[]>([
{ label: "ใช่", value: true },
{ label: "ไม่ใช่", value: false },
]);
const educationOptionFilter = ref<DataOptionEducation[]>([
{ label: "ใช่", value: true },
{ label: "ไม่ใช่", value: false },
]);
const educationOptionFilter = ref([
{ label: "ใช่", value: true },
{ label: "ไม่ใช่", value: false },
]);
const educationLevelOption = ref<any>([]);
const educationLevelOptionFilter = ref([]);
const educationLevelOption = ref<DataOptionEducationLevel[]>([]);
const educationLevelOptionFilter = ref<DataOptionEducationLevel[]>([]);
const historyDialog = ref<boolean>(false);
const educationData = reactive<RequestItemsObject>({
@ -520,14 +531,14 @@ function filterSelector(val: string, update: Function, refData: string) {
case "educationOption":
update(() => {
educationOption.value = educationOptionFilter.value.filter(
(v: any) => v.label.indexOf(val) > -1
(v: DataOptionEducation) => v.label.indexOf(val) > -1
);
});
break;
case "educationLevelOption":
update(() => {
educationLevelOption.value = educationLevelOptionFilter.value.filter(
(v: any) => v.label.indexOf(val) > -1
(v: DataOptionEducationLevel) => v.label.indexOf(val) > -1
);
});
break;
@ -566,7 +577,7 @@ function clearForm() {
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
editId.value = row?.id;
isDate.value = row.isDate ? "true" : "false";
educationData.educationLevel = row.educationLevel;
educationData.institute = row.institute;
@ -607,18 +618,19 @@ function closeDialog() {
*/
function closeHistoryDialog() {
historyDialog.value = false;
historyRows.value = []
}
/**
* function fetch อมลประวการศกษา
* @param id คคล
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewEducationByProfileId(id, empType.value))
.then((res) => {
rows.value = res.data.result;
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -635,7 +647,7 @@ function fetchEducationLevel() {
http
.get(config.API.orgEducationLevel)
.then(async (res) => {
res.data.result.map((r: any) => {
res.data.result.map((r: DataEducationLevel) => {
educationLevelOption.value.push({
value: r.id,
label: r.name,
@ -657,7 +669,7 @@ function fetchHistoryData(id: string) {
http
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
historyRows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -723,6 +735,9 @@ function editData(idData: string) {
});
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => {
await fetchData(id.value);
fetchEducationLevel();
@ -1007,7 +1022,7 @@ onMounted(async () => {
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'educationLevelOption'
) "
:rules="[(val) => !!val || `${'กรุณาเลือกระดับการศึกษา'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับการศึกษา'}`]"
label="ระดับการศึกษา"
class="inputgreen"
hide-bottom-space
@ -1021,7 +1036,7 @@ onMounted(async () => {
bg-color="white"
dense
class="inputgreen"
:rules="[(val) => !!val || `${'กรุณากรอกสถานศึกษา'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกสถานศึกษา'}`]"
hide-bottom-space
/>
</div>
@ -1075,7 +1090,7 @@ onMounted(async () => {
hide-bottom-space
:model-value="educationData.startYear + 543"
:rules="[
(val) => !!val || `${'กรุณาเลือกปีที่เริ่มต้นศึกษา'}`,
(val:string) => !!val || `${'กรุณาเลือกปีที่เริ่มต้นศึกษา'}`,
]"
:label="`${'ปีที่เริ่มต้นศึกษา'}`"
>
@ -1118,7 +1133,7 @@ onMounted(async () => {
hide-bottom-space
:model-value="educationData.endYear + 543"
:rules="[
(val) => !!val || `${'กรุณาเลือกปีที่จบการศึกษา'}`,
(val:string) => !!val || `${'กรุณาเลือกปีที่จบการศึกษา'}`,
]"
:label="`${'ปีที่จบการศึกษา'}`"
>
@ -1162,7 +1177,7 @@ onMounted(async () => {
dense
:model-value="date2Thai(educationData.startDate)"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้นศึกษา'}`,
(val:string) => !!val || `${'กรุณาเลือกวันที่เริ่มต้นศึกษา'}`,
]"
hide-bottom-space
:label="`${'วันที่เริ่มต้นศึกษา'}`"

View file

@ -1,19 +1,23 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { QForm, useQuasar } from "quasar";
import dialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill";
import type { QTableProps } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
import { checkPermission } from "@/utils/permissions";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill";
import dialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const mode = ref<string>("table");
const route = useRoute();
const mixin = useCounterMixin();
const {
dialogConfirm,
showLoader,
@ -23,6 +27,15 @@ const {
date2Thai,
pathRegistryEmp,
} = mixin;
const id = ref<string>(route.params.id.toString()); //id profile
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const mode = ref<string>("table"); // Table card
//Table
const keyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "field",
@ -69,7 +82,20 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"field",
"detail",
"remark",
"reference",
]);
const dialog = ref<boolean>(false); // popup
const dialogStatus = ref<string>("create"); ////
const editId = ref<string>(""); //id
const historyDialog = ref<boolean>(false); // popup
const historyRows = ref<ResponseObject[]>([]); //
const historyKeyword = ref<string>(""); //
const historyColumns = ref<QTableProps["columns"]>([
{
name: "field",
@ -139,25 +165,21 @@ const historyColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const historyVisibleColumns = ref<string[]>([
"field",
"detail",
"remark",
"reference",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyDialog = ref<boolean>(false);
const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("create");
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const editId = ref<string>("");
const keyword = ref<string>("");
const historyKeyword = ref<string>("");
//
const specialSkill = reactive<RequestItemsObject>({
field: "",
detail: "",
remark: "",
reference: "",
field: "", //
detail: "", //
remark: "", //
reference: "", //
profileId: id.value,
dateStart: null,
dateEnd: null,
@ -173,30 +195,6 @@ const historyPagination = ref({
rowsPerPage: 10,
});
const visibleColumns = ref<string[]>([
"field",
"detail",
"remark",
"reference",
]);
const historyVisibleColumns = ref<string[]>([
"field",
"detail",
"remark",
"reference",
"lastUpdateFullName",
"lastUpdatedAt",
]);
function closeDialog() {
dialog.value = false;
}
function closeHistoryDialog() {
historyDialog.value = false;
}
/**
* function นยนการบนทกขอม
*/
@ -238,12 +236,12 @@ function editForm(row: any) {
/**
* function fetch อมลความสามรรถพเศษ
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewAbilityByProfileId(id, empType.value))
.then((res) => {
rows.value = res.data.result;
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -257,12 +255,12 @@ function fetchData(id: string) {
* function fetch ประวการแกไขความสามรรถพเศษ
* @param id ความสามรรถพเศษ
*/
function fetchHistoryData(id: string) {
async function fetchHistoryData(id: string) {
showLoader();
http
await http
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
.then((res) => {
historyRows.value = res.data.result;
.then(async (res) => {
historyRows.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -275,9 +273,9 @@ function fetchHistoryData(id: string) {
/**
* function เพมขอมลความสามรรถพเศษ
*/
function addData() {
async function addData() {
showLoader();
http
await http
.post(config.API.profileNewAbility(empType.value), {
...specialSkill,
dateStart: null,
@ -302,9 +300,9 @@ function addData() {
* function นทกการแกไขขอม
* @param idData ความสามรรถพเศษ
*/
function editData(idData: string) {
async function editData(idData: string) {
showLoader();
http
await http
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
...specialSkill,
dateStart: null,
@ -324,6 +322,24 @@ function editData(idData: string) {
});
}
/**
* function popup อมลความสามารถพเศษ
*/
function closeDialog() {
dialog.value = false;
}
/**
* function popup รายการประว
*/
function closeHistoryDialog() {
historyDialog.value = false;
historyRows.value = [];
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchData(id.value);
});
@ -531,7 +547,7 @@ onMounted(() => {
v-model="specialSkill.field"
label="ด้าน"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกด้านความสามารถพิเศษ'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกด้านความสามารถพิเศษ'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
@ -543,7 +559,7 @@ onMounted(() => {
v-model="specialSkill.detail"
label="รายละเอียด"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">

View file

@ -2,13 +2,12 @@
import { ref } from "vue";
/** importComponents*/
import Profile from "@/modules/04_registryPerson/components/detail/PersonalInformation/01_Profile.vue";
import NameChangeHistory from "@/modules/04_registryPerson/components/detail/PersonalInformation/02_NameChangeHistory.vue";
import Address from "@/modules/04_registryPerson/components/detail/PersonalInformation/03_Address.vue";
import Education from "@/modules/04_registryPerson/components/detail/PersonalInformation/05_Education.vue";
import SpecialSkill from "@/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue";
import FamilyNew from "@/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue";
import Profile from "@/modules/04_registryPerson/components/detail/PersonalInformation/01_Profile.vue"; //
import NameChangeHistory from "@/modules/04_registryPerson/components/detail/PersonalInformation/02_NameChangeHistory.vue"; //
import Address from "@/modules/04_registryPerson/components/detail/PersonalInformation/03_Address.vue"; //
import FamilyNew from "@/modules/04_registryPerson/components/detail/PersonalInformation/04_FamilyNew.vue"; //
import Education from "@/modules/04_registryPerson/components/detail/PersonalInformation/05_Education.vue"; //
import SpecialSkill from "@/modules/04_registryPerson/components/detail/PersonalInformation/06_SpecialSkill.vue"; //
const tab = ref<string>("1");
const props = defineProps({
@ -63,9 +62,6 @@ const props = defineProps({
<q-tab-panel name="6">
<SpecialSkill />
</q-tab-panel>
<!-- <q-tab-panel name="7">
<FamilyNew />
</q-tab-panel> -->
</q-tab-panels>
</q-card>
</template>

View file

@ -44,6 +44,9 @@ const {
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
//Table
const rows = ref<ResListSalary[]>([]); //
const keyword = ref<string>(""); //
const baseColumns = ref<QTableProps["columns"]>([
{
name: "date",
@ -161,31 +164,29 @@ const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const rows = ref<ResListSalary[]>([]);
const keyword = ref<string>("");
const formDataSalary = reactive<FormSalaryNew>({
date: null,
posNo: "",
templatePos: "",
position: "",
positionLine: "",
positionPathSide: "",
positionType: "",
positionLevel: "",
positionExecutive: "",
salaryCompensation: null,
salary: null,
salaryPos: null,
refCommandNo: "",
templateDoc: "",
doc: "",
date: null, ////
posNo: "", //
templatePos: "", // (template)
position: "", //
positionType: "", //,
positionLevel: "", //,
positionLine: "", //
positionPathSide: "", ///
positionExecutive: "", //
salary: null, //
salaryPos: null, //
salaryCompensation: null, //
refCommandNo: "", //
templateDoc: "", // (template)
doc: "", //
});
const modalDialogSalary = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const salaryId = ref<string>("");
const dataLevel = ref<ResType[]>([]);
const modalDialogSalary = ref<boolean>(false); // popup
const isStatusEdit = ref<boolean>(false); //
const salaryId = ref<string>(""); //id
const dataLevel = ref<ResType[]>([]); //
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
@ -314,7 +315,7 @@ function onClickCloseDialog() {
* @param update function จาก quasar
* @param filtername type กำหนด ของ input นๆ
*/
function filterSelector(val: any, update: Function, filtername: string) {
function filterSelector(val: string, update: Function, filtername: string) {
switch (filtername) {
case "pos":
update(() => {
@ -593,16 +594,19 @@ function fetchOptionGroup() {
});
}
onMounted(() => {
fetchListSalary();
});
const classInput = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
fetchListSalary();
});
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
@ -815,7 +819,7 @@ const classInput = (val: boolean) => {
use-input
input-debounce="0"
@update:modelValue="updatePos"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'pos'
)"
/>
@ -857,7 +861,7 @@ const classInput = (val: boolean) => {
input-debounce="0"
@update:model-value="updateSelectType"
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกประเภทตำแหน่ง' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
)"
/>
@ -882,7 +886,7 @@ const classInput = (val: boolean) => {
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posLevel'
)"
/>
@ -907,7 +911,7 @@ const classInput = (val: boolean) => {
use-input
clearable
input-debounce="0"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
)"
/>
@ -931,7 +935,7 @@ const classInput = (val: boolean) => {
use-input
clearable
input-debounce="0"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionPathSide'
)"
/>
@ -955,7 +959,7 @@ const classInput = (val: boolean) => {
use-input
input-debounce="0"
clearable
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionExecutive'
)"
/>
@ -1043,7 +1047,7 @@ const classInput = (val: boolean) => {
use-input
input-debounce="0"
@update:modelValue="updateDoc"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'doc'
)"
/>

View file

@ -1,26 +1,32 @@
<script setup lang="ts">
import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRoute } from "vue-router";
import type { QTableProps } from "quasar";
import type { ResListSalary } from "@/modules/04_registryPerson/interface/response/Salary";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const { date2Thai, showLoader, hideLoader, messageError, pathRegistryEmp } =
useCounterMixin();
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true });
const salaryId = defineModel<string>("salaryId", { required: true });
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const rows = ref<ResListSalary[]>([]); //
const keyword = ref<string>(""); //
const baseColumns = ref<QTableProps["columns"]>([
{
name: "date",
@ -210,7 +216,6 @@ const visibleColumns = ref<string[]>([
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = computed(() => {
if (empType.value === "-employee") {
if (baseColumns.value) {
@ -223,18 +228,11 @@ const columns = computed(() => {
}
return baseColumns.value;
});
const rows = ref<any[]>([]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const keyword = ref<string>("");
function closeDialog() {
modal.value = false;
}
/**
* function fetch อมลประวการแกไข
*/
@ -253,6 +251,19 @@ function fetchListHistory() {
});
}
/**
* งกนป Popup
*/
function closeDialog() {
modal.value = false;
rows.value = [];
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/
watch(
() => modal.value,
() => {

View file

@ -1,19 +1,20 @@
<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 { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHisotory from "@/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue";
import type { QTableProps } from "quasar";
import type { RowList } from "@/modules/04_registryPerson/interface/index/salary";
import type { RequestNoPaidObject } from "@/modules/04_registryPerson/interface/request/Salary";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHisotory from "@/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalaryHistory.vue";
const $q = useQuasar();
const route = useRoute();
const {
@ -25,17 +26,29 @@ const {
success,
pathRegistryEmp,
} = useCounterMixin();
const id = ref<string>("");
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const modelView = ref<string>("table");
const modalDialog = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const rows = ref<RowList[]>([]);
const modelView = ref<string>("table"); // Table,Card
const modalDialog = ref<boolean>(false); // popup
const modalHistory = ref<boolean>(false); // popup
const isStatusEdit = ref<boolean>(false); //
const formData = reactive<RequestNoPaidObject>({
date: null, ////
reference: "", //
detail: "", //
refCommandNo: "", //
refCommandDate: null, //' ()'
});
//Table
const rows = ref<RowList[]>([]); //
const keyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -103,15 +116,6 @@ const visibleColumns = ref<string[]>([
"refCommandNo",
"refCommandDate",
]);
const formData = reactive<RequestNoPaidObject>({
date: null,
reference: "",
detail: "",
refCommandNo: "",
refCommandDate: null,
});
const keyword = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
@ -153,12 +157,12 @@ function onClickCloseDialog() {
/**
* function fetch รายการบนทกวนทไมไดบเงนเดอนฯ
*/
function getData() {
async function getData() {
showLoader();
http
await http
.get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((e) => {
messageError($q, e);
@ -181,8 +185,8 @@ function saveData() {
})
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
onClickCloseDialog();
})
.catch((e) => {
messageError($q, e);
@ -204,8 +208,8 @@ function editData() {
})
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
onClickCloseDialog();
})
.catch((e) => {
messageError($q, e);
@ -223,6 +227,9 @@ function onClickHistory(rowId: string) {
modalHistory.value = true;
}
/**
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(() => {
getData();
});

View file

@ -21,8 +21,10 @@ const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true });
const filter = ref<string>("");
const rows = ref<RowList[]>([]);
//Table
const filter = ref<string>(""); //
const rows = ref<RowList[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "date",
@ -122,12 +124,12 @@ const pagination = ref({
/**
* fetch รายการขอมลประวการแกไช
*/
function getHistory() {
async function getHistory() {
showLoader();
http
await http
.get(config.API.profileNewNoPaidHisById(id.value, empType.value))
.then((res) => {
rows.value = res.data.result;
.then(async (res) => {
rows.value = await res.data.result;
})
.catch((e) => {
messageError($q, e);
@ -137,10 +139,19 @@ function getHistory() {
});
}
/**
* งกนป Popup
*/
function closeDialog() {
modal.value = false;
rows.value = [];
}
/**
* การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/
watch(modal, (status) => {
if (status == true) {
getHistory();

View file

@ -2,8 +2,8 @@
import { ref } from "vue";
/** importComponents*/
import PositionSalary from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue";
import NotReceiveSalary from "@/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue";
import PositionSalary from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue"; //
import NotReceiveSalary from "@/modules/04_registryPerson/components/detail/Salary/02_NotReceiveSalary.vue"; //
const tab = ref<string>("1");
</script>

View file

@ -4,12 +4,14 @@ import { useRoute } from "vue-router";
import { useRegistryDetailNewDataStore } from "@/modules/04_registryPerson/stores/DetailMain";
import PersonalInformationMain from "@/modules/04_registryPerson/components/detail/PersonalInformation/Main.vue";
import GovernmentInformationMain from "@/modules/04_registryPerson/components/detail/GovernmentInformation/Main.vue";
import salaryMain from "@/modules/04_registryPerson/components/detail/Salary/Main.vue";
import AchievementMain from "@/modules/04_registryPerson/components/detail/Achievement/Main.vue";
import OtherMaim from "@/modules/04_registryPerson/components/detail/Other/Main.vue";
import EmployeeMain from "@/modules/04_registryPerson/components/detail/Employee/Main.vue";
import type { ItemTab } from "@/modules/04_registryPerson/interface/index/Main";
import PersonalInformationMain from "@/modules/04_registryPerson/components/detail/PersonalInformation/Main.vue"; //
import GovernmentInformationMain from "@/modules/04_registryPerson/components/detail/GovernmentInformation/Main.vue"; //
import salaryMain from "@/modules/04_registryPerson/components/detail/Salary/Main.vue"; ///
import AchievementMain from "@/modules/04_registryPerson/components/detail/Achievement/Main.vue"; //
import OtherMaim from "@/modules/04_registryPerson/components/detail/Other/Main.vue"; //
import EmployeeMain from "@/modules/04_registryPerson/components/detail/Employee/Main.vue"; //
const route = useRoute();
@ -18,7 +20,7 @@ const props = defineProps({
fetchDataPersonal: { type: Function, require: true },
});
const itemsTab = ref<any>([
const itemsTab = ref<ItemTab[]>([
{
name: "1",
icon: "mdi-account",

View file

@ -1,8 +1,11 @@
<script setup lang="ts">
import { reactive, ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
@ -11,12 +14,6 @@ import type { DataOption } from "@/modules/04_registryPerson/interface/index/Mai
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
@ -28,40 +25,43 @@ const { dialogConfirm, showLoader, hideLoader, messageError, success } =
/**
* props
*/
const modal = defineModel<boolean>("modal", { required: true });
const requestId = defineModel<string>("requestId", { required: true });
const modal = defineModel<boolean>("modal", { required: true }); //, popup
const requestId = defineModel<string>("requestId", { required: true }); // id
const props = defineProps({
fetchData: { type: Function, requied: true },
fetchData: { type: Function, requied: true }, //
});
const isReadOnly = ref<boolean>(false);
const isReadOnly = ref<boolean>(false); //
//
const formData = reactive({
status: "",
remark: "",
status: "", //
remark: "", //
});
//
const statusOptionMain = ref<DataOption[]>(
store.optionStatus.filter((e) => e.id !== "")
);
const statusOption = ref<DataOption[]>(statusOptionMain.value);
const statusOption = ref<DataOption[]>(statusOptionMain.value); //
/**
* function นทกรายการคำรอง
*/
function onSubmit() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
showLoader();
http
await http
.patch(config.API.requestEdit + `${requestId.value}`, {
status: formData.status,
remark: formData.remark,
})
.then(async () => {
await props.fetchData?.();
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
@ -76,13 +76,6 @@ function closeDialog() {
formData.remark = "";
}
function classInput(val: boolean) {
return {
"full-width cursor-pointer ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
/**
* function นหาคำใน select สถานะคำรอง
* @param val คำค
@ -121,6 +114,22 @@ function fetchDataRequest() {
});
}
/**
* class inpui
* @param val าสถานะ
*/
function classInput(val: boolean) {
return {
"full-width cursor-pointer ": val,
"full-width cursor-pointer inputgreen": !val,
};
}
/**
* การเปลยนแปลงของ modal
*
* เม modal เป true ทำการดงขอมลคำรองแกไข
*/
watch(
() => modal.value,
() => {

View file

@ -10,6 +10,7 @@ interface DataOption2 {
id: number;
name: string;
}
interface DataOptionSys {
id: string;
name: string;
@ -21,6 +22,16 @@ interface DataOptionInsignia {
typeName: string;
}
interface DataOptionEducation {
label: string;
value: boolean;
}
interface DataOptionEducationLevel {
label: string;
value: string;
}
interface zipCodeOption {
id: string;
name: string;
@ -50,6 +61,12 @@ interface InsigniaOps {
insigniaOptions: DataOptionInsignia[];
}
interface ItemTab {
name: string;
icon: string;
label: string;
}
export type {
Pagination,
DataOption,
@ -60,4 +77,7 @@ export type {
AddressOps,
InsigniaOps,
DataOptionSys,
ItemTab,
DataOptionEducation,
DataOptionEducationLevel,
};

View file

@ -25,6 +25,7 @@ interface FormFilter {
interface DataOption {
id: string;
name: string;
disable?: boolean;
}
interface DisciplineOps {

View file

@ -1,8 +1,8 @@
interface DetailData {
id: string;
typeLeave: string;
dateStartLeave: Date | null;
dateEndLeave: Date | null;
dateStartLeave: Date | null | string;
dateEndLeave: Date | null | string;
numLeave: number;
status: string;
reason: string;
@ -26,7 +26,8 @@ interface FormFilter {
interface DataOptionLeave {
id: string;
name: string;
totalLeave: number;
totalLeave?: number;
code?: string;
}
interface DataOption {

View file

@ -12,7 +12,7 @@ interface FormFilter {
isProbation: boolean | null;
isAll?: boolean;
nodeId?: string | null;
node?: string | null;
node?: string | null | number;
}
interface FormAddPerson {
@ -39,4 +39,38 @@ interface MyObjectRef {
[key: string]: any;
}
export type { FormFilter, FormAddPerson, MyObjectRef };
interface DataNodeData {
name: string;
nodeId: string | null | undefined;
node: string | null | undefined | number;
}
interface QueryParams {
page: number;
pageSize: number;
isProbation?: boolean;
isRetire?: boolean;
type?: string;
node?: number | string | null | undefined;
nodeId?: string;
isAll?: boolean;
}
interface FormChangeName {
profileId: string;
prefixId: string | null | undefined;
prefix: string | null | undefined;
firstName: string | null | undefined;
lastName: string | null | undefined;
status: string | null | undefined;
documentId: string | null | undefined;
}
export type {
FormFilter,
FormAddPerson,
MyObjectRef,
DataNodeData,
QueryParams,
FormChangeName,
};

View file

@ -29,5 +29,13 @@ interface ResponseObject {
lastUpdateUserID: string;
lastUpdatedAt: Date;
}
interface DataEducationLevel {
createdAt: string;
createdFullName: string;
id: string;
lastUpdatedAt: string;
name: string;
rank: number;
}
export type { ResponseObject };
export type { ResponseObject, DataEducationLevel };

View file

@ -14,6 +14,7 @@ interface DataLevel {
interface DataPerson {
avatar?: string;
avatarName?: string;
citizenId: string;
firstName: string;
id: string;
@ -25,4 +26,138 @@ interface DataPerson {
rank?: string;
}
export type { DataType, DataLevel, DataPerson };
interface DateRequest {
createdAt: string;
createdFullName: string;
detail: string;
fullname: string;
id: string;
lastUpdateFullName: string;
lastUpdatedAt: string;
remark: string;
status: string;
topic: string;
}
interface DataProfile {
avatar: string;
avatarName: string;
birthDate: string;
bloodGroup: string;
citizenId: string;
createdAt: string;
createdFullName: string;
createdUserId: string;
currentAddress: string;
currentDistrictId: string;
currentProvinceId: string;
currentSubDistrictId: string;
currentZipCode: string;
dateAppoint: string;
dateLeave: string;
dateRetire: string;
dateRetireLaw: string;
dateStart: string;
dutyTimeEffectiveDate: string;
dutyTimeId: string;
email: string;
ethnicity: string;
firstName: string;
gender: string;
govAgeAbsent: number;
govAgePlus: number;
id: string;
isLeave: boolean;
isProbation: boolean;
keycloak: string;
lastName: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
leaveReason: string;
nationality: string;
posLevelId: string;
phone: string;
posTypeId: string;
position: string;
prefix: string;
rank: string;
reasonSameDate: null;
registrationAddress: string;
registrationDistrictId: string;
registrationProvinceId: string;
registrationSubDistrictId: string;
registrationZipCode: string;
relationship: string;
religion: string;
telephoneNumber: string;
posLevel: {
createdAt: string;
createdFullName: string;
createdUserId: string;
id: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
posLevelAuthority: string;
posLevelName: string;
posLevelRank: number;
posTypeId: string;
};
posType: {
createdAt: string;
createdFullName: string;
createdUserId: string;
id: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
posTypeName: string;
posTypeRank: number;
};
}
interface DataLeave {
createdAt: string;
createdFullName: string;
createdUserId: string;
dateLeaveEnd: string;
dateLeaveStart: string;
id: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
leaveCount: number;
leaveDays: number;
leaveType: DataLeaveType;
leaveTypeId: string;
profileEmployeeId: string;
profileId: string;
reason: string;
status: string;
totalLeave: number;
typeLeaveId: string;
}
interface DataLeaveType {
code: string;
createdAt: string;
createdUserId: string;
id: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
limit: number;
name: string;
refCommandDate: string;
}
export type {
DataType,
DataLevel,
DataPerson,
DateRequest,
DataProfile,
DataLeave,
DataLeaveType,
};

View file

@ -1,9 +1,13 @@
const listPage = () => import("@/modules/04_registryPerson/views/list.vue");
// ค้นหาข้อมูลทะเบียนประวัติ
const listPage = () => import("@/modules/04_registryPerson/views/listView.vue");
// ทะเบียนประวัติ
const detailPage = () =>
import("@/modules/04_registryPerson/views/detailView.vue");
// รายการคำร้องขอแก้ไขทะเบียนประวัติ
const requestEdit = () =>
import("@/modules/04_registryPerson/views/requestEdit.vue");
import("@/modules/04_registryPerson/views/requestEditView.vue");
export default [
{

View file

@ -13,18 +13,17 @@ import type {
zipCodeOption,
} from "@/modules/04_registryPerson/interface/index/Main";
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
} = mixin;
export const useAddressDataStore = defineStore("addess", () => {
const $q = useQuasar();
const profileIdBefore = ref<string>("");
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
date2Thai,
messageError,
convertDate,
dateToISO,
} = mixin;
const Ops = ref<AddressOps>({
provinceOps: [],
@ -73,6 +72,9 @@ export const useAddressDataStore = defineStore("addess", () => {
return ops.find((r: { id: string }) => r.id === id) || {};
}
/**
*
*/
async function fetchProvince() {
showLoader();
await http
@ -94,6 +96,11 @@ export const useAddressDataStore = defineStore("addess", () => {
});
}
/**
* /
* @param id
* @param position ,
*/
async function fetchDistrict(id: string | null, position: string) {
if (!id) return;
showLoader();
@ -122,6 +129,11 @@ export const useAddressDataStore = defineStore("addess", () => {
});
}
/**
* /
* @param id /
* @param position ,
*/
async function fetchSubDistrict(id: string | null, position: string) {
if (!id) return;
showLoader();
@ -153,6 +165,12 @@ export const useAddressDataStore = defineStore("addess", () => {
});
}
/**
* select
* @param val
* @param update function
* @param refData
*/
function filterSelector(val: any, update: Function, refData: string) {
switch (refData) {
case "provinceOps":

View file

@ -1,9 +1,10 @@
import { ref } from "vue";
import { defineStore } from "pinia";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
import type {
@ -11,39 +12,53 @@ import type {
InformationOps,
} from "@/modules/04_registryPerson/interface/index/Main";
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
} = mixin;
export const useProfileDataStore = defineStore("profile", () => {
const $q = useQuasar();
const mixin = useCounterMixin();
const {
showLoader,
hideLoader,
date2Thai,
messageError,
convertDate,
dateToISO,
} = mixin;
const retireDate = ref<Date>();
//ข้อมูลส่วนตัว
const defaultProfile: RequestObject = {
bloodGroup: null,
relationship: null,
gender: null,
// posTypeId: "",
// posLevelId: "",
religion: null,
citizenId: "",
// telephoneNumber: null,
nationality: null,
ethnicity: null,
birthDate: null,
phone: null,
// email: null,
lastName: "",
firstName: "",
prefix: "",
rank: null,
};
//ข้อมูลตัวเลือก
const OpsFilter = ref<InformationOps>({
prefixOps: [],
rankOps: [],
genderOps: [],
bloodOps: [],
statusOps: [],
religionOps: [],
employeeClassOps: [
{ id: "perm", name: "ลูกจ้างประจำ" },
{ id: "temp", name: "ลูกจ้างชั่วคราว" },
],
employeeTypeOps: [
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
});
//รายการตัวเลือก
const Ops = ref<InformationOps>({
prefixOps: [],
rankOps: [],
@ -61,31 +76,11 @@ export const useProfileDataStore = defineStore("profile", () => {
],
});
const OpsFilter = ref<InformationOps>({
prefixOps: [],
rankOps: [],
genderOps: [],
bloodOps: [],
statusOps: [],
religionOps: [],
employeeClassOps: [
{ id: "perm", name: "ลูกจ้างประจำ" },
{ id: "temp", name: "ลูกจ้างชั่วคราว" },
],
employeeTypeOps: [
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
});
const prefixOp = ref<string[]>([
"นาย",
"นาง",
"นางสาว",
"เด็กชาย",
"เด็กหญิง",
]);
/**
*
* @param birthDate
* @returns
*/
function calculateAge(birthDate: Date | null) {
if (!birthDate) return null;
const birthDateTimeStamp = new Date(birthDate).getTime();
@ -107,7 +102,10 @@ export const useProfileDataStore = defineStore("profile", () => {
return `${years} ปี ${months} เดือน ${days} วัน`;
}
const fetchPerson = async () => {
/**
*
*/
async function fetchPerson() {
showLoader();
await http
.get(config.API.profileNewMetaMain)
@ -181,9 +179,15 @@ export const useProfileDataStore = defineStore("profile", () => {
hideLoader();
}, 2500);
});
};
}
const filterSelector = (val: any, update: Function, refData: string) => {
/**
* select
* @param val
* @param update function
* @param refData
*/
const filterSelector = (val: string, update: Function, refData: string) => {
switch (refData) {
case "prefixOps":
update(() => {

View file

@ -1,15 +1,19 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import {
checkPermission,
checkPermissionCreate,
checkPermissionList,
} from "@/utils/permissions";
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import avatar from "@/assets/avatar_user.jpg";
/**
* importType
*/
@ -22,16 +26,10 @@ import type { ResponseObject } from "@/modules/04_registryPerson/interface/respo
/**
* importComponents
*/
import CardNotPermission from "@/components/CardNotPermission.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import avatar from "@/assets/avatar_user.jpg";
import CardNotPermission from "@/components/CardNotPermission.vue";
/**
* use
*/
@ -51,23 +49,22 @@ const {
pathRegistryEmp,
} = useCounterMixin();
const isPermission = ref<boolean | null>(null);
const notPermissionMsg = ref<string>("");
const isPermission = ref<boolean | null>(null); //
const notPermissionMsg = ref<string>(""); //
const profileId = ref<string>(route.params.id.toString()); //id profile
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); //
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
const dialogPassaway = ref<boolean>(false); //
const filePassaway = ref<any>(null); //
const deathCertificateNo = ref(""); //
const dateDeath = ref<Date>(new Date()); //
const placeDeathCertificate = ref(""); //
const reasonDeath = ref(""); //
const dialogImage = ref<boolean>(false);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const formDetail = ref<ResponseObject>();
const dialogImage = ref<boolean>(false); //
const formDetail = ref<ResponseObject>(); //
//
const itemsMenu = ref<DataOptionSys[]>([
{
id: "1",
@ -100,7 +97,7 @@ const itemsMenu = ref<DataOptionSys[]>([
system: "SYS_PLACEMENT_OTHER",
},
]);
//
const itemsMenuEmployee = ref<DataOptionSys[]>([
{
id: "1",
@ -114,15 +111,14 @@ const itemsMenuEmployee = ref<DataOptionSys[]>([
},
]);
const uploadUrl = ref<string>("");
const fileName = ref<string>("");
const profilePicture = ref<string>("");
const profileFile = ref();
const uploadUrl = ref<string>(""); //URL
const fileName = ref<string>(""); //
const profilePicture = ref<string>(""); //
const profileFile = ref(); //
const input = document.createElement("input");
const activeImage = ref<any | null>(null);
const images = ref<any[]>([]);
const imagesAlldata = ref<any[]>([]);
input.type = "file";
input.accept = ".jpg,.png,.tif,.pic";
@ -140,6 +136,9 @@ function imageActive(n: any) {
activeImage.value = n;
}
/**
* งกนอปโหลด
*/
function uploadImg() {
http
.post(config.API.orgProfileAvatarbyType(empType.value), {
@ -156,6 +155,10 @@ function uploadImg() {
.finally(() => {});
}
/**
* งกนสราง path ปโหลไฟล
* @param path
*/
function uploadProfile(path: string) {
http
.post(config.API.fileByPath(path), {
@ -179,6 +182,11 @@ function uploadProfile(path: string) {
});
}
/**
* งกนอปโหลด
* @param uploadUrl path ปโหลไฟล
* @param file ไฟล
*/
function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
axios
@ -199,8 +207,11 @@ function uploadFileURL(uploadUrl: string, file: any) {
});
}
/**
* งกนดงขอมลรปโปรไฟล
* @param id โปรไฟล
*/
function fetchProfile(id: string) {
// showLoader();
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
@ -209,9 +220,6 @@ function fetchProfile(id: string) {
.catch(() => {
profilePicture.value = avatar;
});
// .finally(() => {
// hideLoader();
// });
}
const reasonStatus = ref<boolean>(false);
@ -251,6 +259,9 @@ const reasonOptions = ref<DataOption[]>([
},
]);
/**
* งกนดงขอมลสวนต
*/
async function fetchDataPersonal() {
showLoader();
await http
@ -298,6 +309,9 @@ async function fetchDataPersonal() {
});
}
/**
* งกนดาวนโหลดไฟล "..7/..1 หร ประวแบบย
*/
function onClickDownloadKp7(type: string) {
showLoader();
const url =
@ -333,7 +347,7 @@ function onClickDownloadKp7(type: string) {
}
/**
* วยราชการ
* งกนออกคำสวยราชการ
*/
function helpPost() {
const formData = new FormData();
@ -356,7 +370,7 @@ function helpPost() {
}
/**
* งตวกล
* งกนออกคำสงตวกล
*/
function repatriationPost() {
const formData = new FormData();
@ -379,7 +393,7 @@ function repatriationPost() {
}
/**
* แตงตงเลอน
* งกนออกคำสแตงตงเลอน
*/
function appointPost() {
const formData = new FormData();
@ -402,14 +416,14 @@ function appointPost() {
}
/**
* งเเกกรรม
* งกนออกคำสงเเกกรรม
*/
function clickPassaway() {
dialogPassaway.value = true;
}
/**
* ใหออกจากราชการ
* งกนออกคำสใหออกจากราชการ
*/
function outPost() {
const formData = new FormData();
@ -432,7 +446,7 @@ function outPost() {
}
/**
* นๆ
* งกนออกคำสนๆ
*/
function otherPost() {
const formData = new FormData();
@ -454,6 +468,9 @@ function otherPost() {
});
}
/**
* งกนออกคำสงปรบระดบชนงาน - าย
*/
function appointEmployeePost() {
const formData = new FormData();
formData.append("id", profileId.value);
@ -474,12 +491,8 @@ function appointEmployeePost() {
});
}
function closePassaway() {
dialogPassaway.value = false;
}
/**
* function นยนบนทกขอมลถงแกกรรม
* งกนยนยนบนทกขอมลถงแกกรรม
*/
function clickSaveDeceased() {
dialogConfirm($q, async () => {
@ -507,7 +520,14 @@ function clickSaveDeceased() {
}
/**
* function เป popup เลอกรปภาพ
* งกนป popup งแกกรรม
*/
function closePassaway() {
dialogPassaway.value = false;
}
/**
* งกนเป popup เลอกรปภาพ
*/
function openDialogImg() {
dialogImage.value = true;
@ -515,7 +535,7 @@ function openDialogImg() {
}
/**
* function เรยกขอมลร
* งกเรยกขอมลร
*/
function getImage() {
showLoader();
@ -538,7 +558,7 @@ function getImage() {
}
/**
* function เรยกขอมลร
* งกเรยกขอมลร
* @param dataList
*/
function getImg(dataList: any) {
@ -559,7 +579,7 @@ function getImg(dataList: any) {
}
/**
* funciton Popup เลอกรปภาพ
* งก Popup เลอกรปภาพ
*/
function closeImage() {
dialogImage.value = false;
@ -568,7 +588,7 @@ function closeImage() {
}
/**
* funciotn นยนการลบร
* งกนยนการลบร
* @param id ปภาพ
*/
function deletePhoto(id: string) {
@ -595,7 +615,7 @@ function deletePhoto(id: string) {
}
/**
* function นยนการเลอกร
* งกนยนการเลอกร
*/
function selectAvatarHistory() {
if (activeImage.value == null) {

View file

@ -1,11 +1,22 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from "vue";
import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import avatar from "@/assets/avatar_user.jpg";
import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type {
DataNodeData,
QueryParams,
} from "@/modules/04_registryPerson/interface/request/Main";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { DataStructureTree } from "@/interface/main";
import type {
DataPerson,
DataType,
@ -13,56 +24,33 @@ import type {
/** importComponents*/
import TableView from "@/modules/04_registryPerson/components/TableView.vue";
import avatar from "@/assets/avatar_user.jpg";
import DialogHeader from "@/components/DialogHeader.vue";
/** importStore*/
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useStructureTree } from "@/stores/structureTree";
const $q = useQuasar();
const store = useRegistryNewDataStore();
const { fetchStructureTree } = useStructureTree();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const route = useRoute();
const mode = ref<"table" | "card">("table");
const filterMain = ref<string>("");
const isShowFilter = ref<boolean>(true);
const isShowBtnFilter = ref<boolean>(false);
const mode = ref<"table" | "card">("table"); //
const empType = ref<string>("officer"); // officer / employee / perm
const dataPersonMain = ref<DataPerson[]>([]); //
const maxPage = ref<number>(1); //
const total = ref<number>(0); //
const isShowBtnFilter = ref<boolean>(false);
// const searchType = ref<string>("fullName");
const node = ref<any>([]);
const expanded = ref<any>([]);
const maxPage = ref<number>(1);
const total = ref<number>(0);
const selectNode = ref<boolean>(false);
const filterMain = ref<string>(""); ///
const node = ref<DataStructureTree[]>([]); //
const expanded = ref<string[]>([]); //
const dataPersonMain = ref<DataPerson[]>([]);
const nodeData = reactive<any>({
page: 1,
pageSize: 10,
round: "",
const selectNode = ref<boolean>(false); //
const nodeData = reactive<DataNodeData>({
name: "เลือกหน่วยงาน/ส่วนราชการ",
keyword: "",
nodeId: null,
node: null,
});
// const conditionTotal = computed(() => {
// let num: string = "";
// if (store.formFilter.isProbation && store.formFilter.isShowRetire) {
// num = "(2)";
// } else if (store.formFilter.isProbation || store.formFilter.isShowRetire) {
// num = "(1)";
// } else "";
// return num;
// });
/**
* function เรยกขอมลตำแหนงประเภท
*/
@ -91,26 +79,12 @@ function fetchOptionGroup() {
});
}
function fetchYearOption() {
if (store.yearOps.length === 0) {
const options = [];
const year = new Date().getFullYear();
for (let i = year - 40; i <= year + 60; i++) {
options.push({ id: i.toString(), name: (i + 543).toString() });
}
if (options) {
store.yearOps.push(...options);
}
}
}
/**
* function fetch รายชอขอมลทะเบยนประว
*/
function fetchDataPerson() {
showLoader();
let queryParams: any = {
let queryParams: QueryParams = {
page: store.formFilter.page,
pageSize: store.formFilter.pageSize,
};
@ -182,7 +156,7 @@ function fetchDataPerson() {
* @param items อมลคน
*/
function insertAvatar(items: DataPerson[]) {
items.map((x: any, index: number) => {
items.map((x: DataPerson, index: number) => {
if (x.avatarName != null) {
http
.get(
@ -209,30 +183,11 @@ function insertAvatar(items: DataPerson[]) {
});
}
/**
* funciotn แสดงตวเลอกเพมเต
*/
// function onClickShowFilter() {
// isShowFilter.value = !isShowFilter.value;
// isShowBtnFilter.value = false;
// if (isShowFilter.value) {
// // fetchLevel();
// fetchYearOption();
// }
// }
/**
* funciotn นหาขอม
*/
function onclickSearch() {
isShowFilter.value = true;
// isShowBtnFilter.value = false;
store.formFilter.page = 1;
if (isShowFilter.value) {
fetchType();
// fetchLevel();
fetchYearOption();
}
store.formFilter.keyword =
store.formFilter.keyword === null ? "" : store.formFilter.keyword;
fetchDataPerson();
@ -242,8 +197,8 @@ function onclickSearch() {
* function เลอกประเภทขาราชการ
* @param item ประเภทขาราชการ
*/
async function selectType() {
empType.value = await (route.name == "registryNew" ? "officer" : "perm");
function selectType() {
empType.value = route.name == "registryNew" ? "officer" : "perm";
if (empType.value !== "officer") {
store.formFilter.isShowRetire = null;
@ -333,7 +288,10 @@ function clearSelect(t: string) {
fetchDataPerson();
}
const isLoad = ref<boolean>(false);
const isLoad = ref<boolean>(false); //
/**
* งกนดงขอโครงสราง
*/
async function fetchTree() {
const data = await fetchStructureTree(route.meta.Key as string);
if (data) {
@ -344,6 +302,9 @@ async function fetchTree() {
}
}
/**
* นหาขอมลรายชอขอมลทะเบยนประวตามหนวยงาน/วนราชการ
*/
function sendNode() {
nodeData.node = store.formFilter.node;
nodeData.nodeId = store.formFilter.nodeId;
@ -352,7 +313,13 @@ function sendNode() {
fetchDataPerson();
}
function updateSelectedTreeMain(data: any) {
/**
* งกนเลอกหนวยงาน/วนราชการ
* @param data อมลหนวยงาน/วนราชการทองการคนหาร
*
* เพอคนหาขอมลตามหนวยงาน/วนราชการ
*/
function updateSelectedTreeMain(data: DataStructureTree) {
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
store.formFilter.node = null;
store.formFilter.nodeId = null;
@ -372,9 +339,11 @@ watch(selectNode, () => {
isLoad.value && hideLoader();
});
/**
* hook เมอมการเรยกใช Components
*/
onMounted(async () => {
selectType();
fetchTree();
await Promise.all([selectType(), fetchTree()]);
});
</script>
@ -438,21 +407,8 @@ onMounted(async () => {
</div>
</div>
</q-form>
<!-- <div v-if="isShowBtnFilter" class="col-12 row q-mt-sm">
<q-btn
flat
label="ตัวเลือกเพิ่มเติม"
icon-right="mdi-tune"
@click="onClickShowFilter"
dense
class="q-px-sm"
></q-btn>
</div> -->
<div
v-if="isShowFilter"
class="row q-mt-sm q-gutter-sm justify-center"
>
<div class="row q-mt-sm q-gutter-sm justify-center">
<q-btn-dropdown
flat
rounded
@ -589,40 +545,6 @@ onMounted(async () => {
label="แสดงตำแหน่งทั้งหมด"
@update:model-value="fetchDataPerson"
/>
<!-- <q-btn-dropdown
v-if="empType === 'officer'"
flat
dense
rounded
label-color="white"
dropdown-icon="mdi-chevron-down"
:label="`เงื่อนไขอื่นๆ ${conditionTotal}`"
class="q-px-sm"
>
<q-list>
<q-item clickable v-close-popup>
<q-item-section>
<q-toggle
v-model="store.formFilter.isProbation"
color="primary"
label="ทดลองปฏิบัติหน้าที่ราชการ"
@update:model-value="fetchDataPerson"
/>
</q-item-section>
</q-item>
<q-item clickable v-close-popup>
<q-item-section>
<q-toggle
v-model="store.formFilter.isShowRetire"
color="primary"
label="แสดงข้อมูลผู้พ้นจากราชการ"
@update:model-value="fetchDataPerson"
/>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown> -->
</div>
<div
@ -655,16 +577,17 @@ onMounted(async () => {
<q-separator />
<q-card-section>
<!-- Components รายการขอมลทะเบยนประว -->
<TableView
v-model:mode="mode"
v-model:form-filter="store.formFilter"
v-model:max-page="maxPage"
:rows="dataPersonMain"
v-model:formFilter="store.formFilter"
v-model:maxPage="maxPage"
:fetchData="fetchDataPerson"
:fetchType="fetchType"
:fetch-data="fetchDataPerson"
:fetch-type="fetchType"
:total="total"
:empType="empType"
:is-filter="isShowBtnFilter"
:emp-type="empType"
/>
</q-card-section>
</q-card>

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
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
@ -13,18 +16,13 @@ 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/DialogStatus.vue";
/**
* importStore
*/
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
@ -36,12 +34,11 @@ const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* 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 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",
@ -114,7 +111,6 @@ const columns = ref<QTableProps["columns"]>([
]);
const visibleColumns = ref<string[]>([
"lastUpdatedAt",
"fullname",
"topic",
"detail",
@ -126,11 +122,11 @@ const visibleColumns = ref<string[]>([
/**
* วแปร
*/
const status = ref<string>("PENDING");
const keyword = ref<string>("");
const statusOption = ref<DataOption[]>(store.optionStatus);
const modalStatus = ref<boolean>(false);
const requestId = ref<string>("");
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 รายการคำรองขอแกไขทะเบยนประว
@ -186,7 +182,7 @@ function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter(
(v: any) => v.name.indexOf(val) > -1
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
@ -262,6 +258,11 @@ function downloadUrl(id: string, fileName: string) {
});
}
/**
* การเปลยนแปลงของ pageSize
*
* เมอมการเปลยนแปลงจำทำการ งชอมลรายการคำรองขอแกไขทะเบยนประวตามจำนวน pageSize
*/
watch(
() => pageSize.value,
() => {
@ -420,8 +421,8 @@ onMounted(() => {
<DialogStatus
v-model:modal="modalStatus"
:fetchData="fetchListRequset"
:requestId="requestId"
:fetch-data="fetchListRequset"
:request-id="requestId"
/>
</template>