เพิ่มระบบค้นหา issue

This commit is contained in:
Net 2024-02-16 16:20:19 +07:00
parent 289e655495
commit 3c5d0aee27
3 changed files with 27 additions and 1 deletions

View file

@ -1,6 +1,8 @@
import env from "../index";
export const supportIssue = `${env.API_SUPPORT_URI}/issue`;
export const supportSearchIssue = (id: string) =>
`${env.API_SUPPORT_URI}/issue?search=${id}`;
export const supportCategory = `${env.API_SUPPORT_URI}/Issue-category`;
export const supportCategoryAction = (id: string) =>
`${env.API_SUPPORT_URI}/Issue-category/${id}`;
@ -17,9 +19,10 @@ export const supportSocket = `${env.API_SUPPORT_SOCKET}`;
export default {
supportIssue,
supportCategory,
supportSocket,
supportMessage,
supportMessageStatus,
supportIssueChangeStatus,
supportCategoryAction,
supportSocket,
supportSearchIssue,
};

View file

@ -82,6 +82,11 @@ const onLoad = (async (_: any, done: any) => {
outlined
label="ค้นหาข้อความ..."
v-model="searchInput"
@keydown.enter.prevent="
() => {
store.searchIssue(searchInput);
}
"
>
<template v-slot:prepend>
<q-icon name="search" />

View file

@ -200,7 +200,24 @@ export const useSupportStore = defineStore("supportServiceStore", () => {
if (res && res.data) {
issue.value = res.data;
currentPageIssue.value = res.data.page;
currentTotalIssue.value = res.data.total;
}
}
async function searchIssue(input: string) {
showLoader();
const res = await http
.get(config.API.supportSearchIssue(input))
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
if (res && res.data) {
issue.value = res.data;
currentPageIssue.value = res.data.page;
currentTotalIssue.value = res.data.total;
}
@ -305,5 +322,6 @@ export const useSupportStore = defineStore("supportServiceStore", () => {
fetchCategory,
deleteCategory,
editCategory,
searchIssue,
};
});