แก้ไขหน้าที่ประธานสืบสวน สอบสวน
This commit is contained in:
parent
9b83d6bfd0
commit
a07cc6d2a2
4 changed files with 99 additions and 49 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue