Dashboard => ลบขข้อความ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-03-04 09:57:38 +07:00
parent d20ef87c5e
commit e9b0d2fbfc

View file

@ -95,14 +95,22 @@ const removeData = async (id: string) => {
showLoader();
await http
.delete(config.API.msgInboxDelete(id))
.then((res) => {
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
const position = inboxList.value.findIndex((item) => item.no === id);
if (position !== -1) {
inboxList.value.splice(position, 1);
data.value = [];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
// getData();
if (inboxList.value.length === 6) {
inboxList.value = [];
getData(1);
}
hideLoader();
});
};
@ -122,6 +130,7 @@ function modalReplyClose() {
const scrollTargetRef = ref<any>(null);
const totalInbox = ref<number>(0);
function onLoad(index: number, done: any) {
const num = index === 1 ? 0 : index++;
if (inboxList.value.length < totalInbox.value && isLoadInbox) {
@ -157,7 +166,9 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
<div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">กลองขอความ</div>
<q-space />
<div v-if="totalInbox" class="text-grey-5" style="font-size: 12px;">ทั้งหมด {{ totalInbox }} ข้อความ</div>
<div v-if="totalInbox" class="text-grey-5" style="font-size: 12px">
งหมด {{ totalInbox }} อความ
</div>
</div>
<q-separator />
@ -172,10 +183,7 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
class="q-pa-sm"
:scroll-target="scrollTargetRef"
>
<q-list
v-for="(contact, index) in inboxList"
:key="contact.no"
>
<q-list v-for="(contact, index) in inboxList" :key="contact.no">
<q-item
clickable
v-ripple