Browse Source

fix issue

tags/v1.21.12.1^2
zhoupzh 3 years ago
parent
commit
a6ee2d4bcd
2 changed files with 51 additions and 9 deletions
  1. +48
    -6
      templates/repo/modelmanage/showinfo.tmpl
  2. +3
    -3
      web_src/js/components/Model.vue

+ 48
- 6
templates/repo/modelmanage/showinfo.tmpl View File

@@ -24,6 +24,7 @@
.ti-text-form-content {
line-height: 30px;
padding-bottom: 20px;
width: 100%;
}
.change-version{
min-width: auto !important;
@@ -48,6 +49,13 @@
width:100%;
table-layout: fixed;
}
.iword-elipsis{
display: inline-block;
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
<div class="ui container">
<h4 class="ui header" id="vertical-segment">
@@ -80,9 +88,10 @@ function changeInfo(version){
})
let initObj = transObj(versionData)[0]
let initModelAcc = transObj(versionData)[1]
let id= transObj(data)[2]
console.log("=======",initObj,initModelAcc)
$('#showInfo').empty()
renderInfo(initObj,initModelAcc)
renderInfo(initObj,initModelAcc,id)
})
}
function loadInfo(){
@@ -94,11 +103,12 @@ function loadInfo(){
$('#dropdown').append(html)
let initObj = transObj(data)[0]
let initModelAcc = transObj(data)[1]
renderInfo(initObj,initModelAcc)
let id= transObj(data)[2]
renderInfo(initObj,initModelAcc,id)
})
}
function transObj(data){
let {Name,Version,Label,Size,Description,CreatedUnix,Accuracy} = data[0]
let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy} = data[0]
let modelAcc = JSON.parse(Accuracy)
let size = tranSize(Size)
let time = transTime(CreatedUnix)
@@ -116,7 +126,7 @@ function transObj(data){
Precision:modelAcc.Precision || '--',
Recall: modelAcc.Recall || '--'
}
return [initObj,initModelAcc]
return [initObj,initModelAcc,ID]
}
function transTime(time){
@@ -141,7 +151,33 @@ function tranSize(value){
size=size.toFixed(2);//保留的小数位数
return size+unitArr[index];
}
function renderInfo(obj,accObj){
function editorFn(text,id){
console.log("----",text,id)
$('#edit-td').replaceWith("<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' rows='3' maxlength='255' style='width:80%;' id='edit-text'></textarea><i class='check icon' onclick='editorSure(\"" + text + "\",\"" + id + "\")'></i><i class='times icon' onclick='editorCancel(\"" + text + "\")'></i></div>");
}
function editorCancel(text){
$('#edit-div').replaceWith('<span id="edit-td" class="iword-elipsis">'+text+'</span>')
}
function editorSure(text,id){
console.log("-------text,id",id)
let description=$('#textarea-value').val()
let data = {
ID:id,
Description:description
}
// $.put(`${url}show_model_info_api?name=${ID}`,(data)={

// })
$.ajax({
url:`${url}modify_model`,
type:'PUT',
data:data
}).done((res)=>{console.log(res)})

}
function renderInfo(obj,accObj,id){
let html = ''
html += '<div class="half-table">'
html += '<span class="model_header_text">基本信息</span>'
@@ -150,7 +186,13 @@ function renderInfo(obj,accObj){
for(let key in obj){
html += '<tr style="font-size: 12px;">'
html += `<td class="ti-text-form-label text-width80">${key}</td>`
html += `<td class="ti-text-form-content word-elipsis">${obj[key]}</td>`
if(key==="Description"){
let description = obj[key]
html += '<td class="ti-text-form-content" ><span id="edit-td" class="iword-elipsis">'+description+'</span><i class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(\'' + description + '\',\'' + id + '\')"></td>'
// html += '<td class="ti-text-form-content iword-elipsis"><i class="pencil alternate icon" style="cursor:pointer" id="editor" onclick="editorFn()"></i></td>'
}else{
html += `<td class="ti-text-form-content word-elipsis">${obj[key]}</td>`
}
html += '</tr>'
}



+ 3
- 3
web_src/js/components/Model.vue View File

@@ -103,9 +103,9 @@
<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.Children.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a>
<a :href="loadhref+scope.row.ID">下载</a>
<a :class="{'disabled':scope.row.Children.IsCanOper}" @click="deleteModel(scope.row.ID)">删除</a>
<a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" :class="{'disabled':!scope.row.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a>
<a :href="loadhref+scope.row.ID" :class="{'disabled':!scope.row.IsCanOper}">下载</a>
<a :class="{'disabled':!scope.row.IsCanOper}" @click="deleteModel(scope.row.ID)">删除</a>
</div>
</template>


Loading…
Cancel
Save