ระบบจัดการประเภทของปัญหา
This commit is contained in:
parent
c6b9236a04
commit
b4c4325cd1
11 changed files with 813 additions and 77 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import "moment/dist/locale/th";
|
||||
import moment from "moment";
|
||||
import DialogStatus from "@/modules/00_support/components/DialogStatus.vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useSupportStore } from "@/modules/00_support/store/Main";
|
||||
|
|
@ -15,11 +16,11 @@ const { scrollContainer } = storeToRefs(store);
|
|||
|
||||
onMounted(async () => {
|
||||
await store.fetchIssue();
|
||||
totalPageIssue.value = Math.ceil(store.currentTotalIssue || 0 / 6);
|
||||
totalPageIssue.value = Math.ceil((store.currentTotalIssue || 0) / 6);
|
||||
});
|
||||
|
||||
const onLoad = (async (_: any, done: any) => {
|
||||
const totalPages = Math.ceil(store.currentTotalMessage || 0 / 30);
|
||||
const totalPages = Math.ceil((store.currentTotalMessage || 1) / 30);
|
||||
if (store.currentPage && totalPages > store.currentPage) {
|
||||
await store.loadMessage(store.currentPage + 1);
|
||||
done();
|
||||
|
|
@ -28,7 +29,15 @@ const onLoad = (async (_: any, done: any) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<p class="text-h6 text-weight-medium">ถาม - ตอบ</p>
|
||||
<div class="flex q-mt-md">
|
||||
<p class="text-h6 text-weight-medium align-center">ถาม - ตอบ</p>
|
||||
<q-space />
|
||||
<p>
|
||||
<router-link to="/category"
|
||||
><q-btn dense size="16px">จัดการประเภทของปัญหา</q-btn></router-link
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="i1 bg-white align-center">
|
||||
|
|
@ -54,66 +63,154 @@ const onLoad = (async (_: any, done: any) => {
|
|||
<q-avatar>
|
||||
<img src="https://cdn.quasar.dev/img/avatar3.jpg" />
|
||||
</q-avatar>
|
||||
<q-item-section class="q-pl-sm">
|
||||
<q-item-label>{{ store.currentTitle }}</q-item-label>
|
||||
<q-item-section v-if="store.currentIssue" class="q-pl-sm">
|
||||
<q-item-label
|
||||
>{{ store.currentTitle }}
|
||||
<q-badge color="blue">
|
||||
{{ store.currentCategory }}
|
||||
</q-badge></q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
|
||||
<q-space />
|
||||
|
||||
<div v-if="store.currentIssue">
|
||||
<q-badge
|
||||
color="white"
|
||||
text-color="black"
|
||||
:label="
|
||||
store.correntStatusIssue == 'new'
|
||||
? 'ปัญหาใหม่'
|
||||
: store.correntStatusIssue == 'ongoing'
|
||||
? 'กำลังดำเนินการ'
|
||||
: 'เสร็จสิ้น'
|
||||
"
|
||||
/>
|
||||
<dialog-status />
|
||||
</div>
|
||||
|
||||
<!-- <q-btn-dropdown
|
||||
v-if="store.currentIssue"
|
||||
:label="
|
||||
store.correntStatusIssue == 'new'
|
||||
? 'ปัญหาใหม่'
|
||||
: store.correntStatusIssue == 'ongoing'
|
||||
? 'กำลังดำเนินการ'
|
||||
: 'เสร็จสิ้น'
|
||||
"
|
||||
dense
|
||||
flat
|
||||
color="positive"
|
||||
@click.stop
|
||||
>
|
||||
|
||||
<q-list v-for="itemStatusIssue in statusIssue">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
() => {
|
||||
store.ChangeStatusIssue(
|
||||
store.currentIssue,
|
||||
store.currentTitle,
|
||||
store.currentCategoryId,
|
||||
itemStatusIssue
|
||||
);
|
||||
}
|
||||
"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{
|
||||
itemStatusIssue == "new"
|
||||
? "ปัญหาใหม่"
|
||||
: itemStatusIssue == "ongoing"
|
||||
? "กำลังดำเนินการ"
|
||||
: "เสร็จสิ้น"
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown> -->
|
||||
|
||||
<q-btn flat round dense icon="o_info" text-color="grey" />
|
||||
</q-toolbar>
|
||||
</div>
|
||||
|
||||
<div class="i3 bg-white">
|
||||
<q-list class="text-primary">
|
||||
<div v-for="data in store.issue?.result">
|
||||
<q-item
|
||||
clickable
|
||||
v-ripple
|
||||
:active="store.currentIssue === data.id"
|
||||
@click="
|
||||
store.currentIssue = data.id;
|
||||
store.currentTitle = data.title;
|
||||
store.fetchMessage(data.id);
|
||||
store.fetchMessageStatus(data.id);
|
||||
<div v-for="(item, index) in store.issue?.result" :key="index">
|
||||
<div
|
||||
@click="
|
||||
async () => {
|
||||
store.currentIssue = item.id;
|
||||
store.currentTitle = item.title;
|
||||
store.correntStatusIssue = item.status;
|
||||
store.currentCategory = item.category.name;
|
||||
store.issue
|
||||
? (store.issue.result = store.issue.result.map((v) => {
|
||||
if (v.id === item.id) {
|
||||
v.unreadCount = 0;
|
||||
}
|
||||
return v;
|
||||
}))
|
||||
: '';
|
||||
await store.fetchMessageStatus(item.id);
|
||||
await store.fetchMessage(item.id);
|
||||
}
|
||||
"
|
||||
:class="{ active: store.currentIssue === item.id }"
|
||||
class="noactive row q-py-sm justify-between items-center q-px-md"
|
||||
>
|
||||
<div class="col-10 row items-center">
|
||||
<div class="noactive-avatar">
|
||||
<q-avatar color="grey-2" text-color="white" size="40px">
|
||||
<img src="https://cdn.quasar.dev/img/avatar1.jpg" />
|
||||
</q-avatar>
|
||||
</div>
|
||||
<div class="col column q-ml-md">
|
||||
<span class="text-long col text-weight-bold line-ellipsis">
|
||||
{{ item.title }}
|
||||
</span>
|
||||
|
||||
if (store.issue) {
|
||||
store.issue.result = store.issue.result.map((v) => {
|
||||
if (v.id === data.id) v.unreadCount = 0;
|
||||
return v;
|
||||
});
|
||||
}
|
||||
"
|
||||
active-class="my-menu-link"
|
||||
>
|
||||
<q-avatar>
|
||||
<img src="https://cdn.quasar.dev/img/avatar1.jpg" />
|
||||
</q-avatar>
|
||||
<q-item-section class="q-pl-sm">
|
||||
<q-item-label>{{ data.title }}</q-item-label>
|
||||
<q-item-label class="flex" caption>
|
||||
{{ data.lastMessage }}
|
||||
<q-space />
|
||||
<q-icon
|
||||
v-if="data.lastMessage?.length === 0"
|
||||
color="green"
|
||||
size="18px"
|
||||
name="mdi-send"
|
||||
<span
|
||||
class="col text-caption line-ellipsis"
|
||||
:class="{
|
||||
'text-weight-bold': item.unreadCount > 0,
|
||||
'text-grey-8': item.unreadCount > 0,
|
||||
'text-grey': item.unreadCount === 0,
|
||||
}"
|
||||
>{{ item.lastMessage }}</span
|
||||
>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
<div class="col-2 items-center text-right">
|
||||
<q-icon
|
||||
v-if="item.lastMessage?.length === 0"
|
||||
name="mdi-send"
|
||||
size="xs"
|
||||
color="primary"
|
||||
/>
|
||||
|
||||
<div v-else class="column">
|
||||
<span class="col text-caption text-grey">20 s</span>
|
||||
|
||||
<div class="col">
|
||||
<q-badge
|
||||
v-if="item.unreadCount > 0"
|
||||
rounded
|
||||
color="negative"
|
||||
text-color="white"
|
||||
:label="item.unreadCount"
|
||||
/>
|
||||
<div v-else>
|
||||
<q-badge
|
||||
v-if="data.unreadCount > 0"
|
||||
class=""
|
||||
rounded
|
||||
color="red"
|
||||
:label="data.unreadCount"
|
||||
/>
|
||||
<q-icon v-else size="18px" name="done_all" />
|
||||
</div>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-separator inset />
|
||||
<q-icon v-else name="mdi-check-all" size="xs" color="grey" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-list>
|
||||
|
||||
<q-separator inset />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="i4 bg-grey-3" v-if="store.currentIssue">
|
||||
|
|
@ -198,29 +295,35 @@ const onLoad = (async (_: any, done: any) => {
|
|||
</div> -->
|
||||
<div class="input-chat">
|
||||
<q-input
|
||||
dense
|
||||
class="q-pa-xs"
|
||||
standout="bg-teal text-white"
|
||||
label="Aa"
|
||||
v-model="content"
|
||||
@keydown.enter.prevent="
|
||||
() => {
|
||||
store.sendMessage(content, store.currentIssue);
|
||||
content = '';
|
||||
if (store.currentIssue) {
|
||||
store.sendMessage(content, store.currentIssue);
|
||||
content = '';
|
||||
}
|
||||
}
|
||||
"
|
||||
/>
|
||||
outlined
|
||||
dense
|
||||
placeholder="Aa"
|
||||
v-model="content"
|
||||
id="message"
|
||||
>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="btn-chat">
|
||||
<q-btn
|
||||
@click="
|
||||
() => {
|
||||
store.sendMessage(content, store.currentIssue);
|
||||
content = '';
|
||||
if (store.currentIssue) {
|
||||
store.sendMessage(content, store.currentIssue);
|
||||
content = '';
|
||||
}
|
||||
}
|
||||
"
|
||||
flat
|
||||
color="primary"
|
||||
class="col-2"
|
||||
style="color: #009789"
|
||||
label="ส่งข้อความ"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -229,9 +332,24 @@ const onLoad = (async (_: any, done: any) => {
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scroll {
|
||||
overflow-y: auto;
|
||||
.text-long {
|
||||
width: 100px;
|
||||
display: inline-block;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.active {
|
||||
background: #ebf9f7;
|
||||
border-left: 5px solid #03a898;
|
||||
& {
|
||||
.noactive-avatar {
|
||||
border-radius: 50%;
|
||||
border: 1px solid #03a898;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.align-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue