diff --git a/src/api/12_evaluatePersonal/api.evaluate.ts b/src/api/12_evaluatePersonal/api.evaluate.ts index 0bd023341..0070bfeaf 100644 --- a/src/api/12_evaluatePersonal/api.evaluate.ts +++ b/src/api/12_evaluatePersonal/api.evaluate.ts @@ -1,10 +1,11 @@ import env from "../index"; +const evaluateDirectorMain = `${env.API_URI}/evaluation/director`; const evaluation = `${env.API_URI}/evaluation`; -const evaluateDirectorMain = `${env.API_URI}/evaluate/director`; export default { evaluateDirectorMain: () => `${evaluateDirectorMain}`, - evaluateDirectorById: (id: string) => `${evaluateDirectorMain}/${id}`, + evaluateDirectorById: (id:string) => `${evaluateDirectorMain}/${id}`, + meeting: () => `${evaluation}/meeting`, meetingById: (id: string) => `${evaluation}/meeting/${id}`, }; diff --git a/src/modules/12_evaluatePersonal/components/Director/EditPage.vue b/src/modules/12_evaluatePersonal/components/Director/EditPage.vue index f3f4bfa65..0f046f2c0 100644 --- a/src/modules/12_evaluatePersonal/components/Director/EditPage.vue +++ b/src/modules/12_evaluatePersonal/components/Director/EditPage.vue @@ -10,7 +10,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; const route = useRoute(); -const personalId = ref(route.params.id.toString()); +const id = ref(route.params.id.toString()); const $q = useQuasar(); const mixin = useCounterMixin(); const { messageError, showLoader, hideLoader, dialogConfirm, success } = mixin; @@ -42,10 +42,10 @@ const fetchData = async () => { showLoader(); await http // .get(config.API.evaluateDirectorById(personalId.value)) - .get(config.API.evaluateDirectorById('0a185476-c764-42d7-a6f9-2c3824a401ed')) + .get(config.API.evaluateDirectorById(id.value)) .then((res) => { const dataApi = res.data.result; - personalId.value = dataApi.Id; + data.personalId = dataApi.Id; data.prefix = dataApi.Prefix; data.firstname = dataApi.FirstName; data.lastname = dataApi.LastName; @@ -73,7 +73,7 @@ function putData(formData: FormData) { showLoader(); http // .put(config.API.evaluateDirectorById(personalId.value), { - .put(config.API.evaluateDirectorById('0a185476-c764-42d7-a6f9-2c3824a401ed'), { + .put(config.API.evaluateDirectorById(id.value), { Prefix: formData.prefix, FirstName: formData.firstname, LastName: formData.lastname, diff --git a/src/modules/12_evaluatePersonal/components/Director/MainPage.vue b/src/modules/12_evaluatePersonal/components/Director/MainPage.vue index a6f33c192..1b6a2df53 100644 --- a/src/modules/12_evaluatePersonal/components/Director/MainPage.vue +++ b/src/modules/12_evaluatePersonal/components/Director/MainPage.vue @@ -50,110 +50,26 @@ watch( getList(); } ); - + // currentPage.value, + // rowsPerPage.value, + // filterKeyword.value function getList() { - // showLoader(); - // http - // .get( - // config.API.evaluateDirectorMain( - // currentPage.value, - // rowsPerPage.value, - // filterKeyword.value - // ) - // ) - // .then((res) => { + showLoader(); + http + .get( + config.API.evaluateDirectorMain()) + .then((res) => { + // maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); + const data = res.data.result + dataStore.fetchData(data); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); - // maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); - // const data = res.data.result.data - // dataStore.fetchData(data); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); - - // { - // "Id": "0a185476-c764-42d7-a6f9-2c3824a401ed", - // "CreatedAt": "2023-12-19T02:40:59.898Z", - // "CreatedUserId": "59134ef9-9e62-41d0-aac5-339be727f2b0", - // "LastUpdatedAt": "2023-12-19T02:40:59.898Z", - // "LastUpdateUserId": "59134ef9-9e62-41d0-aac5-339be727f2b0", - // "CreatedFullName": "สาวิตรี ศรีสมัย", - // "LastUpdateFullName": "สาวิตรี ศรีสมัย", - // "Prefix": "นาย", - // "FirstName": "เทสดี", - // "LastName": "ลองแอด", - // "Phone": "0999998767", - // "Email": "email@gmail.com", - // "Position": "frontEnd" - // } - - const data = [ - { - Id: "xx1", - CreatedAt: "2023-12-19T02:40:59.898Z", - CreatedUserId: "cc1", - LastUpdatedAt: "2023-12-19T02:40:59.898Z", - LastUpdateUserId: "ll1", - CreatedFullName: "สาวิตรี ศรีสมัย", - LastUpdateFullName: "สาวิตรี ศรีสมัย", - Prefix: "นาย", - FirstName: "เทสดี", - LastName: "ลองแอด", - Phone: "0999998767", - Email: "email@gmail.com", - Position: "frontEnd", - }, - { - Id: "xx2", - CreatedAt: "2023-12-19T02:40:59.898Z", - CreatedUserId: "cc2", - LastUpdatedAt: "2023-12-19T02:40:59.898Z", - LastUpdateUserId: "ll2", - CreatedFullName: "สาวิตรี ศรีสมัย", - LastUpdateFullName: "สาวิตรี ศรีสมัย", - Prefix: "นาย", - FirstName: "เทสดี", - LastName: "ลองแอด", - Phone: "0999998767", - Email: "email@gmail.com", - Position: "frontEnd", - }, - { - Id: "xx3", - CreatedAt: "2023-12-19T02:40:59.898Z", - CreatedUserId: "cc3", - LastUpdatedAt: "2023-12-19T02:40:59.898Z", - LastUpdateUserId: "ll3", - CreatedFullName: "สาวิตรี ศรีสมัย", - LastUpdateFullName: "สาวิตรี ศรีสมัย", - Prefix: "นาย", - FirstName: "เทสดี", - LastName: "ลองแอด", - Phone: "0999998767", - Email: "email@gmail.com", - Position: "frontEnd", - }, - { - Id: "xx4", - CreatedAt: "2023-12-19T02:40:59.898Z", - CreatedUserId: "cc5", - LastUpdatedAt: "2023-12-19T02:40:59.898Z", - LastUpdateUserId: "ll5", - CreatedFullName: "สาวิตรี ศรีสมัย", - LastUpdateFullName: "สาวิตรี ศรีสมัย", - Prefix: "นาย", - FirstName: "เทสดี", - LastName: "ลองแอด", - Phone: "0999998767", - Email: "email@gmail.com", - Position: "frontEnd", - }, - - ]; - dataStore.fetchData(data); } /** diff --git a/src/modules/12_evaluatePersonal/components/Meeting/MainPage.vue b/src/modules/12_evaluatePersonal/components/Meeting/MainPage.vue index 7d49ce0a3..7f551eeef 100644 --- a/src/modules/12_evaluatePersonal/components/Meeting/MainPage.vue +++ b/src/modules/12_evaluatePersonal/components/Meeting/MainPage.vue @@ -51,66 +51,28 @@ watch( } ); async function getList() { - // showLoader(); - // await http - // .get( - // config.API.directorList( - // currentPage.value, - // rowsPerPage.value, - // filterKeyword.value - // ) - // ) - // .then((res) => { - // maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); - // const data = res.data.result.data - // dataStore.fetchData(data); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + showLoader(); + await http + .get( + config.API.meeting( + // currentPage.value, + // rowsPerPage.value, + // filterKeyword.value + ) + ) + .then((res) => { + // maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); + const data = res.data.result + dataStore.fetchData(data); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + - /** จำลองข้อมูล */ - const data = [ - { - id: "08dbf276-47d1-446b-8c0a-c109030dd457", - rounded:'1', - title:'ประชุม 1', - dateStart:new Date('2023-12-18T10:12:29.362007'), - dateEnd:new Date('2023-12-18T10:12:29.362007'), - }, - { - id: "08dbf633-a4e4-49f6-8278-7105ce82e158", - rounded:'2', - title:'ประชุม 2', - dateStart:new Date('2023-12-18T10:12:29.362007'), - dateEnd:new Date('2023-12-18T10:12:29.362007'), - }, - { - id: "08dbf67d-ebfa-4216-8bdb-4668351513b8", - rounded:'3', - title:'ประชุม 3', - dateStart:new Date('2023-12-18T10:12:29.362007'), - dateEnd:new Date('2023-12-18T10:12:29.362007'), - }, - { - id: "08dbf6dd-7cff-4dd1-89d3-4fe0533ee186", - rounded:'4', - title:'ประชุม 4', - dateStart:new Date('2023-12-18T10:12:29.362007'), - dateEnd:new Date('2023-12-18T10:12:29.362007'), - }, - { - id: "08dbfd41-0567-447f-8d3f-3254166c815d", - rounded:'5', - title:'ประชุม 5', - dateStart:new Date('2023-12-18T10:12:29.362007'), - dateEnd:new Date('2023-12-18T10:12:29.362007'), - }, - ]; - dataStore.fetchData(data); } /** @@ -126,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(); + }); } /**เมื่อเริ่มโหลดหน้า diff --git a/src/modules/12_evaluatePersonal/store/MeetingStore.ts b/src/modules/12_evaluatePersonal/store/MeetingStore.ts index cf675888d..340836bc3 100644 --- a/src/modules/12_evaluatePersonal/store/MeetingStore.ts +++ b/src/modules/12_evaluatePersonal/store/MeetingStore.ts @@ -13,7 +13,7 @@ export const useEvaluateMeetingDataStore = defineStore( //ค้นหา คอลัมน์ คอลัมน์ที่แสดง const visibleColumns = ref([ "no", - "rounded", + "round", "title", "date", ]); @@ -30,11 +30,11 @@ export const useEvaluateMeetingDataStore = defineStore( style: "font-size: 14px", }, { - name: "rounded", + name: "round", align: "left", label: "ครั้งที่", sortable: true, - field: "rounded", + field: "round", headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -62,10 +62,18 @@ export const useEvaluateMeetingDataStore = defineStore( const rows = ref([]); function fetchData(data: DataResponseList[]) { const dataList: MainList[] = data.map((item: DataResponseList) => ({ - id: item.id, - rounded: item.rounded, - title: item.title, - date: `${date2Thai(item.dateStart as Date)} - ${date2Thai(item.dateEnd as Date)}` + id:item.Id, + createdAt:item.CreatedAt, + createdUserId:item.CreatedUserId, + lastUpdatedAt:item.LastUpdatedAt, + lastUpdateUserId:item.LastUpdateUserId, + createdFullName:item.CreatedFullName, + lastUpdateFullName:item.LastUpdateFullName, + title:item.Tittle, + round:item.Round, + date:date2Thai(item.Date as Date), + result:item.Result, + duration:item.Duration, })) rows.value = dataList }