From 46f82b78fc667232d5f9aa4215f6804b5abf43ca Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 19 Dec 2023 15:05:48 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=80?= =?UTF-8?q?=E0=B9=80=E0=B8=81=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/11_discipline/api.discipline.ts | 3 +- src/api/12_evaluatePersonal/api.evaluate.ts | 8 + src/app.config.ts | 6 + .../components/2_InvestigateFacts/Form.vue | 39 ++-- .../3_InvestigateDisciplinary/Form.vue | 35 ++-- .../components/4_Result/Form.vue | 8 + .../interface/response/investigate.ts | 1 + src/modules/11_discipline/store/main.ts | 3 +- .../components/Director/AddPage.vue | 29 +-- .../components/Director/EditPage.vue | 36 ++-- .../components/Director/Form.vue | 2 + .../components/Director/MainPage.vue | 174 +++++++++++++----- .../12_evaluatePersonal/components/Table.vue | 1 - .../interface/index/director.ts | 78 ++++++++ src/modules/12_evaluatePersonal/router.ts | 2 +- .../store/DirectorStore.ts | 123 +++++++++++++ .../12_evaluatePersonal/store/Evaluate.ts | 1 + .../12_evaluatePersonal/views/MainPage.vue | 87 ++------- 18 files changed, 446 insertions(+), 190 deletions(-) create mode 100644 src/api/12_evaluatePersonal/api.evaluate.ts create mode 100644 src/modules/12_evaluatePersonal/interface/index/director.ts create mode 100644 src/modules/12_evaluatePersonal/store/DirectorStore.ts diff --git a/src/api/11_discipline/api.discipline.ts b/src/api/11_discipline/api.discipline.ts index 1403bc0a6..cbfec2c6a 100644 --- a/src/api/11_discipline/api.discipline.ts +++ b/src/api/11_discipline/api.discipline.ts @@ -49,6 +49,7 @@ export default { investigateResume: (id: string) => `${investigate}/resume/${id}`, investigateApprove: (id: string) => `${investigate}/approve/${id}`, investigateCalendar: () => `${investigate}/calendar`, + investigateReport: () => `${investigate}/report`, /** ระบบวินัยเรื่องสอบสวน */ disciplineDisciplinary: () => `${discipline}`, @@ -65,7 +66,7 @@ export default { disciplinaryApprove: (id: string) => `${discipline}/approve/${id}`, disciplinarySuspend: (id: string) => `${discipline}/suspend/${id}`, disciplinaryCalendar: () => `${discipline}/calendar`, - + disciplinaryReport: () => `${discipline}/report`, /** รายการสรุปผลการพิจารณาทางวินัย*/ listResult: () => `${disciplineMain}/result`, listResultById: (id: string) => `${disciplineMain}/result/${id}`, diff --git a/src/api/12_evaluatePersonal/api.evaluate.ts b/src/api/12_evaluatePersonal/api.evaluate.ts new file mode 100644 index 000000000..9ef8d5ea5 --- /dev/null +++ b/src/api/12_evaluatePersonal/api.evaluate.ts @@ -0,0 +1,8 @@ +import env from "../index"; +const evaluateDirectorMain = `${env.API_URI}/evaluate/director`; + + +export default { + evaluateDirectorMain: () => `${evaluateDirectorMain}`, + evaluateDirectorById: (id:string) => `${evaluateDirectorMain}/${id}`, +}; diff --git a/src/app.config.ts b/src/app.config.ts index 90a90bec6..bae648b73 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -48,6 +48,9 @@ import leave from "./api/09_leave/api.leave"; /** API วินัย */ import discipline from './api/11_discipline/api.discipline' + +/**API ประเมิน */ +import evaluate from './api/12_evaluatePersonal/api.evaluate' // environment variables export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL; export const qualifyDisableExamPanel = import.meta.env @@ -97,6 +100,9 @@ const API = { /**discipline */ ...discipline, + + /**evaluate*/ + ...evaluate }; export default { diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue index b8bb3d020..2dbc0b868 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue @@ -19,12 +19,16 @@ import type { MyObjectInvestigateRef, } from "@/modules/11_discipline/interface/request/investigateFact"; +import type { + ArrayPersonAdd +} from '@/modules/11_discipline/interface/response/investigate' import config from "@/app.config"; import http from "@/plugins/http"; const $q = useQuasar(); const route = useRoute(); const router = useRouter(); +const id = ref(route.params.id as string); const modalPerson = ref(false); const toggleModal = () => (modalPerson.value = !modalPerson.value); /**เรียกใช้ store */ @@ -271,7 +275,8 @@ watch(props.data, async () => { formData.investigationExtendHistory = props.data.investigationExtendHistory; mainStore.rowsAdd = props.data.persons; - + mainStore.rowsCheck = mainStore.rowsAdd.filter((item:any)=> item.isSend === false ) + console.log(mainStore.rowsCheck) const dataMap = props.data.directors.map((item: any) => ({ id: item.id, name: `${item.prefix}${item.firstName} ${item.lastName}`, @@ -523,21 +528,21 @@ function closePopup() { function emitPerson(data: FormData[]) { const dataMapId = data.map((item: FormData) => item.id); console.log(dataMapId); - // showLoader(); - // http - // .put(config.API.investigateApprove(id.value), { - // persons: dataMapId, - // }) - // .then((res) => { - // // router.push(`/discipline/investigatefacts`); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // getData(); - // }); + showLoader(); + http + .post(config.API.investigateReport(), { + Id: dataMapId, + }) + .then((res) => { + // router.push(`/discipline/investigatefacts`); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + getOc(); + }); } onMounted(async () => { @@ -1504,7 +1509,7 @@ onMounted(async () => { :modal="modalPopup" :close="closePopup" title="ส่งรายชื่อไปออกคำสั่งยุติเรื่อง" - :rows="mainStore.rowsAdd" + :rows="mainStore.rowsCheck" :columns="mainStore.columnsDirector" :visibleColumns="mainStore.visibleColumnsDirector" @return-person="emitPerson" diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue index 31c13f241..3350e729a 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue @@ -302,7 +302,7 @@ async function fetchDatadetail() { formData.disciplinaryExtendHistory = props.data.disciplinaryExtendHistory; mainStore.rowsAdd = props.data.persons; - + mainStore.rowsCheck = mainStore.rowsAdd.filter((item:any)=> item.isSend === false ) /** MAP รายชื่อกรรมการ หน้าหลัก */ const dataMap = props.data.director.map((item: any) => ({ id: item.directorId, @@ -500,22 +500,21 @@ function closePopup() { function emitPerson(data: PersonsArray[]) { const dataMapId = data.map((item: PersonsArray) => item.id); - console.log(dataMapId); - // showLoader(); - // http - // .put(config.API.investigateApprove(id.value), { - // persons: dataMapId, - // }) - // .then((res) => { - // // router.push(`/discipline/investigatefacts`); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // getData(); - // }); + showLoader(); + http + .post(config.API.disciplinaryReport(), { + Id: dataMapId, + }) + .then((res) => { + // router.push(`/discipline/investigatefacts`); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + fetchOrganization(); + }); } /** Hook */ @@ -1664,7 +1663,7 @@ onMounted(async () => { :modal="modalPopup" :close="closePopup" title="ส่งรายชื่อไปออกคำสั่งยุติเรื่อง" - :rows="mainStore.rowsAdd" + :rows="mainStore.rowsCheck" :columns="mainStore.columnsDirector" :visibleColumns="mainStore.visibleColumnsDirector" @return-person="emitPerson" diff --git a/src/modules/11_discipline/components/4_Result/Form.vue b/src/modules/11_discipline/components/4_Result/Form.vue index 548aed247..67b2ddf21 100644 --- a/src/modules/11_discipline/components/4_Result/Form.vue +++ b/src/modules/11_discipline/components/4_Result/Form.vue @@ -168,6 +168,10 @@ watch( () => props.data, async () => { respondentType.value = props.data.respondentType; + formData.oc = props.data.resultOc; + formData.disciplineType = props.data.resultDisciplineType; + formData.titleType = props.data.resultTitleType; + formData.year = props.data.resultYear; mainStore.rowsAdd = props.data.persons; await fetchDatadetail(); await fetchOrganization(); @@ -451,6 +455,7 @@ onMounted(async () => {}); @@ -460,6 +465,7 @@ onMounted(async () => {}); v-model="formData.titleType" dense outlined + :class="inputEdit(isReadonly)" label="ประเภทของเรื่อง" /> @@ -468,6 +474,7 @@ onMounted(async () => {}); v-model="formData.oc" dense outlined + :class="inputEdit(isReadonly)" label="หน่วยงาน/ส่วนราชการ" /> @@ -489,6 +496,7 @@ onMounted(async () => {}); { ]); const rowsAdd = ref([]); + const rowsCheck = ref([]); function fetchData(data: ArrayPersonAdd[]) { rowsAdd.value = data; } @@ -295,7 +296,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => { fetchData, statusResultOptions, convertStatusResult, - + rowsCheck, causeTextOptions }; }); diff --git a/src/modules/12_evaluatePersonal/components/Director/AddPage.vue b/src/modules/12_evaluatePersonal/components/Director/AddPage.vue index 4abd3a368..e83e5009d 100644 --- a/src/modules/12_evaluatePersonal/components/Director/AddPage.vue +++ b/src/modules/12_evaluatePersonal/components/Director/AddPage.vue @@ -1,12 +1,12 @@ diff --git a/src/modules/12_evaluatePersonal/components/Director/EditPage.vue b/src/modules/12_evaluatePersonal/components/Director/EditPage.vue index 98692b300..f3f4bfa65 100644 --- a/src/modules/12_evaluatePersonal/components/Director/EditPage.vue +++ b/src/modules/12_evaluatePersonal/components/Director/EditPage.vue @@ -1,6 +1,6 @@ diff --git a/src/modules/12_evaluatePersonal/components/Director/Form.vue b/src/modules/12_evaluatePersonal/components/Director/Form.vue index 351cf92bf..e90afd90a 100644 --- a/src/modules/12_evaluatePersonal/components/Director/Form.vue +++ b/src/modules/12_evaluatePersonal/components/Director/Form.vue @@ -83,9 +83,11 @@ function addEmployee() { keyword: idCard.value, }) .then((res) => { + console.log(res) const dataApi = res.data.result; if (dataApi.length > 0) { const dataList = dataApi[0]; + formData.personalId = dataList.personId; formData.prefix = dataList.prefix; formData.firstname = dataList.firstName; formData.lastname = dataList.lastName; diff --git a/src/modules/12_evaluatePersonal/components/Director/MainPage.vue b/src/modules/12_evaluatePersonal/components/Director/MainPage.vue index d3e648423..a6f33c192 100644 --- a/src/modules/12_evaluatePersonal/components/Director/MainPage.vue +++ b/src/modules/12_evaluatePersonal/components/Director/MainPage.vue @@ -4,12 +4,12 @@ import type { QTableProps } from "quasar"; import router from "@/router"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; -import { useDisciplineDirectorDataStore } from "@/modules/11_discipline/store/DirectorStore"; +import { useEvaluateDirectorDataStore } from "@/modules/12_evaluatePersonal/store/DirectorStore"; import http from "@/plugins/http"; import config from "@/app.config"; const $q = useQuasar(); -const dataStore = useDisciplineDirectorDataStore(); +const dataStore = useEvaluateDirectorDataStore(); const mixin = useCounterMixin(); const { messageError, @@ -34,37 +34,126 @@ const pagination = ref({ rowsPerPage: rowsPerPage.value, }); -watch(() => currentPage.value,() => { - rowsPerPage.value = pagination.value.rowsPerPage; - getList(); -}); +watch( + () => currentPage.value, + () => { + rowsPerPage.value = pagination.value.rowsPerPage; + getList(); + } +); -watch(()=>pagination.value.rowsPerPage,()=>{ - rowsPerPage.value = pagination.value.rowsPerPage; - currentPage.value = 1 - getList(); -}) -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(); - }); +watch( + () => pagination.value.rowsPerPage, + () => { + rowsPerPage.value = pagination.value.rowsPerPage; + currentPage.value = 1; + getList(); + } +); + +function getList() { + // showLoader(); + // http + // .get( + // config.API.evaluateDirectorMain( + // 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(); + // }); + + // { + // "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); } /** @@ -82,7 +171,7 @@ function clickDelete(id: string) { async function deleteData(id: string) { showLoader(); await http - .delete(config.API.directorbyId(id)) + .delete(config.API.evaluateDirectorById(id)) .then((res) => { success($q, "ลบข้อมูลสำเร็จ"); }) @@ -94,19 +183,12 @@ async function deleteData(id: string) { }); } -/**เมื่อเริ่มโหลดหน้า - * ส่งข้อมูลจำลองไปยัง store - */ -onMounted(() => { - getList(); - // get ข้อมูลแล้วโยนใส่ store -}); - /** * ค้นหาในตาราง */ const filterKeyword = ref(""); const filterRef = ref(null); + function resetFilter() { filterKeyword.value = ""; if (filterRef.value) { @@ -114,10 +196,14 @@ function resetFilter() { } } -function filterFn(){ - getList() - console.log('enter',filterKeyword.value) +function filterFn() { + getList(); + console.log("enter", filterKeyword.value); } + +onMounted(() => { + getList(); +});