Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/FiDA_Front
This commit is contained in:
@@ -27,3 +27,16 @@ export interface CreateProjectParamsType {
|
||||
export const createProject = (data: CreateProjectParamsType): Promise<any> => {
|
||||
return request({ url: '/api/project/init', method: 'post', data })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目信息
|
||||
* @param data 获取项目信息参数
|
||||
* @param data.id 项目id
|
||||
* @returns 获取项目信息
|
||||
*/
|
||||
export const getProjectInfo = (data) => {
|
||||
return request({
|
||||
url: `/api/project/${data.id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import request from '@/utils/request'
|
||||
*/
|
||||
export const getChatNodeDetail = (data) => {
|
||||
return request({
|
||||
url: `/api/project/${data.projectId}/chat/node/${data.id}`,
|
||||
url: `/api/version/${data.projectId}/chat/node/${data.id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -22,7 +22,20 @@ export const getChatNodeDetail = (data) => {
|
||||
*/
|
||||
export const versionTree = (data) => {
|
||||
return request({
|
||||
url: `/api/project/${data.projectId}/chat/tree`,
|
||||
url: `/api/version/${data.projectId}/chat/tree`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取版本树
|
||||
* @param data 获取版本树的参数
|
||||
* @param data.projectId 项目id
|
||||
* @returns 获取版本树
|
||||
*/
|
||||
export const getNodeAncestors = (data) => {
|
||||
return request({
|
||||
url: `/api/version/${data.projectId}/chat/node/${data.id}/ancestors`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -3,13 +3,12 @@ import { ref, computed } from 'vue'
|
||||
export const useProjectStore = defineStore('project', () => {
|
||||
const state = ref({// 项目参数
|
||||
id: '',
|
||||
nodeId: '',
|
||||
})
|
||||
|
||||
const setProject = (obj: any) => {
|
||||
for (const key in obj) {
|
||||
if(state.value[key]){
|
||||
state.value[key] = obj[key]
|
||||
}
|
||||
state.value[key] = obj[key]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +22,4 @@ export const useProjectStore = defineStore('project', () => {
|
||||
setId
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
16
src/stores/versionTree.ts
Normal file
16
src/stores/versionTree.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
export const useVersionTreeStore = defineStore('versionTree', () => {
|
||||
const state = ref({
|
||||
nodeDetail: {
|
||||
|
||||
},// 节点详情
|
||||
})
|
||||
|
||||
const setNodeDetail = (v: any) => { state.value.nodeDetail = v }
|
||||
|
||||
return {
|
||||
state,
|
||||
setNodeDetail,
|
||||
}
|
||||
})
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onUnmounted, onMounted, nextTick } from 'vue'
|
||||
import { ref, reactive, computed, onUnmounted, onMounted, nextTick,watch } from 'vue'
|
||||
import List from './List.vue'
|
||||
import Input from '../../components/Input.vue'
|
||||
import { fetchAgentReply } from '@/api/agent'
|
||||
@@ -31,6 +31,8 @@
|
||||
const userStore = useUserInfoStore()
|
||||
const agentStore = useAgentStore()
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
const emits = defineEmits(['update:sketchList'])
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title: string
|
||||
@@ -41,6 +43,7 @@
|
||||
)
|
||||
|
||||
const messageList = ref([])
|
||||
|
||||
const listRef = ref()
|
||||
const isGenerating = ref(false)
|
||||
const isPaused = ref(false) // 标记是否为主动暂停
|
||||
@@ -58,6 +61,13 @@
|
||||
imageUrlList: []
|
||||
})
|
||||
|
||||
const sketchList = ref([])
|
||||
watch(sketchList, (newVal) => {
|
||||
console.log('添加图片链接--------');
|
||||
|
||||
emits('update:sketchList', newVal)
|
||||
}, { deep: true })
|
||||
|
||||
// 每次请求时创建新的 AbortController
|
||||
let abort: AbortController
|
||||
|
||||
@@ -81,9 +91,9 @@
|
||||
if (initialData) {
|
||||
// 等待页面渲染完成后自动发送初始消息
|
||||
params.configParams = {
|
||||
type: initialData.type ,
|
||||
type: initialData.type,
|
||||
region: initialData.area,
|
||||
style: initialData.style ,
|
||||
style: initialData.style,
|
||||
temperature: 0.7
|
||||
}
|
||||
handleSendMessage({
|
||||
@@ -97,10 +107,13 @@
|
||||
}
|
||||
})
|
||||
|
||||
const handleSendMessage = async (message: {
|
||||
text: string
|
||||
images: Array<{ url: string; name: string }>
|
||||
}, skipUserMessage = false) => {
|
||||
const handleSendMessage = async (
|
||||
message: {
|
||||
text: string
|
||||
images: Array<{ url: string; name: string }>
|
||||
},
|
||||
skipUserMessage = false
|
||||
) => {
|
||||
console.log('Message sent:', message)
|
||||
isPaused.value = false
|
||||
isGenerating.value = true
|
||||
@@ -197,6 +210,7 @@
|
||||
console.log('传输结束 end---', contentBody)
|
||||
aiMessage.streaming = false
|
||||
aiMessage.loading = false
|
||||
isGenerating.value = false
|
||||
flag = false
|
||||
break
|
||||
}
|
||||
@@ -217,12 +231,21 @@
|
||||
isNodeIdEvent = true
|
||||
// continue
|
||||
}
|
||||
console.log('event', event)
|
||||
if (event.includes('error')) {
|
||||
aiMessage.text = '出现错误,请重试'
|
||||
aiMessage.streaming = false
|
||||
aiMessage.loading = false
|
||||
isGenerating.value = false
|
||||
flag = false
|
||||
break
|
||||
}
|
||||
|
||||
const dataLines = event
|
||||
.split(/\n/)
|
||||
.filter((line) => line.startsWith('data:'))
|
||||
.map((line) => line.replace(/^data:\s*/, '').trim())
|
||||
console.log('dataLInes', dataLines)
|
||||
// console.log('dataLInes', dataLines)
|
||||
if (isNodeIdEvent) {
|
||||
params.versionID = dataLines[0]
|
||||
}
|
||||
@@ -232,10 +255,14 @@
|
||||
|
||||
try {
|
||||
const jsonData = JSON.parse(jsonText)
|
||||
|
||||
console.log('jsonData', jsonData);
|
||||
|
||||
// 赋值 project_id 和 version_id
|
||||
if (jsonData.project_id) params.projectID = jsonData.project_id
|
||||
if (jsonData.version_id) params.versionID = jsonData.version_id
|
||||
// if (jsonData.project_id) params.projectID = jsonData.project_id
|
||||
// if (jsonData.version_id) params.versionID = jsonData.version_id
|
||||
if (jsonData.image_url) {
|
||||
sketchList.value.push(jsonData.image_url)
|
||||
}
|
||||
if (
|
||||
jsonData.content &&
|
||||
jsonData.content.length > 0 &&
|
||||
@@ -243,6 +270,7 @@
|
||||
) {
|
||||
contentBody += jsonData.content
|
||||
aiMessage.text = contentBody
|
||||
aiMessage.loading = false
|
||||
}
|
||||
if (jsonData.type === 'end') {
|
||||
aiMessage.streaming = false
|
||||
@@ -334,7 +362,9 @@
|
||||
}
|
||||
.agent-container {
|
||||
// width: 39%;
|
||||
width: 63.4rem;
|
||||
// width: 63.4rem;
|
||||
flex: 1;
|
||||
margin-right: 2.7rem;
|
||||
background-color: #fff;
|
||||
border-radius: 2rem;
|
||||
box-shadow: 0px 15px 21px 0px #0000000d;
|
||||
|
||||
@@ -4,13 +4,21 @@
|
||||
:class="type === 'sketch' ? 'sketch-preview' : 'report-preview'"
|
||||
>
|
||||
<template v-if="type === 'sketch'">
|
||||
<div class="sketch-item" v-for="item in 12">
|
||||
<div
|
||||
class="sketch-item"
|
||||
v-for="(item, index) in sketchList"
|
||||
:key="'sketch-item-' + index"
|
||||
>
|
||||
<Menu class="menu-btn" @click="handleClickMenu" />
|
||||
<div class="edit-btn flex align-center space-between" @click="handleClickEdit">
|
||||
<div>Edit</div>
|
||||
<img src="@/assets/images/arrow-top-right.png" alt="" />
|
||||
<img src="@/assets/images/arrow-top-right.png" />
|
||||
</div>
|
||||
<img :src="LoadingImg" alt="" />
|
||||
<img
|
||||
:src="getImageSrc(item, index)"
|
||||
:alt="'sketch-' + index"
|
||||
@load="handleImageLoad(index)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="reportBorder">
|
||||
@@ -28,116 +36,127 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题 <br />
|
||||
# 一级标题
|
||||
<br />
|
||||
# 一级标题
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import Menu from './Menu.vue'
|
||||
import LoadingImg from '@/assets/images/sketch-loading.gif'
|
||||
import reportNull from '@/assets/images/reportNull.png'
|
||||
import LoadingImg from '@/assets/images/sketch-loading.gif'
|
||||
import reportNull from '@/assets/images/reportNull.png'
|
||||
|
||||
// 存储每个图片的加载状态
|
||||
const loadedStatus = reactive<Record<number, boolean>>({})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
type: 'sketch' | 'report'
|
||||
sketchList: Array<string>
|
||||
}>(),
|
||||
{
|
||||
type: 'sketch'
|
||||
type: 'sketch',
|
||||
sketchList: []
|
||||
}
|
||||
)
|
||||
|
||||
// 图片加载完成时触发
|
||||
const handleImageLoad = (index: number) => {
|
||||
loadedStatus[index] = true
|
||||
}
|
||||
|
||||
const handleClickEdit = () => {
|
||||
// 编辑按钮点击逻辑
|
||||
console.log('Edit button clicked')
|
||||
}
|
||||
const handleClickMenu = () => {
|
||||
// 菜单按钮点击逻辑
|
||||
console.log('Menu button clicked')
|
||||
}
|
||||
|
||||
// 获取当前显示的图片源
|
||||
const getImageSrc = (item: string, index: number) => {
|
||||
return loadedStatus[index] ? item : LoadingImg
|
||||
}
|
||||
|
||||
const handleClickEdit = () => {
|
||||
// 编辑按钮点击逻辑
|
||||
console.log('Edit button clicked')
|
||||
}
|
||||
const handleClickMenu = () => {
|
||||
// 菜单按钮点击逻辑
|
||||
console.log('Menu button clicked')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -172,13 +191,13 @@
|
||||
font-size: 1.4rem;
|
||||
padding: 0 0.9rem 0 1.4rem;
|
||||
cursor: pointer;
|
||||
img{
|
||||
img {
|
||||
width: 1.8rem;
|
||||
height: 1.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
.reportBorder{
|
||||
.reportBorder {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -190,7 +209,11 @@
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background: linear-gradient(119.03deg, rgba(233, 121, 60, 0.3) 1.61%, rgba(255, 207, 144, 0.3) 101.01%);
|
||||
background: linear-gradient(
|
||||
119.03deg,
|
||||
rgba(233, 121, 60, 0.3) 1.61%,
|
||||
rgba(255, 207, 144, 0.3) 101.01%
|
||||
);
|
||||
border-radius: 2.3rem;
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
@@ -205,20 +228,20 @@
|
||||
height: calc(100% - var(--border-width) * 2);
|
||||
border-radius: 2rem;
|
||||
display: flex;
|
||||
.report-content-null{
|
||||
.report-content-null {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.report-content{
|
||||
.report-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
.downBtnBox{
|
||||
.downBtnBox {
|
||||
padding: 2.2rem 5.2rem 0;
|
||||
.downBtn{
|
||||
.downBtn {
|
||||
display: flex;
|
||||
width: 11.2rem;
|
||||
justify-content: center;
|
||||
@@ -228,16 +251,16 @@
|
||||
background-color: #ff7a51;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
.icon{
|
||||
margin-right: .02rem;
|
||||
.icon {
|
||||
margin-right: 0.02rem;
|
||||
}
|
||||
span{
|
||||
span {
|
||||
font-weight: 500;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content{
|
||||
.content {
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, reactive, toRefs } from "vue";
|
||||
import { ref, onMounted, onUnmounted, reactive, watch } from "vue";
|
||||
import VersionDetail from './versionDetail.vue'
|
||||
import ChatDetail from './chatDetail.vue'
|
||||
import { useProjectStore } from '@/stores'
|
||||
import { getChatNodeDetail, getNodeAncestors } from '@/api/versitonTree'
|
||||
|
||||
//const props = defineProps({
|
||||
//})
|
||||
const emit = defineEmits([
|
||||
])
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
const detailData = ref({
|
||||
id:1,
|
||||
versionDetail:{
|
||||
@@ -17,9 +23,25 @@ const detailData = ref({
|
||||
userChatDetail:{
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
watch(()=>projectStore.state.nodeId, (newVal, oldVal) => {
|
||||
console.log(newVal)
|
||||
if(newVal){
|
||||
getChatNodeDetail({
|
||||
projectId: projectStore.state.id,
|
||||
id: newVal
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
getNodeAncestors({
|
||||
projectId: projectStore.state.id,
|
||||
id: newVal
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
},{ immediate: true })
|
||||
onMounted(()=>{
|
||||
})
|
||||
onUnmounted(()=>{
|
||||
|
||||
@@ -5,7 +5,7 @@ import Detail from './detail/index.vue'
|
||||
// import { versionsList } from './tools/versionsData'
|
||||
import { findAndAddChild, findAndRemoveChild } from '../../../../../utils/treeDiagram'
|
||||
import { useProjectStore } from '@/stores'
|
||||
import { versionTree, getChatNodeDetail } from '@/api/versitonTree'
|
||||
import { versionTree } from '@/api/versitonTree'
|
||||
|
||||
const props = defineProps({
|
||||
versionTreeData: {
|
||||
@@ -25,65 +25,39 @@ const props = defineProps({
|
||||
const versionsList = ref([])
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
watch(()=>projectStore.state.id, (newVal, oldVal) => {
|
||||
if(newVal){
|
||||
versionTree({
|
||||
projectId: projectStore.state.id
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
|
||||
// versionsList.value = res.data
|
||||
})
|
||||
let oldProjectId:any = ''
|
||||
watch(()=>props.versionTreeData?.drawer, (newVal, oldVal) => {
|
||||
console.log(newVal,oldProjectId,projectStore.state.id)
|
||||
if(newVal && oldProjectId !== projectStore.state.id && projectStore.state.id){
|
||||
getVersionTree()
|
||||
oldProjectId = JSON.parse(JSON.stringify(projectStore.state.id))
|
||||
}
|
||||
})
|
||||
|
||||
const getVersionTree = ()=>{
|
||||
versionTree({
|
||||
projectId: projectStore.state.id
|
||||
}).then(res => {
|
||||
setVersionsList([res])
|
||||
})
|
||||
}
|
||||
|
||||
const setVersionsList = (res)=>{
|
||||
versionsList.value = [{
|
||||
"id": "node_001",
|
||||
"url": "https://example.com/images/cover_001.jpg",
|
||||
"children": [
|
||||
{
|
||||
"id": "node_002",
|
||||
"url": "https://example.com/images/cover_002.jpg",
|
||||
"children": [
|
||||
{
|
||||
"id": "node_003",
|
||||
"url": "https://example.com/images/cover_003.jpg",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"id": "node_004",
|
||||
"url": "https://example.com/images/cover_004.jpg",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "node_005",
|
||||
"url": "https://example.com/images/cover_005.jpg",
|
||||
"children": [
|
||||
{
|
||||
"id": "node_006",
|
||||
"url": "https://example.com/images/cover_006.jpg",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}]
|
||||
//设置versionId
|
||||
function traverseArray(items,father, callback) {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i]
|
||||
if(!item.url)continue
|
||||
callback(item, i,father)
|
||||
if (item.children && Array.isArray(item.children) && item.children.length > 0) {
|
||||
traverseArray(item.children, item, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
traverseArray(versionsList.value,'',(item,i,father)=>{
|
||||
traverseArray(res,'',(item,i,father)=>{
|
||||
item.versionId = father?`${father.versionId}-${i+1}`:'1'
|
||||
})
|
||||
versionsList.value = res
|
||||
}
|
||||
|
||||
const treeRef = ref(null)
|
||||
@@ -133,9 +107,9 @@ const versionDelete = (versionDetail)=>{
|
||||
}
|
||||
|
||||
let data = reactive({})
|
||||
onMounted(() => {setVersionsList('')})
|
||||
// onMounted(() => {setVersionsList('')})
|
||||
onUnmounted(() => {})
|
||||
defineExpose({})
|
||||
defineExpose({getVersionTree})
|
||||
const {} = toRefs(data)
|
||||
</script>
|
||||
<template>
|
||||
@@ -177,6 +151,7 @@ const {} = toRefs(data)
|
||||
<div class="versionTreeBox">
|
||||
<div class="tree">
|
||||
<Tree
|
||||
v-if="versionsList.length > 0"
|
||||
ref="treeRef"
|
||||
:versionsList="versionsList"
|
||||
:treeState="treeState"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import { ref, onMounted, onUnmounted, reactive, toRefs, watch, nextTick } from "vue";
|
||||
import view1Item from './view1Item.vue'
|
||||
import view2 from './view2/index.vue'
|
||||
import { useProjectStore } from '@/stores'
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
versionsList: {
|
||||
@@ -28,6 +30,8 @@ const view1Ref = ref(null)
|
||||
|
||||
const isLoad = ref(false)
|
||||
const treeStateTime = ref(true)
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
|
||||
watch(()=>props.treeState,(newVal,oldVal)=>{
|
||||
treeStateTime.value = false
|
||||
@@ -68,6 +72,8 @@ const initialize = ()=>{
|
||||
|
||||
const setSelectItem = (item)=>{
|
||||
if(!item.versionId)return
|
||||
console.log(item)
|
||||
// projectStore.setProject({latestNodeId: item.id})
|
||||
emit('update:selectItem', {...item})
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ const { layout } = useLayout()
|
||||
async function layoutGraph(direction) {
|
||||
setTimeout(() => {
|
||||
nodes.value = layout(nodes.value, edges.value, direction)
|
||||
console.log(nodes.value)
|
||||
nextTick(() => {
|
||||
fitView()
|
||||
})
|
||||
@@ -196,8 +195,10 @@ defineExpose({push})
|
||||
cursor: pointer;
|
||||
background-color: var(--treeItem-background);
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
&.active{
|
||||
background-color: var(--treeItem-active-background);
|
||||
// background-color: var(--treeItem-active-background);
|
||||
border: 2px solid #000;
|
||||
}
|
||||
&.start{
|
||||
background-color: #7A7A7A;
|
||||
|
||||
@@ -1,34 +1,58 @@
|
||||
<template>
|
||||
<div class="agent-wrapper flex space-between">
|
||||
<div class="openVersionTree">
|
||||
<div class="btn" @click="versionTreeData.drawer = true">
|
||||
Version Tree
|
||||
</div>
|
||||
<div class="btn" @click="versionTreeData.drawer = true">Version Tree</div>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<Agent :title="agentTitle" />
|
||||
<Agent :title="agentTitle" @update:sketchList="updateSketchList" />
|
||||
<div class="preview-wrapper">
|
||||
<Preview :type="previewType" />
|
||||
<Preview :type="previewType" :sketchList="sketchList" />
|
||||
</div>
|
||||
</div>
|
||||
<VersionTreeIndex v-model:versionTreeData="versionTreeData" />
|
||||
<VersionTreeIndex ref="VersionTreeIndexRef" v-model:versionTreeData="versionTreeData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import Agent from './components/Agent.vue'
|
||||
import Preview from './components/Preview.vue'
|
||||
import VersionTreeIndex from './components/versionTree/index.vue'
|
||||
import { useProjectStore } from '@/stores'
|
||||
import { getProjectInfo } from '@/api/agent'
|
||||
|
||||
|
||||
const agentTitle = ref('Retro Sofa Sketch')
|
||||
const previewType = ref<'sketch' | 'report'>('report')
|
||||
const previewType = ref<'sketch' | 'report'>('sketch')
|
||||
|
||||
const VersionTreeIndexRef = ref()
|
||||
|
||||
const sketchList = ref([])
|
||||
const updateSketchList = (newVal) => {
|
||||
console.log('newVal', newVal)
|
||||
sketchList.value = newVal
|
||||
// VersionTreeIndexRef.value.getVersionTree()
|
||||
}
|
||||
|
||||
const versionTreeData = ref({
|
||||
drawer:false,
|
||||
list:computed(()=>{
|
||||
return []
|
||||
})
|
||||
drawer: false,
|
||||
})
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
watch(()=>projectStore.state.id, (newVal, oldVal) => {
|
||||
if(newVal){
|
||||
getProjectInfo({ id: newVal }).then(res => {
|
||||
projectStore.setProject(res.project)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(()=>{
|
||||
if(projectStore.state.id){
|
||||
getProjectInfo({ id: projectStore.state.id }).then(res => {
|
||||
projectStore.setProject(res.project)
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -39,13 +63,13 @@
|
||||
border-top: 0.1rem solid #c9c9c9;
|
||||
padding: 0rem 2.3rem 6rem 2.8rem;
|
||||
flex-direction: column;
|
||||
.openVersionTree{
|
||||
.openVersionTree {
|
||||
padding: 2rem 0rem;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
height: min-content;
|
||||
> .btn{
|
||||
> .btn {
|
||||
padding: 1.5rem 1.45rem;
|
||||
font-weight: 500;
|
||||
font-size: 1.4rem;
|
||||
@@ -57,14 +81,18 @@
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -1px;
|
||||
background: linear-gradient(119.03deg, rgba(233, 121, 60, 0.8) 1.61%, rgba(255, 207, 144, 0.8) 101.01%);
|
||||
background: linear-gradient(
|
||||
119.03deg,
|
||||
rgba(233, 121, 60, 0.8) 1.61%,
|
||||
rgba(255, 207, 144, 0.8) 101.01%
|
||||
);
|
||||
border-radius: 2.2rem;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content-wrapper{
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user