เพื่มลบ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-25 11:48:36 +07:00
parent b6146fb532
commit bc86ba31f0
16 changed files with 566 additions and 35 deletions

View file

@ -31,6 +31,7 @@ const {
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
// Table
@ -136,7 +137,6 @@ const formDataLevel = reactive<FormDataLevel>({
/**
* งกนดงขอมลรายการระดบชนงาน API
*
* เกบขอมลรรายการระดบชนงานไวใน rows.value
*/
async function fetchData() {
@ -231,6 +231,29 @@ function onSubmit() {
});
}
/**
* ลบขอมลรายการระดบชนงาน
* แล fetch อมลรายการ อมลรายการระดบชนงาน ใหม
* @param id อมลรายการระดบชนงาน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEmployeelevelById(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* งกนแปลงตำแหนงผอำนาจ
* @param val าของผอำนาจ
@ -342,12 +365,21 @@ onMounted(() => {
flat
dense
round
class="q-mr-xs"
icon="edit"
@click.stop.pervent="onClickOpenDialog(true, props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="red"
flat
dense
round
icon="delete"
@click.stop.prevent="onDeleteData(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="(col, index) in props.cols" :key="col.id">
<div v-if="col.name == 'no'">