项目历史
This commit is contained in:
@@ -40,3 +40,18 @@ export const getProjectInfo = (data) => {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目版本列表
|
||||||
|
* @param params 获取项目版本列表参数
|
||||||
|
* @param params.page 页码
|
||||||
|
* @param params.size 每页数量
|
||||||
|
* @returns 获取项目版本列表
|
||||||
|
*/
|
||||||
|
export const getProjectList = (params) => {
|
||||||
|
return request({
|
||||||
|
url: `/api/project/list`,
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -48,6 +48,13 @@
|
|||||||
import { FlowManager } from './manager/FlowManager'
|
import { FlowManager } from './manager/FlowManager'
|
||||||
import { NodeManager } from './manager/NodeManager'
|
import { NodeManager } from './manager/NodeManager'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const vueFlow = ref<any>()
|
const vueFlow = ref<any>()
|
||||||
const nodeTypes = ref([NODE_TYPE.INPUT, NODE_TYPE.SECONDARY, NODE_TYPE.OUTPUT])
|
const nodeTypes = ref([NODE_TYPE.INPUT, NODE_TYPE.SECONDARY, NODE_TYPE.OUTPUT])
|
||||||
|
|
||||||
@@ -98,11 +105,12 @@
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// window['vueFlow'] = vueFlow
|
// window['vueFlow'] = vueFlow
|
||||||
// window['nodes'] = nodes
|
// window['nodes'] = nodes
|
||||||
|
console.log(props.config)
|
||||||
nodeManager.createResultNode({
|
nodeManager.createResultNode({
|
||||||
data: {
|
data: {
|
||||||
isHeader: false,
|
isHeader: false,
|
||||||
data: {
|
data: {
|
||||||
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__'
|
url: props.config.url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<fullscreen-dialog v-model="dialogVisible" hide-destroy>
|
<fullscreen-dialog v-model="dialogVisible" hide-destroy>
|
||||||
<flow-canvas />
|
<flow-canvas :config="config" />
|
||||||
</fullscreen-dialog>
|
</fullscreen-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -9,9 +9,10 @@
|
|||||||
import flowCanvas from './flow-canvas.vue'
|
import flowCanvas from './flow-canvas.vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const open = () => {
|
const config = ref({})
|
||||||
console.log('open')
|
const open = (options) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
config.value = options || {}
|
||||||
}
|
}
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const router = createRouter({
|
|||||||
component: () => import('../views/home/mainInput.vue')
|
component: () => import('../views/home/mainInput.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'agent',
|
path: 'agent/:id',
|
||||||
name: 'agent',
|
name: 'agent',
|
||||||
component: () => import('../views/home/agent/index.vue')
|
component: () => import('../views/home/agent/index.vue')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
userInfoStore.getUserInfo()
|
userInfoStore.getUserInfo()
|
||||||
|
|
||||||
const flowCanvasRef = ref(null)
|
const flowCanvasRef = ref(null)
|
||||||
const openFlowCanvas = () => {
|
const openFlowCanvas = (config) => {
|
||||||
flowCanvasRef.value.open()
|
flowCanvasRef.value.open(config)
|
||||||
}
|
}
|
||||||
myEvent.add('openFlowCanvas', openFlowCanvas)
|
myEvent.add('openFlowCanvas', openFlowCanvas)
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
@@ -55,6 +55,8 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { getProjectList } from '@/api/agent'
|
||||||
|
import { FormatDate } from '@/utils/tools'
|
||||||
const { t: $t } = useI18n()
|
const { t: $t } = useI18n()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -66,40 +68,36 @@
|
|||||||
globalStore.setHomeLeftNavCollapse(!isCollapse.value)
|
globalStore.setHomeLeftNavCollapse(!isCollapse.value)
|
||||||
}
|
}
|
||||||
const showHistory = ref(true)
|
const showHistory = ref(true)
|
||||||
const historyList = ref([
|
|
||||||
{
|
const todayList = ref([])
|
||||||
title: true,
|
const yesterdayList = ref([])
|
||||||
name: $t('Home.today')
|
const earlierChatList = ref([])
|
||||||
},
|
const historyList = computed(() => {
|
||||||
{
|
const list = []
|
||||||
id: 1,
|
if (todayList.value.length > 0) {
|
||||||
name: 'Conversation Item 1'
|
list.push({
|
||||||
},
|
title: true,
|
||||||
{
|
name: $t('Home.today')
|
||||||
id: 2,
|
})
|
||||||
name: 'Conversation Item 2'
|
list.push(...todayList.value)
|
||||||
},
|
|
||||||
{
|
|
||||||
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'
|
|
||||||
}
|
}
|
||||||
])
|
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 = () => {
|
const onCreateProject = () => {
|
||||||
router.push({ name: 'mainInput' })
|
router.push({ name: 'mainInput' })
|
||||||
}
|
}
|
||||||
@@ -113,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onClickHistoryItem = (item: any) => {
|
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 onRenameHistoryItem = (item: any) => {
|
||||||
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
||||||
@@ -121,12 +119,37 @@
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
const onDeleteHistoryItem = (item: any) => {
|
const onDeleteHistoryItem = (item: any) => {
|
||||||
console.log(item)
|
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
||||||
const index = historyList.value.findIndex((i: any) => i.id == item.id)
|
// if (index != -1) {
|
||||||
if (index != -1) {
|
// historyList.value.splice(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>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const id = computed(() => route.params.id)
|
const id = computed(() => route.params.id)
|
||||||
const openCanvas = () => {
|
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(() => {
|
onMounted(() => {
|
||||||
openCanvas();
|
openCanvas()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user