Merge branch 'main' of http://18.167.251.121:10003/aidlab/FiDA_Front
This commit is contained in:
@@ -55,10 +55,9 @@
|
||||
token: userStore.state.token,
|
||||
versionID: '',
|
||||
configParams: {
|
||||
type: 'Chair',
|
||||
region: 'China',
|
||||
style: 'Transitional',
|
||||
temperature: 0.7
|
||||
type: '',
|
||||
region: '',
|
||||
style: ''
|
||||
},
|
||||
imageUrlList: []
|
||||
})
|
||||
|
||||
@@ -74,35 +74,34 @@ const openTree = (state)=>{
|
||||
}
|
||||
|
||||
const versionRestore = () => {
|
||||
|
||||
let id = ''
|
||||
if(selectItem.value?.children?.length > 0){
|
||||
function findMaxForYourFormat(items) {
|
||||
let max = 0
|
||||
// let id = ''
|
||||
// if(selectItem.value?.children?.length > 0){
|
||||
// function findMaxForYourFormat(items) {
|
||||
// let max = 0
|
||||
|
||||
for (const item of items) {
|
||||
// 直接分割并取最后一部分
|
||||
const parts = item?.versionId.split('-')
|
||||
const lastNumber = parseInt(parts[parts.length - 1], 10)
|
||||
// for (const item of items) {
|
||||
// // 直接分割并取最后一部分
|
||||
// const parts = item?.versionId.split('-')
|
||||
// const lastNumber = parseInt(parts[parts.length - 1], 10)
|
||||
|
||||
if (lastNumber > max) {
|
||||
max = lastNumber
|
||||
}
|
||||
}
|
||||
// if (lastNumber > max) {
|
||||
// max = lastNumber
|
||||
// }
|
||||
// }
|
||||
|
||||
return max
|
||||
}
|
||||
id = `${selectItem.value?.versionId}-${findMaxForYourFormat(selectItem.value?.children) + 1}`
|
||||
}else{
|
||||
id = `${selectItem.value?.versionId}-1`
|
||||
}
|
||||
let addObj = {
|
||||
id,
|
||||
name:`V${id}`
|
||||
}
|
||||
findAndAddChild(versionsList.value, selectItem.value?.versionId, addObj)
|
||||
selectItem.value = {...addObj}
|
||||
treeKey.value++
|
||||
// return max
|
||||
// }
|
||||
// id = `${selectItem.value?.versionId}-${findMaxForYourFormat(selectItem.value?.children) + 1}`
|
||||
// }else{
|
||||
// id = `${selectItem.value?.versionId}-1`
|
||||
// }
|
||||
// let addObj = {
|
||||
// id,
|
||||
// name:`V${id}`
|
||||
// }
|
||||
// findAndAddChild(versionsList.value, selectItem.value?.versionId, addObj)
|
||||
// selectItem.value = {...addObj}
|
||||
// treeKey.value++
|
||||
emit('restore')
|
||||
emit('update:versionTreeData', {...props.versionTreeData, drawer: false})
|
||||
}
|
||||
@@ -112,6 +111,11 @@ const versionDelete = (versionDetail)=>{
|
||||
treeKey.value++
|
||||
}
|
||||
|
||||
watch(()=>projectStore.state.nodeId,(newVal,oldVal)=>{
|
||||
if(!newVal || newVal === selectItem?.value?.id)return
|
||||
selectItem.value = {id:newVal}
|
||||
})
|
||||
|
||||
let data = reactive({})
|
||||
// onMounted(() => {setVersionsList('')})
|
||||
onUnmounted(() => {})
|
||||
|
||||
@@ -68,7 +68,7 @@ const initialize = ()=>{
|
||||
})
|
||||
console.log(treeList)
|
||||
isLoad.value = true
|
||||
if(!props.selectItem?.versionId)setSelectItem(treeList.value[treeList.value.length - 1])
|
||||
// if(!props.selectItem?.versionId)setSelectItem(treeList.value[treeList.value.length - 1])
|
||||
}
|
||||
|
||||
const setSelectItem = (item)=>{
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
import { createProject } from '@/api/agent'
|
||||
import { getStyleImage } from './style'
|
||||
import { uploadImage } from '@/api/upload'
|
||||
import MyEvent from '@/utils/myEvent'
|
||||
// import Tag from './Tag.vue'
|
||||
|
||||
const router = useRouter()
|
||||
@@ -424,8 +425,6 @@
|
||||
const handleKeyDown = (e) => {
|
||||
// 检测回车
|
||||
if (e.key === 'Enter') {
|
||||
console.log('11111111111')
|
||||
|
||||
e.preventDefault()
|
||||
if (props.isAgentMode) {
|
||||
handleSendAgent()
|
||||
@@ -569,6 +568,7 @@
|
||||
const projectres = await createProject(params)
|
||||
// console.log('projectres', projectres)
|
||||
projectStore.setId(projectres)
|
||||
MyEvent.emit('updateProjectList')
|
||||
// 保存初始数据到 store
|
||||
agentStore.setInitialProjectData({
|
||||
text: inputValue.value.trim(),
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getProjectList } from '@/api/agent'
|
||||
import { FormatDate } from '@/utils/tools'
|
||||
import MyEvent from '@/utils/myEvent'
|
||||
const { t: $t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -154,7 +155,8 @@
|
||||
earlierChatList.value.push(obj)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
MyEvent.add('updateProjectList', GetProjectList)
|
||||
GetProjectList()
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user