| @@ -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 | |||