Dashboard => ลบขข้อความ
This commit is contained in:
parent
d20ef87c5e
commit
e9b0d2fbfc
1 changed files with 15 additions and 7 deletions
|
|
@ -95,14 +95,22 @@ const removeData = async (id: string) => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.delete(config.API.msgInboxDelete(id))
|
.delete(config.API.msgInboxDelete(id))
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
|
const position = inboxList.value.findIndex((item) => item.no === id);
|
||||||
|
if (position !== -1) {
|
||||||
|
inboxList.value.splice(position, 1);
|
||||||
|
data.value = [];
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// getData();
|
if (inboxList.value.length === 6) {
|
||||||
|
inboxList.value = [];
|
||||||
|
getData(1);
|
||||||
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -122,6 +130,7 @@ function modalReplyClose() {
|
||||||
|
|
||||||
const scrollTargetRef = ref<any>(null);
|
const scrollTargetRef = ref<any>(null);
|
||||||
const totalInbox = ref<number>(0);
|
const totalInbox = ref<number>(0);
|
||||||
|
|
||||||
function onLoad(index: number, done: any) {
|
function onLoad(index: number, done: any) {
|
||||||
const num = index === 1 ? 0 : index++;
|
const num = index === 1 ? 0 : index++;
|
||||||
if (inboxList.value.length < totalInbox.value && isLoadInbox) {
|
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="q-px-md q-py-sm row col-12 items-center">
|
||||||
<div class="text-subtitle1 text-weight-medium">กล่องข้อความ</div>
|
<div class="text-subtitle1 text-weight-medium">กล่องข้อความ</div>
|
||||||
<q-space />
|
<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>
|
</div>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
|
|
@ -172,10 +183,7 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
|
||||||
class="q-pa-sm"
|
class="q-pa-sm"
|
||||||
:scroll-target="scrollTargetRef"
|
:scroll-target="scrollTargetRef"
|
||||||
>
|
>
|
||||||
<q-list
|
<q-list v-for="(contact, index) in inboxList" :key="contact.no">
|
||||||
v-for="(contact, index) in inboxList"
|
|
||||||
:key="contact.no"
|
|
||||||
>
|
|
||||||
<q-item
|
<q-item
|
||||||
clickable
|
clickable
|
||||||
v-ripple
|
v-ripple
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue