Merge branch 'oat_dev' into develop
This commit is contained in:
commit
2c89846a8b
1 changed files with 393 additions and 136 deletions
|
|
@ -1,24 +1,36 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch, onMounted } from "vue";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
import { QForm, useQuasar } from "quasar";
|
import { QForm, useQuasar } from "quasar";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { dialogConfirm, date2Thai } = mixin;
|
const {
|
||||||
|
dialogRemove,
|
||||||
|
dialogConfirm,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
success,
|
||||||
|
date2Thai,
|
||||||
|
} = mixin;
|
||||||
|
|
||||||
const addDataDialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
|
const dialogStatus = ref<string>("create");
|
||||||
const mode = ref<string>("table");
|
const mode = ref<string>("table");
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "level",
|
name: "educationLevel",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระดับศึกษา",
|
label: "ระดับศึกษา",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "level",
|
field: "educationLevel",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
|
|
@ -47,22 +59,22 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "finishDate",
|
name: "endDate",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ถึง",
|
label: "ถึง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "finishDate",
|
field: "endDate",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "graduateDate",
|
name: "finishDate",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "วันที่สำเร็จการศึกษา",
|
label: "วันที่สำเร็จการศึกษา",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "graduateDate",
|
field: "finishDate",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
|
|
@ -159,7 +171,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "durationYear",
|
name: "durationYear",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ระยะเวลาหลักสูตร",
|
label: "ระยะเวลาหลักสูตร (ปี)",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "durationYear",
|
field: "durationYear",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -167,28 +179,65 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "note",
|
||||||
|
align: "left",
|
||||||
|
label: "หมายเหตุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "note",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
const backgroundColor = "grey-2";
|
|
||||||
|
const rows = ref<any>([]);
|
||||||
|
const editId = ref<string>("");
|
||||||
|
const route = useRoute();
|
||||||
|
const id = ref<string>(route.params.id.toString());
|
||||||
|
|
||||||
const isDate = ref<string>("false");
|
const isDate = ref<string>("false");
|
||||||
const educationOption = ["ใช่", "ไม่ใช่"];
|
const educationOption = ref([
|
||||||
|
{ label: "ใช่", value: true },
|
||||||
|
{ label: "ไม่ใช่", value: false },
|
||||||
|
]);
|
||||||
const historyDialog = ref<boolean>(false);
|
const historyDialog = ref<boolean>(false);
|
||||||
const educationData = reactive({
|
const educationData = reactive<{
|
||||||
level: "",
|
educationLevel: string;
|
||||||
|
institute: string;
|
||||||
|
startYear: number;
|
||||||
|
endYear: number;
|
||||||
|
finishDate: Date;
|
||||||
|
startDate: Date;
|
||||||
|
endDate: Date;
|
||||||
|
isEducation: boolean | null;
|
||||||
|
degree: string;
|
||||||
|
field: string;
|
||||||
|
fundName: string;
|
||||||
|
gpa: string;
|
||||||
|
country: string;
|
||||||
|
other: string;
|
||||||
|
duration: string;
|
||||||
|
durationYear: number | null;
|
||||||
|
note: string;
|
||||||
|
}>({
|
||||||
|
educationLevel: "",
|
||||||
institute: "",
|
institute: "",
|
||||||
startYear: new Date().getFullYear(),
|
startYear: new Date().getFullYear(),
|
||||||
finishYear: new Date().getFullYear(),
|
endYear: new Date().getFullYear(),
|
||||||
graduateDate: new Date(),
|
|
||||||
startDate: new Date(),
|
|
||||||
finishDate: new Date(),
|
finishDate: new Date(),
|
||||||
isEducation: "",
|
startDate: new Date(),
|
||||||
|
endDate: new Date(),
|
||||||
|
isEducation: null,
|
||||||
degree: "",
|
degree: "",
|
||||||
field: "",
|
field: "",
|
||||||
fundName: "",
|
fundName: "",
|
||||||
gpa: null,
|
gpa: "",
|
||||||
country: "",
|
country: "",
|
||||||
other: "",
|
other: "",
|
||||||
duration: "",
|
duration: "",
|
||||||
durationYear: "",
|
durationYear: null,
|
||||||
note: "",
|
note: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -203,75 +252,8 @@ const pagination = ref({
|
||||||
rowsPerPage: formFilter.pageSize,
|
rowsPerPage: formFilter.pageSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const row = [
|
|
||||||
{
|
|
||||||
level: "ประกาศนียบัตรบัณฑิต",
|
|
||||||
institute: "เชียงใหม่วิทย์",
|
|
||||||
degree: "ปริญญาตรี",
|
|
||||||
field: "วิศวะคอม",
|
|
||||||
gpa: "4.5",
|
|
||||||
country: "อังกฤษ",
|
|
||||||
duration: "3 ปี",
|
|
||||||
durationYear: "4 ปี",
|
|
||||||
other: "อบต เชียงใหม่",
|
|
||||||
fundName: "ทุนรัฐบาล",
|
|
||||||
isEducation: "ปริญญาตรี",
|
|
||||||
finishDate: new Date(),
|
|
||||||
startDate: new Date(),
|
|
||||||
graduateDate: new Date(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level: "ประกาศนียบัตรบัณฑิต",
|
|
||||||
institute: "โปลิวิทยาคม",
|
|
||||||
degree: "ปริญญาตรี",
|
|
||||||
field: "วิศวะคอม",
|
|
||||||
gpa: "3.8",
|
|
||||||
country: "อังกฤษ",
|
|
||||||
duration: "3 ปี",
|
|
||||||
durationYear: "4 ปี",
|
|
||||||
other: "อบต เชียงใหม่",
|
|
||||||
fundName: "ทุนรัฐบาล",
|
|
||||||
isEducation: "ปริญญาตรี",
|
|
||||||
finishDate: new Date(),
|
|
||||||
startDate: new Date(),
|
|
||||||
graduateDate: new Date(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level: "ประกาศนียบัตรบัณฑิต",
|
|
||||||
institute: "โรงเรียนวัฒโน",
|
|
||||||
degree: "ปริญญาตรี",
|
|
||||||
field: "วิศวะคอม",
|
|
||||||
gpa: "3.8",
|
|
||||||
country: "อังกฤษ",
|
|
||||||
duration: "3 ปี",
|
|
||||||
durationYear: "4 ปี",
|
|
||||||
other: "อบต เชียงใหม่",
|
|
||||||
fundName: "ทุนรัฐบาล",
|
|
||||||
isEducation: "ปริญญาตรี",
|
|
||||||
finishDate: new Date(),
|
|
||||||
startDate: new Date(),
|
|
||||||
graduateDate: new Date(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level: "ประกาศนียบัตรบัณฑิต",
|
|
||||||
institute: "โรงเรียนวัฒโน",
|
|
||||||
degree: "ปริญญาตรี",
|
|
||||||
field: "วิศวะคอม",
|
|
||||||
gpa: "3.8",
|
|
||||||
country: "อังกฤษ",
|
|
||||||
duration: "3 ปี",
|
|
||||||
durationYear: "4 ปี",
|
|
||||||
other: "อบต เชียงใหม่",
|
|
||||||
fundName: "ทุนรัฐบาล",
|
|
||||||
isEducation: "ปริญญาตรี",
|
|
||||||
finishDate: new Date(),
|
|
||||||
startDate: new Date(),
|
|
||||||
graduateDate: new Date(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"level",
|
"educationLevel",
|
||||||
"institute",
|
"institute",
|
||||||
"degree",
|
"degree",
|
||||||
"field",
|
"field",
|
||||||
|
|
@ -282,9 +264,10 @@ const visibleColumns = ref<string[]>([
|
||||||
"other",
|
"other",
|
||||||
"fundName",
|
"fundName",
|
||||||
"isEducation",
|
"isEducation",
|
||||||
"finishDate",
|
"endDate",
|
||||||
"startDate",
|
"startDate",
|
||||||
"graduateDate",
|
"finishDate",
|
||||||
|
"note",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
|
|
@ -295,6 +278,7 @@ async function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
|
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
},
|
},
|
||||||
"ยืนยันการบันทึกข้อมูล",
|
"ยืนยันการบันทึกข้อมูล",
|
||||||
|
|
@ -302,29 +286,195 @@ async function onSubmit() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearForm() {
|
||||||
|
isDate.value = "false";
|
||||||
|
educationData.educationLevel = "";
|
||||||
|
educationData.institute = "";
|
||||||
|
educationData.startYear = new Date().getFullYear();
|
||||||
|
educationData.endYear = new Date().getFullYear();
|
||||||
|
educationData.finishDate = new Date();
|
||||||
|
educationData.startDate = new Date();
|
||||||
|
educationData.endDate = new Date();
|
||||||
|
educationData.isEducation = null;
|
||||||
|
educationData.degree = "";
|
||||||
|
educationData.field = "";
|
||||||
|
educationData.fundName = "";
|
||||||
|
educationData.gpa = "";
|
||||||
|
educationData.country = "";
|
||||||
|
educationData.other = "";
|
||||||
|
educationData.duration = "";
|
||||||
|
educationData.durationYear = null;
|
||||||
|
educationData.note = "";
|
||||||
|
}
|
||||||
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
addDataDialog.value = false;
|
clearForm();
|
||||||
|
dialog.value = false;
|
||||||
}
|
}
|
||||||
function closeHistoryDialog() {
|
function closeHistoryDialog() {
|
||||||
historyDialog.value = false;
|
historyDialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchData(id: string) {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.profileNewEducationByProfileId(id))
|
||||||
|
.then(async (res) => {
|
||||||
|
rows.value = res.data.result;
|
||||||
|
console.log(rows.value);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addData() {
|
||||||
|
console.log(educationData.durationYear);
|
||||||
|
await http
|
||||||
|
.post(config.API.profileNewEducation, {
|
||||||
|
profileId: id.value,
|
||||||
|
isActive: true,
|
||||||
|
country: educationData.country,
|
||||||
|
degree: educationData.degree,
|
||||||
|
duration: educationData.duration,
|
||||||
|
durationYear: educationData.durationYear ? educationData.durationYear : 0,
|
||||||
|
field: educationData.field,
|
||||||
|
finishDate: educationData.finishDate,
|
||||||
|
fundName: educationData.fundName,
|
||||||
|
gpa: educationData.gpa,
|
||||||
|
institute: educationData.institute,
|
||||||
|
other: educationData.other,
|
||||||
|
startDate: educationData.startDate,
|
||||||
|
endDate: educationData.endDate,
|
||||||
|
educationLevel: educationData.educationLevel,
|
||||||
|
educationLevelId: "educationLevelId",
|
||||||
|
positionPath: "positionPath",
|
||||||
|
positionPathId: "positionPathId",
|
||||||
|
isDate: isDate.value === "true" ? true : false,
|
||||||
|
isEducation: educationData.isEducation,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchData(id.value);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function editData(idData: string) {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewEducationByEducationId(idData), {
|
||||||
|
profileId: id.value,
|
||||||
|
isActive: true,
|
||||||
|
country: educationData.country,
|
||||||
|
degree: educationData.degree,
|
||||||
|
duration: educationData.duration,
|
||||||
|
durationYear: educationData.durationYear,
|
||||||
|
field: educationData.field,
|
||||||
|
finishDate: educationData.finishDate,
|
||||||
|
fundName: educationData.fundName,
|
||||||
|
gpa: educationData.gpa,
|
||||||
|
institute: educationData.institute,
|
||||||
|
other: educationData.other,
|
||||||
|
startDate: educationData.startDate,
|
||||||
|
endDate: educationData.endDate,
|
||||||
|
educationLevel: educationData.educationLevel,
|
||||||
|
educationLevelId: "educationLevelId",
|
||||||
|
positionPath: "positionPath",
|
||||||
|
positionPathId: "positionPathId",
|
||||||
|
isDate: isDate.value === "true" ? true : false,
|
||||||
|
isEducation: educationData.isEducation,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchData(id.value);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(idData: string) {
|
||||||
|
await http
|
||||||
|
.delete(config.API.profileNewEducationByEducationId(idData))
|
||||||
|
.then(() => {
|
||||||
|
fetchData(id.value);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => isDate.value,
|
() => isDate.value,
|
||||||
() => {
|
() => {
|
||||||
if (isDate.value === "true") {
|
if (isDate.value === "false") {
|
||||||
educationData.startDate = new Date(`${educationData.startYear}`);
|
console.log(educationData.startDate);
|
||||||
educationData.finishDate = new Date(`${educationData.finishYear}`);
|
educationData.startYear = +educationData.startDate
|
||||||
|
.toString()
|
||||||
|
.slice(11, 15);
|
||||||
|
educationData.endYear = +educationData.endDate.toString().slice(11, 15);
|
||||||
|
educationData.startDate = new Date(educationData.startYear + "-01-01");
|
||||||
|
educationData.endDate = new Date(educationData.endYear + "-01-01");
|
||||||
} else {
|
} else {
|
||||||
educationData.startYear = parseInt(
|
educationData.startDate = new Date(educationData.startYear + "-01-01");
|
||||||
moment(educationData.startDate).format("YYYY")
|
educationData.endDate = new Date(educationData.endYear + "-01-01");
|
||||||
);
|
|
||||||
educationData.finishYear = parseInt(
|
|
||||||
moment(educationData.finishDate).format("YYYY")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => educationData.startYear,
|
||||||
|
() => {
|
||||||
|
if (isDate.value === "false") {
|
||||||
|
educationData.startDate = new Date(educationData.startYear + "-01-01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(
|
||||||
|
() => educationData.endYear,
|
||||||
|
() => {
|
||||||
|
if (isDate.value === "false") {
|
||||||
|
educationData.endDate = new Date(educationData.endYear + "-01-01");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => educationData.startDate,
|
||||||
|
() => {
|
||||||
|
if (isDate.value === "true") {
|
||||||
|
educationData.startYear = +educationData.startDate
|
||||||
|
.toString()
|
||||||
|
.slice(11, 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(
|
||||||
|
() => educationData.endDate,
|
||||||
|
() => {
|
||||||
|
if (isDate.value === "true") {
|
||||||
|
educationData.endYear = +educationData.endDate.toString().slice(11, 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchData(id.value);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -335,7 +485,13 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="add"
|
icon="add"
|
||||||
size="16px"
|
size="16px"
|
||||||
@click="addDataDialog = true"
|
@click="
|
||||||
|
() => {
|
||||||
|
dialogStatus = 'create';
|
||||||
|
clearForm;
|
||||||
|
dialog = true;
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
<q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
|
|
@ -405,12 +561,13 @@ watch(
|
||||||
:grid="mode === 'card'"
|
:grid="mode === 'card'"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="row"
|
:rows="rows"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
:paging="true"
|
:paging="true"
|
||||||
dense
|
dense
|
||||||
|
v-model:pagination="pagination"
|
||||||
:rows-per-page-options="[20, 50, 100]"
|
:rows-per-page-options="[20, 50, 100]"
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
|
|
@ -428,19 +585,46 @@ watch(
|
||||||
<q-td
|
<q-td
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.id"
|
:key="col.id"
|
||||||
@click="addDataDialog = true"
|
@click="
|
||||||
|
() => {
|
||||||
|
dialogStatus = 'edit';
|
||||||
|
editId = props.row.id;
|
||||||
|
isDate = props.row.isDate ? 'true' : 'false';
|
||||||
|
educationData.educationLevel = props.row.educationLevel;
|
||||||
|
educationData.institute = props.row.institute;
|
||||||
|
educationData.finishDate = props.row.finishDate;
|
||||||
|
educationData.startDate = props.row.startDate;
|
||||||
|
educationData.endDate = props.row.endDate;
|
||||||
|
educationData.isEducation = props.row.isEducation;
|
||||||
|
educationData.degree = props.row.degree;
|
||||||
|
educationData.field = props.row.field;
|
||||||
|
educationData.fundName = props.row.fundName;
|
||||||
|
educationData.gpa = props.row.gpa;
|
||||||
|
educationData.country = props.row.country;
|
||||||
|
educationData.other = props.row.other;
|
||||||
|
educationData.duration = props.row.duration;
|
||||||
|
educationData.durationYear = props.row.durationYear;
|
||||||
|
educationData.note = props.row.note;
|
||||||
|
educationData.startYear = +props.row.startDate.slice(0, 4);
|
||||||
|
educationData.endYear = +props.row.endDate.slice(0, 4);
|
||||||
|
dialog = true;
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<div
|
<div v-if="col.name === 'startDate' || col.name === 'endDate'">
|
||||||
v-if="
|
<div v-if="props.row.isDate">{{ date2Thai(col.value) }}</div>
|
||||||
col.name === 'startDate' ||
|
<div v-else>
|
||||||
col.name === 'finishDate' ||
|
{{ +col.value.slice(0, 4) + 543 }}
|
||||||
col.name === 'graduateDate'
|
</div>
|
||||||
"
|
</div>
|
||||||
>
|
<div v-else-if="col.name === 'finishDate'">
|
||||||
{{ col.value ? date2Thai(col.value) : "-" }}
|
{{ col.value ? date2Thai(col.value) : "-" }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="col.name === 'isEducation'">
|
||||||
|
{{ col.value === true ? "ใช่" : "ไม่ใช่" }}
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
{{ col.value }}
|
{{ col.value === "" ? "-" : col.value }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
|
|
@ -455,6 +639,21 @@ watch(
|
||||||
>
|
>
|
||||||
<q-tooltip>ประวัติแก้ไขประวัติการศึกษา</q-tooltip>
|
<q-tooltip>ประวัติแก้ไขประวัติการศึกษา</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
color="red"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
round
|
||||||
|
size="12px"
|
||||||
|
icon="mdi-delete"
|
||||||
|
clickable
|
||||||
|
@click.stop="
|
||||||
|
dialogRemove($q, async () => await deleteData(props.row.id))
|
||||||
|
"
|
||||||
|
v-close-popup
|
||||||
|
>
|
||||||
|
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -469,7 +668,30 @@ watch(
|
||||||
round
|
round
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="edit"
|
icon="edit"
|
||||||
@click="addDataDialog = true"
|
@click="
|
||||||
|
dialogStatus = 'edit';
|
||||||
|
editId = props.row.id;
|
||||||
|
console.log(props.cols);
|
||||||
|
isDate = props.row.isDate ? 'true' : 'false';
|
||||||
|
educationData.educationLevel = props.cols[0].value;
|
||||||
|
educationData.institute = props.cols[1].value;
|
||||||
|
educationData.startDate = props.cols[2].value;
|
||||||
|
educationData.endDate = props.cols[3].value;
|
||||||
|
educationData.finishDate = props.cols[4].value;
|
||||||
|
educationData.isEducation = props.cols[5].value;
|
||||||
|
educationData.degree = props.cols[6].value;
|
||||||
|
educationData.field = props.cols[7].value;
|
||||||
|
educationData.fundName = props.cols[8].value;
|
||||||
|
educationData.gpa = props.cols[9].value;
|
||||||
|
educationData.country = props.cols[10].value;
|
||||||
|
educationData.other = props.cols[11].value;
|
||||||
|
educationData.duration = props.cols[12].value;
|
||||||
|
educationData.durationYear = props.cols[13].value;
|
||||||
|
educationData.note = props.row.note;
|
||||||
|
educationData.startYear = +props.cols[2].value.slice(0, 4);
|
||||||
|
educationData.endYear = +props.cols[3].value.slice(0, 4);
|
||||||
|
dialog = true;
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
@ -492,13 +714,19 @@ watch(
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div :class="`row bg-color`">
|
<div :class="`row bg-color`">
|
||||||
<div class="col-3 q-pa-sm label-color">ตั้งแต่</div>
|
<div class="col-3 q-pa-sm label-color">ตั้งแต่</div>
|
||||||
<div class="col-4 q-pa-sm">
|
<div v-if="props.row.isDate" class="col-4 q-pa-sm">
|
||||||
{{ date2Thai(props.cols[2].value) }}
|
{{ date2Thai(props.cols[2].value) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="col-4 q-pa-sm">
|
||||||
|
{{ +props.cols[2].value.slice(0, 4) + 543 }}
|
||||||
|
</div>
|
||||||
<div class="col-2 q-pa-sm label-color">ถึง</div>
|
<div class="col-2 q-pa-sm label-color">ถึง</div>
|
||||||
<div class="col-3 q-pa-sm">
|
<div v-if="props.row.isDate" class="col-3 q-pa-sm">
|
||||||
{{ date2Thai(props.cols[3].value) }}
|
{{ date2Thai(props.cols[3].value) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="col-3 q-pa-sm">
|
||||||
|
{{ +props.cols[3].value.slice(0, 4) + 543 }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 q-pa-sm label-color">วันที่สำเร็จการศึกษา</div>
|
<div class="col-3 q-pa-sm label-color">วันที่สำเร็จการศึกษา</div>
|
||||||
|
|
@ -510,32 +738,54 @@ watch(
|
||||||
<div class="col-4 q-pa-sm label-color">
|
<div class="col-4 q-pa-sm label-color">
|
||||||
เป็นวุฒิการศึกษาในตำแหน่ง
|
เป็นวุฒิการศึกษาในตำแหน่ง
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 q-pa-sm">{{ props.cols[5].value }}</div>
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[5].value ? "ใช่" : "ไม่ใช่" }}
|
||||||
|
</div>
|
||||||
<div class="col-2 q-pa-sm label-color">วุฒิการศึกษา</div>
|
<div class="col-2 q-pa-sm label-color">วุฒิการศึกษา</div>
|
||||||
<div class="col-3 q-pa-sm">{{ props.cols[6].value }}</div>
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[6].value ? props.cols[6].value : "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 q-pa-sm label-color">สาขาวืชา/ทาง</div>
|
<div class="col-3 q-pa-sm label-color">สาขาวืชา/ทาง</div>
|
||||||
<div class="col-4 q-pa-sm">{{ props.cols[7].value }}</div>
|
<div class="col-4 q-pa-sm">
|
||||||
|
{{ props.cols[7].value ? props.cols[7].value : "-" }}
|
||||||
|
</div>
|
||||||
<div class="col-2 q-pa-sm label-color">ทุน</div>
|
<div class="col-2 q-pa-sm label-color">ทุน</div>
|
||||||
<div class="col-3 q-pa-sm">{{ props.cols[8].value }}</div>
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[8].value ? props.cols[8].value : "-" }}
|
||||||
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div :class="`row bg-color`">
|
<div :class="`row bg-color`">
|
||||||
<div class="col-3 q-pa-sm label-color">เกรดเฉลี่ย</div>
|
<div class="col-3 q-pa-sm label-color">เกรดเฉลี่ย</div>
|
||||||
<div class="col-4 q-pa-sm">{{ props.cols[9].value }}</div>
|
<div class="col-4 q-pa-sm">
|
||||||
|
{{ props.cols[9].value ? props.cols[9].value : "-" }}
|
||||||
|
</div>
|
||||||
<div class="col-2 q-pa-sm label-color">ประเทศ</div>
|
<div class="col-2 q-pa-sm label-color">ประเทศ</div>
|
||||||
<div class="col-3 q-pa-sm">{{ props.cols[10].value }}</div>
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[10].value ? props.cols[10].value : "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 q-pa-sm label-color">ข้อมูลการติดต่อ</div>
|
<div class="col-3 q-pa-sm label-color">ข้อมูลการติดต่อ</div>
|
||||||
<div class="col-4 q-pa-sm">{{ props.cols[11].value }}</div>
|
<div class="col-4 q-pa-sm">
|
||||||
|
{{ props.cols[11].value ? props.cols[11].value : "-" }}
|
||||||
|
</div>
|
||||||
<div class="col-2 q-pa-sm label-color">ระยะเวลา</div>
|
<div class="col-2 q-pa-sm label-color">ระยะเวลา</div>
|
||||||
<div class="col-3 q-pa-sm">{{ props.cols[12].value }}</div>
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[12].value ? props.cols[12].value : "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div :class="`row bg-color`">
|
<div :class="`row bg-color`">
|
||||||
<div class="col-3 q-pa-sm label-color">ระยะเวลาหลักสูตร</div>
|
<div class="col-3 q-pa-sm label-color">ระยะเวลาหลักสูตร (ปี)</div>
|
||||||
<div class="col-4 q-pa-sm">{{ props.cols[13].value }}</div>
|
<div class="col-4 q-pa-sm">
|
||||||
|
{{ props.cols[13].value === 0 ? "-" : props.cols[13].value }}
|
||||||
|
</div>
|
||||||
|
<div class="col-2 q-pa-sm label-color">หมายเหตุ</div>
|
||||||
|
<div class="col-3 q-pa-sm">
|
||||||
|
{{ props.cols[14].value ? props.cols[14].value : "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
@ -543,11 +793,14 @@ watch(
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
</d-table>
|
||||||
|
|
||||||
<q-dialog v-model="addDataDialog" class="dialog" persistent>
|
<q-dialog v-model="dialog" class="dialog" persistent>
|
||||||
<q-card style="min-width: 40%" class="bg-white">
|
<q-card style="min-width: 40%" class="bg-white">
|
||||||
<q-form @submit.prevent greedy @validation-success="validateForm">
|
<q-form @submit.prevent greedy @validation-success="validateForm">
|
||||||
<q-card-section class="flex justify-between" style="padding: 0">
|
<q-card-section class="flex justify-between" style="padding: 0">
|
||||||
<dialog-header tittle="เพิ่มประวัติการศึกษา" :close="closeDialog" />
|
<dialog-header
|
||||||
|
:tittle="dialogStatus == 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
|
||||||
|
:close="closeDialog"
|
||||||
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator color="grey-4" />
|
<q-separator color="grey-4" />
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -555,7 +808,7 @@ watch(
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
v-model="educationData.level"
|
v-model="educationData.educationLevel"
|
||||||
label="ระดับการศึกษา"
|
label="ระดับการศึกษา"
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
dense
|
dense
|
||||||
|
|
@ -636,12 +889,12 @@ watch(
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="educationData.finishYear"
|
v-model="educationData.endYear"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
@update:modelValue="educationData.finishYear"
|
@update:modelValue="educationData.endYear"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -653,7 +906,7 @@ watch(
|
||||||
lazy-rules
|
lazy-rules
|
||||||
outlined
|
outlined
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:model-value="educationData.finishYear + 543"
|
:model-value="educationData.endYear + 543"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `${'กรุณาเลือกปีที่จบการศึกษา'}`,
|
(val) => !!val || `${'กรุณาเลือกปีที่จบการศึกษา'}`,
|
||||||
]"
|
]"
|
||||||
|
|
@ -713,7 +966,7 @@ watch(
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="educationData.finishDate"
|
v-model="educationData.endDate"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
|
|
@ -728,7 +981,7 @@ watch(
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:model-value="date2Thai(educationData.finishDate)"
|
:model-value="date2Thai(educationData.endDate)"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `${'กรุณาเลือกวันที่จบการศึกษา'}`,
|
(val) => !!val || `${'กรุณาเลือกวันที่จบการศึกษา'}`,
|
||||||
]"
|
]"
|
||||||
|
|
@ -753,7 +1006,7 @@ watch(
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<datepicker
|
<datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="educationData.graduateDate"
|
v-model="educationData.finishDate"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
|
|
@ -769,7 +1022,7 @@ watch(
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:model-value="date2Thai(educationData.graduateDate)"
|
:model-value="date2Thai(educationData.finishDate)"
|
||||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
|
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'วันที่ได้รับ'}`"
|
:label="`${'วันที่ได้รับ'}`"
|
||||||
|
|
@ -790,9 +1043,13 @@ watch(
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
v-model="educationData.isEducation"
|
v-model="educationData.isEducation"
|
||||||
:options="educationOption"
|
:options="educationOption"
|
||||||
|
option-value="value"
|
||||||
|
option-label="label"
|
||||||
label="เป็นวุฒิการศึกษาในตำแหน่ง"
|
label="เป็นวุฒิการศึกษาในตำแหน่ง"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -874,7 +1131,7 @@ watch(
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
v-model="educationData.durationYear"
|
v-model="educationData.durationYear"
|
||||||
label="ระยะเวลาหลักสูตร"
|
label="ระยะเวลาหลักสูตร (ปี)"
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
type="number"
|
type="number"
|
||||||
dense
|
dense
|
||||||
|
|
@ -956,7 +1213,7 @@ watch(
|
||||||
<d-table
|
<d-table
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="row"
|
:rows="rows"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue