|
|
@@ -8,11 +8,20 @@
|
|
|
<template #unchecked> {{ $t('management.offline') }} </template>
|
|
|
</a-switch>
|
|
|
</template>
|
|
|
- <template #labels>
|
|
|
- <div class="label-btn">
|
|
|
- <icon-subscribe />
|
|
|
- <div>{{ $t('management.addLabelBtn') }}</div>
|
|
|
- </div>
|
|
|
+ <template #labelBtn>
|
|
|
+ <!-- <div class="label-btn"> -->
|
|
|
+ <a-dropdown ref="dropdown" v-model="show_down" class="label-btn" position="bl" :popup-max-height="false">
|
|
|
+ <a-button>
|
|
|
+ <icon-subscribe />
|
|
|
+ {{ $t('management.addLabelBtn') }}</a-button
|
|
|
+ >
|
|
|
+ <template #content>
|
|
|
+ <div class="label-add">
|
|
|
+ <LabelSelected @openManageTags="openManageTags"></LabelSelected>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </a-dropdown>
|
|
|
+ <!-- </div> -->
|
|
|
</template>
|
|
|
<template #bottom>
|
|
|
<div class="bottom">
|
|
|
@@ -28,12 +37,15 @@
|
|
|
<div v-if="scroll_bottom && pages.current >= total_pages">{{ $t('management.noMoreData') }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <ManageTags v-model:visible="visible"></ManageTags>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
|
|
|
import CardItem from '../../views/manage/CardItem.vue';
|
|
|
+import ManageTags from './ManageTags.vue';
|
|
|
import { getImageIntelligent } from '../../views/manage/common';
|
|
|
+import LabelSelected from './LabelSelected.vue';
|
|
|
import { getDialogList } from '../../apis/intelligent';
|
|
|
import { bus_intelligentSearch } from '../../base/event-bus';
|
|
|
|
|
|
@@ -49,27 +61,30 @@ const moke_data = ref([
|
|
|
]);
|
|
|
const pages = reactive({
|
|
|
current: 1,
|
|
|
- pageSize: 25
|
|
|
+ pageSize: 30
|
|
|
});
|
|
|
// 总页码
|
|
|
const total_pages = ref(5);
|
|
|
const body_container = ref(null);
|
|
|
const scroll_bottom = ref(false);
|
|
|
const search_text = ref('');
|
|
|
+const dropdown = ref(null);
|
|
|
+const visible = ref(false);
|
|
|
|
|
|
const getDialog = async () => {
|
|
|
try {
|
|
|
- const res = await getDialogList(pages.current, pages.pageSize);
|
|
|
+ const res = await getDialogList(pages.current, pages.pageSize, search_text.value);
|
|
|
const data = res.data.rows.map((item) => {
|
|
|
return {
|
|
|
...item,
|
|
|
time: new Date(item.update_time).toLocaleString('zh-CN'),
|
|
|
desc: item.description,
|
|
|
img_src: getImageIntelligent(item.icon),
|
|
|
- user: item.user || 'admin',
|
|
|
+ user: item.user.userName || '-',
|
|
|
online: item.status == 1
|
|
|
};
|
|
|
});
|
|
|
+ total_pages.value = Math.ceil(res.data.total / pages.pageSize);
|
|
|
moke_data.value.push(...data);
|
|
|
} catch (err) {
|
|
|
console.log(err);
|
|
|
@@ -80,16 +95,22 @@ const scrollHandler = (e) => {
|
|
|
scroll_bottom.value = true;
|
|
|
// 调用函数加载更多数据
|
|
|
if (pages.current < total_pages.value) {
|
|
|
- pages.current += 1;
|
|
|
getDialog();
|
|
|
+ pages.current += 1;
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+const openManageTags = () => {
|
|
|
+ visible.value = true;
|
|
|
+};
|
|
|
bus_intelligentSearch.on((text) => {
|
|
|
search_text.value = text;
|
|
|
+ moke_data.value = [];
|
|
|
+ pages.current = 1;
|
|
|
getDialog();
|
|
|
});
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getDialog();
|
|
|
body_container.value.addEventListener('scroll', scrollHandler);
|
|
|
@@ -116,10 +137,15 @@ onBeforeUnmount(() => {
|
|
|
display: flex;
|
|
|
gap: 10px;
|
|
|
padding: 8px 16px;
|
|
|
- background-color: var(--color-neutral-3);
|
|
|
+ background-color: var(--color-neutral-2);
|
|
|
+ color: var(--color-neutral-6);
|
|
|
font-size: 12px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+.label-add {
|
|
|
+ width: 240px;
|
|
|
+ padding: 10px;
|
|
|
+}
|
|
|
.bottom {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|