เพื่มลบ

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

@ -18,7 +18,14 @@ const router = useRouter();
const $q = useQuasar();
const store = useInsigniaDataStore();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
const {
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
dialogRemove,
} = mixin;
const id = ref<string>(route.params.id.toString()); //
const title = ref<string>(""); //
@ -216,6 +223,29 @@ async function onSubmit() {
});
}
/**
* ลบขอมลเครองราชอสรยาภรณ
* แล fetch อมลรายการ อมลเครองราชอสรยาภรณ ใหม
* @param id อมลเครองราชอสรยาภรณ
*/
async function onDeleteData(idrow: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.insigniaNewIdOrg(idrow))
.then(async () => {
await fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup เพ,แกไข อม
* และ กำหนดฟอร เพมขอม,แกไขขอมลเป defult
@ -347,7 +377,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -364,6 +393,16 @@ onMounted(async () => {
>
<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'">

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการคำนำหนาช
* แล fetch อมลรายการ คำนำหนาช ใหม
* @param id รายการคำนำหนาช
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPrefixId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการคำนำหนาช
@ -227,7 +251,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -241,6 +264,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
{{ col.value }}

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการยศ
* แล fetch อมลรายการ อมลรายการยศ ใหม
* @param id รายการยศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgRankId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการยศ
@ -224,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -238,6 +261,17 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการเพศ
* แล fetch อมลรายการ อมลรายการเพศ ใหม
* @param id รายการเพศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgGenderId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการเพศ
@ -224,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -238,6 +261,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบรายการสถานภาพ
* แล fetch อมลรายการ อมลรายการสถานภาพ ใหม
* @param id รายการสถานภาพ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgRelationshipId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการสถานภาพ
@ -224,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -238,6 +261,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -141,6 +142,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการกลมเลอด
* แล fetch อมลรายการ อมลรายการกลมเลอด ใหม
* @param id อมลรายการกลมเลอด
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgBloodGroupId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการกลมเลอด
@ -223,7 +247,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -237,6 +260,17 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Table
@ -142,6 +143,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการศาสนา
* แล fetch อมลรายการ อมลรายการศาสนา ใหม
* @param id อมลรายการศาสนา
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgReligionId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการศาสนา
@ -224,7 +248,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -238,6 +261,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -15,7 +15,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const router = useRouter();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
/**
* Teble
@ -144,6 +145,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการจงหว
* แล fetch อมลรายการ อมลรายการจงหว ใหม
* @param id อมลรายการจงหว
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgProvince + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* ไปยงหน รายการเขต/อำเภอ โดย id ของจงหว
* @param id งหว
@ -235,7 +259,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -249,6 +272,16 @@ onMounted(async () => {
>
<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 in props.cols"

View file

@ -13,7 +13,8 @@ import DialogForm from "@/modules/01_metadata/components/personal/DialogForm.vue
const $q = useQuasar();
const store = usePersonalDataStore();
const { messageError, showLoader, hideLoader, success } = useCounterMixin();
const { messageError, showLoader, hideLoader, success, dialogRemove } =
useCounterMixin();
const columns = [
{
@ -154,6 +155,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการระดบการศกษา
* แล fetch อมลรายการ อมลรายการระดบการศกษา ใหม
* @param id อมลรายการระดบการศกษา
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEducationLevelId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* hook ทำงานเม Components กเรยกใชงาน
* แลวเรยก function fetch อมลรายการระดบการศกษา
@ -238,7 +262,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -253,6 +276,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -22,6 +22,7 @@ const {
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
/**
@ -106,9 +107,11 @@ async function fetchData() {
const list = data.map((e: FormDistrict) => ({
...e,
createdAt: e.createdAt ? date2Thai(new Date(e.createdAt),false,true) : "",
createdAt: e.createdAt
? date2Thai(new Date(e.createdAt), false, true)
: "",
lastUpdatedAt: e.lastUpdatedAt
? date2Thai(new Date(e.lastUpdatedAt),false,true)
? date2Thai(new Date(e.lastUpdatedAt), false, true)
: "",
}));
rows.value = list;
@ -168,6 +171,29 @@ async function editData(id: string) {
});
}
/**
* ลบขอมลรายการระดบการเขต/อำเภอ
* แล fetch อมลรายการ อมลรายการระดบการเขต/อำเภอ ใหม
* @param id อมลรายการระดบการเขต/อำเภอ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgDistrict + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* ไปยงหน รายการเแขวง/ตำบลโดย id ของเขต/อำเภอ
* @param idSub เขต/อำเภอ
@ -283,7 +309,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -297,6 +322,16 @@ onMounted(async () => {
>
<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 in props.cols"

View file

@ -22,6 +22,7 @@ const {
success,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
/**
@ -183,6 +184,29 @@ async function editData(idRow: string) {
});
}
/**
* ลบขอมลรายการแขวง/ตำบล
* แล fetch อมลรายการ อมลรายการแขวง/ตำบล ใหม
* @param id อมลรายการแขวง/ตำบล
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgSubDistrict + `/${id}`)
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
@ -291,7 +315,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -306,6 +329,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div>

View file

@ -25,6 +25,7 @@ const {
hideLoader,
date2Thai,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
//Table
@ -182,6 +183,29 @@ function onSubmit() {
});
}
/**
* ลบขอมลรายการกลมงาน
* แล fetch อมลรายการ อมลรายการกลมงาน ใหม
* @param id อมลรายการกลมงาน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgEmployeeTypeById(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* งกนไปหนารายการระดบชนงาน
* @param id กลมงาน
@ -295,12 +319,21 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
@click.stop="onClickOpenDialogEdit(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 in props.cols" :key="col.id">
{{ col.value ? col.value : "-" }}

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'">

View file

@ -22,6 +22,7 @@ const {
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
// Table
@ -154,6 +155,29 @@ function onSubmit() {
}
}
/**
* ลบขอมลประเภทตำแหน
* แล fetch อมลรายการ อมลประเภทตำแหน ใหม
* @param id อมลประเภทตำแหน
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPosTypeId(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup ฟอรมประเภทตำแหน
* และเคลยรวแปรในฟอรมประเภทตำแหน
@ -265,7 +289,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -280,6 +303,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
{{ col.value ?? "-" }}

View file

@ -12,8 +12,15 @@ import type { RowListForm } from "@/modules/01_metadata/interface/request/positi
import DialogAdd from "@/modules/01_metadata/components/position/DialogFormExecutive.vue";
const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
onSearchDataTable,
dialogRemove,
success,
} = useCounterMixin();
// Table
const rows = ref<RowListForm[]>([]); //
@ -96,7 +103,6 @@ const modalPosExecutive = ref<boolean>(false); // popup ตำแหน่งท
/**
* งรายการขอมลตำแหนงทางการบรหาร
*
* เกบขอมลรายการตำแหนงทางการบรหารใน rows.value
*/
async function getData() {
@ -123,6 +129,29 @@ function popUpAdd() {
modalPosExecutive.value = true;
}
/**
* ลบรายการเพศ
* แล fetch อมลรายการ อมลรายการเพศ ใหม
* @param id รายการเพศ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.orgPosExecutiveById(id))
.then(async () => {
await getData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* เป popup เพอแกไขขอมลรายการตำแหนงทางการบรหาร
* @param data อมลรายการตำแหนงทางการบรหารทองการแกไข
@ -224,7 +253,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -235,18 +263,18 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<!-- <q-btn
<q-btn
color="red"
flat
dense
round
icon="mdi-delete"
clickable
@click.stop="deletePos(props.row.id)"
@click.stop="onDeleteData(props.row.id)"
v-close-popup
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">

View file

@ -21,7 +21,7 @@ const {
messageError,
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
} = useCounterMixin();
// Table
@ -149,6 +149,29 @@ function onSubmit() {
});
}
/**
* ลบขอมลเครองราชอสรยาภรณ
* แล fetch อมลรายการ อมลเครองราชอสรยาภรณ ใหม
* @param id อมลเครองราชอสรยาภรณ
*/
async function onDeleteData(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.insigniaTypeNewIdOrg(id))
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/**
* popup เพ,แกไข อม
* และ กำหนดลำดบชนเครองราช เปนคาวาง สถานะการใชงาน เป false
@ -259,7 +282,6 @@ onMounted(async () => {
flat
dense
round
class="q-mr-xs"
icon="edit"
clickable
@click.stop="
@ -274,6 +296,16 @@ onMounted(async () => {
>
<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 in props.cols" :key="col.id">
<div v-if="col.name == 'isActive'">