รวมไฟล์แก้งานงวด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

@ -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>