|
|
@@ -7,28 +7,38 @@
|
|
|
}}</template>
|
|
|
</div>
|
|
|
|
|
|
- <div v-if="is_data_item" :class="item_klass" @click="handleClick">
|
|
|
+ <div v-if="show_current_item" :class="item_klass" @click="handleClick">
|
|
|
<div class="history-item-icon"></div>
|
|
|
|
|
|
<div class="history-item-intro">
|
|
|
<div class="history-item-intro-title">{{ history.name }}</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="history-item-time">{{ time_display }}</div>
|
|
|
+ <div class="history-item-actions">
|
|
|
+ <span class="history-item-time">{{ time_display }}</span>
|
|
|
+
|
|
|
+ <span class="history-item-delete">
|
|
|
+ <BtnHistoryItemDelete :target_id="history.id" @deleteSuccess="handleDeleteSuccess" />
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed } from 'vue';
|
|
|
+import { ref, computed } from 'vue';
|
|
|
import { formatTimestamp2Hours, formatTimestamp2Weekend, formatTimestamp2Date } from '../../utils/datetime';
|
|
|
import { useLocaleStore } from '../../base/store/use-locale';
|
|
|
|
|
|
+import BtnHistoryItemDelete from './BtnHistoryItemDelete.vue';
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
history: Object,
|
|
|
index: Number
|
|
|
});
|
|
|
|
|
|
-const emit = defineEmits('active');
|
|
|
+const emit = defineEmits(['active', 'delete']);
|
|
|
+
|
|
|
+const is_deleted = ref(false);
|
|
|
|
|
|
/**
|
|
|
* history示例数据
|
|
|
@@ -61,6 +71,11 @@ const is_data_item = computed(() => {
|
|
|
return props.history.client_field_content_type === 'content';
|
|
|
});
|
|
|
|
|
|
+// 是否显示当前的数据项目
|
|
|
+const show_current_item = computed(() => {
|
|
|
+ return is_data_item.value && !is_deleted.value;
|
|
|
+});
|
|
|
+
|
|
|
const item_klass = computed(() => {
|
|
|
const obj = {
|
|
|
'conversation-history-item': true
|
|
|
@@ -112,6 +127,14 @@ const time_display = computed(() => {
|
|
|
const handleClick = () => {
|
|
|
emit('active', props.history.id);
|
|
|
};
|
|
|
+
|
|
|
+const handleItemDelete = () => {
|
|
|
+ emit('delete', props.history.id);
|
|
|
+};
|
|
|
+
|
|
|
+const handleDeleteSuccess = () => {
|
|
|
+ is_deleted.value = true;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="css" scoped>
|
|
|
@@ -164,4 +187,23 @@ const handleClick = () => {
|
|
|
|
|
|
.history-item-intro-desc {
|
|
|
}
|
|
|
+
|
|
|
+.conversation-history-section-data:hover {
|
|
|
+ box-shadow: 0 0 5px var(--color-text-1);
|
|
|
+}
|
|
|
+.conversation-history-section-data:hover .history-item-time {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.conversation-history-section-data:hover .history-item-delete {
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
+
|
|
|
+.history-item-actions {
|
|
|
+}
|
|
|
+.history-item-time {
|
|
|
+}
|
|
|
+.history-item-delete {
|
|
|
+ display: none;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|