Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-03-21 13:04:37 +07:00
commit ed227359d1
22 changed files with 813 additions and 444 deletions

View file

@ -14,7 +14,7 @@ export default {
) => `${url}/sub-file/${name}/${group}/${id}/${subId}/${fileName}`, ) => `${url}/sub-file/${name}/${group}/${id}/${subId}/${fileName}`,
file: (name: string, group: string, id: string) => file: (name: string, group: string, id: string) =>
`${url}/sub/${name}/${group}/${id}`, `${url}/file/${name}/${group}/${id}`,
fileByFile: (name: string, group: string, id: string, fileName: string) => fileByFile: (name: string, group: string, id: string, fileName: string) =>
`${url}/sub/${name}/${group}/${id}/${fileName}`, `${url}/file/${name}/${group}/${id}/${fileName}`,
}; };

View file

@ -4,6 +4,8 @@ const registryNew = `${env.API_URI}/org/profile/`;
export default { export default {
registryNew, registryNew,
registryNewByProfileId: (profileId : string) => `${registryNew}${profileId}`,
// เครื่องราชฯ // เครื่องราชฯ
profileNewInsign: `${registryNew}insignia`, profileNewInsign: `${registryNew}insignia`,
profileNewInsignByProfileId: (profileId: string) => profileNewInsignByProfileId: (profileId: string) =>
@ -48,8 +50,34 @@ profileNewEducationHisByEducationId: (educationsId: string) =>
profileNewAbility: `${registryNew}ability`, profileNewAbility: `${registryNew}ability`,
profileNewAbilityByProfileId: (profileId: string) => profileNewAbilityByProfileId: (profileId: string) =>
`${registryNew}ability/${profileId}`, `${registryNew}ability/${profileId}`,
profileNewAbilityByAbilityId: (educationId: string) => profileNewAbilityByAbilityId: (abilityId: string) =>
`${registryNew}ability/${educationId}`, `${registryNew}ability/${abilityId}`,
profileNewAbilityHisByAbilityId: (abilityId: string) => profileNewAbilityHisByAbilityId: (abilityId: string) =>
`${registryNew}ability/history/${abilityId}`, `${registryNew}ability/history/${abilityId}`,
};
// ใบอนุญาตประกอบวิชาชีพ
profileNewCertificate: `${registryNew}certificate`,
profileNewCertificateByProfileId: (profileId: string) =>
`${registryNew}certificate/${profileId}`,
profileNewCertificateByCertificateId: (certificateId: string) =>
`${registryNew}certificate/${certificateId}`,
profileNewCertificateHisByCertificateId: (certificateId: string) =>
`${registryNew}certificate/history/${certificateId}`,
// ข้อมูลอื่นๆ
profileNewOther: `${registryNew}other`,
profileNewOtherByProfileId: (profileId: string) =>
`${registryNew}other/${profileId}`,
profileNewOtherById: (dataId: string) => `${registryNew}other/${dataId}`,
profileNewOtherHisById: (dataId: string) =>
`${registryNew}other/history/${dataId}`,
// ข้อมูลครอบครัว
profileNewFamily: `${registryNew}family`,
profileNewFamilyByProfileId: (profileId: string) =>
`${registryNew}family/${profileId}`,
profileNewFamilyByFamilyId: (familyId: string) =>
`${registryNew}family/${familyId}`,
profileNewFamilyeHisByFamilyId: (familyId: string) =>
`${registryNew}family/history/${familyId}`,
};

View file

@ -228,7 +228,12 @@ function validateForm() {
} }
async function onSubmit() { async function onSubmit() {
if (posLevelName.value.length > 0) { if (
posLevelName.value.length > 0 &&
posLevelAuthority.value.length > 0 &&
posLevelRank.value !== undefined &&
posLevelRank.value > 0
) {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -310,9 +315,12 @@ onMounted(async () => {
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="(col, index) in props.cols" :key="col.id"> <q-td v-for="(col, index) in props.cols" :key="col.id">
<div v-if="col.name == 'no'"> <div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-if="col.name === 'posTypeName'">
{{ posName }}
</div>
<div v-else> <div v-else>
{{ col.value }} {{ col.value }}
</div> </div>
@ -405,7 +413,7 @@ onMounted(async () => {
borderless borderless
min="1" min="1"
bg-color="white" bg-color="white"
:rules="[(val) => val != null || 'กรุณากรอกระดับ']" :rules="[(val) => val > 0 || 'กรุณากรอกระดับ']"
hide-bottom-space hide-bottom-space
mask="############" mask="############"
/> />

View file

@ -1,18 +1,34 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch, onMounted } from "vue";
import moment from "moment";
import dialogHeader from "@/components/DialogHeader.vue"; import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { QForm, useQuasar } from "quasar"; import { QForm, useQuasar } from "quasar";
import type { ProfesLicenseObject } from "@/modules/04_registryNew/interface/index/profesLicense"; import { useRoute } from "vue-router";
import type { RequestItemsObject } from "@/modules/04_registryNew/interface/request/ProfesLicense";
import type { ResponseObject } from "@/modules/04_registryNew/interface/response/ProfesLicense";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const $q = useQuasar(); const $q = useQuasar();
const { dialogConfirm, date2Thai } = mixin; const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
date2Thai,
} = mixin;
const historyDialog = ref<boolean>(false); const historyDialog = ref<boolean>(false);
const addDataDialog = ref<boolean>(false);
const mode = ref<string>("table"); const mode = ref<string>("table");
const dialog = ref<boolean>(false);
const route = useRoute();
const id = ref<string>(route.params.id.toString());
const dialogStatus = ref<string>("create");
const editId = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "certificateType", name: "certificateType",
@ -53,6 +69,7 @@ const columns = ref<QTableProps["columns"]>([
label: "วันที่ออกใบอนุญาต", label: "วันที่ออกใบอนุญาต",
sortable: true, sortable: true,
field: "issueDate", field: "issueDate",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -63,6 +80,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันที่หมดอายุ", label: "วันที่หมดอายุ",
sortable: true, sortable: true,
format: (v) => date2Thai(v),
field: "expireDate", field: "expireDate",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -71,7 +89,7 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
const profesLicenseData = reactive<ProfesLicenseObject>({ const profesLicenseData = reactive<RequestItemsObject>({
certificateType: "", certificateType: "",
issuer: "", issuer: "",
certificateNo: "", certificateNo: "",
@ -79,47 +97,30 @@ const profesLicenseData = reactive<ProfesLicenseObject>({
expireDate: new Date(), expireDate: new Date(),
}); });
const rows = ref<ResponseObject[]>([]);
const historyRows = ref<ResponseObject[]>([]);
const formFilter = reactive({ const formFilter = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
keyword: "", keyword: "",
}); });
const historyFormFilter = reactive({
page: 1,
pageSize: 10,
keyword: "",
});
const pagination = ref({ const pagination = ref({
page: formFilter.page, page: formFilter.page,
rowsPerPage: formFilter.pageSize, rowsPerPage: formFilter.pageSize,
}); });
const row = [ const historyPagination = ref({
{ page: historyFormFilter.page,
certificateType: "ใบอนุญาต", rowsPerPage: historyFormFilter.pageSize,
issuer: "หน่วยงานเชียงใหม่", });
certificateNo: "12",
issueDate: new Date(),
expireDate: new Date(),
},
{
certificateType: "ใบอนุญาต",
issuer: "หน่วยงานพะเยา",
certificateNo: "136",
issueDate: new Date(),
expireDate: new Date(),
},
{
certificateType: "ใบอนุญาต",
issuer: "หน่วยงานโคราช",
certificateNo: "12",
issueDate: new Date(),
expireDate: new Date(),
},
{
certificateType: "ใบอนุญาต",
issuer: "หน่วยงานกทม",
certificateNo: "11",
issueDate: new Date(),
expireDate: new Date(),
},
];
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"certificateType", "certificateType",
@ -129,6 +130,14 @@ const visibleColumns = ref<string[]>([
"expireDate", "expireDate",
]); ]);
const historyVisibleColumns = ref<string[]>([
"certificateType",
"issuer",
"certificateNo",
"issueDate",
"expireDate",
]);
function validateForm() { function validateForm() {
onSubmit(); onSubmit();
} }
@ -137,6 +146,7 @@ async function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog(); closeDialog();
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
@ -145,11 +155,123 @@ async function onSubmit() {
} }
function closeDialog() { function closeDialog() {
addDataDialog.value = false; dialog.value = false;
} }
function closeHistoryDialog() { function closeHistoryDialog() {
historyDialog.value = false; historyDialog.value = false;
} }
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.profileNewCertificateByProfileId(id))
.then(async (res) => {
rows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function clearForm() {
profesLicenseData.expireDate = new Date();
profesLicenseData.issueDate = new Date();
profesLicenseData.certificateNo = "";
profesLicenseData.certificateType = "";
profesLicenseData.issuer = "";
}
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
profesLicenseData.certificateType = row.certificateType;
profesLicenseData.certificateNo = row.certificateNo;
profesLicenseData.issuer = row.issuer;
profesLicenseData.issueDate = row.issueDate;
profesLicenseData.expireDate = row.expireDate;
dialog.value = true;
}
async function addData() {
await http
.post(config.API.profileNewCertificate, {
profileId: id.value,
expireDate: profesLicenseData.expireDate,
issueDate: profesLicenseData.issueDate,
certificateNo: profesLicenseData.certificateNo,
certificateType: profesLicenseData.certificateType,
issuer: profesLicenseData.issuer,
isActive: true,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function editData(idData: string) {
await http
.patch(config.API.profileNewCertificateByCertificateId(idData), {
expireDate: profesLicenseData.expireDate,
issueDate: profesLicenseData.issueDate,
certificateNo: profesLicenseData.certificateNo,
certificateType: profesLicenseData.certificateType,
issuer: profesLicenseData.issuer,
isActive: true,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function deleteData(idData: string) {
await http
.delete(config.API.profileNewCertificateByCertificateId(idData))
.then(() => {
fetchData(id.value);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchHistoryData(id: string) {
showLoader();
await http
.get(config.API.profileNewCertificateHisByCertificateId(id))
.then(async (res) => {
historyRows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => {
await fetchData(id.value);
});
</script> </script>
<template> <template>
@ -161,12 +283,27 @@ function closeHistoryDialog() {
color="primary" color="primary"
icon="add" icon="add"
size="16px" size="16px"
@click="addDataDialog = true" @click="
dialogStatus = 'create';
clearForm();
dialog = true;
"
> >
<q-tooltip>เพมขอม</q-tooltip></q-btn <q-tooltip>เพมขอม</q-tooltip></q-btn
> >
<q-space /> <q-space />
<q-input
dense
outlined
v-model="formFilter.keyword"
label="ค้นหา"
class="q-mr-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select <q-select
v-if="mode === 'table'" v-if="mode === 'table'"
v-model="visibleColumns" v-model="visibleColumns"
@ -219,12 +356,13 @@ function closeHistoryDialog() {
:grid="mode === 'card'" :grid="mode === 'card'"
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="row" :rows="rows"
row-key="name" row-key="name"
flat flat
bordered bordered
:paging="true" :paging="true"
dense dense
:filter="formFilter.keyword"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
class="custom-header-table" class="custom-header-table"
@ -240,19 +378,29 @@ function closeHistoryDialog() {
</template> </template>
<template v-slot:body="props" v-if="mode === 'table'"> <template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td <q-td v-for="col in props.cols" :key="col.id">
v-for="col in props.cols" <div>
:key="col.id"
@click="addDataDialog = true"
>
<div v-if="col.name === 'issueDate' || col.name === 'expireDate'">
{{ col.value ? date2Thai(col.value) : "-" }}
</div>
<div v-else>
{{ col.value }} {{ col.value }}
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn
color="primary"
flat
dense
round
class="q-mr-xs"
size="14px"
icon="mdi-pencil-outline"
clickable
@click="
() => {
editForm(props.row);
}
"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn <q-btn
color="info" color="info"
flat flat
@ -260,9 +408,26 @@ function closeHistoryDialog() {
round round
size="14px" size="14px"
icon="mdi-history" icon="mdi-history"
@click="() => (historyDialog = true)" @click="
() => (fetchHistoryData(props.row.id), (historyDialog = true))
"
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขใบอนญาตประกอบวชาช</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
size="14px"
icon="mdi-delete"
clickable
@click.stop="
dialogRemove($q, async () => await deleteData(props.row.id))
"
v-close-popup
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> </q-btn>
</q-td> </q-td>
</q-tr> </q-tr>
@ -278,18 +443,21 @@ function closeHistoryDialog() {
round round
color="primary" color="primary"
icon="edit" icon="edit"
@click="addDataDialog = true" @click="editForm(props.row)"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
<q-btn <q-btn
flat flat
round round
color="blue" color="info"
icon="history" icon="mdi-history"
@click="historyDialog = true" size="14px"
@click="
() => (fetchHistoryData(props.row.id), (historyDialog = true))
"
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขใบอนญาตประกอบวชาช</q-tooltip>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
<q-separator /> <q-separator />
@ -305,13 +473,7 @@ function closeHistoryDialog() {
<div>{{ col.label }}</div> <div>{{ col.label }}</div>
</div> </div>
<div class="col"> <div class="col">
<div <div>{{ col.value }}</div>
v-if="col.name === 'issueDate' || col.name === 'expireDate'"
>
{{ col.value ? date2Thai(col.value) : "-" }}
</div>
<div v-else>{{ col.value }}</div>
</div> </div>
</div> </div>
</q-list> </q-list>
@ -320,12 +482,12 @@ function closeHistoryDialog() {
</template> </template>
</d-table> </d-table>
<q-dialog v-model="addDataDialog" class="dialog" persistent> <q-dialog v-model="dialog" class="dialog" persistent>
<q-card style="min-width: 40%" class="bg-white"> <q-card style="min-width: 40%" class="bg-white">
<q-form @submit.prevent greedy @validation-success="validateForm"> <q-form @submit.prevent greedy @validation-success="validateForm">
<q-card-section class="flex justify-between" style="padding: 0"> <q-card-section class="flex justify-between" style="padding: 0">
<dialog-header <dialog-header
tittle="เพิ่มใบอนุญาตประกอบวิชาชีพ" :tittle="dialogStatus == 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
:close="closeDialog" :close="closeDialog"
/> />
</q-card-section> </q-card-section>
@ -345,7 +507,7 @@ function closeHistoryDialog() {
<div class="col"> <div class="col">
<q-input <q-input
outlined outlined
v-model="profesLicenseData.certificateType" v-model="profesLicenseData.issuer"
label="หน่วยงานผู้ออกใบอนุญาต" label="หน่วยงานผู้ออกใบอนุญาต"
bg-color="white" bg-color="white"
dense dense
@ -360,7 +522,7 @@ function closeHistoryDialog() {
<div class="col"> <div class="col">
<q-input <q-input
outlined outlined
v-model="profesLicenseData.certificateType" v-model="profesLicenseData.certificateNo"
label="เลขที่ใบอนุญาต" label="เลขที่ใบอนุญาต"
bg-color="white" bg-color="white"
dense dense
@ -475,7 +637,7 @@ function closeHistoryDialog() {
<q-form @submit.prevent greedy @validation-success="validateForm"> <q-form @submit.prevent greedy @validation-success="validateForm">
<q-card-section class="flex justify-between" style="padding: 0"> <q-card-section class="flex justify-between" style="padding: 0">
<dialog-header <dialog-header
tittle="ประวัติแก้ไขประวัติการศึกษา" tittle="ประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ"
:close="closeHistoryDialog" :close="closeHistoryDialog"
/> />
</q-card-section> </q-card-section>
@ -487,7 +649,7 @@ function closeHistoryDialog() {
dense dense
outlined outlined
bg-color="white" bg-color="white"
v-model="formFilter.keyword" v-model="historyFormFilter.keyword"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
> >
@ -497,7 +659,7 @@ function closeHistoryDialog() {
</q-input> </q-input>
<q-select <q-select
v-model="visibleColumns" v-model="historyVisibleColumns"
multiple multiple
outlined outlined
dense dense
@ -515,15 +677,17 @@ function closeHistoryDialog() {
<d-table <d-table
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="row" :rows="historyRows"
row-key="name" row-key="name"
flat flat
:filter="historyFormFilter.keyword"
v-model:pagination="historyPagination"
bordered bordered
:paging="true" :paging="true"
dense dense
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
class="custom-header-table" class="custom-header-table"
:visible-columns="visibleColumns" :visible-columns="historyVisibleColumns"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
@ -536,13 +700,8 @@ function closeHistoryDialog() {
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id"> <q-td v-for="col in props.cols" :key="col.id">
<div <div>
v-if="col.name === 'issueDate' || col.name === 'expireDate'" {{ col.value ? col.value : "-" }}
>
{{ col.value ? date2Thai(col.value) : "-" }}
</div>
<div v-else>
{{ col.value }}
</div> </div>
</q-td> </q-td>
</q-tr> </q-tr>

View file

@ -174,6 +174,7 @@ const pagination = ref({
page: formFilter.page, page: formFilter.page,
rowsPerPage: formFilter.pageSize, rowsPerPage: formFilter.pageSize,
}); });
const historyFormFilter = reactive({ const historyFormFilter = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -244,6 +245,25 @@ function clearForm() {
trainData.endDate = new Date(); trainData.endDate = new Date();
} }
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
isDate.value = row.isDate ? "true" : "false";
trainData.name = row.name;
trainData.topic = row.topic;
trainData.yearly = row.yearly;
trainData.place = row.place;
trainData.duration = row.duration;
trainData.department = row.department;
trainData.numberOrder = row.numberOrder;
trainData.dateOrder = row.dateOrder;
trainData.startDate = row.startDate;
trainData.endDate = row.endDate;
trainData.startYear = +row.startDate.slice(0, 4);
trainData.finishYear = +row.endDate.slice(0, 4);
dialog.value = true;
}
async function addData() { async function addData() {
await http await http
.post(config.API.profileNewTraining, { .post(config.API.profileNewTraining, {
@ -276,7 +296,6 @@ async function addData() {
async function editData(idData: string) { async function editData(idData: string) {
await http await http
.patch(config.API.profileNewTrainingByTrainingId(idData), { .patch(config.API.profileNewTrainingByTrainingId(idData), {
profileId: id.value,
name: trainData.name, name: trainData.name,
topic: trainData.topic ? trainData.topic : "", topic: trainData.topic ? trainData.topic : "",
yearly: trainData.yearly, yearly: trainData.yearly,
@ -315,6 +334,7 @@ async function deleteData(idData: string) {
hideLoader(); hideLoader();
}); });
} }
function closeDialog() { function closeDialog() {
clearForm(); clearForm();
dialog.value = false; dialog.value = false;
@ -532,22 +552,7 @@ onMounted(async () => {
clickable clickable
@click=" @click="
() => { () => {
dialogStatus = 'edit'; editForm(props.row);
editId = props.row.id;
isDate = props.row.isDate ? 'true' : 'false';
trainData.name = props.row.name;
trainData.topic = props.row.topic;
trainData.yearly = props.row.yearly;
trainData.place = props.row.place;
trainData.duration = props.row.duration;
trainData.department = props.row.department;
trainData.numberOrder = props.row.numberOrder;
trainData.dateOrder = props.row.dateOrder;
trainData.startDate = props.row.startDate;
trainData.endDate = props.row.endDate;
trainData.startYear = +props.row.startDate.slice(0, 4);
trainData.finishYear = +props.row.endDate.slice(0, 4);
dialog = true;
} }
" "
> >
@ -564,7 +569,7 @@ onMounted(async () => {
() => (fetchHistoryData(props.row.id), (historyDialog = true)) () => (fetchHistoryData(props.row.id), (historyDialog = true))
" "
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขการฝกอบรม/งาน</q-tooltip>
</q-btn> </q-btn>
<q-btn <q-btn
color="red" color="red"
@ -596,24 +601,7 @@ onMounted(async () => {
size="14px" size="14px"
color="primary" color="primary"
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
@click=" @click="editForm(props.row)"
dialogStatus = 'edit';
editId = props.row.id;
isDate = props.row.isDate ? 'true' : 'false';
trainData.name = props.row.name;
trainData.topic = props.row.topic;
trainData.yearly = props.row.yearly;
trainData.place = props.row.place;
trainData.duration = props.row.duration;
trainData.department = props.row.department;
trainData.numberOrder = props.row.numberOrder;
trainData.dateOrder = props.row.dateOrder;
trainData.startDate = props.row.startDate;
trainData.endDate = props.row.endDate;
trainData.startYear = +props.row.startDate.slice(0, 4);
trainData.finishYear = +props.row.endDate.slice(0, 4);
dialog = true;
"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
@ -623,9 +611,11 @@ onMounted(async () => {
size="14px" size="14px"
color="info" color="info"
icon="history" icon="history"
@click="historyDialog = true" @click="
() => (fetchHistoryData(props.row.id), (historyDialog = true))
"
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขการฝกอบรม/งาน</q-tooltip>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
<q-separator /> <q-separator />
@ -1008,7 +998,7 @@ onMounted(async () => {
<q-form @submit.prevent greedy @validation-success="validateForm"> <q-form @submit.prevent greedy @validation-success="validateForm">
<q-card-section class="flex justify-between" style="padding: 0"> <q-card-section class="flex justify-between" style="padding: 0">
<dialog-header <dialog-header
tittle="ประวัติแก้ไขประวัติการศึกษา" tittle="ประวัติแก้ไขการฝึกอบรม/ดูงาน"
:close="closeHistoryDialog" :close="closeHistoryDialog"
/> />
</q-card-section> </q-card-section>

View file

@ -489,7 +489,7 @@ async function addEditData(editStatus: boolean = false) {
: config.API.profileNewInsign; : config.API.profileNewInsign;
const method = editStatus ? "patch" : "post"; const method = editStatus ? "patch" : "post";
const reqBody: RequestItemsObject = { const reqBody: RequestItemsObject = {
profileId: profileId.value, profileId: editStatus ? undefined : profileId.value,
isActive: insigniaData.isActive, isActive: insigniaData.isActive,
year: insigniaData.year, year: insigniaData.year,
no: insigniaData.no, no: insigniaData.no,

View file

@ -238,12 +238,13 @@ async function addEditData(editStatus: boolean = false) {
: config.API.profileNewHonor; : config.API.profileNewHonor;
const method = editStatus ? "patch" : "post"; const method = editStatus ? "patch" : "post";
const reqBody: RequestItemsObject = { const reqBody: RequestItemsObject = {
profileId: profileId.value, profileId: editStatus ? undefined : profileId.value,
isActive: declHonorData.isActive, isActive: declHonorData.isActive,
detail: declHonorData.detail, detail: declHonorData.detail,
issueDate: declHonorData.isDate issueDate:
? declHonorData.issueDate declHonorData.isDate === "true"
: new Date(`${declHonorData.issueDateYear}-1-1`), ? declHonorData.issueDate
: new Date(`${declHonorData.issueDateYear}-01-01`),
issuer: declHonorData.issuer, issuer: declHonorData.issuer,
refCommandDate: declHonorData.refCommandDate, refCommandDate: declHonorData.refCommandDate,
refCommandNo: declHonorData.refCommandNo, refCommandNo: declHonorData.refCommandNo,

View file

@ -295,7 +295,7 @@ async function addEditData(editStatus: boolean = false) {
: config.API.profileNewAssessments; : config.API.profileNewAssessments;
const method = editStatus ? "patch" : "post"; const method = editStatus ? "patch" : "post";
const reqBody: RequestItemsObject = { const reqBody: RequestItemsObject = {
profileId: profileId.value, profileId: editStatus ? undefined : profileId.value,
isActive: resPerformData.isActive, isActive: resPerformData.isActive,
name: resPerformData.name, name: resPerformData.name,
date: resPerformData.date, date: resPerformData.date,
@ -337,7 +337,6 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
isEdit.value = editStatus; isEdit.value = editStatus;
if (editStatus && row) { if (editStatus && row) {
console.log(row.id);
Object.assign(resPerformData, row); Object.assign(resPerformData, row);
} else { } else {
(resPerformData.id = ""), (resPerformData.id = ""),
@ -375,7 +374,9 @@ async function clickHistory(row: ResponseObject) {
showLoader(); showLoader();
try { try {
const res = await http.get(config.API.profileAssessmentHisId(row.id)); const res = await http.get(config.API.profileNewAssessmentsHisById(row.id));
console.log(res.data);
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
} catch (e) { } catch (e) {
messageError($q, e); messageError($q, e);

View file

@ -7,6 +7,8 @@ import type {
MyObjectRef, MyObjectRef,
} from "@/modules/04_registryNew/interface/index/other"; } from "@/modules/04_registryNew/interface/index/other";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
@ -14,7 +16,15 @@ import DialogHistory from "@/modules/04_registryNew/components/detail/Other/01_O
const route = useRoute(); const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, showLoader, hideLoader, success, messageError } = mixin; const {
date2Thai,
showLoader,
hideLoader,
success,
messageError,
dialogRemove,
dialogConfirm,
} = mixin;
const id = ref<string>(""); const id = ref<string>("");
@ -45,6 +55,7 @@ const modal = ref<boolean>(false);
const edit = ref<boolean>(false); const edit = ref<boolean>(false);
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
const isActive = ref<boolean>(true);
const date = ref<Date | null>(null); const date = ref<Date | null>(null);
const detail = ref<string>(); const detail = ref<string>();
@ -65,6 +76,7 @@ const columns = ref<QTableProps["columns"]>([
field: "date", field: "date",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; width: 50px;", style: "font-size: 14px; width: 50px;",
format: (v) => date2Thai(v),
}, },
{ {
name: "detail", name: "detail",
@ -91,6 +103,7 @@ function openDialogEdit(props: RowList) {
modal.value = true; modal.value = true;
edit.value = true; edit.value = true;
id.value = props.id;
date.value = props.date; date.value = props.date;
detail.value = props.detail; detail.value = props.detail;
} }
@ -112,107 +125,118 @@ function closeDialog() {
/** validate check*/ /** validate check*/
function validateForm() { function validateForm() {
const hasError = []; dialogConfirm(
for (const key in objectRef) { $q,
if (Object.prototype.hasOwnProperty.call(objectRef, key)) { async () => {
const property = objectRef[key]; const hasError = [];
if (property.value && typeof property.value.validate === "function") { for (const key in objectRef) {
const isValid = property.value.validate(); if (Object.prototype.hasOwnProperty.call(objectRef, key)) {
hasError.push(isValid); const property = objectRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
} }
} if (hasError.every((result) => result === true)) {
} if (edit.value) {
if (hasError.every((result) => result === true)) { editData();
if ((edit.value = false)) { } else {
saveData(); saveData();
} else { }
editData(); }
} },
} "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
} }
/** /**
* นทกเพมขอม * นทกเพมขอม
*/ */
function saveData() { async function saveData() {
// showLoader(); showLoader();
// await http await http
// .post(config.API.profileOtherId(profileId.value), { .post(config.API.profileNewOther, {
// id: id.value, profileId: profileId.value,
// date: date.value, isActive: isActive.value,
// detail: detail.value, date: date.value,
// }) detail: detail.value,
// .then((res) => { })
// success($q, ""); .then((res) => {
// modal.value = false; success($q, "บันทึกข้อมูลสำเร็จ");
// }) getData();
// .catch((e) => { closeDialog();
// messageError($q, e); })
// }) .catch((e) => {
// .finally(async () => { messageError($q, e);
// await fetchData(); })
// }); .finally(() => {
closeDialog(); hideLoader();
});
} }
/** /**
* นทกแกไขขอม * นทกแกไขขอม
*/ */
const editData = async () => { async function editData() {
// showLoader(); showLoader();
// await http await http
// .put(config.API.profileOtherId(id.value), { .patch(config.API.profileNewOtherById(id.value), {
// id: id.value, isActive: isActive.value,
// date: date.value, date: date.value,
// detail: detail.value, detail: detail.value,
// }) })
// .then((res) => { .then((res) => {
// success($q, ""); success($q, "บันทึกข้อมูลสำเร็จ");
// modal.value = false; getData();
// }) closeDialog();
// .catch((e) => { })
// messageError($q, e); .catch((e) => {
// }) messageError($q, e);
// .finally(async () => { })
// await fetchData(); .finally(() => {
// }); hideLoader();
closeDialog(); });
}; }
function getData() { async function getData() {
const data: RowList[] = [ showLoader();
{ await http
id: "08dc3c0e-b6ef-4e6c-8c84-787447416450", .get(config.API.profileNewOtherByProfileId(profileId.value))
date: null, .then((res) => {
detail: "ทดสอบ 1", rows.value = res.data.result;
createdFullName: "สาวิตรี ศรีสมัย", })
createdAt: new Date("2024-03-04T05:48:27.615Z"), .catch((e) => {
}, messageError($q, e);
{ })
id: "08dc3c0e-bd30-48e8-8d14-31bcaf92b3a2", .finally(() => {
date: null, hideLoader();
detail: "ทดสอบ 2", });
createdFullName: "สาวิตรี ศรีสมัย", }
createdAt: new Date("2024-03-04T05:48:38.105Z"),
},
{
id: "08dc3c0e-c874-41fe-8b55-7c992ebf99b2",
date: new Date("2024-03-03T17:00:00.000Z"),
detail: "ข้อมูลอื่นๆ",
createdFullName: "สาวิตรี ศรีสมัย",
createdAt: new Date("2024-03-04T05:48:57.002Z"),
},
];
rows.value = data; async function deleteData(id: string) {
showLoader();
await http
.delete(config.API.profileNewOtherById(id))
.then((res) => {
success($q, "ลบข้อมูลสำเร็จ");
getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
} }
const infoRows = [ const infoRows = [
{ title: 'รายละเอียด', value: '' }, { title: "รายละเอียด", value: "" },
{ title: 'ล้างมลทิน', value: '' }, { title: "ล้างมลทิน", value: "" },
{ title: 'เลขที่คำสั่ง', value: '' }, { title: "เลขที่คำสั่ง", value: "" },
{ title: 'เอกสารอ้างอิง (ลงวันที่)', value: '' } { title: "เอกสารอ้างอิง (ลงวันที่)", value: "" },
] ];
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -318,24 +342,24 @@ onMounted(() => {
</template> </template>
<template v-slot:body="props" v-if="mode === 'table'"> <template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td <q-td v-for="col in props.cols" :key="col.id">
v-for="col in props.cols" <div>
:key="col.id"
@click="openDialogEdit(props.row)"
>
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
}}
</div>
<div v-else-if="col.name == 'date'" class="table_ellipsis">
{{ col.value ? date2Thai(col.value) : "-" }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn
flat
dense
round
class="q-mr-xs"
size="14px"
color="primary"
icon="mdi-pencil-outline"
@click="openDialogEdit(props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn <q-btn
color="info" color="info"
flat flat
@ -347,6 +371,19 @@ onMounted(() => {
> >
<q-tooltip>ประวแกไขอนๆ</q-tooltip> <q-tooltip>ประวแกไขอนๆ</q-tooltip>
</q-btn> </q-btn>
<!-- <q-btn
flat
dense
round
size="14px"
color="red"
icon="mdi-delete"
@click="
dialogRemove($q, async () => await deleteData(props.row.id))
"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
@ -376,36 +413,23 @@ onMounted(() => {
</div> </div>
<q-separator /> <q-separator />
<q-card-section class="q-pa-none"> <q-card-section class="q-pa-none">
<div class="row q-pa-sm"> <q-item
<div class="col text-grey-6 text-weight-medium">รายละเอยด</div> v-for="(col, index) in props.cols.filter(
<div class="col"> (col) => col.name !== 'desc'
{{ props.row.detail !== "" ? props.row.detail : "-" }} )"
</div> :key="col.name"
<div class="col text-grey-6 text-weight-medium">างมลท</div> :class="index % 2 !== 0 ? 'bg-grey-1' : ''"
<div class="col"> >
{{ props.row.unStigma ? props.row.unStigma : "-" }} <q-item-section class="text-grey-6">
</div> <q-item-label>{{ col.label }}</q-item-label>
</div> </q-item-section>
<q-separator />
<div class="row bg-grey-2 q-pa-sm">
<div class="col text-grey-6 text-weight-medium">เลขทคำส</div>
<div class="col">
{{
props.row.refCommandNo ? props.row.refCommandNo : "-"
}}
</div>
<div class="col text-grey-6 text-weight-medium">
เอกสารอางอ (ลงวนท)
</div>
<div class="col">
{{
props.row.refCommandDate
? date2Thai(props.row.refCommandDate)
: "-"
}}
</div>
</div>
<q-item-section class="text-dark">
<q-item-label>
{{ col.value ? col.value : "-" }}
</q-item-label>
</q-item-section>
</q-item>
</q-card-section> </q-card-section>
</q-card> </q-card>
</div> </div>

View file

@ -91,8 +91,7 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http.get(config.API.profileNewOtherHisById(id.value))
.get(config.API.profileOtherHisId(id.value))
.then((res) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
rows.value = []; rows.value = [];

View file

@ -1,91 +1,174 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import axios from "axios";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import type { ArrayFileList } from "@/modules/04_registryNew/interface/index/document"; import type { ArrayFileList } from "@/modules/04_registryNew/interface/index/document";
const $q = useQuasar; const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
dialogConfirm,
showLoader,
hideLoader,
success, success,
messageError, messageError,
showLoader,
hideLoader,
dialogConfirm,
dialogRemove, dialogRemove,
} = mixin; } = mixin;
const id = ref<string>("");
const documentFile = ref<any>(null); const documentFile = ref<any>(null);
const fileDocDataUpload = ref<File[]>([]);
const fileList = ref<ArrayFileList[]>([]); const fileList = ref<ArrayFileList[]>([]);
/** const profileId = ref<string>(
* งชนอปโหลดไฟล route.params.id ? route.params.id.toString() : ""
* @param documentFile ไฟลบมา );
*/
function fileUploadDoc(documentFile: any) { async function getData() {
documentFile.forEach((file: any) => { showLoader()
fileDocDataUpload.value.push(file); await http
}); .get(
config.API.file("ระบบทะเบียนประวัติ", "เอกสารหลักฐาน", profileId.value)
)
.then((res) => {
fileList.value = res.data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader()
});
} }
function getData() {}
/** /**
* งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน * งกนสำหรบอพโหลดไฟลเอกสารหลกฐาน
*/ */
function upLoadFileDoc() { async function uploadFileDoc(uploadUrl: string, file: any) {
const Data = new FormData(); const Data = new FormData();
Data.append("file", documentFile.value); Data.append("file", documentFile.value);
showLoader(); showLoader();
http await axios
.put(config.API.complaintFileUpload(id.value), Data) .put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then((res) => { .then((res) => {
success($q, "อัพโหลดไฟล์สำเร็จ"); success($q, "อัโหลดไฟล์สำเร็จ");
getData(); getData();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => {
hideLoader();
documentFile.value = null;
});
}
async function clickUpload(file: any) {
const fileName = { fileName: file.name };
dialogConfirm(
$q,
async () => {
const selectedFile = file;
const formdata = new FormData();
formdata.append("file", selectedFile);
await http
.post(
config.API.file(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐาน",
profileId.value
),
{
replace: false,
fileList: fileName,
}
)
.then(async (res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey &&
uploadFileDoc(res.data[foundKey]?.uploadUrl, documentFile.value);
})
.catch((err) => {
messageError($q, err);
});
},
"ยืนยันการอัปโหลดไฟล์",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?"
);
}
/**
* ดาวนโหลดลงคไฟล
* @param fileName file name
*/
function downloadFile(fileName: string) {
showLoader();
http
.get(
config.API.fileByFile(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐาน",
profileId.value,
fileName
)
)
.then((res) => {
const data = res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => { .finally(async () => {
hideLoader(); hideLoader();
documentFile.value = null;
}); });
} }
/**
* เปดลงคไฟล
* @param link บมาเป https งค
*/
function downloadFile(link: string) {
window.open(link, "_blank");
}
/** /**
* ลบไฟล * ลบไฟล
* @param id id file * @param fileName file name
*/ */
function deleteFile(id: string) { function deleteFile(fileName: string) {
dialogRemove($q, () => confirmDelete(id)); dialogRemove($q, async () => {
showLoader();
http
.delete(
config.API.fileByFile(
"ระบบทะเบียนประวัติ",
"เอกสารหลักฐาน",
profileId.value,
fileName
)
)
.then((res) => {
success($q, `ลบไฟล์สำเร็จ`);
setTimeout(() => {
getData();
hideLoader();
}, 1000);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
} }
/** onMounted(() => {
* นย ลบ ไฟล getData();
* @param id id file });
*/
function confirmDelete(idOrder: string) {
showLoader();
http
.delete(config.API.complaintFileDelete(id.value, idOrder))
.then((res) => {
success($q, `ลบไฟล์สำเร็จ`);
getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
</script> </script>
<template> <template>
<div class="col-sm-12 col-md-3"> <div class="col-sm-12 col-md-3">
@ -105,7 +188,6 @@ function confirmDelete(idOrder: string) {
outlined outlined
dense dense
v-model="documentFile" v-model="documentFile"
@added="fileUploadDoc"
label="ไฟล์เอกสารหลักฐาน" label="ไฟล์เอกสารหลักฐาน"
hide-bottom-space hide-bottom-space
accept=".pdf,.xlsx,.docx,.png,.jpg" accept=".pdf,.xlsx,.docx,.png,.jpg"
@ -123,7 +205,7 @@ function confirmDelete(idOrder: string) {
dense dense
color="add" color="add"
icon="mdi-upload" icon="mdi-upload"
@click="upLoadFileDoc()" @click="clickUpload(documentFile)"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn ><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
> >
</template> </template>
@ -151,7 +233,7 @@ function confirmDelete(idOrder: string) {
dense dense
color="blue" color="blue"
icon="mdi-download" icon="mdi-download"
@click="downloadFile(data.pathName)" @click="downloadFile(data.fileName)"
><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn ><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn
> >
<q-btn <q-btn
@ -162,7 +244,7 @@ function confirmDelete(idOrder: string) {
color="red" color="red"
class="q-ml-sm" class="q-ml-sm"
icon="mdi-delete-outline" icon="mdi-delete-outline"
@click="deleteFile(data.id)" @click="deleteFile(data.fileName)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn ><q-tooltip>ลบไฟล</q-tooltip></q-btn
> >
</div> </div>

View file

@ -326,6 +326,30 @@ function clearForm() {
educationData.note = ""; educationData.note = "";
} }
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
isDate.value = row.isDate ? "true" : "false";
educationData.educationLevel = row.educationLevel;
educationData.institute = row.institute;
educationData.finishDate = row.finishDate;
educationData.startDate = row.startDate;
educationData.endDate = row.endDate;
educationData.isEducation = row.isEducation;
educationData.degree = row.degree;
educationData.field = row.field;
educationData.fundName = row.fundName;
educationData.gpa = row.gpa;
educationData.country = row.country;
educationData.other = row.other;
educationData.duration = row.duration;
educationData.durationYear = row.durationYear;
educationData.note = row.note;
educationData.startYear = +row.startDate.slice(0, 4);
educationData.endYear = +row.endDate.slice(0, 4);
dialog.value = true;
}
function closeDialog() { function closeDialog() {
clearForm(); clearForm();
dialog.value = false; dialog.value = false;
@ -403,7 +427,6 @@ async function addData() {
async function editData(idData: string) { async function editData(idData: string) {
await http await http
.patch(config.API.profileNewEducationByEducationId(idData), { .patch(config.API.profileNewEducationByEducationId(idData), {
profileId: id.value,
isActive: true, isActive: true,
country: educationData.country, country: educationData.country,
degree: educationData.degree, degree: educationData.degree,
@ -519,7 +542,7 @@ onMounted(async () => {
@click=" @click="
() => { () => {
dialogStatus = 'create'; dialogStatus = 'create';
clearForm; clearForm();
dialog = true; dialog = true;
} }
" "
@ -631,27 +654,7 @@ onMounted(async () => {
clickable clickable
@click=" @click="
() => { () => {
dialogStatus = 'edit'; editForm(props.row);
editId = props.row.id;
isDate = props.row.isDate ? 'true' : 'false';
educationData.educationLevel = props.row.educationLevel;
educationData.institute = props.row.institute;
educationData.finishDate = props.row.finishDate;
educationData.startDate = props.row.startDate;
educationData.endDate = props.row.endDate;
educationData.isEducation = props.row.isEducation;
educationData.degree = props.row.degree;
educationData.field = props.row.field;
educationData.fundName = props.row.fundName;
educationData.gpa = props.row.gpa;
educationData.country = props.row.country;
educationData.other = props.row.other;
educationData.duration = props.row.duration;
educationData.durationYear = props.row.durationYear;
educationData.note = props.row.note;
educationData.startYear = +props.row.startDate.slice(0, 4);
educationData.endYear = +props.row.endDate.slice(0, 4);
dialog = true;
} }
" "
> >
@ -700,29 +703,7 @@ onMounted(async () => {
color="primary" color="primary"
size="14px" size="14px"
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
@click=" @click="editForm(props.row)"
dialogStatus = 'edit';
editId = props.row.id;
isDate = props.row.isDate ? 'true' : 'false';
educationData.educationLevel = props.row.educationLevel;
educationData.institute = props.row.institute;
educationData.finishDate = props.row.finishDate;
educationData.startDate = props.row.startDate;
educationData.endDate = props.row.endDate;
educationData.isEducation = props.row.isEducation;
educationData.degree = props.row.degree;
educationData.field = props.row.field;
educationData.fundName = props.row.fundName;
educationData.gpa = props.row.gpa;
educationData.country = props.row.country;
educationData.other = props.row.other;
educationData.duration = props.row.duration;
educationData.durationYear = props.row.durationYear;
educationData.note = props.row.note;
educationData.startYear = +props.row.startDate.slice(0, 4);
educationData.endYear = +props.row.endDate.slice(0, 4);
dialog = true;
"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>

View file

@ -150,6 +150,16 @@ function clearForm() {
specialSkill.remark = ""; specialSkill.remark = "";
} }
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
specialSkill.detail = row.detail;
specialSkill.field = row.field;
specialSkill.reference = row.reference;
specialSkill.remark = row.remark;
dialog.value = true;
}
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
@ -208,7 +218,6 @@ async function addData() {
async function editData(idData: string) { async function editData(idData: string) {
await http await http
.patch(config.API.profileNewAbilityByAbilityId(idData), { .patch(config.API.profileNewAbilityByAbilityId(idData), {
profileId: id.value,
isActive: true, isActive: true,
remark: specialSkill.remark, remark: specialSkill.remark,
field: specialSkill.field, field: specialSkill.field,
@ -359,13 +368,7 @@ onMounted(async () => {
clickable clickable
@click=" @click="
() => { () => {
dialogStatus = 'edit'; editForm(props.row);
editId = props.row.id;
specialSkill.detail = props.row.detail;
specialSkill.field = props.row.field;
specialSkill.reference = props.row.reference;
specialSkill.remark = props.row.remark;
dialog = true;
} }
" "
> >
@ -417,13 +420,7 @@ onMounted(async () => {
size="14px" size="14px"
@click=" @click="
() => { () => {
dialogStatus = 'edit'; editForm(props.row);
editId = props.row.id;
specialSkill.detail = props.row.detail;
specialSkill.field = props.row.field;
specialSkill.reference = props.row.reference;
specialSkill.remark = props.row.remark;
dialog = true;
} }
" "
> >
@ -533,7 +530,7 @@ onMounted(async () => {
<q-form @submit.prevent greedy @validation-success="validateForm"> <q-form @submit.prevent greedy @validation-success="validateForm">
<q-card-section class="flex justify-between" style="padding: 0"> <q-card-section class="flex justify-between" style="padding: 0">
<dialog-header <dialog-header
tittle="ประวัติแก้ไขประวัติการศึกษา" tittle="ประวัติแก้ไขความสามารถพิเศษ"
:close="closeHistoryDialog" :close="closeHistoryDialog"
/> />
</q-card-section> </q-card-section>

View file

@ -1,5 +1,5 @@
interface RequestItemsObject { interface RequestItemsObject {
profileId: string; profileId?: string;
isActive: boolean; isActive: boolean;
detail: string; detail: string;
issueDate: Date | null; issueDate: Date | null;

View file

@ -1,5 +1,5 @@
interface RequestItemsObject { interface RequestItemsObject {
profileId: string; profileId?: string;
isActive: boolean; isActive: boolean;
year: number; year: number;
no: string; no: string;

View file

@ -1,4 +1,4 @@
interface ProfesLicenseObject { interface RequestItemsObject {
certificateType: string; certificateType: string;
issuer: string; issuer: string;
certificateNo: string; certificateNo: string;
@ -6,4 +6,4 @@ interface ProfesLicenseObject {
expireDate: Date; expireDate: Date;
} }
export type { ProfesLicenseObject }; export type { RequestItemsObject };

View file

@ -1,5 +1,5 @@
interface RequestItemsObject { interface RequestItemsObject {
profileId: string; profileId?: string;
isActive: boolean; isActive: boolean;
name: string; name: string;
date: Date | null; date: Date | null;

View file

@ -0,0 +1,12 @@
//ข้อมูล
interface ResponseObject {
issuer: string,
certificateType: string,
certificateNo: string,
issueDate: Date | null,
isActive: boolean,
expireDate: Date | null
}
export type { ResponseObject };

View file

@ -1,18 +1,32 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from "vue"; import { ref, onMounted, reactive } from "vue";
import axios from "axios";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useQuasar } from "quasar";
import type { DataOption } from "@/modules/04_registryNew/interface/index/Main"; import type { DataOption } from "@/modules/04_registryNew/interface/index/Main";
import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main"; import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main";
import avatar from "@/assets/avatar_user.jpg";
import TabMain from "@/modules/04_registryNew/components/detail/TabMain.vue"; import TabMain from "@/modules/04_registryNew/components/detail/TabMain.vue";
import UploadFile from "@/modules/11_discipline/components/UploadFile.vue";
const mixin = useCounterMixin();
const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
date2Thai,
} = mixin;
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
const formDetail = ref<DataPerson>(); const formDetail = ref<any>();
const itemsMenu = ref<DataOption[]>([ const itemsMenu = ref<DataOption[]>([
{ {
id: "1", id: "1",
@ -39,27 +53,94 @@ const itemsMenu = ref<DataOption[]>([
name: "อื่นๆ", name: "อื่นๆ",
}, },
]); ]);
const uploadUrl = ref<string>("");
const fileName = ref<string>("");
const profilePicture = ref<string>("");
const profileFile = ref();
const input = document.createElement("input"); const input = document.createElement("input");
input.type = "file"; input.type = "file";
input.accept = ".jpg,.png,.tif,.pic"; input.accept = ".jpg,.png,.tif,.pic";
input.addEventListener("change", (e) => {
profileFile.value = (e.currentTarget as HTMLInputElement).files?.[0];
uploadProfile();
});
function selectFile() { function selectFile() {
input.click(); input.click();
} }
function fetchDataPersonal() { async function uploadProfile() {
const data = { await http
id: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", .post(config.API.file("ทะเบียนประวัติ", "โปรไฟล์", profileId.value), {
prefix: "นาย", replace: true,
firstName: "ณัฐพงศ์", fileList: [
lastName: "ดิษยบุตร", {
citizenId: "0000000000001", fileName: fileName.value,
position: "นักบริหาร", },
posLevelId: "1526d9d3-d8b1-43ab-81b5-a84dfbe09362", ],
posTypeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe08091", })
}; .then(async (res) => {
uploadUrl.value = res.data[fileName.value].uploadUrl;
uploadFileURL(uploadUrl.value, profileFile.value);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
formDetail.value = data; async function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(() => {
fetchProfile(profileId.value);
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchProfile(id: string) {
showLoader();
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
profilePicture.value = res.data.downloadUrl;
})
.catch(() => {
profilePicture.value = avatar;
})
.finally(() => {
hideLoader();
});
}
async function fetchDataPersonal() {
showLoader();
await http
.get(config.API.registryNewByProfileId(profileId.value))
.then((res) => {
formDetail.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
function onClickDownloadKp7(type: string) { function onClickDownloadKp7(type: string) {
@ -69,7 +150,9 @@ function onClickDownloadKp7(type: string) {
window.open(config.API.profileKp7ShortId(profileId.value)); window.open(config.API.profileKp7ShortId(profileId.value));
} }
} }
onMounted(() => { onMounted(async () => {
fileName.value = `profile-${profileId.value}`;
fetchProfile(profileId.value);
fetchDataPersonal(); fetchDataPersonal();
}); });
</script> </script>
@ -147,7 +230,7 @@ onMounted(() => {
<div class="absolute-center-left q-ml-lg"> <div class="absolute-center-left q-ml-lg">
<q-avatar size="130px"> <q-avatar size="130px">
<img src="@/assets/avatar_user.jpg" /> <img :src="profilePicture" />
</q-avatar> </q-avatar>
<q-btn <q-btn
round round
@ -166,19 +249,19 @@ onMounted(() => {
<div class="col-2"> <div class="col-2">
<div class="col-sm-3 col-md-3"> <div class="col-sm-3 col-md-3">
<div class="col text-grey-6">ตำแหนงในสายงาน</div> <div class="col text-grey-6">ตำแหนงในสายงาน</div>
<div class="col">วหนาสำนกงาน</div> <div class="col">{{ formDetail?.position }}</div>
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-2">
<div class="col-sm-3 col-md-3"> <div class="col-sm-3 col-md-3">
<div class="col text-grey-6">ประเภทตำแหน</div> <div class="col text-grey-6">ประเภทตำแหน</div>
<div class="col">บรหาร</div> <div class="col">{{ formDetail?.posType.posTypeName }}</div>
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-2">
<div class="col-sm-3 col-md-3"> <div class="col-sm-3 col-md-3">
<div class="col text-grey-6">ระดบตำแหน</div> <div class="col text-grey-6">ระดบตำแหน</div>
<div class="col">ชำนาญการพเศษ</div> <div class="col">{{ formDetail?.posLevel.posLevelName }}</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -309,15 +309,15 @@ function fetchDataPeriodNew() {
} }
function onClickDownload(data: DataOption) { function onClickDownload(data: DataOption) {
if (data.id === "gov1-06" || data.id === "gov2-06") { if (data.id === "gov-06") {
const formData = { const formData = {
type: "HAFT", type: "HAFT",
startDate: startDate:
data.id === "gov1-06" data.id === "gov-06"
? `${props?.roundFilter?.year - 1}-10-01` ? `${props?.roundFilter?.year - 1}-10-01`
: `${props?.roundFilter?.year}-04-01`, : `${props?.roundFilter?.year}-04-01`,
endDate: endDate:
data.id === "gov1-06" data.id === "gov-06"
? `${props?.roundFilter?.year}-03-31` ? `${props?.roundFilter?.year}-03-31`
: `${props?.roundFilter?.year}-09-30`, : `${props?.roundFilter?.year}-09-30`,
}; };
@ -336,6 +336,10 @@ function onClickDownload(data: DataOption) {
} else { } else {
if (props.rootId && props.periodId) { if (props.rootId && props.periodId) {
showLoader(); showLoader();
console.log("id==>", data.id);
console.log("rootId==>", props.rootId);
console.log("periodId==>", props.periodId);
http http
.get( .get(
config.API.salaryReportListsByid( config.API.salaryReportListsByid(

View file

@ -64,35 +64,35 @@ export const useSalaryEmployeeListSDataStore = defineStore(
/** List Download รายงานของรอบเมษายน*/ /** List Download รายงานของรอบเมษายน*/
const itemDownloadApr = ref<DataOption[]>([ const itemDownloadApr = ref<DataOption[]>([
{ {
id: "gov1-01", id: "gov-01",
name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม", name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม",
}, },
{ {
id: "gov1-02", id: "gov-02",
name: "บัญชีการคำนวณโควตาเลื่อนเงินเดือน รอบเมษายน", name: "บัญชีการคำนวณโควตาเลื่อนเงินเดือน รอบเมษายน",
}, },
{ {
id: "gov1-03", id: "gov-03",
name: "รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น", name: "รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น",
}, },
{ {
id: "gov1-04", id: "gov-04",
name: "แบบ 1 กท รอบเมษายน", name: "แบบ 1 กท รอบเมษายน",
}, },
{ {
id: "gov1-05", id: "gov-05",
name: "แบบ 2 กท รอบเมษายน", name: "แบบ 2 กท รอบเมษายน",
}, },
{ {
id: "gov1-06", id: "gov-06",
name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก.", name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก.",
}, },
{ {
id: "gov1-07", id: "gov-07",
name: "คำสั่งเลื่อนเงินเดือน รอบเมษายน", name: "คำสั่งเลื่อนเงินเดือน รอบเมษายน",
}, },
{ {
id: "gov1-08", id: "gov-08",
name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อน รอบเมษายน", name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อน รอบเมษายน",
}, },
]); ]);
@ -100,39 +100,39 @@ export const useSalaryEmployeeListSDataStore = defineStore(
/** List Download รายงานของรอบตุลาคม*/ /** List Download รายงานของรอบตุลาคม*/
const itemDownloadOct = ref<DataOption[]>([ const itemDownloadOct = ref<DataOption[]>([
{ {
id: "gov2-01", id: "gov-01",
name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 กันยายน", name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 กันยายน",
}, },
{ {
id: "gov2-02", id: "gov-02",
name: "บัญชีการคำนวณวงเงินเลื่อนเงินเดือน รอบตุลาคม", name: "บัญชีการคำนวณวงเงินเลื่อนเงินเดือน รอบตุลาคม",
}, },
{ {
id: "gov2-03", id: "gov-03",
name: "รายชื่อข้าราชการผู้ที่ได้รับการเสนอขอเลื่อนเงินเดือนทั้งปีสองขั้น", name: "รายชื่อข้าราชการผู้ที่ได้รับการเสนอขอเลื่อนเงินเดือนทั้งปีสองขั้น",
}, },
{ {
id: "gov2-04", id: "gov-04",
name: "แบบ 1 กท รอบตุลาคม", name: "แบบ 1 กท รอบตุลาคม",
}, },
{ {
id: "gov2-05", id: "gov-05",
name: "แบบ 2 กท รอบตุลาคม", name: "แบบ 2 กท รอบตุลาคม",
}, },
{ {
id: "gov2-06", id: "gov-06",
name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก. ", name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก. ",
}, },
{ {
id: "gov2-07", id: "gov-07",
name: "คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ", name: "คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ",
}, },
{ {
id: "gov2-08", id: "gov-08",
name: "คำสั่งเลื่อนเงินเดือน รอบตุลาคม", name: "คำสั่งเลื่อนเงินเดือน รอบตุลาคม",
}, },
{ {
id: "gov2-09", id: "gov-09",
name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อนเงินเดือน รอบตุลาคม", name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อนเงินเดือน รอบตุลาคม",
}, },
]); ]);

View file

@ -18,7 +18,7 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => {
const remaining = ref<number>(0); const remaining = ref<number>(0);
const statusQuota = ref<string>('') const statusQuota = ref<string>("");
const groupId = ref<string>(""); const groupId = ref<string>("");
const rootId = ref<string>(""); const rootId = ref<string>("");
const roundMainCode = ref<string>(""); const roundMainCode = ref<string>("");
@ -62,35 +62,35 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => {
/** List Download รายงานของรอบเมษายน*/ /** List Download รายงานของรอบเมษายน*/
const itemDownloadApr = ref<DataOption[]>([ const itemDownloadApr = ref<DataOption[]>([
{ {
id: "gov1-01", id: "gov-01",
name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม", name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม",
}, },
{ {
id: "gov1-02", id: "gov-02",
name: "บัญชีการคำนวณโควตาเลื่อนเงินเดือน รอบเมษายน", name: "บัญชีการคำนวณโควตาเลื่อนเงินเดือน รอบเมษายน",
}, },
{ {
id: "gov1-03", id: "gov-03",
name: "รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น", name: "รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น",
}, },
{ {
id: "gov1-04", id: "gov-04",
name: "แบบ 1 กท รอบเมษายน", name: "แบบ 1 กท รอบเมษายน",
}, },
{ {
id: "gov1-05", id: "gov-05",
name: "แบบ 2 กท รอบเมษายน", name: "แบบ 2 กท รอบเมษายน",
}, },
{ {
id: "gov1-06", id: "gov-06",
name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก.", name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก.",
}, },
{ {
id: "gov1-07", id: "gov-07",
name: "คำสั่งเลื่อนเงินเดือน รอบเมษายน", name: "คำสั่งเลื่อนเงินเดือน รอบเมษายน",
}, },
{ {
id: "gov1-08", id: "gov-08",
name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อน รอบเมษายน", name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อน รอบเมษายน",
}, },
]); ]);
@ -98,39 +98,39 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => {
/** List Download รายงานของรอบตุลาคม*/ /** List Download รายงานของรอบตุลาคม*/
const itemDownloadOct = ref<DataOption[]>([ const itemDownloadOct = ref<DataOption[]>([
{ {
id: "gov2-01", id: "gov-01",
name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 กันยายน", name: "รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 กันยายน",
}, },
{ {
id: "gov2-02", id: "gov-02",
name: "บัญชีการคำนวณวงเงินเลื่อนเงินเดือน รอบตุลาคม", name: "บัญชีการคำนวณวงเงินเลื่อนเงินเดือน รอบตุลาคม",
}, },
{ {
id: "gov2-03", id: "gov-03",
name: "รายชื่อข้าราชการผู้ที่ได้รับการเสนอขอเลื่อนเงินเดือนทั้งปีสองขั้น", name: "รายชื่อข้าราชการผู้ที่ได้รับการเสนอขอเลื่อนเงินเดือนทั้งปีสองขั้น",
}, },
{ {
id: "gov2-04", id: "gov-04",
name: "แบบ 1 กท รอบตุลาคม", name: "แบบ 1 กท รอบตุลาคม",
}, },
{ {
id: "gov2-05", id: "gov-05",
name: "แบบ 2 กท รอบตุลาคม", name: "แบบ 2 กท รอบตุลาคม",
}, },
{ {
id: "gov2-06", id: "gov-06",
name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก. ", name: "แบบ 3 กท บัญชีแสดงวันลาครึ่งปี ขรก. ",
}, },
{ {
id: "gov2-07", id: "gov-07",
name: "คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ", name: "คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ",
}, },
{ {
id: "gov2-08", id: "gov-08",
name: "คำสั่งเลื่อนเงินเดือน รอบตุลาคม", name: "คำสั่งเลื่อนเงินเดือน รอบตุลาคม",
}, },
{ {
id: "gov2-09", id: "gov-09",
name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อนเงินเดือน รอบตุลาคม", name: "คำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อนเงินเดือน รอบตุลาคม",
}, },
]); ]);
@ -156,6 +156,6 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => {
remaining, remaining,
isClosedRound, isClosedRound,
roundYear, roundYear,
statusQuota statusQuota,
}; };
}); });