commit
864ae768ad
@ -0,0 +1,88 @@
|
||||
<div class="mt20" id="levelSystem">
|
||||
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<th width="10%">等级</th>
|
||||
<th width="15%" class="edu-txt-left">名称</th>
|
||||
<th width="45" class="edu-txt-left">实训课程数</th>
|
||||
<th width="15%">创建时间</th>
|
||||
<th width="15%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="levelNo">1</td>
|
||||
<td class="edu-txt-left levelName">初级课程</td>
|
||||
<td class="edu-txt-left">500</td>
|
||||
<td>2019-03-02 10:38</td>
|
||||
<td>
|
||||
<a href="javascript:void(0)" class="mr15">删除</a>
|
||||
<a href="javascript:void(0)" class="mr15 renameLine">重命名</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="levelNo">2</td>
|
||||
<td class="edu-txt-left levelName">初级课程</td>
|
||||
<td class="edu-txt-left">--</td>
|
||||
<td>2019-03-02 10:38</td>
|
||||
<td>
|
||||
<a href="javascript:void(0)" class="mr15">删除</a>
|
||||
<a href="javascript:void(0)" class="mr15 renameLine">重命名</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<a href="javascript:void(0)" class="color-blue" onclick="createLevel();">+ 新建</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/html" id="template_newForm">
|
||||
<div class="bor-grey-e mt20 clearfix padding10-20 edu-back-white" id="newForm">
|
||||
<span class="fl mt3">名称</span>
|
||||
<input type="text" class="winput-240-35 fl ml20"/>
|
||||
<li class="fr mt3">
|
||||
<a href="javascript:void(0)" class="mr15" onclick="cancelNew();">取消</a>
|
||||
<a href="javascript:void(0)" class="mr15">保存</a>
|
||||
</li>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
//新建
|
||||
function createLevel(){
|
||||
if($("#newForm").length==0){
|
||||
var bt = baidu.template;
|
||||
bt.LEFT_DELIMITER = '<!';
|
||||
bt.RIGHT_DELIMITER = '!>';
|
||||
var html = bt('template_newForm', null);
|
||||
$("#levelSystem").append(html);
|
||||
}
|
||||
|
||||
}
|
||||
//新建--取消
|
||||
function cancelNew(){
|
||||
$("#newForm").remove();
|
||||
}
|
||||
|
||||
//重命名
|
||||
var lastHtml="";
|
||||
$("table").on("click",".renameLine",function(){
|
||||
var tr=$(this).parents("tr");
|
||||
lastHtml=$(tr).html();
|
||||
var value=$(tr).find(".levelName").html();
|
||||
var No=$(tr).find(".levelNo").html();
|
||||
var html='<td>'+No+'</td>'+
|
||||
'<td colspan="4" class="edu-txt-left">'+
|
||||
'<input type="winput-240-35" name="rename" value="'+value+'"/>'+
|
||||
'<a href="javascript:void(0)" class="mr15 ml20" onclick="cancelEdit(this);">取消</a>'+
|
||||
'<a href="javascript:void(0)">保存</a>'+
|
||||
'</td>';
|
||||
$(tr).html(html);
|
||||
})
|
||||
|
||||
//重命名--取消
|
||||
function cancelEdit(item){
|
||||
$(item).parents("tr").html(lastHtml);
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue