feat(): add handleDelete director meeting

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-04-01 13:40:50 +07:00
parent a6018507c9
commit 546942f8fb
2 changed files with 69 additions and 4 deletions

View file

@ -27,6 +27,7 @@ const {
dialogConfirm,
date2Thai,
success,
dialogRemove,
} = mixin;
/** props*/
@ -208,6 +209,21 @@ async function getList() {
});
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
showLoader();
try {
await http.delete(config.API.meeting() + `/admin/${id}`);
await props.fetchData();
await success($q, "ลบสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
watch(
() => props.data,
() => {
@ -265,6 +281,7 @@ watch(
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
@ -272,6 +289,19 @@ watch(
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-th auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense
icon="delete"
color="red"
@click="handleDelete(props.row.id)"
>
<q-tooltip>ลบ</q-tooltip>
</q-btn>
</q-th>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}