From d868f40dfe6973fc91f685ed099efbea33a1d812 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 8 Nov 2024 14:03:01 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20-em?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/leave/api.leave.ts | 4 ++++ src/modules/03_retire/views/DialogRetire.vue | 3 ++- src/modules/03_retire/views/addRetire.vue | 23 ++++++++++++++------ src/modules/03_retire/views/main.vue | 6 ++++- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/api/leave/api.leave.ts b/src/api/leave/api.leave.ts index 24f1cb7..8c2b537 100644 --- a/src/api/leave/api.leave.ts +++ b/src/api/leave/api.leave.ts @@ -6,12 +6,16 @@ const holiday = `${env.API_URI}/metadata/holiday/`; export default { listUser: () => `${retirementResign}/resign/user`, + listUserByType:(type:string) => `${retirementResign}/resign${type}/user`, listResign: () => `${retirementResign}/resign`, + listResignByType: (type:string) => `${retirementResign}/resign${type}`, resingByid: (id: string) => `${retirementResign}/resign/${id}`, + resingByidType: (type:string,id: string) => `${retirementResign}/resign${type}/${id}`, questionnaireByid: (id: string) => `${retirementResign}/resign/questionnaire/${id}`, listquestionnaire: () => `${retirementResign}/resign/questionnaire`, cancelResign: (id: string) => `${retirementResign}/resign/cancel/${id}`, + cancelResignByType: (type:string,id: string) => `${retirementResign}/resign${type}/cancel/${id}`, // คำถาม questionList: () => `${retirementResign}/resign/questionnaire/question`, diff --git a/src/modules/03_retire/views/DialogRetire.vue b/src/modules/03_retire/views/DialogRetire.vue index 9c5de91..8b3fc2f 100644 --- a/src/modules/03_retire/views/DialogRetire.vue +++ b/src/modules/03_retire/views/DialogRetire.vue @@ -17,6 +17,7 @@ const { dialogConfirm, messageError, showLoader, hideLoader, success } = mixin; const id = ref(route.params.id ? route.params.id.toString() : ""); const modal = defineModel("modal", { required: true }); +const link = defineModel("link", { required: true }); const props = defineProps({ fectData: { type: Function, require: true }, }); @@ -41,7 +42,7 @@ function onSubmit() { () => { showLoader(); http - .put(config.API.cancelResign(id.value), { + .put(config.API.cancelResignByType(link.value, id.value), { reason: reason.value, }) .then(() => { diff --git a/src/modules/03_retire/views/addRetire.vue b/src/modules/03_retire/views/addRetire.vue index 7cf94d4..a1e3404 100644 --- a/src/modules/03_retire/views/addRetire.vue +++ b/src/modules/03_retire/views/addRetire.vue @@ -7,6 +7,7 @@ import { useRouter, useRoute } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; +import { useDataStore } from "@/stores/data"; import Dialog from "@/modules/03_retire/views/DialogRetire.vue"; import Header from "@/components/DialogHeader.vue"; @@ -15,6 +16,8 @@ import Workflow from "@/components/Workflow/Main.vue"; const $q = useQuasar(); const route = useRoute(); const router = useRouter(); +const link = ref(""); +const dataStore = useDataStore(); const routeName = router.currentRoute.value.name; const mixin = useCounterMixin(); const { @@ -77,10 +80,14 @@ async function onSubmit() { formData.append("file", files.value); http - .post(config.API.listResign(), formData) + .post(config.API.listResignByType(link.value), formData) .then((res) => { let id = res.data.result.id; - router.push(`/retire/result/${id}`); + if (dataStore.officerType == "OFFICER") { + router.push(`/retire/result/${id}`); + } else { + router.push(`/retire/result`); + } success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((e) => { @@ -110,7 +117,7 @@ function cancelResing() { async function fectDataresign(id: string) { showLoader(); await http - .get(config.API.resingByid(id)) + .get(config.API.resingByidType(link.value, id)) .then((res) => { let data = res.data.result; tranferOrg.value = data.location; @@ -144,7 +151,8 @@ function downloadFile(data: string) { /** * เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้ */ -onMounted(() => { +onMounted(async () => { + link.value = await dataStore.getProFileType(); if (route.params.id !== undefined) { fectDataresign(id.value); } @@ -197,7 +205,7 @@ onMounted(() => { /> { dataDetail.status !== 'DELETE' && dataDetail.status !== 'CANCEL' && dataDetail.status !== 'DONECANCEL' && - dataDetail.status !== 'DONEREJECT' + dataDetail.status !== 'DONEREJECT' && + dataStore.officerType == 'OFFICER' " > @@ -602,7 +611,7 @@ onMounted(() => { - + diff --git a/src/modules/03_retire/views/main.vue b/src/modules/03_retire/views/main.vue index 1dc39e3..bd48787 100644 --- a/src/modules/03_retire/views/main.vue +++ b/src/modules/03_retire/views/main.vue @@ -7,6 +7,7 @@ import { useRouter } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; +import { useDataStore } from "@/stores/data"; import { useRestDataStore } from "@/modules/03_retire/store"; import type { @@ -16,6 +17,8 @@ import type { const $q = useQuasar(); const router = useRouter(); +const link = ref(""); +const dataStore = useDataStore(); const mixin = useCounterMixin(); const { date2Thai, messageError, showLoader, hideLoader } = mixin; const RestData = useRestDataStore(); @@ -89,7 +92,7 @@ const columns = ref([ /** ดึงข้อมูล */ async function fectListleave() { await http - .get(config.API.listUser()) + .get(config.API.listUserByType(link.value)) .then(async (res) => { let data = await res.data.result; rows.value = data.map((e: MainListResponse) => ({ @@ -123,6 +126,7 @@ onBeforeMount(() => { * เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้ */ onMounted(async () => { + link.value = await dataStore.getProFileType(); await fectListleave(); hideLoader(); });