รวมไฟล์แก้งานงวด2

This commit is contained in:
Kittapath 2023-07-10 10:10:46 +07:00
parent 79889c9464
commit 2249097b07
89 changed files with 11287 additions and 7048 deletions

View file

@ -366,9 +366,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขผลก
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -597,36 +595,34 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileAssessmentId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
point1Total: e.point1Total,
point1: e.point1,
point2Total: e.point2Total,
point2: e.point2,
pointSumTotal: e.pointSumTotal,
pointSum: e.pointSum,
date: new Date(e.date),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
loaderPage(true);
await http
.get(config.API.profileAssessmentId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
point1Total: e.point1Total,
point1: e.point1,
point2Total: e.point2Total,
point2: e.point2,
pointSumTotal: e.pointSumTotal,
pointSum: e.pointSum,
date: new Date(e.date),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -716,31 +712,29 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileAssessmentId(profileId.value), {
id: id.value,
name: name.value,
point1Total: point1Total.value,
point1: point1.value,
point2Total: point2Total.value,
point2: point2.value,
pointSumTotal: pointSumTotal.value,
pointSum: pointSum.value,
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileAssessmentId(profileId.value), {
id: id.value,
name: name.value,
point1Total: point1Total.value,
point1: point1.value,
point2Total: point2Total.value,
point2: point2.value,
pointSumTotal: pointSumTotal.value,
pointSum: pointSum.value,
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**

View file

@ -25,8 +25,11 @@
@click="selectData(props)"
class="cursor-pointer"
>
<div v-if="col.name == 'issueDate'" class="table_ellipsis">
{{ date2Thai(col.value) }}
<div
v-if="col.name == 'issueDate' || col.name == 'refCommandDate'"
class="table_ellipsis"
>
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -118,9 +121,9 @@
:readonly="!edit"
:borderless="!edit"
v-model="issuer"
:rules="[(val) => !!val || `${'กรุณากรอกหน่วยงานที่ออก'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
hide-bottom-space
:label="`${'หน่วยงานที่ออก'}`"
:label="`${'ผู้มีอำนาจลงนาม'}`"
@update:modelValue="clickEditRow"
/>
</div>
@ -140,6 +143,72 @@
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="refCommandDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</q-card-section>
<q-separator />
@ -173,10 +242,14 @@
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div
v-if="col.name == 'issueDate' || col.name == 'createdAt'"
v-if="
col.name == 'issueDate' ||
col.name == 'createdAt' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -230,6 +303,8 @@ const id = ref<string>("");
const issuer = ref<string>();
const detail = ref<string>();
const issueDate = ref<Date>(new Date());
const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
const modal = ref<boolean>(false); //modal add detail
@ -244,14 +319,18 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.coined.columns.length == 0
? (visibleColumns.value = ["issuer", "detail", "issueDate"])
? (visibleColumns.value = [
"issuer",
"detail",
"issueDate",
"refCommandNo",
"refCommandDate",
])
: (visibleColumns.value = profileData.coined.columns);
const columns = ref<QTableProps["columns"]>([
{
@ -268,7 +347,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "issuer",
align: "left",
label: "หน่วยงานที่ออก",
label: "ผู้มีอำนาจลงนาม",
sortable: true,
field: "issuer",
headerStyle: "font-size: 14px",
@ -287,6 +366,28 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -303,7 +404,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "issuer",
align: "left",
label: "หน่วยงานที่ออก",
label: "ผู้มีอำนาจลงนาม",
sortable: true,
field: "issuer",
headerStyle: "font-size: 14px",
@ -322,6 +423,28 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
@ -349,6 +472,8 @@ const visibleColumnsHistory = ref<String[]>([
"issuer",
"detail",
"issueDate",
"refCommandNo",
"refCommandDate",
"createdFullName",
"createdAt",
]);
@ -362,31 +487,32 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileHonorId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
loaderPage(true);
await http
.get(config.API.profileHonorId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -417,6 +543,8 @@ const getData = () => {
issuer.value = row.issuer;
detail.value = row.detail;
issueDate.value = row.issueDate;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
};
@ -471,26 +599,27 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileHonorId(profileId.value), {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileHonorId(profileId.value), {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -504,6 +633,9 @@ const editData = async () => {
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -584,6 +716,8 @@ const selectData = async (props: DataProps) => {
issuer.value = props.row.issuer;
detail.value = props.row.detail;
issueDate.value = props.row.issueDate;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
await checkRowPage();
};
@ -598,6 +732,8 @@ const addData = () => {
issuer.value = "";
detail.value = "";
issueDate.value = new Date();
refCommandNo.value = "";
refCommandDate.value = null;
};
/**
@ -651,6 +787,9 @@ const clickHistory = async (row: RequestItemsObject) => {
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdAt: new Date(e.createdAt),
createdFullName: e.createdFullName,
});
@ -686,6 +825,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

View file

@ -1,5 +1,5 @@
<template>
<q-card-actions class="text-primary q-py-sm q-gutter-sm">
<q-card-actions class="text-primary q-py-sm">
<q-btn
flat
round
@ -19,48 +19,51 @@
:color="!next ? 'grey-7' : 'public'"
/>
<q-space />
<q-btn
v-if="modalEdit == true"
flat
round
color="red"
@click="clickDelete"
icon="mdi-delete"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
<q-btn
v-if="!editvisible"
outline
flat
round
:disabled="editvisible"
:color="editvisible ? 'grey-7' : 'primary'"
@click="edit"
label="แก้ไขข้อมูล"
><!-- icon="mdi-pencil-outline"
<q-tooltip>แกไขขอม</q-tooltip> -->
</q-btn>
<q-btn
v-show="editvisible"
flat
:disabled="!editvisible"
:outline="!editvisible"
:color="!editvisible ? 'grey-7' : 'red'"
@click="cancel()"
label="ยกเลิกแก้ไข"
v-if="modalEdit == true"
> <!-- icon="mdi-undo"
<q-tooltip>ยกเล</q-tooltip> -->
</q-btn>
<q-btn
v-if="modalEdit == true"
unelevated
color="red"
@click="clickDelete"
label="ลบข้อมูล"
><!-- icon="mdi-delete"
<q-tooltip>ลบขอม</q-tooltip> -->
</q-btn>
<q-btn
v-if="editvisible"
unelevated
label="บันทึก"
:disabled="!editvisible"
:color="!editvisible ? 'grey-7' : 'public'"
@click="checkSave"
><!-- icon="mdi-content-save-outline"
<q-tooltip>นท</q-tooltip> -->
icon="mdi-pencil-outline"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<div v-else>
<q-btn
flat
round
:disabled="!editvisible"
:outline="!editvisible"
:color="!editvisible ? 'grey-7' : 'red'"
@click="cancel()"
icon="mdi-undo"
v-if="modalEdit == true"
>
<q-tooltip>ยกเล</q-tooltip>
</q-btn>
<q-btn
flat
round
:disabled="!editvisible"
:color="!editvisible ? 'grey-7' : 'public'"
@click="checkSave"
icon="mdi-content-save-outline"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</div>
</q-card-actions>
</template>
<script setup lang="ts">

View file

@ -27,7 +27,7 @@
v-if="col.name == 'refCommandDate' || col.name == 'date'"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -126,9 +126,9 @@
:readonly="!edit"
:borderless="!edit"
v-model="level"
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับความผิด'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับการลงโทษทางวินัย'}`]"
hide-bottom-space
:label="`${'ระดับความผิด'}`"
:label="`${'ระดับการลงโทษทางวินัย'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
@ -150,16 +150,35 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
:rules="[
(val:string) =>
!!val || `${'กรุณากรอกเอกสารอ้างอิง (เลขที่คำสั่ง)'}`,
]"
v-model="unStigma"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (เลขที่คำสั่ง)'}`"
:label="`${'ล้างมลทิน'}`"
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
@ -182,11 +201,9 @@
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(refCommandDate)"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกเอกสารอ้างอิง (ลงวันที่)'}`,
]"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
@ -246,7 +263,7 @@
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -346,8 +363,9 @@ const OpsFilter = ref<DisciplineOps>({
],
});
const detail = ref<string>();
const unStigma = ref<string>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date>(new Date());
const refCommandDate = ref<Date | null>(new Date());
const date = ref<Date>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
@ -363,9 +381,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขวิน
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -373,6 +389,7 @@ profileData.discipline.columns.length == 0
? (visibleColumns.value = [
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
@ -404,7 +421,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "level",
align: "left",
label: "ระดับความผิด",
label: "ระดับการลงโทษทางวินัย",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
@ -412,10 +429,21 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "unStigma",
align: "left",
label: "ล้างมลทิน",
sortable: true,
field: "unStigma",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
@ -461,7 +489,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "level",
align: "left",
label: "ระดับความผิด",
label: "ระดับการลงโทษทางวินัย",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
@ -469,10 +497,21 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "unStigma",
align: "left",
label: "ล้างมลทิน",
sortable: true,
field: "unStigma",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
@ -517,6 +556,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
const visibleColumnsHistory = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
@ -547,33 +587,33 @@ const filterSelector = (val: string, update: Function, refData: string) => {
};
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
refCommandNo: e.refCommandNo,
refCommandDate: new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -603,6 +643,7 @@ const getData = () => {
const row = rows.value[rowIndex.value];
level.value = row.level;
detail.value = row.detail;
unStigma.value = row.unStigma;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
date.value = row.date;
@ -660,28 +701,28 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
refCommandNo: refCommandNo.value,
refCommandDate: dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -694,8 +735,10 @@ const editData = async () => {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate: dateToISO(refCommandDate.value),
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
@ -776,6 +819,7 @@ const selectData = async (props: DataProps) => {
rowIndex.value = props.rowIndex;
level.value = props.row.level;
detail.value = props.row.detail;
unStigma.value = props.row.unStigma;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
date.value = props.row.date;
@ -792,8 +836,9 @@ const addData = () => {
edit.value = true;
level.value = "";
detail.value = "";
unStigma.value = "";
refCommandNo.value = "";
refCommandDate.value = new Date();
refCommandDate.value = null;
date.value = new Date();
};
@ -843,8 +888,10 @@ const clickHistory = async (row: RequestItemsObject) => {
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate: new Date(e.refCommandDate),
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
@ -881,6 +928,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

View file

@ -8,7 +8,6 @@
:changeBtn="changeBtn"
:disable="statusEdit"
:save="uploadData"
:addEmployee="statusAdd()"
/>
<div class="row col-12 q-pt-sm">
<q-card bordered flat class="full-width">
@ -154,10 +153,6 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -167,9 +162,7 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const route = useRoute();
const { success, messageError } = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const edit = ref<boolean>(false);
const uploader = ref<any>();
const files = ref<any>([]);
@ -178,37 +171,22 @@ const name = ref<string>("");
onMounted(async () => {
await getData();
defaultAdd();
});
const getData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profilePaperId(profileId.value))
.then((res) => {
const data = res.data.result;
files.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
};
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
name.value = "";
if (uploader.value) {
uploader.value.reset();
}
}
loaderPage(true);
await http
.get(config.API.profilePaperId(profileId.value))
.then((res) => {
const data = res.data.result;
files.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const deleteData = async (id: string) => {
@ -228,33 +206,31 @@ const deleteData = async (id: string) => {
const uploadData = async () => {
if (file.value.length > 0) {
if (profileId.value !== "") {
const blob = file.value.slice(0, file.value[0].size);
const newFile = new File(blob, name.value, {
type: file.value[0].type,
const blob = file.value.slice(0, file.value[0].size);
const newFile = new File(blob, name.value, {
type: file.value[0].type,
});
const formData = new FormData();
formData.append("avatar", newFile);
formData.append("moss", "newFile");
console.log(formData);
loaderPage(true);
await http
.post(config.API.profilePaperId(profileId.value), formData)
.then((res) => {
const data = res.data.result;
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
uploader.value.reset();
name.value = "";
edit.value = false;
emit("update:statusEdit", false);
await getData();
});
const formData = new FormData();
formData.append("avatar", newFile);
formData.append("moss", "newFile");
console.log(formData);
loaderPage(true);
await http
.post(config.API.profilePaperId(profileId.value), formData)
.then((res) => {
const data = res.data.result;
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
uploader.value.reset();
name.value = "";
edit.value = false;
emit("update:statusEdit", false);
await getData();
});
}
} else {
// modalError(
// $q,

View file

@ -23,15 +23,26 @@
@click="selectData(props)"
class="cursor-pointer"
>
<div
v-if="col.name == 'startDate' || col.name == 'endDate'"
class="table_ellipsis"
>
{{ col.value + 543 }}
<div v-if="col.name == 'startDate'" class="table_ellipsis">
{{
props.row.isDate == "true"
? date2Thai(props.row.startDate2)
: col.value + 543
}}
</div>
<div v-else-if="col.name == 'endDate'" class="table_ellipsis">
{{
props.row.isDate == "true"
? date2Thai(props.row.endDate2)
: col.value + 543
}}
</div>
<div v-else-if="col.name == 'finishDate'" class="table_ellipsis">
{{ date2Thai(col.value) }}
</div>
<div v-else-if="col.name == 'isEducation'" class="table_ellipsis">
{{ col.value ? "ใช่" : "ไม่ใช่" }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div>
@ -102,94 +113,219 @@
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="startDate"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
<div class="col-12">
<q-card flat bordered class="q-px-sm q-pb-sm borderCard">
<div class="row col-12 q-gutter-md q-py-sm text-grey-7">
<q-radio
v-model="isDate"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="ปี"
dense
lazy-rules
:borderless="!edit"
:model-value="startDate + 543"
:rules="[(val) => !!val || `${'กรุณาเลือกปีตั้งแต่'}`]"
hide-bottom-space
:label="`${'ตั้งแต่'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
v-model="endDate"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:min-date="minDate"
:readonly="!edit"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
:disable="!edit"
/>
<q-radio
v-model="isDate"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="true"
label="วัน/เดือน/ปี"
dense
lazy-rules
:borderless="!edit"
:model-value="endDate + 543"
:rules="[(val) => !!val || `${'กรุณาเลือกปีถึง'}`]"
hide-bottom-space
:label="`${'ถึง'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
:disable="!edit"
/>
</div>
<div class="col-12 row q-col-gutter-sm">
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
v-if="isDate === 'false'"
menu-class-name="modalfix"
:readonly="!edit"
v-model="startDate"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="startDate + 543"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกปีที่เริ่มต้นศึกษา'}`,
]"
hide-bottom-space
:label="`${'ปีที่เริ่มต้นศึกษา'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="startDate2"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(startDate2)"
:rules="[
(val) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี ที่เริ่มต้นศึกษา'}`,
]"
hide-bottom-space
:label="`${'วัน เดือน ปี ที่เริ่มต้นศึกษา'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
v-if="isDate === 'false'"
menu-class-name="modalfix"
v-model="endDate"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:min-date="minDate"
:readonly="!edit"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="endDate + 543"
:rules="[
(val) => !!val || `${'กรุณาเลือกปีที่จบการศึกษา'}`,
]"
hide-bottom-space
:label="`${'ปีที่จบการศึกษา'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="endDate2"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(endDate2)"
:rules="[
(val) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี ที่จบการศึกษา'}`,
]"
hide-bottom-space
:label="`${'วัน เดือน ปี ที่จบการศึกษา'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</q-card>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
@ -244,8 +380,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionPathId"
:rules="[(val:string) => !!val || `${'กรุณาเลือกเป็นวุฒิการศึกษาในตำแหน่ง'}`]"
v-model="isEducation"
hide-bottom-space
:label="`${'เป็นวุฒิการศึกษาในตำแหน่ง'}`"
@update:modelValue="clickEditRow"
@ -411,11 +546,19 @@
<template #columns="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div
v-if="col.name == 'startDate' || col.name == 'endDate'"
class="table_ellipsis"
>
{{ col.value + 543 }}
<div v-if="col.name == 'startDate'" class="table_ellipsis">
{{
props.row.isDate == true
? date2Thai(props.row.startDate2)
: col.value + 543
}}
</div>
<div v-else-if="col.name == 'endDate'" class="table_ellipsis">
{{
props.row.isDate == true
? date2Thai(props.row.endDate2)
: col.value + 543
}}
</div>
<div
v-else-if="col.name == 'finishDate' || col.name == 'createdAt'"
@ -423,6 +566,9 @@
>
{{ date2Thai(col.value) }}
</div>
<div v-else-if="col.name == 'isEducation'" class="table_ellipsis">
{{ col.value ? "ใช่" : "ไม่ใช่" }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div>
@ -478,7 +624,7 @@ const OpsFilter = ref<EduOps>({
levelOptions: [],
positionPathOptions: [],
});
const positionPathId = ref<string>();
const isEducation = ref<boolean>();
const institute = ref<string>();
const degree = ref<string>();
const field = ref<string>();
@ -488,9 +634,12 @@ const duration = ref<string>();
const durationYear = ref<number>(0);
const other = ref<string>();
const fundName = ref<string>();
const isDate = ref<string>("true");
const finishDate = ref<Date>(new Date());
const startDate = ref<number>(new Date().getFullYear());
const startDate2 = ref<Date>(new Date());
const endDate = ref<number>(new Date().getFullYear());
const endDate2 = ref<Date>(new Date());
const minDate = ref<Date>();
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
@ -506,9 +655,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -524,7 +671,7 @@ profileData.education.columns.length == 0
"durationYear",
"other",
"fundName",
"positionPath",
"isEducation",
"finishDate",
"startDate",
"endDate",
@ -587,11 +734,11 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionPath",
name: "isEducation",
align: "left",
label: "เป็นวุฒิการศึกษาในตำแหน่ง",
sortable: true,
field: "positionPath",
field: "isEducation",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -743,11 +890,11 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionPath",
name: "isEducation",
align: "left",
label: "เป็นวุฒิการศึกษาในตำแหน่ง",
sortable: true,
field: "positionPath",
field: "isEducation",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -874,7 +1021,7 @@ const visibleColumnsHistory = ref<String[]>([
"duration",
"durationYear",
"other",
"positionPath",
"isEducation",
"fundName",
"finishDate",
"startDate",
@ -924,10 +1071,11 @@ const fetchPositionPath = async () => {
.get(config.API.positionPath)
.then((res) => {
const data = res.data.result;
let option: DataOption[] = [];
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
let option: any = [];
// data.map((r: DataOption) => {
option.push({ id: true, name: "ใช่" });
option.push({ id: false, name: "ไม่ใช่" });
// });
Ops.value.positionPathOptions = option;
OpsFilter.value.positionPathOptions = option;
})
@ -962,44 +1110,45 @@ const filterSelector = (val: any, update: Function, refData: string) => {
};
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileEduId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.educationLevel,
levelId: e.educationLevelId,
positionPath: e.positionPath,
positionPathId: e.positionPathId,
institute: e.institute,
degree: e.degree,
field: e.field,
gpa: e.gpa,
country: e.country,
duration: e.duration,
durationYear: e.durationYear,
other: e.other,
fundName: e.fundName,
finishDate: new Date(e.finishDate),
startDate: new Date(e.startDate).getFullYear(),
endDate: new Date(e.endDate).getFullYear(),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileEduId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.educationLevel,
levelId: e.educationLevelId,
positionPath: e.positionPath,
isEducation: e.isEducation,
institute: e.institute,
degree: e.degree,
field: e.field,
gpa: e.gpa,
country: e.country,
duration: e.duration,
durationYear: e.durationYear,
other: e.other,
fundName: e.fundName,
isDate: e.isDate.toString(),
finishDate: new Date(e.finishDate),
startDate: new Date(e.startDate).getFullYear(),
endDate: new Date(e.endDate).getFullYear(),
startDate2: new Date(e.startDate),
endDate2: new Date(e.endDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -1028,7 +1177,7 @@ const clickNext = async () => {
const getData = () => {
const row = rows.value[rowIndex.value];
levelId.value = row.levelId;
positionPathId.value = row.positionPathId;
isEducation.value = row.isEducation;
institute.value = row.institute;
degree.value = row.degree;
field.value = row.field;
@ -1039,8 +1188,11 @@ const getData = () => {
other.value = row.other;
fundName.value = row.fundName;
finishDate.value = row.finishDate;
isDate.value = row.isDate;
startDate.value = row.startDate;
endDate.value = row.endDate;
startDate2.value = row.startDate2;
endDate2.value = row.endDate2;
id.value = row.id;
};
@ -1094,46 +1246,50 @@ const clickSave = async () => {
/**
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
// const filter = OpsFilter.value.levelOptions.filter(
// (r: any) => r.id == levelId.value
// );
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == positionPathId.value
// );
loaderPage(true);
await http
.post(config.API.profileEduId(profileId.value), {
id: id.value,
// educationLevel: filter[0].name,
educationLevelId: levelId.value,
positionPathId: positionPathId.value,
institute: institute.value,
degree: degree.value,
field: field.value,
gpa: gpa.value,
country: country.value,
duration: duration.value,
durationYear: durationYear.value,
other: other.value,
fundName: fundName.value,
finishDate: dateToISO(finishDate.value),
startDate: new Date(`${startDate.value}-01-01`),
endDate: new Date(`${endDate.value}-01-01`),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
// const filter = OpsFilter.value.levelOptions.filter(
// (r: any) => r.id == levelId.value
// );
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == isEducation.value
// );
loaderPage(true);
await http
.post(config.API.profileEduId(profileId.value), {
id: id.value,
// educationLevel: filter[0].name,
educationLevelId: levelId.value,
isEducation: isEducation.value,
institute: institute.value,
degree: degree.value,
field: field.value,
gpa: gpa.value,
country: country.value,
duration: duration.value,
durationYear: durationYear.value,
other: other.value,
fundName: fundName.value,
isDate: isDate.value == "true" ? true : false,
finishDate: dateToISO(finishDate.value),
startDate:
isDate.value == "true"
? dateToISO(startDate2.value)
: new Date(`${startDate.value}-01-01`),
endDate:
isDate.value == "true"
? dateToISO(endDate2.value)
: new Date(`${endDate.value}-01-01`),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -1144,7 +1300,7 @@ const editData = async () => {
// (r: any) => r.id == levelId.value
// );
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == positionPathId.value
// (r: any) => r.id == isEducation.value
// );
loaderPage(true);
await http
@ -1152,7 +1308,7 @@ const editData = async () => {
id: id.value,
// educationLevel: filter[0].name,
educationLevelId: levelId.value,
positionPathId: positionPathId.value,
isEducation: isEducation.value,
institute: institute.value,
degree: degree.value,
field: field.value,
@ -1162,9 +1318,16 @@ const editData = async () => {
durationYear: durationYear.value,
other: other.value,
fundName: fundName.value,
isDate: isDate.value == "true" ? true : false,
finishDate: dateToISO(finishDate.value),
startDate: new Date(`${startDate.value}-01-01`),
endDate: new Date(`${endDate.value}-01-01`),
startDate:
isDate.value == "true"
? dateToISO(startDate2.value)
: new Date(`${startDate.value}-01-01`),
endDate:
isDate.value == "true"
? dateToISO(endDate2.value)
: new Date(`${endDate.value}-01-01`),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -1243,7 +1406,7 @@ const selectData = async (_props: DataProps) => {
rawItem.value = _props.row;
rowIndex.value = _props.rowIndex;
levelId.value = _props.row.levelId;
positionPathId.value = _props.row.positionPathId;
isEducation.value = _props.row.isEducation;
institute.value = _props.row.institute;
degree.value = _props.row.degree;
field.value = _props.row.field;
@ -1254,8 +1417,11 @@ const selectData = async (_props: DataProps) => {
other.value = _props.row.other;
fundName.value = _props.row.fundName;
finishDate.value = _props.row.finishDate;
isDate.value = _props.row.isDate;
startDate.value = _props.row.startDate;
endDate.value = _props.row.endDate;
startDate2.value = _props.row.startDate2;
endDate2.value = _props.row.endDate2;
id.value = _props.row.id;
await checkRowPage();
};
@ -1268,7 +1434,7 @@ const addData = () => {
modal.value = true;
edit.value = true;
levelId.value = "";
positionPathId.value = "";
isEducation.value = false;
institute.value = "";
degree.value = "";
field.value = "";
@ -1278,9 +1444,12 @@ const addData = () => {
durationYear.value = 0;
other.value = "";
fundName.value = "";
isDate.value = "true";
finishDate.value = new Date();
startDate.value = new Date().getFullYear();
endDate.value = new Date().getFullYear();
startDate2.value = new Date();
endDate2.value = new Date();
};
/**
@ -1330,7 +1499,7 @@ const clickHistory = async (row: RequestItemsObject) => {
level: e.educationLevel,
levelId: e.educationLevelId,
positionPath: e.positionPath,
positionPathId: e.positionPathId,
isEducation: e.isEducation,
institute: e.institute,
degree: e.degree,
field: e.field,
@ -1340,9 +1509,12 @@ const clickHistory = async (row: RequestItemsObject) => {
durationYear: e.durationYear,
other: e.other,
fundName: e.fundName,
isDate: e.isDate.toString(),
finishDate: new Date(e.finishDate),
startDate: new Date(e.startDate).getFullYear(),
endDate: new Date(e.endDate).getFullYear(),
startDate2: new Date(e.startDate2),
endDate2: new Date(e.endDate2),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -1383,4 +1555,7 @@ const getClass = (val: boolean) => {
.modalfix {
position: fixed !important;
}
.borderCard {
border: 1px solid #d0d0d0;
}
</style>

View file

@ -5,12 +5,11 @@
header="ข้อมูลที่อยู่"
icon="mdi-map-marker"
:save="saveData"
:history="!statusAdd()"
:history="true"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
@ -312,10 +311,6 @@ const props = defineProps({
type: Boolean,
required: true,
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -512,28 +507,8 @@ const visibleColumnsHistory = ref<String[]>([
onMounted(async () => {
await getNewData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
addressData.value = {
address: null,
provinceId: null,
districtId: null,
subdistrictId: null,
addressC: null,
provinceIdC: null,
districtIdC: null,
subdistrictIdC: null,
same: "0",
};
}
};
const filterSelector = (val: any, update: Function, refData: string) => {
switch (refData) {
case "provinceOps":
@ -581,39 +556,37 @@ const filterSelector = (val: any, update: Function, refData: string) => {
* งชนดอมลประวแกไขขอมลทเลอก
*/
const clickHistory = async () => {
if (route.params.id) {
modalHistory.value = true;
loaderPage(true);
await http
.get(config.API.profileAdrsHisId(route.params.id.toString()))
.then((res) => {
let data = res.data.result;
rowsHistory.value = [];
data.map((e: RequestItemsHistoryObject) => {
rowsHistory.value.push({
currentAddress: e.currentAddress,
currentDistrict: e.currentDistrict,
currentProvince: e.currentProvince,
currentSubDistrict: e.currentSubDistrict,
currentZipCode: e.currentZipCode,
registrationSame: e.registrationSame,
registrationAddress: e.registrationAddress,
registrationDistrict: e.registrationDistrict,
registrationProvince: e.registrationProvince,
registrationSubDistrict: e.registrationSubDistrict,
registrationZipCode: e.registrationZipCode,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
modalHistory.value = true;
loaderPage(true);
await http
.get(config.API.profileAdrsHisId(route.params.id.toString()))
.then((res) => {
let data = res.data.result;
rowsHistory.value = [];
data.map((e: RequestItemsHistoryObject) => {
rowsHistory.value.push({
currentAddress: e.currentAddress,
currentDistrict: e.currentDistrict,
currentProvince: e.currentProvince,
currentSubDistrict: e.currentSubDistrict,
currentZipCode: e.currentZipCode,
registrationSame: e.registrationSame,
registrationAddress: e.registrationAddress,
registrationDistrict: e.registrationDistrict,
registrationProvince: e.registrationProvince,
registrationSubDistrict: e.registrationSubDistrict,
registrationZipCode: e.registrationZipCode,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const refreshData = async () => {
@ -633,29 +606,27 @@ const getNewData = async () => {
};
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
loaderPage(true);
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
addressData.value.address = data.registrationAddress;
addressData.value.addressC = data.currentAddress;
addressData.value.districtId = data.registrationDistrictId;
addressData.value.districtIdC = data.currentDistrictId;
addressData.value.provinceId = data.registrationProvinceId;
addressData.value.provinceIdC = data.currentProvinceId;
addressData.value.subdistrictId = data.registrationSubDistrictId;
addressData.value.subdistrictIdC = data.currentSubDistrictId;
addressData.value.same = data.registrationSame ? "1" : "0";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const editData = async () => {
@ -705,34 +676,12 @@ const editData = async () => {
const saveData = async () => {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
if (props.statusAdd) {
await addData();
} else {
await editData();
}
await editData();
} else {
}
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const selectProvince = async (e: string | null, name: string) => {
if (e != null) {
if (name == "1") {

View file

@ -285,10 +285,6 @@ const props = defineProps({
type: String,
required: true,
},
statusAdd: {
type: Boolean,
default: false,
},
});
const $q = useQuasar();
@ -320,9 +316,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขใบอ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -490,33 +484,31 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
certificateNo: e.certificateNo,
issuer: e.issuer,
issueDate: new Date(e.issueDate),
expireDate: new Date(e.expireDate),
certificateType: e.certificateType,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -603,28 +595,26 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileCertId(profileId.value), {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: dateToISO(issueDate.value),
expireDate: dateToISO(expireDate.value),
certificateType: certificateType.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileCertId(profileId.value), {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: dateToISO(issueDate.value),
expireDate: dateToISO(expireDate.value),
certificateType: certificateType.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**

View file

@ -5,24 +5,62 @@
header="ข้อมูลครอบครัว"
icon="mdi-account-group"
:save="saveData"
:history="!statusAdd()"
:history="true"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
:historyClick="historyData"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 text-weight-bold"> ดา</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-12 row q-pb-sm q-pt-md">
<div class="col-xs-2 col-sm-1 text-weight-bold"> ดา</div>
<div class="q-gutter-sm">
<q-radio
v-model="familyData.liveM"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
dense
color="blue"
:disable="!edit"
/>
<q-radio
v-model="familyData.liveM"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
color="red"
label="เสียชีวิต"
dense
:disable="!edit"
/>
</div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="familyData.citizenIdM"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -32,7 +70,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -69,7 +107,7 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -84,15 +122,54 @@
</div>
<div class="col-12 q-pt-md q-pb-sm"><q-separator /></div>
<div class="col-xs-12 text-weight-bold"> มารดา</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="row col-12 q-py-sm">
<div class="col-xs-2 col-sm-1 text-weight-bold"> มารดา</div>
<div class="q-gutter-sm">
<q-radio
v-model="familyData.liveF"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
color="blue"
dense
:disable="!edit"
/>
<q-radio
v-model="familyData.liveF"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
color="red"
dense
:disable="!edit"
/>
</div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="familyData.citizenIdF"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -102,7 +179,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -139,7 +216,7 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -153,27 +230,75 @@
/>
</div>
<div class="col-12 q-pt-md q-pb-sm"><q-separator /></div>
<div class="col-xs-12 q-col-gutter-x-sm items-center flex q-my-sm">
<label class="text-weight-bold"> สมรส</label>
<q-radio
v-model="familyData.same"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มี"
dense
:disable="!edit"
@update:model-value="selectRadio"
<div class="row col-12 q-py-sm">
<div class="col-xs-2 col-sm-1 text-weight-bold"> สมรส</div>
<div class="q-gutter-sm">
<q-radio
v-model="familyData.same"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มี"
dense
:disable="!edit"
@update:model-value="selectRadio"
/>
<q-radio
v-model="familyData.same"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="ไม่มี"
color="grey-9"
dense
:disable="!edit"
@update:model-value="selectRadio"
/>
</div>
<q-separator
vertical
color="grey-4"
size="2px"
class="q-mx-md"
v-if="familyData.same == '1'"
/>
<q-radio
v-model="familyData.same"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="ไม่มี"
<div class="q-gutter-sm" v-if="familyData.same == '1'">
<q-radio
v-model="familyData.liveC"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
color="blue"
dense
:disable="!edit"
/>
<q-radio
v-model="familyData.liveC"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
color="red"
dense
:disable="!edit"
/>
</div>
</div>
<div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
:disable="!edit"
@update:model-value="selectRadio"
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="familyData.citizenIdC"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
@ -184,7 +309,7 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -194,7 +319,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -203,7 +328,7 @@
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="familyData.same == '1'">
<div class="col-xs-6 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -245,7 +370,7 @@
:label="`${'นามสกุล(เดิม)'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3" v-if="familyData.same == '1'">
<div class="col-xs-12 col-sm-2 col-md-2" v-if="familyData.same == '1'">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -261,7 +386,9 @@
<div class="col-12 q-pt-md q-pb-sm"><q-separator /></div>
</div>
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div
class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs q-mb-sm"
>
<div class="col-xs-12 q-col-gutter-x-sm items-center flex">
<label class="text-weight-bold"> ตร</label>
<div>
@ -282,35 +409,70 @@
<div
class="row col-12 items-center q-col-gutter-xs"
v-for="items in familyData.childrens"
:key="items.id"
v-for="(items, index) in familyData.childrens"
:key="index"
>
<q-btn
v-if="edit"
size="12px"
flat
round
:disable="!edit"
:color="!edit ? 'grey-7' : 'red'"
@click="deleteChildren(items)"
icon="mdi-delete-outline"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
<div
:class="
edit
? 'col-xs-10 col-sm-2 col-md-2'
: 'col-xs-12 col-sm-3 col-md-3'
"
>
<div class="col-12 row q-gutter-sm q-pb-xs">
<q-avatar class="bg-grey-2" size="28px">{{ index + 1 }}</q-avatar>
<q-radio
v-model="items.childrenLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
color="blue"
dense
:disable="!edit"
/>
<q-radio
v-model="items.childrenLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
color="red"
dense
:disable="!edit"
/>
</div>
<div>
<q-btn
v-if="edit"
flat
dense
size="12px"
round
:disable="!edit"
:color="!edit ? 'grey-7' : 'red'"
@click="deleteChildren(items)"
icon="mdi-delete-outline"
>
<q-tooltip>ลบขอม {{ index + 1 }}</q-tooltip>
</q-btn>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(edit)"
hide-bottom-space
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="items.childrenCitizenId"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="!edit"
hide-bottom-space
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -320,7 +482,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -356,7 +518,13 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div
:class="
edit
? 'col-xs-10 col-sm-1 col-md-1'
: 'col-xs-12 col-sm-2 col-md-2'
"
>
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -369,6 +537,12 @@
:label="`${'อาชีพ'}`"
/>
</div>
<div
class="col-12 q-my-sm"
v-if="index + 1 < familyData.childrens.length"
>
<q-separator v-if="edit" inset />
</div>
</div>
</div>
</q-form>
@ -390,15 +564,50 @@
}`
}}
</div>
<div class="col-xs-12 text-weight-bold"> ดา</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 text-weight-bold">
ดา
<q-radio
v-model="familyDataHistory[indexRow].fatherLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
dense
:disable="true"
/>
<q-radio
v-model="familyDataHistory[indexRow].fatherLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
dense
:disable="true"
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
:outlined="false"
dense
lazy-rules
:readonly="true"
:borderless="true"
v-model="familyDataHistory[indexRow].fatherCitizenId"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="true"
hide-bottom-space
:class="getClass(false)"
:readonly="true"
:borderless="true"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="false"
dense
lazy-rules
@ -408,7 +617,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -445,7 +654,7 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
@ -460,15 +669,50 @@
</div>
<div class="col-12 q-pt-md q-pb-sm"><q-separator /></div>
<div class="col-xs-12 text-weight-bold"> มารดา</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 text-weight-bold">
มารดา
<q-radio
v-model="familyDataHistory[indexRow].motherLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
dense
:disable="true"
/>
<q-radio
v-model="familyDataHistory[indexRow].motherLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
dense
:disable="true"
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
:outlined="false"
dense
lazy-rules
:readonly="true"
:borderless="true"
v-model="familyDataHistory[indexRow].motherCitizenId"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="true"
hide-bottom-space
:class="getClass(false)"
:readonly="true"
:borderless="true"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="false"
dense
lazy-rules
@ -478,7 +722,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -515,7 +759,7 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
@ -547,14 +791,62 @@
unchecked-icon="panorama_fish_eye"
val="0"
label="ไม่มี"
color="grey-9"
dense
:disable="true"
@update:model-value="selectRadio"
/>
<q-separator
vertical
color="grey-4"
size="2px"
class="q-mx-md"
v-if="familyData.same == '1'"
/>
<div class="q-gutter-sm" v-if="familyData.same == '1'">
<q-radio
v-model="familyDataHistory[indexRow].coupleLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
color="blue"
dense
:disable="true"
/>
<q-radio
v-model="familyDataHistory[indexRow].coupleLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
color="red"
dense
:disable="true"
/>
</div>
</div>
<div
class="col-xs-6 col-sm-2 col-md-2"
v-if="familyDataHistory[indexRow].couple == '1'"
>
<q-input
:class="getClass(false)"
hide-bottom-space
:outlined="false"
dense
lazy-rules
:readonly="true"
:borderless="true"
v-model="familyDataHistory[indexRow].coupleCitizenId"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div
class="col-xs-12 col-sm-3 col-md-3"
class="col-xs-12 col-sm-2 col-md-2"
v-if="familyDataHistory[indexRow].couple == '1'"
>
<selector
@ -563,7 +855,7 @@
:class="getClass(false)"
:readonly="true"
:borderless="true"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="false"
dense
lazy-rules
@ -573,7 +865,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -617,7 +909,7 @@
/>
</div>
<div
class="col-xs-6 col-sm-3 col-md-3"
class="col-xs-6 col-sm-2 col-md-2"
v-if="familyDataHistory[indexRow].couple == '1'"
>
<q-input
@ -634,7 +926,7 @@
/>
</div>
<div
class="col-xs-12 col-sm-3 col-md-3"
class="col-xs-12 col-sm-2 col-md-2"
v-if="familyDataHistory[indexRow].couple == '1'"
>
<q-input
@ -662,14 +954,51 @@
v-for="items in familyDataHistory[indexRow].childrens"
:key="items.id"
>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-12 row q-gutter-sm q-pb-xs">
<q-radio
v-model="items.childrenLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="1"
label="มีชีวิต"
color="blue"
dense
:disable="true"
/>
<q-radio
v-model="items.childrenLive"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="0"
label="เสียชีวิต"
color="red"
dense
:disable="true"
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
:outlined="false"
dense
lazy-rules
:readonly="true"
:borderless="true"
v-model="items.childrenCitizenId"
:label="`${'เลขที่บัตรประชาชน'}`"
maxlength="13"
mask="#############"
/>
</div>
<div class="col-xs-6 col-sm-2 col-md-2">
<selector
:hide-dropdown-icon="true"
hide-bottom-space
:class="getClass(false)"
:readonly="true"
:borderless="true"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="false"
dense
lazy-rules
@ -679,7 +1008,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -715,7 +1044,7 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass(false)"
hide-bottom-space
@ -785,10 +1114,6 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -815,16 +1140,22 @@ const familyData = ref<Family>({
lastnameC: null,
lastnameCOld: null,
occupationC: null,
liveC: null,
citizenIdC: null,
prefixM: null,
prefixIdM: null,
firstnameM: null,
lastnameM: null,
occupationM: null,
liveM: null,
citizenIdM: null,
prefixF: null,
prefixIdF: null,
firstnameF: null,
lastnameF: null,
occupationF: null,
liveF: null,
citizenIdF: null,
same: "0",
childrens: [],
});
@ -840,37 +1171,8 @@ onMounted(async () => {
await fetchPrefix();
await fetchData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
familyData.value = {
prefixC: null,
prefixIdC: null,
firstnameC: null,
lastnameC: null,
lastnameCOld: null,
occupationC: null,
prefixM: null,
prefixIdM: null,
firstnameM: null,
lastnameM: null,
occupationM: null,
prefixF: null,
prefixIdF: null,
firstnameF: null,
lastnameF: null,
occupationF: null,
same: "0",
childrens: [],
};
}
};
const historyData = async () => {
await fetchHistory();
};
@ -918,6 +1220,8 @@ const addChildren = async () => {
childrenFirstName: "",
childrenLastName: "",
childrenCareer: "",
childrenLive: "1",
childrenCitizenId: "",
});
familyData.value.childrens.sort(
@ -948,14 +1252,20 @@ const fetchHistory = async () => {
coupleLastName: row.coupleLastName,
coupleLastNameOld: row.coupleLastNameOld,
coupleCareer: row.coupleCareer,
coupleLive: row.coupleLive ? "1" : "0",
coupleCitizenId: row.coupleCitizenId,
fatherPrefixId: row.fatherPrefixId,
fatherFirstName: row.fatherFirstName,
fatherLastName: row.fatherLastName,
fatherCareer: row.fatherCareer,
fatherLive: row.fatherLive ? "1" : "0",
fatherCitizenId: row.fatherCitizenId,
motherPrefixId: row.motherPrefixId,
motherFirstName: row.motherFirstName,
motherLastName: row.motherLastName,
motherCareer: row.motherCareer,
motherLive: row.motherLive ? "1" : "0",
motherCitizenId: row.motherCitizenId,
childrens: row.childrens,
createdFullName: row.createdFullName,
createdAt: new Date(row.createdAt),
@ -989,55 +1299,61 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
familyData.value.prefixC = "";
familyData.value.prefixIdC = data.couplePrefixId;
familyData.value.firstnameC = data.coupleFirstName;
familyData.value.lastnameC = data.coupleLastName;
familyData.value.lastnameCOld = data.coupleLastNameOld;
familyData.value.occupationC = data.coupleCareer;
familyData.value.prefixM = "";
familyData.value.prefixIdM = data.fatherPrefixId;
loaderPage(true);
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
const data: ResponseObject = res.data.result;
familyData.value.prefixC = "";
familyData.value.prefixIdC = data.couplePrefixId;
familyData.value.firstnameC = data.coupleFirstName;
familyData.value.lastnameC = data.coupleLastName;
familyData.value.lastnameCOld = data.coupleLastNameOld;
familyData.value.occupationC = data.coupleCareer;
familyData.value.liveC = data.coupleLive ? "1" : "0";
familyData.value.citizenIdC = data.coupleCitizenId;
familyData.value.firstnameM = data.fatherFirstName;
familyData.value.lastnameM = data.fatherLastName;
familyData.value.occupationM = data.fatherCareer;
familyData.value.prefixF = "";
familyData.value.prefixIdF = data.motherPrefixId;
familyData.value.prefixM = "";
familyData.value.prefixIdM = data.fatherPrefixId;
familyData.value.firstnameM = data.fatherFirstName;
familyData.value.lastnameM = data.fatherLastName;
familyData.value.occupationM = data.fatherCareer;
familyData.value.liveM = data.fatherLive ? "1" : "0";
familyData.value.citizenIdM = data.fatherCitizenId;
familyData.value.firstnameF = data.motherFirstName;
familyData.value.lastnameF = data.motherLastName;
familyData.value.occupationF = data.motherCareer;
familyData.value.same = data.couple ? "1" : "0";
familyData.value.prefixF = "";
familyData.value.prefixIdF = data.motherPrefixId;
familyData.value.firstnameF = data.motherFirstName;
familyData.value.lastnameF = data.motherLastName;
familyData.value.occupationF = data.motherCareer;
familyData.value.liveF = data.motherLive ? "1" : "0";
familyData.value.citizenIdF = data.motherCitizenId;
familyData.value.same = data.couple ? "1" : "0";
if (data.childrens.length > 0) {
let dataChild: childrenFamily[] = [];
data.childrens.map((row: childrenFamily, index: number) => {
dataChild.push({
id: `${index + 1}`,
childrenPrefixId: row.childrenPrefixId,
childrenFirstName: row.childrenFirstName,
childrenLastName: row.childrenLastName,
childrenCareer: row.childrenCareer,
});
if (data.childrens.length > 0) {
let dataChild: childrenFamily[] = [];
data.childrens.map((row: childrenFamily, index: number) => {
dataChild.push({
id: `${index + 1}`,
childrenPrefixId: row.childrenPrefixId,
childrenFirstName: row.childrenFirstName,
childrenLastName: row.childrenLastName,
childrenCareer: row.childrenCareer,
childrenLive: row.childrenLive,
childrenCitizenId: row.childrenCitizenId,
});
familyData.value.childrens = dataChild;
} else {
familyData.value.childrens = [];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
});
}
});
familyData.value.childrens = dataChild;
} else {
familyData.value.childrens = [];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
});
};
const editData = async () => {
@ -1049,14 +1365,20 @@ const editData = async () => {
coupleLastName: familyData.value.lastnameC,
coupleLastNameOld: familyData.value.lastnameCOld,
coupleCareer: familyData.value.occupationC,
coupleLive: familyData.value.liveC == "1",
coupleCitizenId: familyData.value.citizenIdC,
fatherPrefixId: familyData.value.prefixIdM,
fatherFirstName: familyData.value.firstnameM,
fatherLastName: familyData.value.lastnameM,
fatherCareer: familyData.value.occupationM,
fatherLive: familyData.value.liveM == "1",
fatherCitizenId: familyData.value.citizenIdM,
motherPrefixId: familyData.value.prefixIdF,
motherFirstName: familyData.value.firstnameF,
motherLastName: familyData.value.lastnameF,
motherCareer: familyData.value.occupationF,
motherLive: familyData.value.liveF == "1",
motherCitizenId: familyData.value.citizenIdF,
childrens: familyData.value.childrens,
createdFullName: "-",
createdAt: new Date(),
@ -1076,32 +1398,10 @@ const editData = async () => {
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
await myform.value?.validate().then(async (success: boolean) => {
if (success) {
if (props.statusAdd) {
await addData();
} else {
await editData();
}
await editData();
} else {
}
});
@ -1123,6 +1423,8 @@ const selectRadio = (e: boolean, i: any) => {
familyData.value.lastnameC = "";
familyData.value.lastnameCOld = "";
familyData.value.occupationC = "";
familyData.value.liveC = "";
familyData.value.citizenIdC = "";
}
};

View file

@ -25,7 +25,7 @@
:label="`${'สังกัด'}`"
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<div class="col-xs-6 col-sm-3 col-md-3" v-if="employeeClass != 'temp'">
<q-input
:class="getClass(false)"
hide-bottom-space
@ -85,7 +85,7 @@
:label="`${'ประเภท'}`"
/>
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<div class="col-xs-6 col-sm-3 col-md-3" v-if="employeeClass != 'temp'">
<q-input
:class="getClass(false)"
hide-bottom-space
@ -149,8 +149,18 @@
:readonly="!edit"
:borderless="!edit"
:model-value="date2Thai(new Date(govermentData.containDate))"
:rules="[(val) => !!val || `${'กรุณาเลือก วันที่บรรจุ'}`]"
:label="`${'วันที่บรรจุ'}`"
:rules="[
(val) =>
!!val ||
`${
profileType == 'officer'
? 'กรุณาเลือกวันที่บรรจุ'
: 'กรุณาเลือกวันที่แต่งตั้ง'
}`,
]"
:label="`${
profileType == 'officer' ? 'วันที่บรรจุ' : 'วันที่แต่งตั้ง'
}`"
>
<template v-slot:prepend>
<q-icon
@ -193,9 +203,19 @@
:borderless="!edit"
:model-value="date2Thai(new Date(govermentData.workDate))"
:rules="[
(val) => !!val || `${'กรุณาเลือก เริ่มปฎิบัติราชการ'}`,
(val) =>
!!val ||
`${
profileType == 'officer'
? 'กรุณาเลือกเริ่มปฎิบัติราชการ'
: 'กรุณาเลือกวันที่จ้างและแต่งตั้งมีผล'
}`,
]"
:label="`${'เริ่มปฎิบัติราชการ'}`"
:label="`${
profileType == 'officer'
? 'เริ่มปฎิบัติราชการ'
: 'วันที่จ้างและแต่งตั้งมีผล'
}`"
>
<template v-slot:prepend>
<q-icon
@ -211,7 +231,7 @@
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="col-xs-6 col-sm-6 col-md-6" v-if="profileType == 'officer'">
<q-input
:class="getClass(edit)"
hide-bottom-space
@ -330,6 +350,14 @@ const props = defineProps({
type: Boolean,
required: true,
},
profileType: {
type: String,
required: true,
},
employeeClass: {
type: String,
required: true,
},
});
const emit = defineEmits(["update:statusEdit"]);

View file

@ -5,12 +5,11 @@
header="ข้อมูลส่วนตัว"
icon="mdi-account"
:save="saveData"
:history="!statusAdd()"
:history="true"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="onCancel"
:historyClick="clickHistory"
:addEmployee="statusAdd()"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-sm">
@ -25,7 +24,6 @@
:borderless="!edit"
v-model="informaData.cardid"
@update:model-value="changeCardID"
maxlength="13"
:rules="[
(val:string) => !!val || `${'กรุณากรอก เลขบัตรประจำตัวประชาชน'}`,
(val:string) =>
@ -33,6 +31,7 @@
`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,
]"
label="เลขบัตรประจำตัวประชาชน"
maxlength="13"
mask="#############"
/>
</div>
@ -43,7 +42,7 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -53,7 +52,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -116,11 +115,7 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
:model-value="
informaData.birthDate == null
? ''
: date2Thai(informaData.birthDate)
"
:model-value="date2Thai(informaData.birthDate)"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
:label="`${'วัน/เดือน/ปี เกิด'}`"
>
@ -158,7 +153,6 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก เพศ'}`]"
:outlined="edit"
dense
lazy-rules
@ -183,7 +177,6 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก สถานภาพ'}`]"
:outlined="edit"
dense
lazy-rules
@ -211,7 +204,6 @@
:readonly="!edit"
:borderless="!edit"
v-model="informaData.nationality"
:rules="[(val:string) => !!val || `${'กรุณากรอก สัญชาติ'}`]"
:label="`${'สัญชาติ'}`"
/>
</div>
@ -225,7 +217,6 @@
:readonly="!edit"
:borderless="!edit"
v-model="informaData.ethnicity"
:rules="[(val:string) => !!val || `${'กรุณากรอก เชื้อชาติ'}`]"
:label="`${'เชื้อชาติ'}`"
/>
</div>
@ -236,7 +227,6 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก ศาสนา'}`]"
:outlined="edit"
dense
lazy-rules
@ -368,6 +358,7 @@
unchecked-icon="panorama_fish_eye"
val="0"
label="ไม่มี"
color="grey-9"
dense
:disable="!edit"
/>
@ -377,6 +368,11 @@
v-if="same == '1'"
v-model:statusEdit="edit"
:fetchDataInformation="fetchDataComponent"
:perfixId="informaData.prefixId == null ? '' : informaData.prefixId"
:firstname="
informaData.firstname == null ? '' : informaData.firstname
"
:lastname="informaData.lastname == null ? '' : informaData.lastname"
/>
</div>
</div>
@ -443,10 +439,6 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
statusAdd: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:statusEdit"]);
@ -515,7 +507,7 @@ const columnsHistory = ref<QTableColumn[]>([
{
name: "prefix",
align: "left",
label: "คำนำหน้า",
label: "คำนำหน้าชื่อ",
sortable: true,
field: "prefix",
headerStyle: "font-size: 14px",
@ -701,36 +693,8 @@ onMounted(async () => {
await fetchPerson();
await fetchData();
emit("update:statusEdit", false);
defaultAdd();
});
const statusAdd = () => props.statusAdd;
const defaultAdd = () => {
if (props.statusAdd) {
edit.value = props.statusAdd;
informaData.value = {
cardid: null,
age: null,
prefix: null,
prefixId: null,
firstname: null,
lastname: null,
birthDate: null,
genderId: null,
bloodId: null,
nationality: null,
ethnicity: null,
statusId: null,
religionId: null,
tel: null,
employeeType: null,
employeeClass: null,
profileType: null,
};
}
};
const onCancel = async () => {
if (myform.value != null) {
myform.value.reset();
@ -858,52 +822,50 @@ const checkCitizen = async (id: string) => {
* งชนดอมลประวแกไขขอมลทเลอก
*/
const clickHistory = async () => {
if (route.params.id) {
modalHistory.value = true;
loaderPage(true);
await http
.get(config.API.profileInforHisId(route.params.id.toString()))
.then((res) => {
let data = res.data.result;
rowsHistory.value = [];
data.map((e: RequestItemsHistoryObject) => {
rowsHistory.value.push({
citizenId: e.citizenId,
prefix: e.prefix,
firstName: e.firstName,
lastName: e.lastName,
birthDate: new Date(e.birthDate),
gender: e.gender,
relationship: e.relationship,
bloodGroup: e.bloodGroup,
nationality: e.nationality,
race: e.race,
religion: e.religion,
telephoneNumber: e.telephoneNumber,
employeeType:
e.employeeType == "gov"
? "งบประมาณเงินอุดหนุนรัฐบาล"
: e.employeeType == "bkk"
? "งบประมาณกรุงเทพมหานคร"
: "-",
employeeClass:
e.employeeClass == "perm"
? "ลูกจ้างประจำ"
: e.employeeClass == "temp"
? "ลูกจ้างชั่วคราว"
: "-",
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
modalHistory.value = true;
loaderPage(true);
await http
.get(config.API.profileInforHisId(route.params.id.toString()))
.then((res) => {
let data = res.data.result;
rowsHistory.value = [];
data.map((e: RequestItemsHistoryObject) => {
rowsHistory.value.push({
citizenId: e.citizenId,
prefix: e.prefix,
firstName: e.firstName,
lastName: e.lastName,
birthDate: new Date(e.birthDate),
gender: e.gender,
relationship: e.relationship,
bloodGroup: e.bloodGroup,
nationality: e.nationality,
race: e.race,
religion: e.religion,
telephoneNumber: e.telephoneNumber,
employeeType:
e.employeeType == "gov"
? "งบประมาณเงินอุดหนุนรัฐบาล"
: e.employeeType == "bkk"
? "งบประมาณกรุงเทพมหานคร"
: "-",
employeeClass:
e.employeeClass == "perm"
? "ลูกจ้างประจำ"
: e.employeeClass == "temp"
? "ลูกจ้างชั่วคราว"
: "-",
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const filterSelector = (val: any, update: Function, refData: string) => {
@ -1000,49 +962,44 @@ const calRetire = async (birth: Date) => {
};
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (
data.profileType == "officer" &&
columnsHistory.value.length >= 15
) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
}
loaderPage(true);
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
const data: ResponseObject = res.data.result;
defaultCitizenData.value = data.citizenId;
informaData.value.cardid = data.citizenId;
informaData.value.prefix = "";
informaData.value.prefixId = data.prefixId;
informaData.value.firstname = data.firstName;
informaData.value.lastname = data.lastName;
informaData.value.birthDate = new Date(data.birthDate);
informaData.value.genderId = data.genderId;
informaData.value.bloodId = data.bloodGroupId;
informaData.value.nationality = data.nationality;
informaData.value.ethnicity = data.race;
informaData.value.statusId = data.relationshipId;
informaData.value.religionId = data.religionId;
informaData.value.tel = data.telephoneNumber;
informaData.value.age = data.age;
informaData.value.employeeType = data.employeeType;
informaData.value.employeeClass = data.employeeClass;
informaData.value.profileType = data.profileType;
dateBefore.value = new Date(data.birthDate);
same.value = data.changeName == true ? "1" : "0";
await calRetire(new Date(dateToISO(new Date(data.birthDate))));
if (data.profileType == "officer" && columnsHistory.value.length >= 15) {
columnsHistory.value.splice(13, 1);
columnsHistory.value.splice(12, 1);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
await props.fetchDataProfile();
});
};
const editData = async () => {
@ -1055,10 +1012,7 @@ const editData = async () => {
nationality: informaData.value.nationality,
race: informaData.value.ethnicity,
religionId: informaData.value.religionId,
birthDate:
informaData.value.birthDate == null
? dateToISO(new Date())
: dateToISO(informaData.value.birthDate),
birthDate: dateToISO(informaData.value.birthDate) ?? dateToISO(new Date()),
bloodGroupId: informaData.value.bloodId,
relationshipId: informaData.value.statusId,
telephoneNumber: informaData.value.tel,
@ -1086,33 +1040,11 @@ const editData = async () => {
});
};
const addData = async () => {
// loaderPage(true);
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// edit.value = false;
// emit("update:statusEdit", false);
// await fetchData();
// await changeBirth(informaData.value.birthDate ?? new Date());
// });
};
const saveData = async () => {
if (myform.value != null) {
await myform.value.validate().then(async (success: boolean) => {
if (success) {
if (props.statusAdd) {
await addData();
} else {
await editData();
}
await editData();
} else {
}
});

View file

@ -100,7 +100,7 @@
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
:outlined="edit"
dense
lazy-rules
@ -110,7 +110,7 @@
option-label="name"
:options="Ops.prefixOps"
option-value="id"
:label="`${'คำนำหน้า'}`"
:label="`${'คำนำหน้าชื่อ'}`"
use-input
input-debounce="0"
@filter="(inputValue:any,
@ -124,7 +124,7 @@
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:readonly="!edit || status == 'lastName'"
:borderless="!edit"
v-model="firstName"
:rules="[(val) => !!val || `${'กรุณากรอกชื่อ'}`]"
@ -139,7 +139,7 @@
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:readonly="!edit || status == 'firstName'"
:borderless="!edit"
v-model="lastName"
:rules="[(val) => !!val || `${'กรุณากรอกนามสกุล'}`]"
@ -324,6 +324,18 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
perfixId: {
type: String,
required: true,
},
firstname: {
type: String,
required: true,
},
lastname: {
type: String,
required: true,
},
});
const $q = useQuasar();
@ -362,9 +374,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขประ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const file = ref<string | null>(null);
const fileUpload = ref<any>([]);
const rows = ref<RequestItemsObject[]>([]);
@ -411,7 +421,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "prefix",
align: "left",
label: "คำนำหน้า",
label: "คำนำหน้าชื่อ",
sortable: true,
field: "prefix",
headerStyle: "font-size: 14px",
@ -457,7 +467,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "prefix",
align: "left",
label: "คำนำหน้า",
label: "คำนำหน้าชื่อ",
sortable: true,
field: "prefix",
headerStyle: "font-size: 14px",
@ -540,34 +550,32 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileChangeNameId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
prefix: e.prefix,
prefixId: e.prefixId,
firstName: e.firstName,
lastName: e.lastName,
status: e.status,
file: e.file,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileChangeNameId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
prefix: e.prefix,
prefixId: e.prefixId,
firstName: e.firstName,
lastName: e.lastName,
status: e.status,
file: e.file,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -669,19 +677,44 @@ const clickSave = async () => {
if (modalEdit.value) {
await editData();
} else {
await checkSave();
await saveData();
}
}
});
};
const checkSave = async () => {
/**
* นทกเพมขอม
*/
const saveData = async () => {
if (fileUpload.value.length > 0) {
if (profileId.value !== "") {
await saveData();
} else {
await saveDataEmployee();
}
const blob = fileUpload.value.slice(0, fileUpload.value[0].size);
const newFile = new File(blob, nameFile.value, {
type: fileUpload.value[0].type,
});
const formData = new FormData();
formData.append("", newFile);
if (prefixId.value != undefined)
formData.append("prefixId", prefixId.value);
if (firstName.value != undefined)
formData.append("firstName", firstName.value);
if (lastName.value != undefined)
formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
loaderPage(true);
await http
.post(config.API.profileChangeNameId(profileId.value), formData)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetchDataInformation();
});
} else {
dialogMessage(
$q,
@ -697,41 +730,6 @@ const checkSave = async () => {
}
};
/**
* นทกเพมขอม
*/
const saveData = async () => {
const blob = fileUpload.value.slice(0, fileUpload.value[0].size);
const newFile = new File(blob, nameFile.value, {
type: fileUpload.value[0].type,
});
const formData = new FormData();
formData.append("", newFile);
if (prefixId.value != undefined) formData.append("prefixId", prefixId.value);
if (firstName.value != undefined)
formData.append("firstName", firstName.value);
if (lastName.value != undefined) formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
loaderPage(true);
await http
.post(config.API.profileChangeNameId(profileId.value), formData)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetchDataInformation();
});
};
const saveDataEmployee = async () => {
console.log("saveDataEmployee");
};
/**
* นทกแกไขขอม
*/
@ -845,9 +843,9 @@ const addData = () => {
modalEdit.value = false;
modal.value = true;
edit.value = true;
prefixId.value = "";
firstName.value = "";
lastName.value = "";
prefixId.value = props.perfixId;
firstName.value = props.firstname;
lastName.value = props.lastname;
status.value = "";
file.value = "";
};

View file

@ -43,7 +43,7 @@
size="12px"
flat
round
v-if="edit && !addEmployee"
v-if="edit"
:color="!edit ? 'grey-7' : 'red'"
@click="ClickCancel"
icon="mdi-undo"
@ -125,7 +125,6 @@ const props = defineProps({
type: Boolean,
defualt: false,
},
disable: {
type: Boolean,
defualt: false,
@ -158,10 +157,6 @@ const props = defineProps({
type: Function,
default: () => console.log("not function"),
},
addEmployee: {
type: Boolean,
defualt: false,
},
});
const emit = defineEmits(["update:edit"]);

View file

@ -24,10 +24,14 @@
class="cursor-pointer"
>
<div
v-if="col.name == 'receiveDate' || col.name == 'dateAnnounce'"
v-if="
col.name == 'receiveDate' ||
col.name == 'dateAnnounce' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else-if="col.name == 'year'" class="table_ellipsis">
{{ col.value + 543 }}
@ -187,7 +191,7 @@
:readonly="true"
:borderless="true"
v-model="insigniaType"
:label="`${'ประเภท'}`"
:label="`${'ลำดับชั้น'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
@ -328,6 +332,72 @@
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="refCommandDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</q-card-section>
<q-separator />
@ -364,11 +434,12 @@
v-if="
col.name == 'receiveDate' ||
col.name == 'dateAnnounce' ||
col.name == 'createdAt'
col.name == 'createdAt' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else-if="col.name == 'year'" class="table_ellipsis">
{{ col.value + 543 }}
@ -440,6 +511,8 @@ const section = ref<string>();
const page = ref<string>();
const receiveDate = ref<Date>(new Date());
const dateAnnounce = ref<Date>(new Date());
const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
const modal = ref<boolean>(false); //modal add detail
@ -454,9 +527,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขเคร
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -473,6 +544,8 @@ profileData.insignia.columns.length == 0
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
])
: (visibleColumns.value = profileData.insignia.columns);
const columns = ref<QTableProps["columns"]>([
@ -512,7 +585,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "insigniaType",
align: "left",
label: "ประเภท",
label: "ลำดับชั้น",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",
@ -597,6 +670,28 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -635,7 +730,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "insigniaType",
align: "left",
label: "ประเภท",
label: "ลำดับชั้น",
sortable: true,
field: "insigniaType",
headerStyle: "font-size: 14px",
@ -720,6 +815,28 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
@ -755,6 +872,8 @@ const visibleColumnsHistory = ref<String[]>([
"page",
"receiveDate",
"dateAnnounce",
"refCommandNo",
"refCommandDate",
"createdFullName",
"createdAt",
]);
@ -818,40 +937,41 @@ const fetchInsignia = async () => {
};
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileInsignId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
insignia: e.insignia,
insigniaId: e.insigniaId,
insigniaType: e.insigniaType,
year: e.year,
no: e.no,
issue: e.issue,
volumeNo: e.volumeNo,
volume: e.volume,
section: e.section,
page: e.page,
receiveDate: new Date(e.receiveDate),
dateAnnounce: new Date(e.dateAnnounce),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileInsignId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
insignia: e.insignia,
insigniaId: e.insigniaId,
insigniaType: e.insigniaType,
year: e.year,
no: e.no,
issue: e.issue,
volumeNo: e.volumeNo,
volume: e.volume,
section: e.section,
page: e.page,
receiveDate: new Date(e.receiveDate),
dateAnnounce: new Date(e.dateAnnounce),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -890,6 +1010,8 @@ const getData = () => {
page.value = row.page;
receiveDate.value = row.receiveDate;
dateAnnounce.value = row.dateAnnounce;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
};
@ -944,34 +1066,35 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileInsignId(profileId.value), {
id: id.value,
insigniaId: insigniaId.value,
insigniaType: insigniaType.value,
year: year.value,
no: no.value,
issue: issue.value,
volumeNo: volumeNo.value,
volume: volume.value,
section: section.value,
page: page.value,
receiveDate: dateToISO(receiveDate.value),
dateAnnounce: dateToISO(dateAnnounce.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileInsignId(profileId.value), {
id: id.value,
insigniaId: insigniaId.value,
insigniaType: insigniaType.value,
year: year.value,
no: no.value,
issue: issue.value,
volumeNo: volumeNo.value,
volume: volume.value,
section: section.value,
page: page.value,
receiveDate: dateToISO(receiveDate.value),
dateAnnounce: dateToISO(dateAnnounce.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -993,6 +1116,9 @@ const editData = async () => {
page: page.value,
receiveDate: dateToISO(receiveDate.value),
dateAnnounce: dateToISO(dateAnnounce.value),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -1081,6 +1207,8 @@ const selectData = async (props: DataProps) => {
page.value = props.row.page;
receiveDate.value = props.row.receiveDate;
dateAnnounce.value = props.row.dateAnnounce;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
await checkRowPage();
};
@ -1103,6 +1231,8 @@ const addData = () => {
page.value = "";
receiveDate.value = new Date();
dateAnnounce.value = new Date();
refCommandNo.value = "";
refCommandDate.value = null;
};
/**
@ -1161,6 +1291,9 @@ const clickHistory = async (row: RequestItemsObject) => {
page: e.page,
receiveDate: new Date(e.receiveDate),
dateAnnounce: new Date(e.dateAnnounce),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -1196,6 +1329,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

View file

@ -251,42 +251,50 @@
<q-form ref="myForm">
<DialogHeader tittle="การลา" :close="clickClose" />
<q-separator />
<div class="col-xs-12 col-sm-12 col-md-12">
<data-table
:rows="rowsTotal"
:columns="columnsTotal"
:filter="filterTotal"
:visible-columns="visibleColumnsTotal"
v-model:inputfilter="filterTotal"
v-model:inputvisible="visibleColumnsTotal"
:nornmalData="true"
>
<template #columns="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else-if="
col.name == 'numLeave' ||
col.name == 'sumLeave' ||
col.name == 'totalLeave'
"
class="table_ellipsis"
<q-card-section>
<div class="col-xs-12 col-sm-12 col-md-12">
<data-table
:rows="rowsTotal"
:columns="columnsTotal"
:filter="filterTotal"
:visible-columns="visibleColumnsTotal"
v-model:inputfilter="filterTotal"
v-model:inputvisible="visibleColumnsTotal"
:nornmalData="true"
>
<template #columns="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{
col.value == null ? "" : col.value.toLocaleString("en-US")
}}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</data-table>
</div>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else-if="
col.name == 'numLeave' ||
col.name == 'sumLeave' ||
col.name == 'totalLeave'
"
class="table_ellipsis"
>
{{
col.value == null
? ""
: col.value.toLocaleString("en-US")
}}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</data-table>
</div>
</q-card-section>
<q-separator />
</q-form>
</q-card>
@ -436,9 +444,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filterTotal = ref<string>("");
const rowsTotal = ref<RequestItemsTotalObject[]>([]); //select data history
@ -708,36 +714,34 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
rows.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveId(profileId.value))
.then((res) => {
const data = res.data.result;
// console.log(data);
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
typeLeave: e.typeLeave,
dateStartLeave: new Date(e.dateStartLeave),
dateEndLeave: new Date(e.dateEndLeave),
numLeave: e.numLeave,
sumLeave: e.sumLeave,
totalLeave: e.totalLeave,
status: e.status,
reason: e.reason,
typeLeaveId: e.typeLeaveId,
});
rows.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveId(profileId.value))
.then((res) => {
const data = res.data.result;
// console.log(data);
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
typeLeave: e.typeLeave,
dateStartLeave: new Date(e.dateStartLeave),
dateEndLeave: new Date(e.dateEndLeave),
numLeave: e.numLeave,
sumLeave: e.sumLeave,
totalLeave: e.totalLeave,
status: e.status,
reason: e.reason,
typeLeaveId: e.typeLeaveId,
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
const filterSelector = (val: any, update: Function, filtername: string) => {
@ -958,31 +962,30 @@ const clickSave = async () => {
// *
// */
const saveData = async () => {
if (profileId.value !== "") {
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
loaderPage(true);
await http
.post(config.API.profileLeaveId(profileId.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
dateEndLeave: dateToISO(dateRange.value[1]),
numLeave: numLeave.value,
sumLeave: numUsedLeave.value,
totalLeave: sum,
status: statLeave.value,
reason: reason.value,
typeLeaveId: typeLeave.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modalAdd.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
loaderPage(true);
await http
.post(config.API.profileLeaveId(profileId.value), {
dateStartLeave: dateToISO(dateRange.value[0]),
dateEndLeave: dateToISO(dateRange.value[1]),
numLeave: numLeave.value,
sumLeave: numUsedLeave.value,
totalLeave: sum,
status: statLeave.value,
reason: reason.value,
typeLeaveId: typeLeave.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modalAdd.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
// /**
@ -1181,30 +1184,28 @@ const addData = async () => {
* @param row อม row ประวการแกไข
*/
const clickTotal = async () => {
if (profileId.value !== "") {
rowsTotal.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveTotalId(profileId.value))
.then((res) => {
let data = res.data.result;
data.map((e: ResponseTotalObject) => {
rowsTotal.value.push({
typeLeaveId: e.typeLeaveId,
totalLeave: e.totalLeave,
limitLeave: e.limitLeave,
remainLeave: e.remainLeave,
typeLeave: e.typeLeave,
});
rowsTotal.value = [];
loaderPage(true);
await http
.get(config.API.profileLeaveTotalId(profileId.value))
.then((res) => {
let data = res.data.result;
data.map((e: ResponseTotalObject) => {
rowsTotal.value.push({
typeLeaveId: e.typeLeaveId,
totalLeave: e.totalLeave,
limitLeave: e.limitLeave,
remainLeave: e.remainLeave,
typeLeave: e.typeLeave,
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
// /**

View file

@ -213,9 +213,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขอื่
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -304,30 +302,28 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileOtherId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileOtherId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -411,25 +407,23 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileOtherId(profileId.value), {
id: id.value,
date: date.value,
detail: detail.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileOtherId(profileId.value), {
id: id.value,
date: date.value,
detail: detail.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**

View file

@ -1,7 +1,7 @@
<template>
<div class="col-12 row">
<div class="row col-12" style="padding-top: 80px">
<div id="information" name="1" class="row col-12 information q-mt-sm">
<div id="information" name="1" class="row col-12 information">
<!-- <Informationvue
v-model:statusEdit="statusEdit"
:profileType="profileType"
@ -11,16 +11,20 @@
:fetchDataProfile="fetchData"
/>
</div>
<div id="government" name="16" class="row col-12">
<Government v-model:statusEdit="statusEdit" />
<div id="government" name="16" class="row col-12 q-mt-md">
<Government
v-model:statusEdit="statusEdit"
:profileType="profileType"
:employeeClass="employeeClass"
/>
</div>
<div id="address" name="17" class="row col-12">
<div id="address" name="17" class="row col-12 q-mt-md">
<Address v-model:statusEdit="statusEdit" />
</div>
<div id="family" name="18" class="row col-12">
<div id="family" name="18" class="row col-12 q-mt-md">
<Family v-model:statusEdit="statusEdit" />
</div>
<div id="certicate" name="15" class="row col-12">
<div id="certicate" name="15" class="row col-12 q-mt-md">
<Certicate v-model:statusEdit="statusEdit" :profileType="profileType" />
</div>
<div id="education" name="2" class="row col-12 q-mt-md">
@ -46,7 +50,10 @@
v-model:statusEdit="statusEdit"
v-if="profileType === 'officer'"
/>
<SalaryEmployeeTempVue
v-model:statusEdit="statusEdit"
v-else-if="employeeClass === 'temp'"
/>
<SalaryEmployeeVue v-model:statusEdit="statusEdit" v-else />
</div>
<div id="rule" name="8" class="row col-12 q-mt-md">
@ -156,7 +163,7 @@
"
>
<q-tooltip>{{
reasonStatus ? "กลับเข้าราชการ" : "ออกราชการ"
reasonStatus ? "การกลับเข้ารับราชการ" : "การออกจากราชการ"
}}</q-tooltip>
</q-btn>
@ -486,9 +493,14 @@
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn unelevated label="บันทึก" color="public" @click="Retire"
><!-- icon="mdi-content-save-outline"
<q-tooltip>นท</q-tooltip> -->
<q-btn
flat
round
color="public"
@click="Retire"
icon="mdi-content-save-outline"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
</q-card>
@ -496,75 +508,36 @@
<full-loader :visibility="loader"></full-loader>
</template>
<script setup lang="ts">
import { ref, onMounted, defineAsyncComponent } from "vue";
import { ref, onMounted } from "vue";
import { useDataStore } from "@/stores/data";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import EducationVue from "@/modules/04_registry/components/Education.vue";
import TrainVue from "@/modules/04_registry/components/Train.vue";
import InsigniaVue from "@/modules/04_registry/components/Insignia.vue";
import CoinedVue from "@/modules/04_registry/components/Coin.vue";
import AssessmentVue from "@/modules/04_registry/components/Assessment.vue";
import SalaryVue from "@/modules/04_registry/components/Salary.vue";
import SalaryEmployeeVue from "@/modules/04_registry/components/SalaryEmployee.vue";
import SalaryEmployeeTempVue from "@/modules/04_registry/components/SalaryEmployeeTemp.vue";
import DisciplineVue from "@/modules/04_registry/components/Discipline.vue";
import LeaveVue from "@/modules/04_registry/components/Leave.vue";
import TalentVue from "@/modules/04_registry/components/Talent.vue";
import WorkVue from "@/modules/04_registry/components/Work.vue";
import RecordVue from "@/modules/04_registry/components/Record.vue";
import OtherVue from "@/modules/04_registry/components/Other.vue";
import DocumentVue from "@/modules/04_registry/components/Document.vue";
import Certicate from "@/modules/04_registry/components/Information/Certicate.vue";
import Information from "@/modules/04_registry/components/Information/Information.vue";
import Government from "@/modules/04_registry/components/Information/Government.vue";
import Address from "@/modules/04_registry/components/Information/Address.vue";
import Family from "@/modules/04_registry/components/Information/Family.vue";
import OldName from "@/modules/04_registry/components/Information/OldName.vue";
import type { DataOption } from "@/modules/04_registry/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
const EducationVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Education.vue")
);
const TrainVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Train.vue")
);
const InsigniaVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Insignia.vue")
);
const CoinedVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Coin.vue")
);
const AssessmentVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Assessment.vue")
);
const SalaryVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Salary.vue")
);
const SalaryEmployeeVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/SalaryEmployee.vue")
);
const DisciplineVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Discipline.vue")
);
const LeaveVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Leave.vue")
);
const TalentVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Talent.vue")
);
const WorkVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Work.vue")
);
const RecordVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Record.vue")
);
const OtherVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Other.vue")
);
const DocumentVue = defineAsyncComponent(
() => import("@/modules/04_registry/components/Document.vue")
);
const Certicate = defineAsyncComponent(
() => import("@/modules/04_registry/components/Information/Certicate.vue")
);
const Information = defineAsyncComponent(
() => import("@/modules/04_registry/components/Information/Information.vue")
);
const Government = defineAsyncComponent(
() => import("@/modules/04_registry/components/Information/Government.vue")
);
const Address = defineAsyncComponent(
() => import("@/modules/04_registry/components/Information/Address.vue")
);
const Family = defineAsyncComponent(
() => import("@/modules/04_registry/components/Information/Family.vue")
);
const $q = useQuasar();
const store = useDataStore();
const { changeTab, loaderPage } = store;
@ -592,6 +565,7 @@ const activeImage = ref<any | null>(null);
const images = ref<any>([]);
const profileId = ref<string>(route.params.id.toString());
const profileType = ref<string>("");
const employeeClass = ref<string>("temp");
const leaveDate = ref<Date>(new Date());
const leaveDetail = ref<string>("");
const leaveNumberOrder = ref<string>("");
@ -655,6 +629,8 @@ const fetchData = async () => {
imageUrl.value = data.avatar;
position.value = data.position;
profileType.value = data.profileType;
employeeClass.value =
data.employeeClass == null ? "" : data.employeeClass;
const reason = reasonOptions.value.filter(
(r: DataOption) => r.id == data.leaveReason
);

View file

@ -23,8 +23,11 @@
@click="selectData(props)"
class="cursor-pointer"
>
<div v-if="col.name == 'date'" class="table_ellipsis">
{{ date2Thai(col.value) }}
<div
v-if="col.name == 'date' || col.name == 'refCommandDate'"
class="table_ellipsis"
>
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -134,6 +137,72 @@
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="refCommandDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</q-card-section>
<q-separator />
@ -167,10 +236,14 @@
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div
v-if="col.name == 'date' || col.name == 'createdAt'"
v-if="
col.name == 'date' ||
col.name == 'createdAt' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -219,6 +292,8 @@ const id = ref<string>("");
const date = ref<Date>(new Date());
const detail = ref<string>();
const reference = ref<string>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
const modal = ref<boolean>(false); //modal add detail
@ -234,15 +309,19 @@ const tittleHistory = ref<string>(
);
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const checkValidate = ref<boolean>(false); //validate data
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.record.columns.length == 0
? (visibleColumns.value = ["date", "detail", "reference"])
? (visibleColumns.value = [
"date",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
])
: (visibleColumns.value = profileData.record.columns);
const columns = ref<QTableProps["columns"]>([
{
@ -278,6 +357,28 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -313,6 +414,28 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
@ -340,6 +463,8 @@ const visibleColumnsHistory = ref<String[]>([
"date",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
"createdFullName",
"createdAt",
]);
@ -353,31 +478,32 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileNopaidId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileNopaidId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
date: new Date(e.date),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -408,6 +534,8 @@ const getData = () => {
date.value = row.date;
detail.value = row.detail;
reference.value = row.reference;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
};
@ -462,26 +590,27 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileNopaidId(profileId.value), {
id: id.value,
date: dateToISO(date.value),
detail: detail.value,
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileNopaidId(profileId.value), {
id: id.value,
date: dateToISO(date.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -495,6 +624,9 @@ const editData = async () => {
date: dateToISO(date.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -575,6 +707,8 @@ const selectData = async (props: DataProps) => {
date.value = props.row.date;
detail.value = props.row.detail;
reference.value = props.row.reference;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
await checkRowPage();
};
@ -589,6 +723,8 @@ const addData = () => {
date.value = new Date();
detail.value = "";
reference.value = "";
refCommandNo.value = "";
refCommandDate.value = null;
};
/**
@ -638,6 +774,9 @@ const clickHistory = async (row: RequestItemsObject) => {
date: new Date(e.date),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -673,6 +812,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

View file

@ -149,9 +149,9 @@
:rules="[
(val:string) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี รับตำแหน่ง'}`,
`${'กรุณาเลือกวัน เดือน ปี'}`,
]"
:label="`${'วัน เดือน ปี รับตำแหน่ง'}`"
:label="`${'วัน เดือน ปี'}`"
hide-bottom-space
>
<template v-slot:prepend>
@ -257,9 +257,9 @@
:borderless="!edit"
v-model="positionTypeId"
:rules="[
(val:string) => !!val || `${'กรุณาเลือกประเภทตำแหน่ง'}`,
(val:string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`,
]"
:label="`${'ประเภทตำแหน่ง'}`"
:label="`${'ตำแหน่งประเภท'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
@ -373,9 +373,6 @@
:readonly="!edit"
:borderless="!edit"
v-model="positionSalaryAmount"
:rules="[
(val:string) => !!val || `${'กรุณากรอกเงินประจำตำแหน่ง'}`,
]"
:label="`${'เงินประจำตำแหน่ง'}`"
@update:modelValue="clickEditRow"
type="number"
@ -391,17 +388,36 @@
:readonly="!edit"
:borderless="!edit"
v-model="mouthSalaryAmount"
:rules="[
(val) =>
!!val || `${'กรุณากรอกเงินค่าตอบแทนรายเดือน'}`,
]"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<!-- <div class="col-xs-12 col-sm-12 col-md-12">
<q-input
:class="getClass(edit)"
:outlined="edit"
@ -432,7 +448,7 @@
/>
</template>
</q-input>
</div>
</div> -->
<div class="row col-xs-12 col-sm-12 col-md-12">
<selector
@ -443,7 +459,7 @@
:readonly="!edit"
:borderless="!edit"
v-model="refSelected"
:label="`${'ต้นแบบเอกสารอ้างอิง'}`"
:label="`${'ต้นแบบ (template) เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRowRef"
option-label="name"
:options="refOptions"
@ -465,9 +481,6 @@
:readonly="!edit"
:borderless="!edit"
v-model="salaryRef"
:rules="[
(val:string) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`,
]"
:label="`${'เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRow"
type="textarea"
@ -587,6 +600,8 @@ const positionLevelId = ref<string>();
const positionExecutiveId = ref<string>();
const positionExecutiveSideId = ref<string>();
const posNoId = ref<string>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date>(new Date());
const ocOptions = ref<DataOption[]>([]);
const positionOptions = ref<DataOption[]>([]);
const positionLineOptions = ref<DataOption[]>([]);
@ -626,7 +641,11 @@ const refOptions = ref<DataOption[]>([
},
{
id: "20",
name: "รับโอน {ประเภทตำแหน่ง} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
name: "รับโอน {ตำแหน่งประเภท} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "21",
name: "เลื่อนระดับ {ประเภทตำแหน่ง} จาก ตำแหน่งเลขที่ {ตำแหน่งเลขที่เดิม} ตำแหน่ง {ตำแหน่งเดิม} ระดับ {ระดับเดิม} {สำนักเดิม} เงินเดือน {เงินเดือนเดิม} เป็น ตำแหน่งเลขที่ {ตำแหน่งเลขที่ใหม่} ตำแหน่ง {ตำแหน่งใหม่} ระดับ {ระดับใหม่} {สำนักใหม่} เงินเดือน {เงินเดือนใหม่} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "0",
@ -758,7 +777,7 @@ const refOptionsFilter = ref<DataOption[]>([
},
{
id: "20",
name: "รับโอน {ประเภทตำแหน่ง} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
name: "รับโอน {ตำแหน่งประเภท} จากตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} เป็นตำแหน่ง {ตำแหน่ง} ระดับ {ระดับ} สังกัด {สังกัด} ตำแหน่งเลขที่ {ตำแหน่งเลขที่} เงินเดือน {เงินเดือน} คำสั่ง กทม.ที่ {ที่}/{พ.ศ} ลงวันที่ {วัน} {เดือน} {พ.ศ.}",
},
{
id: "0",
@ -911,13 +930,14 @@ profileData.salary.columns.length == 0
"positionExecutiveSide",
"salaryClass",
"salaryRef",
"refCommandNo",
])
: (visibleColumns.value = profileData.salary.columns);
const columns = ref<QTableProps["columns"]>([
{
name: "date",
align: "left",
label: "วัน เดือน ปี รับตำแหน่ง",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
@ -1016,7 +1036,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionType",
align: "left",
label: "ประเภทตำแหน่ง",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
@ -1079,12 +1099,23 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
name: "date",
align: "left",
label: "วัน เดือน ปี รับตำแหน่ง",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
@ -1183,7 +1214,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "positionType",
align: "left",
label: "ประเภทตำแหน่ง",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
@ -1246,6 +1277,17 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
@ -1285,6 +1327,7 @@ const visibleColumnsHistory = ref<String[]>([
"positionExecutiveSide",
"salaryClass",
"salaryRef",
"refCommandNo",
"createdFullName",
"createdAt",
]);
@ -1502,6 +1545,7 @@ const fetchData = async () => {
positionExecutiveSideId: e.positionExecutiveSideId,
salaryClass: e.salaryClass,
salaryRef: e.salaryRef,
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -1599,6 +1643,7 @@ const getData = async () => {
positionExecutiveSideId.value = row.positionExecutiveSideId;
salaryClass.value = row.salaryClass;
salaryRef.value = row.salaryRef;
refCommandNo.value = row.refCommandNo;
id.value = row.id;
await fetchPositionNumber(row.ocId);
};
@ -1679,7 +1724,7 @@ const templateDetail = async () => {
);
if (positionTypeF.length > 0) {
salaryClass.value =
salaryClass.value + `ประเภทตำแหน่ง${positionTypeF[0].name} `;
salaryClass.value + `ตำแหน่งประเภท${positionTypeF[0].name} `;
}
const positionLevelF = positionLevelOptions.value.filter(
@ -1735,6 +1780,7 @@ const saveData = async () => {
positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value,
salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -1770,6 +1816,7 @@ const editData = async () => {
positionExecutiveSideId: positionExecutiveSideId.value,
salaryClass: salaryClass.value,
salaryRef: salaryRef.value,
refCommandNo: refCommandNo.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -1863,6 +1910,7 @@ const selectData = async (props: DataProps) => {
positionExecutiveSideId.value = props.row.positionExecutiveSideId;
salaryClass.value = props.row.salaryClass;
salaryRef.value = props.row.salaryRef;
refCommandNo.value = props.row.refCommandNo;
id.value = props.row.id;
await checkRowPage();
};
@ -1892,6 +1940,7 @@ const addData = () => {
salaryClass.value = "";
refSelected.value = null;
salaryRef.value = "";
refCommandNo.value = "";
};
/**
@ -1970,6 +2019,7 @@ const clickHistory = async (row: RequestItemsObject) => {
positionExecutiveSideId: e.positionExecutiveSideId,
salaryClass: e.salaryClass,
salaryRef: e.salaryRef,
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -2005,6 +2055,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -119,7 +119,13 @@
<div class="dialog-card-contain">
<q-card-section class="q-pa-md">
<div class="row col-12 q-col-gutter-sm">
<div :class=" $q.screen.lt.md ? ' row col-12 q-col-gutter-xs' : 'no-wrap row col-12 q-col-gutter-xs'">
<div
:class="
$q.screen.lt.md
? ' row col-12 q-col-gutter-xs'
: 'no-wrap row col-12 q-col-gutter-xs'
"
>
<selector
hide-bottom-space
:rules="[(val:string) => !!val || `${'กรุณาเลือก ประเภท'}`]"
@ -137,7 +143,7 @@
input-debounce="0"
@update:model-value="updateEmployeeClass"
/>
<!-- @filter="(inputValue:any,
<!-- @filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'employeeTypeOps'
) " -->
<q-input
@ -177,7 +183,7 @@
}}</template>
<template #trigger>
<q-input
class="full-width inputgreen cursor-pointer q-mb-sm"
class="inputgreen cursor-pointer q-mb-sm"
hide-bottom-space
outlined
dense
@ -190,14 +196,14 @@
clearable
@clear="clearDate"
>
<template v-slot:prepend>
<!-- <template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</template> -->
</q-input>
</template>
</datepicker>
@ -308,8 +314,8 @@ const initialPagination = ref<Pagination>({
rowsPerPage: 0,
});
const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการกทม.สามัญ" },
{ id: "employee", name: "ลูกจ้าง(ทั้งหมด)" },
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
// { id: "employee", name: "()" },
{ id: "perm", name: "ลูกจ้างประจำ" },
{ id: "temp", name: "ลูกจ้างชั่วคราว" },
]);

View file

@ -23,13 +23,7 @@
@click="selectData(props)"
class="cursor-pointer"
>
<div
v-if="col.name == 'dateStart' || col.name == 'dateEnd'"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
<div class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
@ -106,92 +100,6 @@
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="dateStart"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(dateStart)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
hide-bottom-space
:label="`${'วันที่เริ่มต้น'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="dateEnd"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(dateEnd)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-12">
<q-input
:class="getClass(edit)"
@ -240,14 +148,7 @@
<template #columns="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div
v-if="
col.name == 'dateStart' ||
col.name == 'dateEnd' ||
col.name == 'createdAt'
"
class="table_ellipsis"
>
<div v-if="col.name == 'createdAt'" class="table_ellipsis">
{{ date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
@ -297,8 +198,6 @@ const id = ref<string>("");
const field = ref<string>();
const detail = ref<string>();
const remark = ref<string>();
const dateStart = ref<Date>(new Date());
const dateEnd = ref<Date>(new Date());
const reference = ref<string>();
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
@ -314,21 +213,12 @@ const tittleHistory = ref<string>("ประวัติแก้ไขควา
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.talent.columns.length == 0
? (visibleColumns.value = [
"field",
"detail",
"remark",
"dateStart",
"dateEnd",
"reference",
])
? (visibleColumns.value = ["field", "detail", "remark", "reference"])
: (visibleColumns.value = profileData.talent.columns);
const columns = ref<QTableProps["columns"]>([
{
@ -364,28 +254,6 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateStart",
align: "left",
label: "วันที่เริ่มต้น",
sortable: true,
field: "dateStart",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateEnd",
align: "left",
label: "วันที่สิ้นสุด",
sortable: true,
field: "dateEnd",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "reference",
align: "left",
@ -432,28 +300,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateStart",
align: "left",
label: "วันที่เริ่มต้น",
sortable: true,
field: "dateStart",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateEnd",
align: "left",
label: "วันที่สิ้นสุด",
sortable: true,
field: "dateEnd",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "reference",
align: "left",
@ -492,8 +338,6 @@ const visibleColumnsHistory = ref<String[]>([
"field",
"detail",
"remark",
"dateStart",
"dateEnd",
"reference",
"createdFullName",
"createdAt",
@ -508,34 +352,30 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileAbiliId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
field: e.field,
detail: e.detail,
remark: e.remark,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileAbiliId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
field: e.field,
detail: e.detail,
remark: e.remark,
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -566,8 +406,6 @@ const getData = () => {
field.value = row.field;
detail.value = row.detail;
remark.value = row.remark;
dateStart.value = row.dateStart;
dateEnd.value = row.dateEnd;
reference.value = row.reference;
id.value = row.id;
};
@ -623,29 +461,25 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileAbiliId(profileId.value), {
id: id.value,
field: field.value,
detail: detail.value,
remark: remark.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileAbiliId(profileId.value), {
id: id.value,
field: field.value,
detail: detail.value,
remark: remark.value,
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -659,8 +493,6 @@ const editData = async () => {
field: field.value,
detail: detail.value,
remark: remark.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
reference: reference.value,
})
.then((res) => {
@ -742,8 +574,6 @@ const selectData = async (props: DataProps) => {
field.value = props.row.field;
detail.value = props.row.detail;
remark.value = props.row.remark;
dateStart.value = props.row.dateStart;
dateEnd.value = props.row.dateEnd;
reference.value = props.row.reference;
id.value = props.row.id;
await checkRowPage();
@ -759,8 +589,6 @@ const addData = () => {
field.value = "";
detail.value = "";
remark.value = "";
dateStart.value = new Date();
dateEnd.value = new Date();
reference.value = "";
};
@ -811,8 +639,6 @@ const clickHistory = async (row: RequestItemsObject) => {
field: e.field,
detail: e.detail,
remark: e.remark,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),

View file

@ -459,9 +459,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขการ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -753,38 +751,36 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileTrainId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
topic: e.topic,
yearly: e.yearly,
place: e.place,
duration: e.duration,
department: e.department,
numberOrder: e.numberOrder,
dateOrder: e.dateOrder,
startDate: new Date(e.startDate),
endDate: new Date(e.endDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileTrainId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
name: e.name,
topic: e.topic,
yearly: e.yearly,
place: e.place,
duration: e.duration,
department: e.department,
numberOrder: e.numberOrder,
dateOrder: e.dateOrder,
startDate: new Date(e.startDate),
endDate: new Date(e.endDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -876,33 +872,31 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileTrainId(profileId.value), {
id: id.value,
name: name.value,
topic: topic.value,
yearly: yearly.value,
place: place.value,
duration: duration.value,
department: department.value,
numberOrder: numberOrder.value,
dateOrder: dateOrder.value,
startDate: dateToISO(startDate.value),
endDate: dateToISO(endDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileTrainId(profileId.value), {
id: id.value,
name: name.value,
topic: topic.value,
yearly: yearly.value,
place: place.value,
duration: duration.value,
department: department.value,
numberOrder: numberOrder.value,
dateOrder: dateOrder.value,
startDate: dateToISO(startDate.value),
endDate: dateToISO(endDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**

View file

@ -24,10 +24,14 @@
class="cursor-pointer"
>
<div
v-if="col.name == 'dateStart' || col.name == 'dateEnd'"
v-if="
col.name == 'dateStart' ||
col.name == 'dateEnd' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -178,6 +182,72 @@
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
:readonly="!edit"
v-model="refCommandDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</q-card-section>
<q-separator />
@ -214,11 +284,12 @@
v-if="
col.name == 'dateStart' ||
col.name == 'dateEnd' ||
col.name == 'createdAt'
col.name == 'createdAt' ||
col.name == 'refCommandDate'
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -269,6 +340,8 @@ const dateEnd = ref<Date>(new Date());
const detail = ref<string>();
const reference = ref<string>();
const minDate = ref<Date>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
const modal = ref<boolean>(false); //modal add detail
@ -283,14 +356,19 @@ const tittleHistory = ref<string>("ประวัติแก้ไขปฏิ
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.work.columns.length == 0
? (visibleColumns.value = ["dateStart", "dateEnd", "detail", "reference"])
? (visibleColumns.value = [
"dateStart",
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
])
: (visibleColumns.value = profileData.work.columns);
const columns = ref<QTableProps["columns"]>([
{
@ -337,6 +415,28 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
{
@ -383,6 +483,28 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandDate",
align: "left",
label: "เอกสารอ้างอิง (ลงวันที่)",
sortable: true,
field: "refCommandDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "createdFullName",
align: "left",
@ -411,6 +533,8 @@ const visibleColumnsHistory = ref<String[]>([
"dateEnd",
"detail",
"reference",
"refCommandNo",
"refCommandDate",
"createdFullName",
"createdAt",
]);
@ -428,32 +552,33 @@ onMounted(async () => {
});
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileDutyId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
detail: e.detail,
reference: e.reference,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileDutyId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
dateStart: new Date(e.dateStart),
dateEnd: new Date(e.dateEnd),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -485,6 +610,8 @@ const getData = () => {
dateEnd.value = row.dateEnd;
detail.value = row.detail;
reference.value = row.reference;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
};
@ -539,27 +666,28 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileDutyId(profileId.value), {
id: id.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
detail: detail.value,
reference: reference.value,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileDutyId(profileId.value), {
id: id.value,
dateStart: dateToISO(dateStart.value),
dateEnd: dateToISO(dateEnd.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -574,6 +702,9 @@ const editData = async () => {
dateEnd: dateToISO(dateEnd.value),
detail: detail.value,
reference: reference.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -655,6 +786,8 @@ const selectData = async (props: DataProps) => {
dateEnd.value = props.row.dateEnd;
detail.value = props.row.detail;
reference.value = props.row.reference;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
await checkRowPage();
};
@ -670,6 +803,8 @@ const addData = () => {
dateEnd.value = new Date();
detail.value = "";
reference.value = "";
refCommandNo.value = "";
refCommandDate.value = null;
};
/**
@ -720,6 +855,9 @@ const clickHistory = async (row: RequestItemsObject) => {
dateEnd: new Date(e.dateEnd),
detail: e.detail,
reference: e.reference,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
@ -755,6 +893,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {

View file

@ -14,7 +14,7 @@ interface Information {
prefixId: string | null;
firstname: string | null;
lastname: string | null;
birthDate: Date | null;
birthDate: Date;
genderId: string | null;
bloodId: string | null;
nationality: string | null;
@ -34,16 +34,22 @@ interface Family {
lastnameC: string | null;
lastnameCOld: string | null;
occupationC: string | null;
citizenIdC: string | null;
liveC: string | null;
prefixM: string | null; // male
prefixIdM: string | null;
firstnameM: string | null;
lastnameM: string | null;
occupationM: string | null;
citizenIdM: string | null;
liveM: string | null;
prefixF: string | null; // female
prefixIdF: string | null;
firstnameF: string | null;
lastnameF: string | null;
occupationF: string | null;
citizenIdF: string | null;
liveF: string | null;
same: string | null;
childrens: childrenFamily[];
}
@ -149,16 +155,22 @@ const defaultFamily: Family = {
lastnameC: null,
lastnameCOld: null,
occupationC: null,
citizenIdC: null,
liveC: "1",
prefixM: null,
prefixIdM: null,
firstnameM: null,
lastnameM: null,
occupationM: null,
citizenIdM: null,
liveM: "1",
prefixF: null,
prefixIdF: null,
firstnameF: null,
lastnameF: null,
occupationF: null,
citizenIdF: null,
liveF: "1",
same: "0",
childrens: [],
};