2023-08-25 17:08:25 +07:00
|
|
|
<script setup lang="ts">
|
2023-08-26 15:59:09 +07:00
|
|
|
import { ref, watch } from "vue";
|
2023-08-25 17:08:25 +07:00
|
|
|
import { QForm, useQuasar } from "quasar";
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
|
2023-08-26 15:59:09 +07:00
|
|
|
import { useRouter } from "vue-router";
|
2023-08-25 17:08:25 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const myForm = ref<QForm>();
|
|
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const {
|
|
|
|
|
dialogConfirm,
|
|
|
|
|
} = mixin;
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const routeName = router.currentRoute.value.name;
|
|
|
|
|
const amount = ref<number | null>();
|
|
|
|
|
const Org = ref<string | null>("");
|
|
|
|
|
const grandCross = ref<string | null>("");
|
|
|
|
|
const closeModal = () => {
|
|
|
|
|
props.close();
|
|
|
|
|
};
|
2023-08-26 15:59:09 +07:00
|
|
|
|
2023-08-25 17:08:25 +07:00
|
|
|
const props = defineProps({
|
|
|
|
|
modal: Boolean,
|
|
|
|
|
save: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
close: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2023-08-26 15:59:09 +07:00
|
|
|
insigniaList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: []
|
2023-08-25 17:08:25 +07:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2023-08-26 15:59:09 +07:00
|
|
|
watch(props, () => {
|
|
|
|
|
if (props.modal) {
|
|
|
|
|
grandCross.value = ""
|
|
|
|
|
Org.value = ""
|
|
|
|
|
amount.value = null
|
2023-08-25 17:08:25 +07:00
|
|
|
}
|
2023-08-26 15:59:09 +07:00
|
|
|
console.log("insigniaList===>", props.insigniaList)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const clickSave = () => {
|
|
|
|
|
dialogConfirm($q, () => props.save(grandCross.value, amount.value));
|
2023-08-25 17:08:25 +07:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<q-dialog v-model="props.modal" persistent>
|
|
|
|
|
<q-card style="width: 800px">
|
|
|
|
|
<q-toolbar class="q-py-sm">
|
2023-08-25 19:10:48 +07:00
|
|
|
<q-toolbar-title class="text-h6">จัดสรรเครื่องราชฯ </q-toolbar-title>
|
2023-08-26 15:59:09 +07:00
|
|
|
<q-btn icon="close" unelevated round dense @click="closeModal"
|
|
|
|
|
style="color: #ff8080; background-color: #ffdede" />
|
2023-08-25 17:08:25 +07:00
|
|
|
</q-toolbar>
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
|
|
<q-form ref="myForm">
|
|
|
|
|
<div class="q-pa-md">
|
2023-08-26 15:59:09 +07:00
|
|
|
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
|
2023-08-25 17:08:25 +07:00
|
|
|
<div class="col-6">
|
2023-08-26 15:59:09 +07:00
|
|
|
<q-select hide-bottom-space :options="insigniaList" dense borderless
|
|
|
|
|
option-label="name" option-value="id" emit-value map-options outlined options-cover v-model="grandCross"
|
|
|
|
|
:label="routeName == 'insigniaAllocate' ? `เครื่องราชฯ` : `เลือกหน่วยงาน`" />
|
2023-08-25 17:08:25 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 col-sm-6">
|
2023-08-26 15:59:09 +07:00
|
|
|
<q-input hide-bottom-space outlined class="inputgreen" v-model="amount" dense lazy-rules type="number"
|
|
|
|
|
label="จำนวน" />
|
2023-08-25 17:08:25 +07:00
|
|
|
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-form>
|
|
|
|
|
|
|
|
|
|
<q-separator />
|
|
|
|
|
<div class="row justify-end q-py-sm">
|
|
|
|
|
<div class="q-px-md">
|
|
|
|
|
<q-btn label="บันทึก" @click="clickSave" color="public" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-dialog>
|
|
|
|
|
</template>
|