Browse Source

Merge pull request 'fix #1172 模型列表有2个展开的模型节点时,给A创建新版本,B的展开图标会消失' (#2550) from fix-1172 into V20220801

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2550
Reviewed-by: zhoupzh <zhoupzh@pcl.ac.cn>
pull/2575/head
zhoupzh 2 years ago
parent
commit
2eec9123ac
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      web_src/js/components/Model.vue

+ 9
- 7
web_src/js/components/Model.vue View File

@@ -6,7 +6,7 @@
ref="table"
:data="tableData"
style="min-width: 100%"
row-key="ID"
row-key="rowKey"
lazy
:load="load"
:tree-props="{children: 'Children', hasChildren: 'hasChildren'}"
@@ -171,6 +171,7 @@ export default {
tableData[i].EngineName = this.getEngineName(tableData[i])
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
tableData[i].cName=tableData[i].Name
tableData[i].rowKey = tableData[i].ID + Math.random()
tableData[i].Name=''
tableData[i].VersionCount = ''
tableData[i].Children = true
@@ -310,18 +311,18 @@ export default {
const store = this.$refs.table.store
if(!this.loadNodeMap.get(row.cName)){
const parent = store.states.data
const index = parent.findIndex(child => child.ID == row.ID)
const index = parent.findIndex(child => child.rowKey == row.rowKey)
this.getModelList()
}else{
let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName)
const keys = Object.keys(store.states.lazyTreeNodeMap);
if(keys.includes(row.ID)){
if(keys.includes(row.rowKey)){
this.getModelList()
}else{
let parentRow = store.states.data.find(child => child.cName == row.cName);
let childrenIndex = store.states.lazyTreeNodeMap[parentRow.ID].findIndex(child => child.ID == row.ID)
let childrenIndex = store.states.lazyTreeNodeMap[parentRow.rowKey].findIndex(child => child.rowKey == row.rowKey)
parentRow.VersionCount = parentRow.VersionCount-1
const parent = store.states.lazyTreeNodeMap[parentRow.ID]
const parent = store.states.lazyTreeNodeMap[parentRow.rowKey]
if(parent.length===1){
this.getModelList()
}else{
@@ -379,8 +380,8 @@ export default {
}
},
getModelList(){
try {
this.$refs.table.store.states.lazyTreeNodeMap = {}
try {
this.loadNodeMap.clear();
this.$axios.get(location.href+'_api',{
params:this.params
}).then((res)=>{
@@ -391,6 +392,7 @@ export default {
for(let i=0;i<this.tableData.length;i++){
TrainTaskInfo = JSON.parse(this.tableData[i].TrainTaskInfo)
this.tableData[i].cName=this.tableData[i].Name
this.tableData[i].rowKey=this.tableData[i].ID + Math.random()
this.tableData[i].EngineName = this.getEngineName(this.tableData[i])
this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true


Loading…
Cancel
Save