项目历史

This commit is contained in:
lzp
2026-02-27 16:47:02 +08:00
parent 190357caf5
commit 834f163fce
7 changed files with 99 additions and 50 deletions

View File

@@ -31,8 +31,8 @@
userInfoStore.getUserInfo()
const flowCanvasRef = ref(null)
const openFlowCanvas = () => {
flowCanvasRef.value.open()
const openFlowCanvas = (config) => {
flowCanvasRef.value.open(config)
}
myEvent.add('openFlowCanvas', openFlowCanvas)
onUnmounted(() => {

View File

@@ -55,6 +55,8 @@
import { computed, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { getProjectList } from '@/api/agent'
import { FormatDate } from '@/utils/tools'
const { t: $t } = useI18n()
const route = useRoute()
const router = useRouter()
@@ -66,40 +68,36 @@
globalStore.setHomeLeftNavCollapse(!isCollapse.value)
}
const showHistory = ref(true)
const historyList = ref([
{
title: true,
name: $t('Home.today')
},
{
id: 1,
name: 'Conversation Item 1'
},
{
id: 2,
name: 'Conversation Item 2'
},
{
title: true,
name: $t('Home.yesterday')
},
{
id: 3,
name: 'Conversation Item 3'
},
{
title: true,
name: $t('Home.earlierChat')
},
{
id: 4,
name: 'Conversation Item 4'
},
{
id: 5,
name: 'Conversation Item 5'
const todayList = ref([])
const yesterdayList = ref([])
const earlierChatList = ref([])
const historyList = computed(() => {
const list = []
if (todayList.value.length > 0) {
list.push({
title: true,
name: $t('Home.today')
})
list.push(...todayList.value)
}
])
if (yesterdayList.value.length > 0) {
list.push({
title: true,
name: $t('Home.yesterday')
})
list.push(...yesterdayList.value)
}
if (earlierChatList.value.length > 0) {
list.push({
title: true,
name: $t('Home.earlierChat')
})
list.push(...earlierChatList.value)
}
return list
})
const onCreateProject = () => {
router.push({ name: 'mainInput' })
}
@@ -113,7 +111,7 @@
}
}
const onClickHistoryItem = (item: any) => {
router.push({ name: 'test', params: { id: item.id } })
router.push({ name: 'agent', params: { id: item.id } })
}
const onRenameHistoryItem = (item: any) => {
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
@@ -121,12 +119,37 @@
// }
}
const onDeleteHistoryItem = (item: any) => {
console.log(item)
const index = historyList.value.findIndex((i: any) => i.id == item.id)
if (index != -1) {
historyList.value.splice(index, 1)
}
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
// if (index != -1) {
// historyList.value.splice(index, 1)
// }
}
const GetProjectList = async () => {
const res = await getProjectList({
page: 1,
size: 100
})
const str = 'yyyyMMdd'
const today = FormatDate(Date.now(), str)
const yesterday = FormatDate(Date.now() - 24 * 60 * 60 * 1000, str)
todayList.value = []
yesterdayList.value = []
earlierChatList.value = []
const list = res.records || []
list.forEach((item: any) => {
const obj = { ...item }
const date = FormatDate(obj.createTime * 1000, str)
if (date == today) {
todayList.value.push(obj)
} else if (date == yesterday) {
yesterdayList.value.push(obj)
} else {
earlierChatList.value.push(obj)
}
})
}
GetProjectList()
</script>
<style lang="less" scoped>

View File

@@ -12,10 +12,12 @@
const route = useRoute()
const id = computed(() => route.params.id)
const openCanvas = () => {
myEvent.emit('openFlowCanvas')
myEvent.emit('openFlowCanvas', {
url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__'
})
}
onMounted(() => {
openCanvas();
openCanvas()
})
</script>