แก้ questionnair

This commit is contained in:
AnandaTon 2023-08-22 12:14:27 +07:00
parent 9be585065b
commit b3edfb9d4f
2 changed files with 21 additions and 16 deletions

View file

@ -38,7 +38,7 @@ export default [
},
{
path: "/leave/result",
path: "/leave/result/:id",
name: "resultLeave",
component: ResultQuestionair,
meta: {

View file

@ -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<string>("")
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`)
}