Authored by 王涛

首页资源下探,默认展示空白问题

... ... @@ -50,10 +50,22 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
var getTpl = document.getElementById("biz_reslist_restype_tab_tpl").innerHTML;
laytpl(getTpl).render(res.data, function (html) {
$('#biz_reslist_restype_tab').html(html);
var active = '';
var activeItem = '';
var data = res.data;
for (let i = 0; i < data.length; i++) {
var v = data[i];
if(v.resNum > 0){
activeItem = v;
$('#biz_reslist_restype_tab').find('[data-id="'+v.resTypeCode+'"]').addClass('layui-this');
break;
}
}
// 默认加载第一个
if (res.data[0]) {
var resType = res.data[0]["resTypeCode"];
activeResType = res.data[0]["resTypeCode"];
if (activeItem) {
var resType = activeItem.resTypeCode;//res.data[0]["resTypeCode"];
activeResType = activeItem.resTypeCode;//res.data[0]["resTypeCode"];
if (resType && $.inArray(resType, treeTableResTypes) !== -1) {
renderTreeTable(bizId, resType);
} else {
... ... @@ -881,4 +893,4 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
$("#biz_reslist_server_state").val('');
};
});
});
\ No newline at end of file
});
... ...
... ... @@ -309,7 +309,7 @@
<script type="text/html" id="biz_reslist_restype_tab_tpl">
{{# layui.each(d, function(index, item){ }}
{{# var acive = '', hideCls = ''}}
{{# if(index==0){ acive = "layui-this" } }}
{{# if(index==0){ acive = "" } }}
{{# if(item.resNum == 0){ hideCls = "hide" } }}
<li class="{{acive}} {{hideCls}}" data-id="{{item.resTypeCode}}">
... ... @@ -323,4 +323,4 @@
layui.use('bizreslist', function (fn) {
fn();
});
</script>
\ No newline at end of file
</script>
... ...