From 79288c80f5dd39a1e22b53b5acd09b6580e3d323 Mon Sep 17 00:00:00 2001 From: waruneeta Date: Mon, 15 Jan 2024 12:07:13 +0700 Subject: [PATCH] =?UTF-8?q?-=20=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1?= =?UTF-8?q?=E0=B9=88=E0=B8=87=20=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20get=20=E0=B9=80=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B8=A3=E0=B9=89=E0=B8=AD=E0=B8=87=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=99=20-=20=E0=B9=81=E0=B8=81=E0=B9=89?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/05_placement/api.placement.ts | 16 ++-- src/modules/10_order/components/Detail.vue | 2 +- .../10_order/components/step/step01.vue | 90 ++++++++++++++++--- .../10_order/interface/response/Order.ts | 14 ++- src/modules/10_order/store.ts | 9 ++ 5 files changed, 111 insertions(+), 20 deletions(-) diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index 547dabc10..d0fb7b902 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -1,5 +1,6 @@ import env from "../index"; const placement = `${env.API_PLACEMENT_URI}/placement`; +const disciplineReportList = `${env.API_URI}/discipline/complaint/report`; const orgTree = `${env.API_URI_ORG_TREE}`; const order = `${env.API_PLACEMENT_URI}`; const receive = `${env.API_PLACEMENT_URI}/placement/Receive`; @@ -10,7 +11,6 @@ const placemenRelocation = `${placement}/relocation`; const placemenOther = `${env.API_URI}/retirement/other`; const placemenAppointment = `${placement}/appointment`; - export default { MainDetail: (year: number) => `${placement}/exam/${year}`, yearOptions: () => `${placement}/fiscal`, @@ -60,10 +60,10 @@ export default { // clear Position clearPosition: (personalId: string) => `${placement}/position/clear/${personalId}`, - // Document + // Document documentByid: (personalId: string) => `${placement}/doc/${personalId}`, - documentDelid: (personalId: string, docid: string) => `${placement}/doc/${personalId}/${docid}`, - + documentDelid: (personalId: string, docid: string) => + `${placement}/doc/${personalId}/${docid}`, // order organizationsOrder: () => `${order}/order/organizations`, @@ -99,7 +99,7 @@ export default { orderReady: (id: string) => `${order}/order/ready/${id}`, attachmentOrder: (orderId: string) => `${order}/order/attachment/${orderId}`, searchOrderprofile: () => `${order}/order/search/profile/command`, - + disciplineReportList, //receive ระบบรับโอน receiveData: () => `${receive}`, receiveReport: `${receive}/report`, @@ -168,7 +168,9 @@ export default { //appoint-employee appointEmployee: () => `${placement}/appointment/temp`, appointEmployeeByid: (id: string) => `${placement}/appointment/temp/${id}`, - appointEmployeePosition: (id: string) => `${placement}/appointment/temp/position/${id}`, - appointEmployeeOrder: (typeId: string) => `${placement}/appointment/temp/report/${typeId}`, + appointEmployeePosition: (id: string) => + `${placement}/appointment/temp/position/${id}`, + appointEmployeeOrder: (typeId: string) => + `${placement}/appointment/temp/report/${typeId}`, apppointmentPositionUse: () => `${placement}/appointment/temp/use`, }; diff --git a/src/modules/10_order/components/Detail.vue b/src/modules/10_order/components/Detail.vue index 9e645066e..ee2d77f18 100644 --- a/src/modules/10_order/components/Detail.vue +++ b/src/modules/10_order/components/Detail.vue @@ -101,7 +101,7 @@ onMounted(() => { color="primary" class="q-mr-sm" @click=" - route.name == 'disciplineOrderDatail' + route.name == 'disciplineOrderDatail' || route.name == 'disciplineOrderAdd' ? router.push(`/discipline-order`) : router.push(`/order`) " diff --git a/src/modules/10_order/components/step/step01.vue b/src/modules/10_order/components/step/step01.vue index 0ae1e3e5c..4a10eabda 100644 --- a/src/modules/10_order/components/step/step01.vue +++ b/src/modules/10_order/components/step/step01.vue @@ -8,8 +8,12 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { treeTab } from "@/modules/05_placement/interface/index/Main"; import type { ResponseOrganiz } from "@/modules/05_placement/interface/response/Order"; +import type { complaintLists } from "@/modules/10_order/interface/response/Order"; import type { QTableProps } from "quasar"; -import type { DataOption1, OrederResult } from "@/modules/10_order/interface/index/Main"; +import type { + DataOption1, + OrederResult, +} from "@/modules/10_order/interface/index/Main"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import { useOrderPlacementDataStore } from "@/modules/10_order/store"; @@ -121,12 +125,6 @@ const caseFault = ref(""); const result = ref(""); const refRaw = ref(""); const complaintId = ref(""); -const complaintOption = ref([ - { - id: "00000000-0000-0000-0000-000000000000", - name: "ทุจริตต่อหน้าที่", - }, -]); const typeOrderFilter = ref({ typeOrderOption: [], @@ -138,6 +136,13 @@ onMounted(async () => { } else { await fecthTypeOption("noData"); } + + if ( + route.name == "disciplineOrderDatail" || + route.name == "disciplineOrderAdd" + ) { + await getComplaint(); + } }); // เลือกคำสั่งโดย watch(byOrder, async () => { @@ -312,13 +317,62 @@ const fecthCommand = async () => { }); }; -const selectCMP = (selectOrder: OrederResult) => { +const selectCMP = async (selectOrder: OrederResult) => { if (selectOrder != null) { fecthExamRoundOption(selectOrder.commandCode); if (selectOrder.commandCode === "C-PM-10") { nodeTree(); } nameOrder.value = DataStore.nameOrderFilter(selectOrder.commandCode); + + // บรรจุ แต่งตั้ง ย้าย 01 - 04 + if ( + selectOrder.commandCode == "C-PM-01" || + selectOrder.commandCode == "C-PM-02" || + selectOrder.commandCode == "C-PM-03" || + selectOrder.commandCode == "C-PM-04" + ) { + fecthExamRoundOption(selectOrder.commandCode); + } + + // คำสั่งวินัย + // console.log(DataStore.complaintLists) + DataStore.complaintOption = []; + if ( + selectOrder.commandCode == "C-PM-25" || + selectOrder.commandCode == "C-PM-26" + ) { + await DataStore.complaintLists + .filter((x: complaintLists) => x.isDisciplinary === true) + .map((val: complaintLists) => { + DataStore.complaintOption.push({ id: val.id, name: val.title }); + }); + } else if (selectOrder.commandCode == "C-PM-32") { + await DataStore.complaintLists + .filter( + (x: complaintLists) => + x.isInvestigate === true || + x.isDisciplinary === true || + x.isResult === true + ) + .map((val: complaintLists) => { + DataStore.complaintOption.push({ id: val.id, name: val.title }); + }); + } else if ( + selectOrder.commandCode == "C-PM-19" || + selectOrder.commandCode == "C-PM-20" || + selectOrder.commandCode == "C-PM-27" || + selectOrder.commandCode == "C-PM-28" || + selectOrder.commandCode == "C-PM-29" || + selectOrder.commandCode == "C-PM-30" || + selectOrder.commandCode == "C-PM-31" + ) { + await DataStore.complaintLists + .filter((x: complaintLists) => x.isResult === true) + .map((val: complaintLists) => { + DataStore.complaintOption.push({ id: val.id, name: val.title }); + }); + } } //01-04 examRound.value = ""; @@ -391,6 +445,21 @@ const fecthExamRoundOption = async (commandCode: string) => { }); }; +/** + * ดึงรายการเรื่องร้องเรียนจาก API + */ +async function getComplaint() { + await http + .get(config.API.disciplineReportList) + .then((res: any) => { + const dataArr = res.data.result; + DataStore.complaintLists = dataArr; + }) + .catch((e) => { + messageError($q, e); + }); +} + // บันทึกข้อมูล const submit = async () => { let signBy = null; @@ -557,6 +626,7 @@ const submit = async () => { } }); }; + // สร้างคำสัง const createListOrder = async (formData: Object, type: string) => { showLoader(); @@ -1936,7 +2006,7 @@ const getClass = (val: boolean) => { :label="`${'เรื่องร้องเรียน'}`" map-options option-label="name" - :options="complaintOption" + :options="DataStore.complaintOption" option-value="id" use-input input-debounce="0" @@ -2160,7 +2230,7 @@ const getClass = (val: boolean) => { :label="`${'เรื่องร้องเรียน'}`" map-options option-label="name" - :options="complaintOption" + :options="DataStore.complaintOption" option-value="id" use-input input-debounce="0" diff --git a/src/modules/10_order/interface/response/Order.ts b/src/modules/10_order/interface/response/Order.ts index 375361a97..10c15ef4f 100644 --- a/src/modules/10_order/interface/response/Order.ts +++ b/src/modules/10_order/interface/response/Order.ts @@ -5,7 +5,7 @@ interface ResponseData { personalId: string; selectStatus: boolean; sequence: number; - refRecordId: string + refRecordId: string; } interface ResponseOrganiz { @@ -41,4 +41,14 @@ interface DataCopyOrder { mutiselect: number[]; } -export type { ResponseData, ResponseOrganiz, ResponseCopyOrder, DataCopyOrder }; +interface complaintLists { + id: string; + title: string; + dateConsideration: Date | null; + isComplaint: boolean; + isInvestigate: boolean; + isDisciplinary: boolean; + isResult: boolean; +} + +export type { ResponseData, ResponseOrganiz, ResponseCopyOrder, DataCopyOrder, complaintLists }; diff --git a/src/modules/10_order/store.ts b/src/modules/10_order/store.ts index 2ef0be8e8..c5262126a 100644 --- a/src/modules/10_order/store.ts +++ b/src/modules/10_order/store.ts @@ -1,14 +1,18 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import type { FormOrderPlacementMainData } from "@/modules/10_order/interface/request/Main"; +import type { complaintLists } from "@/modules/10_order/interface/response/Order"; +import type { DataOption1 } from "@/modules/10_order/interface/index/Main"; export const useOrderPlacementDataStore = defineStore("placementOrder", () => { interface placementOrder { mappingPosition: { columns: String[] }; } + const placementOrderData = ref({ mappingPosition: { columns: [] }, }); + const changePlacementColumns = (system: String, val: String[]) => { if (system == "mappingPosition") placementOrderData.value.mappingPosition.columns = val; @@ -168,6 +172,9 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => { } }; + const complaintLists = ref([]); + const complaintOption = ref([]); + return { placementOrderData, changePlacementColumns, @@ -178,5 +185,7 @@ export const useOrderPlacementDataStore = defineStore("placementOrder", () => { DataMainYearSetOrder, DataMainOrder, nameOrderFilter, + complaintLists, + complaintOption, }; });