แก้ไขหน้าที่ประธานสืบสวน สอบสวน
This commit is contained in:
parent
9b83d6bfd0
commit
a07cc6d2a2
4 changed files with 99 additions and 49 deletions
|
|
@ -280,6 +280,7 @@ watch(props.data, async () => {
|
|||
|
||||
const dataMap = props.data.directors.map((item: any) => ({
|
||||
id: item.id,
|
||||
directorId: item.directorId,
|
||||
name: `${item.prefix}${item.firstName} ${item.lastName}`,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
|
|
@ -287,6 +288,7 @@ watch(props.data, async () => {
|
|||
position: item.position,
|
||||
email: item.email,
|
||||
phone: item.phone,
|
||||
duty: item.duty,
|
||||
}));
|
||||
|
||||
rows.value = dataMap;
|
||||
|
|
@ -552,30 +554,34 @@ function emitPerson(data: FormData[]) {
|
|||
}
|
||||
|
||||
const modalEditDirector = ref<boolean>(false);
|
||||
function openEditDirector(id: string) {
|
||||
const editDirectorId = ref<string>();
|
||||
const dutyVal = ref<string>();
|
||||
function openEditDirector(id: string, duty: string) {
|
||||
editDirectorId.value = id;
|
||||
modalEditDirector.value = true;
|
||||
dutyVal.value = duty;
|
||||
}
|
||||
|
||||
function closeEditDirector(id: string) {
|
||||
function closeEditDirector() {
|
||||
modalEditDirector.value = false;
|
||||
}
|
||||
|
||||
async function saveDuty(id: string) {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .put(config.API.reportresult(idPath.value, type.value as string), body)
|
||||
// .then((res: any) => {
|
||||
// success($q, `${props.title}สำเร็จ`);
|
||||
// props.closeModal?.();
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// props.getData?.();
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
const saveDuty = async (id: string, duty: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.investigateEditDuty(formData.id, id), { duty: duty })
|
||||
.then((res: any) => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
closeEditDirector();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
props.getData?.();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
mainStore.rowsAdd = [];
|
||||
|
|
@ -1156,7 +1162,12 @@ onMounted(async () => {
|
|||
flat
|
||||
round
|
||||
color="blue"
|
||||
@click="openEditDirector(props.row.id)"
|
||||
@click="
|
||||
openEditDirector(
|
||||
props.row.directorId,
|
||||
props.row.duty
|
||||
)
|
||||
"
|
||||
icon="mdi-pencil-outline"
|
||||
>
|
||||
<q-tooltip>แก้ไข</q-tooltip>
|
||||
|
|
@ -1164,7 +1175,9 @@ onMounted(async () => {
|
|||
<DialogDuty
|
||||
:modal="modalEditDirector"
|
||||
:close-popup="closeEditDirector"
|
||||
@save="saveDuty(props.row.id)"
|
||||
:id="editDirectorId"
|
||||
:duty="dutyVal"
|
||||
:save="saveDuty"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
|
|
|
|||
|
|
@ -45,8 +45,14 @@ const investigateDis = useInvestigateDisStore();
|
|||
const mainStore = useDisciplineMainStore();
|
||||
const { filterSelector } = complainstStore; // function จาก store complainstStore
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, showLoader, hideLoader, dialogConfirm, messageError } =
|
||||
mixin;
|
||||
const {
|
||||
date2Thai,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
messageError,
|
||||
success,
|
||||
} = mixin;
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
|
@ -308,6 +314,7 @@ async function fetchDatadetail() {
|
|||
);
|
||||
/** MAP รายชื่อกรรมการ หน้าหลัก */
|
||||
const dataMap = props.data.director.map((item: any) => ({
|
||||
idRaw: item.id,
|
||||
id: item.directorId,
|
||||
name: `${item.prefix}${item.firstName} ${item.lastName}`,
|
||||
prefix: item.prefix,
|
||||
|
|
@ -316,6 +323,7 @@ async function fetchDatadetail() {
|
|||
position: item.position,
|
||||
email: item.email,
|
||||
phone: item.phone,
|
||||
duty: item.duty,
|
||||
}));
|
||||
|
||||
rows.value = dataMap;
|
||||
|
|
@ -346,23 +354,6 @@ function deletePerson(id: string) {
|
|||
mainStore.rowsAdd = updatedRows;
|
||||
}
|
||||
|
||||
async function saveDuty(id: string) {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .put(config.API.reportresult(idPath.value, type.value as string), body)
|
||||
// .then((res: any) => {
|
||||
// success($q, `${props.title}สำเร็จ`);
|
||||
// props.closeModal?.();
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// props.getData?.();
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* เช็คข้อมูลจาก props
|
||||
* เมื่อมีข้อมูล
|
||||
|
|
@ -544,14 +535,35 @@ function emitPerson(data: PersonsArray[]) {
|
|||
}
|
||||
|
||||
const modalEditDirector = ref<boolean>(false);
|
||||
function openEditDirector(id: string) {
|
||||
const editDirectorId = ref<string>();
|
||||
const dutyVal = ref<string>();
|
||||
function openEditDirector(idVal: string, duty: string) {
|
||||
editDirectorId.value = idVal;
|
||||
modalEditDirector.value = true;
|
||||
dutyVal.value = duty;
|
||||
}
|
||||
|
||||
function closeEditDirector(id: string) {
|
||||
function closeEditDirector() {
|
||||
modalEditDirector.value = false;
|
||||
}
|
||||
|
||||
const saveDuty = async (id: string, duty: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.disciplinaryEditDuty(props.data.id, id), { duty: duty })
|
||||
.then((res: any) => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
closeEditDirector();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
props.fetchData();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
mainStore.rowsAdd = [];
|
||||
|
|
@ -1320,7 +1332,9 @@ onMounted(async () => {
|
|||
flat
|
||||
round
|
||||
color="blue"
|
||||
@click="openEditDirector(props.row.id)"
|
||||
@click="
|
||||
openEditDirector(props.row.idRaw, props.row.duty)
|
||||
"
|
||||
icon="mdi-pencil-outline"
|
||||
>
|
||||
<q-tooltip>แก้ไข</q-tooltip>
|
||||
|
|
@ -1328,7 +1342,9 @@ onMounted(async () => {
|
|||
<DialogDuty
|
||||
:modal="modalEditDirector"
|
||||
:close-popup="closeEditDirector"
|
||||
@save="saveDuty(props.row.id)"
|
||||
:id="editDirectorId"
|
||||
:duty="dutyVal"
|
||||
:save="saveDuty"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed, watchEffect, watch, type PropType } from "vue";
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
watchEffect,
|
||||
watch,
|
||||
type PropType,
|
||||
onMounted,
|
||||
} from "vue";
|
||||
import { QForm, useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
|
|
@ -11,10 +18,15 @@ const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
|
|||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
id: String,
|
||||
closePopup: Function,
|
||||
duty: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
save: {
|
||||
type: Function,
|
||||
default: ""
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -24,22 +36,27 @@ const myForm = ref<QForm | null>(null);
|
|||
/**
|
||||
* ฟังก์ชั่น Save
|
||||
*/
|
||||
const submit = async () => {
|
||||
const submit = async () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then((success) => {
|
||||
if (success) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
await props.save();
|
||||
await props.save(props.id, duty.value);
|
||||
duty.value = "";
|
||||
},
|
||||
"ยืนยันการแก้ไขข้อมูล",
|
||||
"ต้องการยืนยันการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายหรือไม่?"
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลหรือไม่?"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
watch(props, () => {
|
||||
duty.value = props?.duty;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue