Merge branch 'develop' into devTee
# Conflicts: # src/api/12_evaluatePersonal/api.evaluate.ts # src/modules/12_evaluatePersonal/components/Meeting/AddPage.vue # src/modules/12_evaluatePersonal/interface/index/meeting.ts
This commit is contained in:
commit
e76953820f
5 changed files with 165 additions and 87 deletions
|
|
@ -1,12 +1,11 @@
|
|||
import env from "../index";
|
||||
const evaluateDirectorMain = `${env.API_URI}/evaluation/director`;
|
||||
const evaluateMeetingMain = `${env.API_URI}/evaluation/meeting`;
|
||||
|
||||
const evaluation = `${env.API_URI}/evaluation`;
|
||||
|
||||
export default {
|
||||
evaluateDirectorMain: () => `${evaluateDirectorMain}`,
|
||||
evaluateDirectorById: (id:string) => `${evaluateDirectorMain}/${id}`,
|
||||
|
||||
evaluateMeetingMain: () => `${evaluateMeetingMain}`,
|
||||
evaluateMeetingById: (id:string) => `${evaluateMeetingMain}/${id}`,
|
||||
meeting: () => `${evaluation}/meeting`,
|
||||
meetingById: (id: string) => `${evaluation}/meeting/${id}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,32 +16,29 @@ const router = useRouter();
|
|||
* บันทึกข้อมูลที่เเก้ไข
|
||||
* @param id ระบุ บุคคล
|
||||
*/
|
||||
function onSubmit(formData:FormDataPost) {
|
||||
function onSubmit(formData: FormDataPost) {
|
||||
dialogConfirm($q, () => addData(formData));
|
||||
}
|
||||
|
||||
function addData(formData: FormDataPost) {
|
||||
console.log(formData)
|
||||
// showLoader();
|
||||
// http
|
||||
// .post(config.API.evaluateMeetingMain(), {
|
||||
// // personalId:formData.personalId ?? '',
|
||||
// Prefix: formData.prefix,
|
||||
// FirstName: formData.firstname,
|
||||
// LastName: formData.lastname,
|
||||
// Position: formData.position,
|
||||
// Email: formData.email,
|
||||
// Phone: formData.phone,
|
||||
// })
|
||||
// .then((res) => {
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// router.push(`/discipline/meeting`);
|
||||
// });
|
||||
function addData(formData: any) {
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.meeting(), {
|
||||
Round: formData.rounded ?? "",
|
||||
Tittle: formData.title,
|
||||
Date: formData.dateMeetingStart,
|
||||
Result: formData.consider,
|
||||
Duration: formData.period,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
router.push(`/evaluate/meeting`);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ const {
|
|||
dialogMessageNotify,
|
||||
dialogConfirm,
|
||||
success,
|
||||
date2Thai,
|
||||
hideLoader,
|
||||
dialogRemove
|
||||
dialogRemove,
|
||||
} = mixin;
|
||||
/**
|
||||
* รับ props มาจาก page หลัก
|
||||
|
|
@ -48,8 +49,11 @@ const fileOj = reactive<FileOj[]>([]);
|
|||
const formData = reactive<FormData>({
|
||||
rounded: "",
|
||||
dateMeeting: "",
|
||||
dateMeetingStart: null,
|
||||
dateMeetingEnd: null,
|
||||
consider: "",
|
||||
period: "",
|
||||
title: "",
|
||||
file: fileOj,
|
||||
});
|
||||
|
||||
|
|
@ -64,6 +68,7 @@ watch(props.data, async () => {
|
|||
formData.dateMeeting = props.data.dateMeeting;
|
||||
formData.consider = props.data.consider;
|
||||
formData.period = props.data.period;
|
||||
formData.title = props.data.title;
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -112,12 +117,14 @@ const roundedRef = ref<object | null>(null);
|
|||
const dateMeetingRef = ref<object | null>(null);
|
||||
const considerRef = ref<object | null>(null);
|
||||
const periodRef = ref<object | null>(null);
|
||||
const titleRef = ref<object | null>(null);
|
||||
|
||||
const formRef: FormRef = {
|
||||
rounded: roundedRef,
|
||||
dateMeeting: dateMeetingRef,
|
||||
consider: considerRef,
|
||||
period: periodRef,
|
||||
title: titleRef,
|
||||
};
|
||||
|
||||
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
|
||||
|
|
@ -185,6 +192,17 @@ function confirmDelete(id: string) {
|
|||
// });
|
||||
}
|
||||
|
||||
//checkDate
|
||||
function checkDate() {
|
||||
if (formData.dateMeetingEnd !== null && formData.dateMeetingStart !== null) {
|
||||
if (formData.dateMeetingEnd <= formData.dateMeetingStart) {
|
||||
formData.dateMeetingEnd = null;
|
||||
}
|
||||
} else {
|
||||
console.log("One or both dates are null");
|
||||
}
|
||||
}
|
||||
|
||||
function inputEdit(val: boolean) {
|
||||
return {
|
||||
"full-width cursor-pointer ": val,
|
||||
|
|
@ -210,7 +228,7 @@ function inputEdit(val: boolean) {
|
|||
/>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<q-input
|
||||
<!-- <q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
|
|
@ -220,6 +238,89 @@ function inputEdit(val: boolean) {
|
|||
for="dateMeetingRef"
|
||||
hide-bottom-space
|
||||
:rules="[(val: string) => val !== null && val !== '' || `${'กรุณากรอกวันเวลาในการประชุม'}`]"
|
||||
/> -->
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.dateMeetingStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="true"
|
||||
week-start="0"
|
||||
@update:model-value="checkDate"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="selectDate"
|
||||
dense
|
||||
outlined
|
||||
lazy-rules
|
||||
:model-value="
|
||||
formData.dateMeetingStart != null
|
||||
? date2Thai(formData.dateMeetingStart, false, true)
|
||||
: null
|
||||
"
|
||||
hide-bottom-space
|
||||
:label="`${'วันเวลาที่เริ่มต้นการประชุม'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="event" class="cursor-pointer text-primary">
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.dateMeetingEnd"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="true"
|
||||
week-start="0"
|
||||
:min-date="formData.dateMeetingStart"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="selectDate"
|
||||
dense
|
||||
outlined
|
||||
lazy-rules
|
||||
:model-value="
|
||||
formData.dateMeetingEnd != null
|
||||
? date2Thai(formData.dateMeetingEnd, false, true)
|
||||
: null
|
||||
"
|
||||
hide-bottom-space
|
||||
:label="`${'วันเวลาที่สิ้นสุด'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="event" class="cursor-pointer text-primary">
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
v-model="formData.title"
|
||||
label="ชื่อการประชุม"
|
||||
ref="titleRef"
|
||||
for="titleRef"
|
||||
hide-bottom-space
|
||||
:rules="[(val: string) => !!val || `${'กรุณากรอกชื่อการประชุม'}`]"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ async function getList() {
|
|||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.evaluateMeetingMain(
|
||||
config.API.meeting(
|
||||
// currentPage.value,
|
||||
// rowsPerPage.value,
|
||||
// filterKeyword.value
|
||||
|
|
@ -88,19 +88,18 @@ function clickDelete(id: string) {
|
|||
* @param id type
|
||||
*/
|
||||
async function deleteData(id: string) {
|
||||
alert('ลบ')
|
||||
// showLoader();
|
||||
// await http
|
||||
// .delete(config.API.directorbyId(id))
|
||||
// .then((res) => {
|
||||
// success($q, "ลบข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// await getList();
|
||||
// });
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.meetingById(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getList();
|
||||
});
|
||||
}
|
||||
|
||||
/**เมื่อเริ่มโหลดหน้า
|
||||
|
|
|
|||
|
|
@ -1,58 +1,40 @@
|
|||
interface DataResponseList {
|
||||
Id:string
|
||||
CreatedAt:string
|
||||
CreatedUserId:string
|
||||
LastUpdatedAt:string
|
||||
LastUpdateUserId:string
|
||||
CreatedFullName:string
|
||||
LastUpdateFullName:string
|
||||
Tittle:string
|
||||
Round:string
|
||||
Date:string
|
||||
Result:string
|
||||
Duration:string
|
||||
id: string;
|
||||
rounded: string;
|
||||
title: string;
|
||||
dateStart: Date;
|
||||
dateEnd: Date;
|
||||
}
|
||||
|
||||
interface MainList {
|
||||
id:string
|
||||
createdAt:string
|
||||
createdUserId:string
|
||||
lastUpdatedAt:string
|
||||
lastUpdateUserId:string
|
||||
createdFullName:string
|
||||
lastUpdateFullName:string
|
||||
tittle:string
|
||||
round:string
|
||||
date:string
|
||||
result:string
|
||||
duration:string
|
||||
id: string;
|
||||
rounded: string;
|
||||
title: string;
|
||||
date: string;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
rounded: string
|
||||
dateMeeting: string
|
||||
consider: string
|
||||
period: string
|
||||
file: FileOj[]
|
||||
rounded: string;
|
||||
dateMeeting: string;
|
||||
dateMeetingStart: Date | null;
|
||||
dateMeetingEnd: Date | null;
|
||||
consider: string;
|
||||
period: string;
|
||||
title: string;
|
||||
file: FileOj[];
|
||||
}
|
||||
|
||||
interface FileOj {
|
||||
id: string
|
||||
pathName: string
|
||||
fileName: string
|
||||
id: string;
|
||||
pathName: string;
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
interface FormRef {
|
||||
rounded: object | null;
|
||||
dateMeeting: object | null;
|
||||
consider: object | null;
|
||||
period: object | null;
|
||||
[key: string]: any;
|
||||
rounded: object | null;
|
||||
dateMeeting: object | null;
|
||||
consider: object | null;
|
||||
period: object | null;
|
||||
[key: string]: any;
|
||||
}
|
||||
export type {
|
||||
DataResponseList,
|
||||
MainList,
|
||||
FormData,
|
||||
FormRef,
|
||||
FileOj
|
||||
}
|
||||
export type { DataResponseList, MainList, FormData, FormRef, FileOj };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue