diff --git a/src/modules/03_leave/router.ts b/src/modules/03_leave/router.ts index 5fc2b1a..1607954 100644 --- a/src/modules/03_leave/router.ts +++ b/src/modules/03_leave/router.ts @@ -38,7 +38,7 @@ export default [ }, { - path: "/leave/result", + path: "/leave/result/:id", name: "resultLeave", component: ResultQuestionair, meta: { diff --git a/src/modules/03_leave/views/result.vue b/src/modules/03_leave/views/result.vue index dcd7877..28df978 100644 --- a/src/modules/03_leave/views/result.vue +++ b/src/modules/03_leave/views/result.vue @@ -7,13 +7,16 @@ import { useCounterMixin } from "@/stores/mixin" import http from "@/plugins/http" import config from "@/app.config" +const route = useRoute() const router = useRouter() const $q = useQuasar() const mixin = useCounterMixin() const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = mixin const leaveReason = ref("") +const id = ref("") const noteReason = ref("") const routeName = router.currentRoute.value.name +const questionId = route.params.id.toString() const saveForm = () => { $q.dialog({ @@ -32,21 +35,23 @@ const saveForm = () => { .onDismiss(() => {}) } -const createResult = async () => { - // const formData = new FormData() - // // formData.append("Location", tranferOrg.value) - // // formData.append("SendDate", dateToISO(dateCommand.value)) - // await http - // .post(config.API.listResign(), formData) - // .then((res: any) => { - // // console.log(res); - // success($q, "บันทึกข้อมูลสำเร็จ") - // router.push(`/leave`) - // }) - // .catch((e: any) => { - // messageError($q, e) - // console.log(e) - // }) +const createResult = async (questionId: string) => { + const formData = new FormData() + console.log(formData) + + formData.append("Location", leaveReason.value) + formData.append("SendDate", noteReason.value) + await http + .post(config.API.questionnaireByid(questionId), formData) + .then((res: any) => { + // console.log(res); + success($q, "บันทึกข้อมูลสำเร็จ") + router.push(`/leave`) + }) + .catch((e: any) => { + messageError($q, e) + console.log(e) + }) success($q, "บันทึกข้อมูลสำเร็จ") router.push(`/leave`) }