feat
This commit is contained in:
parent
9256f6cd16
commit
6aa8a61b40
3 changed files with 362 additions and 2 deletions
118
src/modules/04_registryPerson/components/DialogTransfer.vue
Normal file
118
src/modules/04_registryPerson/components/DialogTransfer.vue
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
div
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** import components*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
//use
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, messageError, success } = useCounterMixin();
|
||||
|
||||
//props
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
|
||||
const form = reactive({
|
||||
tranferOrg: "",
|
||||
noteReason: "",
|
||||
files: null as File | null,
|
||||
});
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
showLoader();
|
||||
const formData = new FormData();
|
||||
formData.append("Organization", form.tranferOrg);
|
||||
formData.append("Reason", form.noteReason);
|
||||
if (form.files) {
|
||||
formData.append("file", form.files);
|
||||
}
|
||||
|
||||
// await http.post(config.API.listtransfer(), formData);
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
|
||||
/** function ปิด popup*/
|
||||
function closeDialog() {
|
||||
modal.value = false;
|
||||
form.tranferOrg = "";
|
||||
form.noteReason = "";
|
||||
form.files = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="width: 40vw; max-width: 50vw">
|
||||
<q-form greedy @submit.prevent="onSubmit">
|
||||
<DialogHeader :tittle="'ขอโอน'" :close="closeDialog" />
|
||||
<q-separator />
|
||||
|
||||
<q-card-section class="q-pa-md">
|
||||
<div class="col-12 row q-col-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
dense
|
||||
outlined
|
||||
v-model="form.tranferOrg"
|
||||
hide-bottom-space
|
||||
label="หน่วยงานที่ขอโอนไป"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกหน่วยงานที่ขอโอนไป'}`]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
dense
|
||||
outlined
|
||||
v-model="form.noteReason"
|
||||
label="เหตุผล"
|
||||
hide-bottom-space
|
||||
type="textarea"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-file
|
||||
v-model="form.files"
|
||||
class="inputgreen"
|
||||
outlined
|
||||
dense
|
||||
accept=".pdf"
|
||||
label="เอกสารเพิ่มเติม"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" /> </template
|
||||
></q-file>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn type="submit" :label="`บันทึก`" color="public">
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue