|
|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<div class="body-container" ref="body_container">
|
|
|
- <CardItem v-for="item in moke_data" :key="item.id" :name="item.name" :img_src="item.img_src" :height="200">
|
|
|
+ <CardItem
|
|
|
+ class="card_box"
|
|
|
+ v-for="item in moke_data"
|
|
|
+ :key="item.id"
|
|
|
+ :name="item.name"
|
|
|
+ :img_src="item.img_src"
|
|
|
+ :height="200"
|
|
|
+ >
|
|
|
<template #description> {{ item.desc }} </template>
|
|
|
<template #settings>
|
|
|
<a-switch v-model="item.online" @change="changeStatus(item)">
|
|
|
@@ -11,7 +18,6 @@
|
|
|
<template #labelBtn>
|
|
|
<a-dropdown
|
|
|
ref="dropdown"
|
|
|
- v-model="show_down"
|
|
|
position="bl"
|
|
|
:popup-max-height="false"
|
|
|
@popup-visible-change="changeDropdownVisible($event, item.id)"
|
|
|
@@ -19,8 +25,8 @@
|
|
|
<a-button v-if="!item.label.length" class="label-btn">
|
|
|
<icon-subscribe /> {{ $t('management.addLabelBtn') }}</a-button
|
|
|
>
|
|
|
- <a-button v-else class="label-btn">
|
|
|
- <icon-subscribe /> {{ item.label.map((it) => it.labelName).join(',') }}</a-button
|
|
|
+ <a-button v-else class="label-btn btn-content">
|
|
|
+ <icon-subscribe /> {{ item.label.map((it) => it.labelName).join(',') }}</a-button
|
|
|
>
|
|
|
<template #content>
|
|
|
<div class="label-add">
|
|
|
@@ -39,11 +45,11 @@
|
|
|
<div class="bottom">
|
|
|
<div class="user"><icon-user /> {{ $t('management.createUser') }}:{{ item.user }}</div>
|
|
|
<div class="tools" v-if="item.online">
|
|
|
- <icon-more :style="{ fontSize: '20px' }" />
|
|
|
+ <icon-more :style="{ cursor: 'pointer' }" />
|
|
|
</div>
|
|
|
<div class="tools" v-if="!item.online">
|
|
|
- <icon-settings :style="{ fontSize: '20px', cursor: 'pointer' }" @click="editIntelligent(item)" />
|
|
|
- <icon-delete :style="{ fontSize: '20px', cursor: 'pointer' }" @click="deleteIntelligent" />
|
|
|
+ <icon-settings :style="{ cursor: 'pointer' }" @click.stop="editIntelligent(item)" />
|
|
|
+ <icon-delete :style="{ cursor: 'pointer' }" @click.stop="deleteIntelligent(item)" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -58,13 +64,16 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
|
|
|
+import { Modal } from '@arco-design/web-vue';
|
|
|
import CardItem from '../../views/manage/CardItem.vue';
|
|
|
import ManageTags from './ManageTags.vue';
|
|
|
import { getIconIntelligent, getImageIntelligent } from '../../views/manage/common';
|
|
|
import LabelSelected from './LabelSelected.vue';
|
|
|
import { getDialogList } from '../../apis/intelligent';
|
|
|
import { bus_intelligentSearch, bus_intelligentEdit } from '../../base/event-bus';
|
|
|
+import { dialogType } from '../../views/manage/common';
|
|
|
import { getLabelList, addLabelToDialog, changeDialogStatus } from '../../apis/intelligent';
|
|
|
+import { deleteDify } from '../../apis/rgflow-dify';
|
|
|
|
|
|
const moke_data = ref([
|
|
|
// {
|
|
|
@@ -96,7 +105,7 @@ const getDialog = async () => {
|
|
|
const data = res.data.rows.map((item) => {
|
|
|
return {
|
|
|
...item,
|
|
|
- time: new Date(item.update_time).toLocaleString('zh-CN'),
|
|
|
+ time: new Date(item.create_time).toLocaleString('zh-CN'),
|
|
|
desc: item.description,
|
|
|
img_src: getImageIntelligent(item.icon) || getIconIntelligent(item.icon),
|
|
|
user: item.user.userName || '-',
|
|
|
@@ -127,8 +136,31 @@ const openManageTags = () => {
|
|
|
const editIntelligent = (item) => {
|
|
|
bus_intelligentEdit.emit(item);
|
|
|
};
|
|
|
-const deleteIntelligent = () => {
|
|
|
- console.log('deleteIntelligent');
|
|
|
+const deleteIntelligent = (item) => {
|
|
|
+ Modal.warning({
|
|
|
+ title: '提示',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ hideCancel: false,
|
|
|
+ content: '确定删除该智能体吗?',
|
|
|
+ async onOk(e) {
|
|
|
+ console.log('确定', item.agentType, dialogType.DIFY);
|
|
|
+ // dify删除
|
|
|
+ if (item.agentType == dialogType.DIFY) {
|
|
|
+ await deleteDify(item.id);
|
|
|
+ // TODO:刷新页面
|
|
|
+ bus_intelligentSearch.emit('');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onCancel(e) {
|
|
|
+ console.log('取消');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // if (item.agentType == dialogType.DIFY) {
|
|
|
+
|
|
|
+ // deleteDify(item.id).then((res) => {});
|
|
|
+ // }
|
|
|
+ // console.log('deleteIntelligent');
|
|
|
};
|
|
|
|
|
|
// 获取标签列表
|
|
|
@@ -224,7 +256,6 @@ onBeforeUnmount(() => {
|
|
|
}
|
|
|
.label-btn {
|
|
|
text-align: left;
|
|
|
- padding: 8px 10px;
|
|
|
background-color: var(--color-neutral-2);
|
|
|
color: var(--color-neutral-6);
|
|
|
font-size: 12px;
|
|
|
@@ -235,6 +266,7 @@ onBeforeUnmount(() => {
|
|
|
-webkit-line-clamp: 1;
|
|
|
-webkit-box-orient: vertical;
|
|
|
text-overflow: ellipsis;
|
|
|
+ visibility: hidden;
|
|
|
}
|
|
|
.label-add {
|
|
|
width: 240px;
|
|
|
@@ -253,5 +285,17 @@ onBeforeUnmount(() => {
|
|
|
.tools {
|
|
|
display: flex;
|
|
|
gap: 5px;
|
|
|
+ visibility: hidden;
|
|
|
+}
|
|
|
+.card_box:hover .tools {
|
|
|
+ cursor: pointer;
|
|
|
+ visibility: visible;
|
|
|
+}
|
|
|
+.card_box:hover .label-btn {
|
|
|
+ visibility: visible;
|
|
|
+}
|
|
|
+.btn-content {
|
|
|
+ visibility: visible;
|
|
|
+ background-color: var(--color-bg-1);
|
|
|
}
|
|
|
</style>
|