แก้ ส่งไปพัก ราช การ // map idCard

This commit is contained in:
STW_TTTY\stwtt 2024-10-03 15:04:03 +07:00
parent 7d4d2e157c
commit e93e6ed6c1
4 changed files with 38 additions and 15 deletions

View file

@ -1,17 +1,28 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
import { title } from "process";
const modal = defineModel<boolean>("modal", { required: true });
const mixin = useCounterMixin();
const $q = useQuasar();
const { dialogConfirm, dialogMessageNotify } = mixin;
const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
id: i.id,
prefix: i.prefix,
firstName: i.firstName,
lastName: i.lastName,
citizenId: i.idcard,
}));
});
const rows = ref<any[]>([]);
const props = defineProps({
title: {
@ -60,18 +71,30 @@ const initialPagination = ref<any>({
/** ฟังชั่นส่งคนไปออกคำสั่ง */
function onclickSend() {
if (selected.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 บุคคล");
} else {
if (props.title == "ส่งไปพักราชการ") {
dialogConfirm(
$q,
async () => {
modalCommand.value = true;
emit("returnPerson", selected.value);
modal.value = false;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
`ยืนยันการ${props.title}`,
`ต้องการยืนยันการ${props.title}หรือไม่`
);
} else {
if (selected.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 บุคคล");
} else {
dialogConfirm(
$q,
async () => {
modalCommand.value = true;
modal.value = false;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
}
}
}
@ -96,7 +119,6 @@ watch(
<q-dialog v-model="modal">
<q-card style="width: 820px; max-width: 80vw">
<DialogHeader :tittle="props.title" :close="onClickClose" />
<q-separator />
<q-card-section class="q-pt-none q-mt-md">
@ -208,7 +230,7 @@ watch(
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-32'"
:persons="selected"
:persons="selected ? dataMapToSend : []"
/>
</template>