diff --git a/package-lock.json b/package-lock.json index fae6f10eb..9db532de2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7738,7 +7738,7 @@ }, "node_modules/vue": { "version": "3.2.47", - "resolved": "https://npm.joolsoft.com/vue/-/vue-3.2.47.tgz", + // "resolved": "https://npm.joolsoft.com/vue/-/vue-3.2.47.tgz", "integrity": "sha512-60188y/9Dc9WVrAZeUVSDxRQOZ+z+y5nO2ts9jWXSTkMvayiWxCWOWtBQoYjLeccfXkiiPZWAHcV+WTPhkqJHQ==", "dependencies": { "@vue/compiler-dom": "3.2.47", diff --git a/package.json b/package.json index c333abd98..86d69369e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "vite", - "build": "run-p type-check build-only", + "build": "run-p build-only", "preview": "vite preview", "test:unit": "vitest --environment jsdom --root src/", "test:e2e": "start-server-and-test preview :4173 'cypress run --e2e'", diff --git a/src/modules/05_placement/components/PersonalDetail/Detail.vue b/src/modules/05_placement/components/PersonalDetail/Detail.vue index 7f55d64d1..826e1226a 100644 --- a/src/modules/05_placement/components/PersonalDetail/Detail.vue +++ b/src/modules/05_placement/components/PersonalDetail/Detail.vue @@ -28,6 +28,7 @@ import type { Education, Family, Address, + Certificate, } from "@/modules/05_placement/interface/index/Main"; import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType"; @@ -92,6 +93,7 @@ const InformationData = ref(InformationDataDefualt); const EducationData = ref([]); const FamilyData = ref(FamilyDataDefualt); const AddressData = ref
(AddressDataDefualt); +const CertificateData = ref([]); onMounted(async () => { // await checkProfileData(); @@ -106,7 +108,7 @@ const fetchData = async () => { .then((res: any) => { const data = res.data.result; // data.value = data; - console.log(data); + // console.log(data); personalData.value.fullName = data.fullName; personalData.value.id = data.personalId; @@ -190,13 +192,27 @@ const fetchData = async () => { durationYear: row.durationYear ?? 0, finishDate: row.finishDate ?? new Date(), isDate: row.isDate ?? "", - startDate: row.startDate ?? 0, - endDate: row.endDate ?? 0, + startDate: row.startDate ? new Date(row.startDate).getFullYear() : 0, + endDate: row.endDate ? new Date(row.endDate).getFullYear() : 0, positionPath: row.positionPath ?? "", isEducation: row.isEducation ?? "", }); }); EducationData.value = listRow; + + let listCert: Certificate[] = []; + + data.certificates.map((row: any) => { + listCert.push({ + id: row.id ?? "", + certificateNo: row.certificateNo ?? "", + issuer: row.issuer ?? "", + issueDate: new Date(row.issueDate) ?? new Date(), + expireDate: new Date(row.expireDate) ?? new Date(), + certificateType: row.certificateType ?? "", + }); + }); + CertificateData.value = listCert; }) .catch((e: any) => { messageError($q, e); @@ -252,7 +268,7 @@ const fetchData = async () => { diff --git a/src/modules/05_placement/components/PersonalDetail/Education.vue b/src/modules/05_placement/components/PersonalDetail/Education.vue index e9d3014c8..79e71af58 100644 --- a/src/modules/05_placement/components/PersonalDetail/Education.vue +++ b/src/modules/05_placement/components/PersonalDetail/Education.vue @@ -43,8 +43,6 @@ const props = defineProps({ const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; const mixin = useCounterMixin(); const { success, dateToISO, date2Thai, messageError, showLoader, hideLoader } = mixin; @@ -94,7 +92,7 @@ const filter = ref(""); //search data table const visibleColumns = ref([]); profileData.education.columns.length == 0 ? (visibleColumns.value = [ - "level", + "educationLevel", "institute", "degree", "field", @@ -112,11 +110,11 @@ profileData.education.columns.length == 0 : (visibleColumns.value = profileData.education.columns); const columns = ref([ { - name: "level", + name: "educationLevel", align: "left", label: "ระดับศึกษา", sortable: true, - field: "level", + field: "educationLevel", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -474,7 +472,8 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => { onMounted(async () => { await fetchLevel(); await fetchPositionPath(); - // await fetchData(); + await props.fetch(); + rows.value = props.data; }); const fetchLevel = async () => { @@ -541,45 +540,6 @@ const filterSelector = (val: any, update: Function, refData: string) => { } }; -const fetchData = async () => { - showLoader(); - 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), - // }); - }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; - /** * กดดูข้อมูลก่อนหน้า */ @@ -604,22 +564,32 @@ const clickNext = async () => { * กดดูข้อมูลต่อไป */ const getData = () => { - // const row = rows.value[rowIndex.value]; - // levelId.value = row.levelId; - // positionPathId.value = row.positionPathId; - // institute.value = row.institute; - // degree.value = row.degree; - // field.value = row.field; - // gpa.value = row.gpa; - // country.value = row.country; - // duration.value = row.duration; - // durationYear.value = row.durationYear; - // other.value = row.other; - // fundName.value = row.fundName; - // finishDate.value = row.finishDate; - // startDate.value = row.startDate; - // endDate.value = row.endDate; - // id.value = row.id; + const row = rows.value[rowIndex.value]; + const filter = OpsFilter.value.levelOptions.filter( + (r: any) => r.name == row.educationLevel + ); + const filterPositionPath = OpsFilter.value.positionPathOptions.filter( + (r: any) => r.name == row.positionPath + ); + const result = filter.length > 0 ? filter[0].id : ""; + const resultPath = + filterPositionPath.length > 0 ? filterPositionPath[0].id : ""; + + levelId.value = result; + positionPathId.value = resultPath; + institute.value = row.institute; + degree.value = row.degree; + field.value = row.field; + gpa.value = row.gpa; + country.value = row.country; + duration.value = row.duration; + durationYear.value = row.durationYear; + other.value = row.other; + fundName.value = row.fundName; + finishDate.value = row.finishDate; + startDate.value = row.startDate; + endDate.value = row.endDate; + id.value = row.id; }; /** @@ -673,15 +643,9 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - // const filter = OpsFilter.value.levelOptions.filter( - // (r: any) => r.id == levelId.value - // ); - // const filterPositionPath = OpsFilter.value.positionPathOptions.filter( - // (r: any) => r.id == positionPathId.value - // ); showLoader(); await http - .post(config.API.profileEduId(profileId.value), { + .post(config.API.placementEducationId(route.params.personalId.toString()), { id: id.value, // educationLevel: filter[0].name, educationLevelId: levelId.value, @@ -692,7 +656,7 @@ const saveData = async () => { gpa: gpa.value, country: country.value, duration: duration.value, - durationYear: durationYear.value, + durationYear: Number(durationYear.value), other: other.value, fundName: fundName.value, finishDate: dateToISO(finishDate.value), @@ -707,7 +671,8 @@ const saveData = async () => { messageError($q, e); }) .finally(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }; @@ -723,7 +688,7 @@ const editData = async () => { // ); showLoader(); await http - .put(config.API.profileEduId(id.value), { + .put(config.API.placementEducationId(route.params.personalId.toString()), { id: id.value, // educationLevel: filter[0].name, educationLevelId: levelId.value, @@ -734,10 +699,10 @@ const editData = async () => { gpa: gpa.value, country: country.value, duration: duration.value, - durationYear: durationYear.value, + durationYear: Number(durationYear.value), other: other.value, fundName: fundName.value, - finishDate: dateToISO(finishDate.value), + finishDate: new Date(finishDate.value), startDate: new Date(`${startDate.value}-01-01`), endDate: new Date(`${endDate.value}-01-01`), }) @@ -749,7 +714,8 @@ const editData = async () => { messageError($q, e); }) .finally(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }; @@ -767,7 +733,7 @@ const clickDelete = async () => { .onOk(async () => { showLoader(); await http - .delete(config.API.profileEduId(id.value)) + .delete(config.API.placementEducationId(id.value)) .then((res) => { success($q, "ลบข้อมูลสำเร็จ"); modal.value = false; @@ -776,11 +742,13 @@ const clickDelete = async () => { messageError($q, e); }) .finally(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }) .onCancel(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }; @@ -812,13 +780,26 @@ const clickClose = async () => { * @param _props ค่า props ใน row ที่เลือก */ const selectData = async (_props: DataProps) => { + const filter = OpsFilter.value.levelOptions.filter( + (r: any) => r.name == _props.row.educationLevel + ); + const filterPositionPath = OpsFilter.value.positionPathOptions.filter( + (r: any) => r.name == _props.row.positionPath + ); + const result = filter.length > 0 ? filter[0].id : ""; + const resultPath = + filterPositionPath.length > 0 ? filterPositionPath[0].id : ""; + + // console.log(_props.row); modalEdit.value = true; modal.value = true; edit.value = false; rawItem.value = _props.row; rowIndex.value = _props.rowIndex; - levelId.value = _props.row.levelId; - positionPathId.value = _props.row.positionPathId; + levelId.value = result; + positionPathId.value = resultPath; + // levelId.value = _props.row.levelId; + // positionPathId.value = _props.row.positionPathId; institute.value = _props.row.institute; degree.value = _props.row.degree; field.value = _props.row.field; diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue b/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue index 2f2186299..67cddd1f7 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue @@ -18,6 +18,8 @@ import HistoryTable from "@/components/TableHistory.vue"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; +import type { PropType } from "vue"; +import type { Certificate } from "@/modules/05_placement/interface/index/Main"; const props = defineProps({ statusEdit: { @@ -32,13 +34,16 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + data: { + type: Array as PropType, + default: [], + }, }); const $q = useQuasar(); const store = useProfileDataStore(); const { profileData, changeProfileColumns } = store; -const dataStore = useDataStore(); -const { loaderPage } = dataStore; + const mixin = useCounterMixin(); const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } = mixin; @@ -68,7 +73,7 @@ const checkValidate = ref(false); //validate data ผ่านหรื // route.params.id ? route.params.id.toString() : "" // ); const profileId = ref(""); -const rows = ref([]); +const rows = ref([]); const filter = ref(""); //search data table const visibleColumns = ref([]); profileData.certicate.columns.length == 0 @@ -233,40 +238,12 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => { onMounted(async () => { // await fetchData(); if (route.params.id) { - profileId.value = route.params.id.toString(); + profileId.value = route.params.personalId.toString(); } + await props.fetch(); + rows.value = props.data; }); -const fetchData = async () => { - if (profileId.value != "") { - showLoader(); - 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(() => { - hideLoader(); - }); - } -}; - /** * กดดูข้อมูลก่อนหน้า */ @@ -351,42 +328,16 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - if (profileId.value !== "") { - showLoader(); - 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(); - }); - } -}; + // console.log("saveData"); -/** - * บันทึกแก้ไขข้อมูล - */ -const editData = async () => { showLoader(); await http - .put(config.API.profileCertId(id.value), { + .post(config.API.placementCertId(route.params.personalId.toString()), { id: id.value, certificateNo: certificateNo.value, issuer: issuer.value, - issueDate: dateToISO(issueDate.value), - expireDate: dateToISO(expireDate.value), + issueDate: new Date(issueDate.value), + expireDate: new Date(expireDate.value), certificateType: certificateType.value, }) .then((res) => { @@ -397,7 +348,35 @@ const editData = async () => { messageError($q, e); }) .finally(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; + }); +}; + +/** + * บันทึกแก้ไขข้อมูล + */ +const editData = async () => { + showLoader(); + await http + .put(config.API.placementCertId(route.params.personalId.toString()), { + id: id.value, + certificateNo: certificateNo.value, + issuer: issuer.value, + issueDate: new Date(issueDate.value), + expireDate: new Date(expireDate.value), + certificateType: certificateType.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await props.fetch(); + rows.value = props.data; }); }; @@ -415,7 +394,12 @@ const clickDelete = async () => { .onOk(async () => { showLoader(); await http - .delete(config.API.profileCertId(id.value)) + .delete( + config.API.placementCertDetailId( + route.params.personalId.toString(), + id.value + ) + ) .then((res) => { success($q, "ลบข้อมูลสำเร็จ"); modal.value = false; @@ -424,11 +408,13 @@ const clickDelete = async () => { messageError($q, e); }) .finally(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }) .onCancel(async () => { - await fetchData(); + await props.fetch(); + rows.value = props.data; }); }; diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Information.vue b/src/modules/05_placement/components/PersonalDetail/Information/Information.vue index e03652847..479c51666 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Information.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Information.vue @@ -115,7 +115,7 @@ const fetchPerson = async () => { .then((res) => { const data = res.data.result; let optionbloodGroups: optionData[] = []; - console.log(data); + // console.log(data); data.bloodGroups.map((r: any) => { optionbloodGroups.push({ id: r.id ?? "", diff --git a/src/modules/05_placement/components/probation/AddWork.vue b/src/modules/05_placement/components/probation/AddWork.vue index dfb9dbe98..3259cecac 100644 --- a/src/modules/05_placement/components/probation/AddWork.vue +++ b/src/modules/05_placement/components/probation/AddWork.vue @@ -54,7 +54,7 @@
2 ผู้ดูแลการทดลองปฏิบัติหน้าที่ราชการ (อาจมีได้มากกว่า 1 คน) - +
3.1 ชื่องาน / ภารกิจงานที่มอบหมาย (ควรมีมากกว่า 1 ภารกิจงาน) - +
@@ -153,7 +153,7 @@
ความรู้ความสามารถในการปฏิบัติงาน - +
@@ -194,7 +194,7 @@
ความรู้เรื่องกฎหมายและกฎระเบียบ (ไม่เกิน 20 หัวข้อ) - +
@@ -457,7 +457,7 @@
3.6 ผลผลิตของงานที่คาดหวังและตัวชี้วัดความสําเร็จของงาน - +
diff --git a/src/modules/05_placement/interface/index/Main.ts b/src/modules/05_placement/interface/index/Main.ts index ff97f44c5..481331322 100644 --- a/src/modules/05_placement/interface/index/Main.ts +++ b/src/modules/05_placement/interface/index/Main.ts @@ -140,6 +140,15 @@ interface Address { registSame: string; } +interface Certificate { + id: string; + certificateNo: string; + issuer: string; + issueDate: Date; + expireDate: Date; + certificateType: string; +} + const AddressDataDefualt: Address = { registAddress: "", currentAddress: "", @@ -195,6 +204,7 @@ export type { Family, Address, optionData, + Certificate, }; export { AddressDataDefualt, FamilyDataDefualt }; diff --git a/src/modules/05_placement/interface/request/Education.ts b/src/modules/05_placement/interface/request/Education.ts index eb0270198..f1d755e51 100644 --- a/src/modules/05_placement/interface/request/Education.ts +++ b/src/modules/05_placement/interface/request/Education.ts @@ -6,6 +6,7 @@ interface DataProps { //ข้อมูล interface RequestItemsObject { id: string; + educationLevel: string; level: string; levelId: string; positionPath: string;