From 142fc30d8bc2522c96232004f4b0a2b4c2842350 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 3 Jan 2024 13:50:17 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B8=A7?= =?UTF-8?q?=E0=B8=B4=E0=B8=99=E0=B8=B1=E0=B8=A2=20=E0=B9=80=E0=B8=9E?= =?UTF-8?q?=E0=B8=B4=E0=B9=88=E0=B8=A1=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/11_discipline/api.discipline.ts | 10 +- .../components/1_Complaint/MainPage.vue | 8 +- .../2_InvestigateFacts/EditPage.vue | 2 + .../components/2_InvestigateFacts/Form.vue | 43 +++--- .../2_InvestigateFacts/MainPage.vue | 5 +- .../3_InvestigateDisciplinary/MainPage.vue | 10 +- .../3_InvestigateDisciplinary/Table.vue | 6 +- .../components/4_Result/MainPage.vue | 10 +- .../components/4_Result/Table.vue | 6 +- .../Director/DialogInvestigateTotal.vue | 135 ++++++------------ .../6_BasicInformation/Director/MainPage.vue | 25 ++-- .../interface/request/investigateFact.ts | 1 + .../interface/response/director.ts | 18 +-- 13 files changed, 134 insertions(+), 145 deletions(-) diff --git a/src/api/11_discipline/api.discipline.ts b/src/api/11_discipline/api.discipline.ts index 0a668bdd8..6ebaa8b95 100644 --- a/src/api/11_discipline/api.discipline.ts +++ b/src/api/11_discipline/api.discipline.ts @@ -24,16 +24,16 @@ export default { complaintbyId: (id: string) => `${disciplineMain}/complaint/${id}`, complaintReject: (id: string) => `${disciplineMain}/complaint/reject/${id}`, complaintResume: (id: string) => `${disciplineMain}/complaint/resume/${id}`, - complaintList: (page: number, pageSize: number, keyword: string) => - `${disciplineMain}/complaint?page=${page}&pageSize=${pageSize}&keyword=${keyword}`, + complaintList: (page: number, pageSize: number, keyword: string,status:string) => + `${disciplineMain}/complaint?page=${page}&pageSize=${pageSize}&keyword=${keyword}&status=${status}`, complaintFileUpload: (id: string) => `${disciplineMain}/complaint/file/${id}`, complaintFileDelete: (id: string, docId: string) => `${disciplineMain}/complaint/file/${id}/${docId}`, complaintApprove: (id: string) => `${disciplineMain}/complaint/approve/${id}`, /** API สืบสวนข้อเท็จจริง*/ - investigateMain: (page: number, pageSize: number, keyword: string) => - `${investigate}?page=${page}&pageSize=${pageSize}&keyword=${keyword}`, + investigateMain: (page: number, pageSize: number, keyword: string,status:string) => + `${investigate}?page=${page}&pageSize=${pageSize}&keyword=${keyword}&status=${status}`, investigateById: (id: string) => `${investigate}/${id}`, investigateRelevantUploadFile: (id: string) => @@ -104,4 +104,6 @@ export default { appealUpLoadFile: (id: string) => `${appeal}/file/${id}`, appealDeleteFile: (id: string, docId: string) => `${appeal}/file/${id}/${docId}`, + + historyDirectorbyId:(id:string,type:string) => `${disciplineMain}/director/${type}/${id}` }; diff --git a/src/modules/11_discipline/components/1_Complaint/MainPage.vue b/src/modules/11_discipline/components/1_Complaint/MainPage.vue index 426ef05b8..3c3dff56a 100644 --- a/src/modules/11_discipline/components/1_Complaint/MainPage.vue +++ b/src/modules/11_discipline/components/1_Complaint/MainPage.vue @@ -43,7 +43,8 @@ async function getList() { config.API.complaintList( page.value, rowsPerPage.value, - filterKeyword.value + filterKeyword.value, + statusFilter.value ) ) // @@ -69,9 +70,6 @@ function filterFn() { getList(); } -function dataUpdate() { - console.log(statusFilter.value); -} function resetFilter() { filterKeyword.value = ""; @@ -104,7 +102,7 @@ onMounted(async () => { option-label="name" option-value="id" :options="complainstStore.statusOptions" - @update:model-value="dataUpdate" + @update:model-value="getList()" />
diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue b/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue index 0ee23e820..44596fb22 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue @@ -59,6 +59,7 @@ const data = reactive({ organizationId: "", persons: [], investigationExtendHistory: [], + isDisciplinary:false }); /** ข้อมูล v-model ของฟอร์มเรื่องร้องเรียน */ @@ -162,6 +163,7 @@ function getData() { data.investigationStatusResult = dataList.investigationStatusResult; data.investigationExtendStatus = dataList.investigationExtendStatus; data.investigationDaysExtend = dataList.investigationDaysExtend; + data.isDisciplinary = dataList.isDisciplinary; data.investigationExtendHistory = dataList.investigationExtendHistory ?? []; }) diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue index 035023387..d94502151 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue @@ -128,6 +128,7 @@ const formData = reactive({ organizationId: "", persons: [], investigationExtendHistory: [], + isDisciplinary:false }); /** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */ @@ -292,7 +293,7 @@ watch(props.data, async () => { mainStore.rowsAdd = props.data.persons; mainStore.rowsCheck = mainStore.rowsAdd.filter( - (item: any) => item.isSend === "NEW" + (item: any) => item.isDisciplinary === false && item.isSend === 'NEW' ); const dataMap = props.data.directors.map((item: any) => ({ @@ -679,7 +680,7 @@ onMounted(async () => {
{
{
-
-
+ +
{
+
+ +
-
- -
-
+
diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue b/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue index 49a7b8cf3..bac1a5a54 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue @@ -64,7 +64,8 @@ async function getList() { config.API.investigateMain( currentPage.value, rowsPerPage.value, - filterKeyword.value + filterKeyword.value, + statusFilter.value ) ) .then((res) => { @@ -123,7 +124,7 @@ onMounted(async () => { option-label="name" option-value="id" :options="dataInvestigate.statusOptions" - @update:model-value="dataUpdate" + @update:model-value="getList()" />
diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue index 66c959324..fc6bc9f12 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue @@ -22,13 +22,13 @@ const router = useRouter(); const filter = ref(""); //search data table const page = ref(1); const maxPage = ref(1); - +const status = ref("ALL"); async function fetchListDisciplinary() { showLoader(); await http .get( config.API.disciplineDisciplinary() + - `?page=${page.value}&pageSize=${rowsPerPage.value}&keyword=${filter.value}` + `?page=${page.value}&pageSize=${rowsPerPage.value}&keyword=${filter.value}&status=${status.value}` ) .then((res) => { const data = res.data.result.data; @@ -55,6 +55,11 @@ async function updatePagingProp(rowPerpage: number, pageCurrent: number) { await fetchListDisciplinary(); } +function filterStatus(statusReturn: string) { + status.value = statusReturn; + fetchListDisciplinary() +} + /**เมื่อเริ่มโหลดหน้า * ส่งข้อมูลจำลองไปยัง store */ @@ -86,6 +91,7 @@ onMounted(async () => { :fetchListDisciplinary="fetchListDisciplinary" @update:pagination="updatePagingProp" v-model:open-edit="openEdit" + :filterStatus="filterStatus" >
diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue index 47db89882..ef52c883a 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue @@ -33,6 +33,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + filterStatus: { + type: Function, + default: () => console.log("not function"), + }, nornmalData: { type: Boolean, defualt: true, @@ -114,7 +118,7 @@ watch( ); function dataUpdate() { - console.log(statusFilter.value); + props.filterStatus(statusFilter.value); } function filterFn() { diff --git a/src/modules/11_discipline/components/4_Result/MainPage.vue b/src/modules/11_discipline/components/4_Result/MainPage.vue index 275b6f0d9..a3dcd7f45 100644 --- a/src/modules/11_discipline/components/4_Result/MainPage.vue +++ b/src/modules/11_discipline/components/4_Result/MainPage.vue @@ -26,14 +26,14 @@ const page = ref(1); const pageSize = ref(10); const maxPage = ref(1); const filter = ref(""); - +const status = ref("ALL"); /** function เรียกรายการสรุปผลการพิจารณาทางวินัย*/ async function fetchListResult() { showLoader(); await http .get( config.API.listResult() + - `?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}` + `?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}&status=${status.value}` ) .then(async (res) => { const data = res.data.result.data; @@ -66,6 +66,11 @@ function openEdit(id: string) { router.push(`/discipline-result/${id}`); } +function filterStatus(statusReturn: string) { + status.value = statusReturn; + fetchListResult(); +} + /**เมื่อเริ่มโหลดหน้า * ส่งข้อมูลจำลองไปยัง store */ @@ -97,6 +102,7 @@ onMounted(async () => { :maxPage="maxPage" @update:queryString="updateQueryString" v-model:open-edit="openEdit" + :filterStatus="filterStatus" >
diff --git a/src/modules/11_discipline/components/4_Result/Table.vue b/src/modules/11_discipline/components/4_Result/Table.vue index 94f059ebb..0cfb4787e 100644 --- a/src/modules/11_discipline/components/4_Result/Table.vue +++ b/src/modules/11_discipline/components/4_Result/Table.vue @@ -30,6 +30,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + filterStatus: { + type: Function, + default: () => console.log("not function"), + }, nornmalData: { type: Boolean, defualt: true, @@ -94,7 +98,7 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => { }); function dataUpdate() { - console.log(statusFilter.value); + props.filterStatus(statusFilter.value); } function updateInput(value: string | number | null) { diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/DialogInvestigateTotal.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/DialogInvestigateTotal.vue index 7cb9358ed..542289b18 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/DialogInvestigateTotal.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/DialogInvestigateTotal.vue @@ -9,13 +9,16 @@ import { } from "vue"; import { QForm, useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; - +import type { DirectorRowsResponse } from "@/modules/11_discipline/interface/response/director"; import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue"; +import config from "@/app.config"; +import http from "@/plugins/http"; const $q = useQuasar(); const mixin = useCounterMixin(); const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin; -const listCheck = ref(""); +const listCheck = ref(); + const props = defineProps({ modal: Boolean, title: { @@ -23,87 +26,43 @@ const props = defineProps({ default: "", }, close: Function, + type: String, + dataList: Object, }); const dataList = ref(); -const listInvestigateDetail = [ - { - id: "1", - title: "test1", - type: "x1", - }, - { - id: "2", - title: "test2", - type: "x2", - }, - { - id: "3", - title: "test3", - type: "x3", - }, - { - id: "4", - title: "test4", - type: "x4", - }, - { - id: "5", - title: "test5", - type: "x5", - }, - { - id: "6", - title: "test6", - type: "x6", - }, - { - id: "7", - title: "test7", - type: "x7", - }, -]; +const listInvestigateDetail = ref([]); -function clickList(id: string, type: string) { - const data = [ - { - id: "1", - title: "นาย 1", - type: "x1", - }, - { - id: "2", - title: "นาย 2", - type: "x1", - }, - { - id: "3", - title: "นาย 3", - type: "x2", - }, - { - id: "4", - title: "นาย 4", - type: "x2", - }, - { - id: "5", - title: "นาย 5", - type: "x3", - }, - { - id: "6", - title: "นาย 6", - type: "x3", - }, - { - id: "7", - title: "นาย 7", - type: "x4", - }, - ]; - dataList.value = data.filter((r) => r.type == type); - listCheck.value = id; +function clickList(index: number, data: any) { + listCheck.value = index; + dataList.value = data.map((i: any) => ({ + commandNo: i.commandNo, + duty: i.duty, + prefix: i.prefix, + firstName: i.firstName, + lastName: i.lastName, + fullName:`${i.prefix}${i.firstName} ${i.lastName}` + })); + console.log(data); } + +watch(props, () => { + if (props) { + const data: DirectorRowsResponse = props.dataList as DirectorRowsResponse; + showLoader(); + http + .get(config.API.historyDirectorbyId(data.id, props.type as string)) + .then((res) => { + console.log(res.data.result); + listInvestigateDetail.value = res.data.result; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + } +}); diff --git a/src/modules/11_discipline/interface/request/investigateFact.ts b/src/modules/11_discipline/interface/request/investigateFact.ts index 2a216b4a6..f3c6a3cd8 100644 --- a/src/modules/11_discipline/interface/request/investigateFact.ts +++ b/src/modules/11_discipline/interface/request/investigateFact.ts @@ -26,6 +26,7 @@ interface FormData { organizationId: string; persons: object | null; investigationExtendHistory: ExtendHistoryObject[]; + isDisciplinary:boolean } interface ExtendHistoryObject { diff --git a/src/modules/11_discipline/interface/response/director.ts b/src/modules/11_discipline/interface/response/director.ts index c5710219d..c1b7350ea 100644 --- a/src/modules/11_discipline/interface/response/director.ts +++ b/src/modules/11_discipline/interface/response/director.ts @@ -1,8 +1,8 @@ interface DirectorRows { - id:string - prefix:string - firstName:string - lastName:string + id: string + prefix: string + firstName: string + lastName: string position: string; email: string; phone: string; @@ -10,11 +10,11 @@ interface DirectorRows { totalDisciplinary: number } interface DirectorRowsResponse { - id:string - fullName:string - position:string - email:string - phone:string + id: string + fullName: string + position: string + email: string + phone: string totalInvestigate: number totalDisciplinary: number }