|
|
@@ -95,8 +95,8 @@ |
|
|
|
min-width="6.75%" |
|
|
|
> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a :href="'/'+scope.row.UserName" :title="scope.row.UserName"> |
|
|
|
<img class="ui avatar image" :src="scope.row.UserRelAvatarLink"> |
|
|
|
<a :href="!scope.row.UserName? '#':'/'+scope.row.UserName" :title="scope.row.UserName||defaultAvatarName"> |
|
|
|
<img class="ui avatar image" :src="scope.row.UserRelAvatarLink||defaultAvatar"> |
|
|
|
</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
@@ -104,7 +104,7 @@ |
|
|
|
<el-table-column label="操作" min-width="18%" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div class="space-around"> |
|
|
|
<a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" :class="{'disabled':!scope.row.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a> |
|
|
|
<a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" :class="{'disabled':!scope.row.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version,scope.row.Label)">创建新版本</a> |
|
|
|
<a :href="loadhref+scope.row.ID" :class="{'disabled':!scope.row.IsCanOper}">下载</a> |
|
|
|
<a :class="{'disabled':!scope.row.IsCanOper}" @click="deleteModel(scope.row.ID,scope.row.cName)">删除</a> |
|
|
|
</div> |
|
|
@@ -141,6 +141,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
|
|
|
|
currentPage:1, |
|
|
|
pageSize:10, |
|
|
|
totalNum:0, |
|
|
@@ -149,29 +150,37 @@ export default { |
|
|
|
url:'', |
|
|
|
isLoading:true, |
|
|
|
loadNodeMap:new Map(), |
|
|
|
submitId:{} |
|
|
|
submitId:{}, |
|
|
|
defaultAvatar:'/user/avatar/Ghost/-1', |
|
|
|
defaultAvatarName:'Ghost', |
|
|
|
data:'' |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
load(tree, treeNode, resolve) { |
|
|
|
this.loadNodeMap.set(tree.cName, {tree,treeNode,resolve}) |
|
|
|
this.$axios.get(this.url+'show_model_child_api',{params:{ |
|
|
|
name:tree.cName |
|
|
|
}}).then((res)=>{ |
|
|
|
let TrainTaskInfo |
|
|
|
let tableData |
|
|
|
tableData= res.data |
|
|
|
for(let i=0;i<tableData.length;i++){ |
|
|
|
TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo) |
|
|
|
tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0] |
|
|
|
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource |
|
|
|
tableData[i].cName=tableData[i].Name |
|
|
|
tableData[i].Name='' |
|
|
|
tableData[i].VersionCount = '' |
|
|
|
tableData[i].Children = true |
|
|
|
} |
|
|
|
resolve(tableData) |
|
|
|
}) |
|
|
|
try{ |
|
|
|
this.loadNodeMap.set(tree.cName, {tree,treeNode,resolve}) |
|
|
|
this.$axios.get(this.url+'show_model_child_api',{params:{ |
|
|
|
name:tree.cName |
|
|
|
}}).then((res)=>{ |
|
|
|
let TrainTaskInfo |
|
|
|
let tableData |
|
|
|
tableData= res.data |
|
|
|
for(let i=0;i<tableData.length;i++){ |
|
|
|
TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo) |
|
|
|
tableData[i].EngineName = TrainTaskInfo.EngineName.split('-')[0] |
|
|
|
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource |
|
|
|
tableData[i].cName=tableData[i].Name |
|
|
|
tableData[i].Name='' |
|
|
|
tableData[i].VersionCount = '' |
|
|
|
tableData[i].Children = true |
|
|
|
} |
|
|
|
resolve(tableData||[]) |
|
|
|
}) |
|
|
|
} |
|
|
|
catch(e){ |
|
|
|
this.loading = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
tableHeaderStyle({row,column,rowIndex,columnIndex}){ |
|
|
|
if(rowIndex===0){ |
|
|
@@ -186,26 +195,32 @@ export default { |
|
|
|
this.params.page = val |
|
|
|
this.getModelList() |
|
|
|
}, |
|
|
|
showcreateVue(name,version){ |
|
|
|
showcreateVue(name,version,label){ |
|
|
|
$('.ui.modal.second') |
|
|
|
.modal({ |
|
|
|
centered: false, |
|
|
|
onShow:function(){ |
|
|
|
$('#model_header').text("创建模型新版本") |
|
|
|
$('input[name="Name"]').addClass('model_disabled') |
|
|
|
$('input[name="Name"]').attr('readonly','readonly') |
|
|
|
$('input[name="Version"]').addClass('model_disabled') |
|
|
|
$('.ui.dimmer').css({"background-color":"rgb(136, 136, 136,0.7)"}) |
|
|
|
$("#job-name").empty() |
|
|
|
$('#name').val(name) |
|
|
|
$('#label').val(label) |
|
|
|
let version_string = versionAdd(version) |
|
|
|
$('#version').val(version_string) |
|
|
|
loadTrainList() |
|
|
|
}, |
|
|
|
onHide:function(){ |
|
|
|
document.getElementById("formId").reset(); |
|
|
|
$('input[name="Name"]').removeClass('model_disabled') |
|
|
|
$('input[name="Name"]').removeAttr('readonly') |
|
|
|
$('#choice_model').dropdown('clear') |
|
|
|
$('#choice_version').dropdown('clear') |
|
|
|
$('.ui.dimmer').css({"background-color":""}) |
|
|
|
$('.ui.error.message').text() |
|
|
|
$('.ui.error.message').css('display','none') |
|
|
|
} |
|
|
|
}) |
|
|
|
.modal('show') |
|
|
@@ -240,23 +255,22 @@ export default { |
|
|
|
$("#verionname").removeClass("error") |
|
|
|
} |
|
|
|
return true |
|
|
|
|
|
|
|
}, |
|
|
|
submit(){ |
|
|
|
let context = this |
|
|
|
let flag= this.check() |
|
|
|
if(flag){ |
|
|
|
let data = $("#formId").serialize() |
|
|
|
let cName = $("input[name='Name']").val() |
|
|
|
let row = {cName:cName} |
|
|
|
let version = $("input[name='Version']").val() |
|
|
|
let data = $("#formId").serialize() |
|
|
|
$("#mask").css({"display":"block","z-index":"9999"}) |
|
|
|
$.ajax({ |
|
|
|
url:url_href, |
|
|
|
type:'POST', |
|
|
|
data:data, |
|
|
|
success:function(res){ |
|
|
|
// context.loadrefresh1(row) |
|
|
|
context.getModelList() |
|
|
|
context.loadrefresh(row) |
|
|
|
$('.ui.modal.second').modal('hide') |
|
|
|
}, |
|
|
|
error: function(xhr){ |
|
|
@@ -274,20 +288,32 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
loadrefresh(row){ |
|
|
|
const store = this.$refs.table.store |
|
|
|
if(!this.loadNodeMap.get(row.cName)){ |
|
|
|
return |
|
|
|
const parent = store.states.data |
|
|
|
const index = parent.findIndex(child => child.ID == row.ID) |
|
|
|
parent.splice(index, 1) |
|
|
|
}else{ |
|
|
|
let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName) |
|
|
|
this.$set( |
|
|
|
this.$refs.table.store.states.lazyTreeNodeMap, |
|
|
|
tree.ID, |
|
|
|
[]) |
|
|
|
this.load(tree,treeNode,resolve) |
|
|
|
const keys = Object.keys(store.states.lazyTreeNodeMap); |
|
|
|
if(keys.includes(row.ID)){ |
|
|
|
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) |
|
|
|
parentRow.VersionCount = parentRow.VersionCount-1 |
|
|
|
const parent = store.states.lazyTreeNodeMap[parentRow.ID] |
|
|
|
if(parent.length===1){ |
|
|
|
this.getModelList() |
|
|
|
}else{ |
|
|
|
parent.splice(childrenIndex, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
deleteModel(id,name){ |
|
|
|
let row={cName:name} |
|
|
|
let row={cName:name,ID:id} |
|
|
|
let _this = this |
|
|
|
let flag=1 |
|
|
|
$('.ui.basic.modal.first') |
|
|
@@ -300,8 +326,8 @@ export default { |
|
|
|
params:{ |
|
|
|
ID:id |
|
|
|
}}).then((res)=>{ |
|
|
|
_this.getModelList() |
|
|
|
_this.loadrefresh(row) |
|
|
|
// _this.getModelList() |
|
|
|
}) |
|
|
|
flag = true |
|
|
|
}, |
|
|
@@ -315,24 +341,29 @@ export default { |
|
|
|
}) |
|
|
|
.modal('show') |
|
|
|
}, |
|
|
|
|
|
|
|
getModelList(){ |
|
|
|
this.$axios.get(location.href+'_api',{ |
|
|
|
params:this.params |
|
|
|
}).then((res)=>{ |
|
|
|
$(".ui.grid").removeAttr("style") |
|
|
|
$("#loadContainer").removeClass("loader") |
|
|
|
let TrainTaskInfo |
|
|
|
this.tableData = res.data.data |
|
|
|
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].EngineName = TrainTaskInfo.EngineName.split('-')[0] |
|
|
|
this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource |
|
|
|
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true |
|
|
|
} |
|
|
|
this.totalNum = res.data.count |
|
|
|
}) |
|
|
|
try { |
|
|
|
this.$refs.table.store.states.lazyTreeNodeMap = {} |
|
|
|
this.$axios.get(location.href+'_api',{ |
|
|
|
params:this.params |
|
|
|
}).then((res)=>{ |
|
|
|
$(".ui.grid").removeAttr("style") |
|
|
|
$("#loadContainer").removeClass("loader") |
|
|
|
let TrainTaskInfo |
|
|
|
this.tableData = res.data.data |
|
|
|
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].EngineName = TrainTaskInfo.EngineName.split('-')[0] |
|
|
|
this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource |
|
|
|
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true |
|
|
|
} |
|
|
|
this.totalNum = res.data.count |
|
|
|
}) |
|
|
|
}catch (e) { |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
@@ -369,8 +400,6 @@ export default { |
|
|
|
return size+unitArr[index]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.submitId = document.getElementById("submitId") |
|
|
|