chat-panel.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <a-card
  3. class="general-card chat-panel"
  4. :title="$t('monitor.title.chatPanel')"
  5. :bordered="false"
  6. :header-style="{ paddingBottom: '0' }"
  7. :body-style="{
  8. height: '100%',
  9. paddingTop: '16px',
  10. display: 'flex',
  11. flexFlow: 'column',
  12. }"
  13. >
  14. <a-space :size="8">
  15. <a-select style="width: 86px" default-value="all">
  16. <a-option value="all">
  17. {{ $t('monitor.chat.options.all') }}
  18. </a-option>
  19. </a-select>
  20. <a-input-search
  21. :placeholder="$t('monitor.chat.placeholder.searchCategory')"
  22. />
  23. <a-button type="text">
  24. <icon-download />
  25. </a-button>
  26. </a-space>
  27. <div class="chat-panel-content">
  28. <a-spin :loading="loading" style="width: 100%">
  29. <ChatList :render-list="chatList" />
  30. </a-spin>
  31. </div>
  32. <div class="chat-panel-footer">
  33. <a-space :size="8">
  34. <a-Input>
  35. <template #suffix>
  36. <icon-face-smile-fill />
  37. </template>
  38. </a-Input>
  39. <a-button type="primary">{{ $t('monitor.chat.update') }}</a-button>
  40. </a-space>
  41. </div>
  42. </a-card>
  43. </template>
  44. <script lang="ts">
  45. import { defineComponent, ref } from 'vue';
  46. import { queryChatList, ChatRecord } from '@/api/message';
  47. import useLoading from '@/hooks/loading';
  48. import ChatList from './chat-list.vue';
  49. export default defineComponent({
  50. components: {
  51. ChatList,
  52. },
  53. setup() {
  54. const { loading, setLoading } = useLoading(true);
  55. const chatList = ref<ChatRecord[]>([]);
  56. const fetchData = async () => {
  57. try {
  58. const { data } = await queryChatList();
  59. chatList.value = data;
  60. } catch (err) {
  61. // you can report use errorHandler or other
  62. } finally {
  63. setLoading(false);
  64. }
  65. };
  66. fetchData();
  67. return {
  68. loading,
  69. chatList,
  70. };
  71. },
  72. });
  73. </script>
  74. <style scoped lang="less">
  75. .chat-panel {
  76. display: flex;
  77. flex-direction: column;
  78. height: 100%;
  79. // padding: 20px;
  80. background-color: var(--color-bg-2);
  81. &-content {
  82. flex: 1;
  83. margin: 20px 0;
  84. }
  85. }
  86. </style>