Authored by 王涛

Merge branch 'master-v32-xwx' into 'master'

资源视图、业务视图左侧树搜索优化



See merge request !728
@@ -419,7 +419,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' @@ -419,7 +419,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions'
419 editMode: 'true', 419 editMode: 'true',
420 resCategory: 'resources' 420 resCategory: 'resources'
421 }, 421 },
422 - height: 'full-200', 422 + height: 615,
423 cellMinWidth: 80, 423 cellMinWidth: 80,
424 page: { 424 page: {
425 layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] 425 layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
@@ -433,11 +433,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' @@ -433,11 +433,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions'
433 field: 'resName', title: '资源名称', align: 'center',sort:true, 433 field: 'resName', title: '资源名称', align: 'center',sort:true,
434 templet: '<div><span resmanage-data-edit="{{d.resId}}" data-zymc="{{ d.resId }}" data-ip="{{ d.ip }}" data-resTypeName="{{ d.resTypeName }}" data-admin="{{ d.admin }}" data-restype="{{d.resType}}" data-name="{{d.resName}}" data-pingenable="{{d.pingEnable}}">{{ d.resName }}</span></div>' 434 templet: '<div><span resmanage-data-edit="{{d.resId}}" data-zymc="{{ d.resId }}" data-ip="{{ d.ip }}" data-resTypeName="{{ d.resTypeName }}" data-admin="{{ d.admin }}" data-restype="{{d.resType}}" data-name="{{d.resName}}" data-pingenable="{{d.pingEnable}}">{{ d.resName }}</span></div>'
435 } 435 }
436 - , {field: 'ip', title: 'IP地址', align: 'center',sort:true}  
437 - , {field: 'port', title: '端口号', align: 'center',sort:true}  
438 - , {field: 'adminName', title: '负责人', align: 'center',sort:true}  
439 - , {field: 'resTypeName', title: '资源类型', align: 'center',sort:true}  
440 - , {field: 'state', title: '资源状态', align: 'center',sort:true, templet: function (d) { 436 + , {field: 'ip', title: 'IP地址', align: 'center',sort:true,width:200}
  437 + , {field: 'port', title: '端口号', align: 'center',sort:true,width:200}
  438 + , {field: 'adminName', title: '负责人', align: 'center',sort:true,width:180}
  439 + , {field: 'resTypeName', title: '资源类型', align: 'center',sort:true,width:230}
  440 + , {field: 'state', title: '资源状态', align: 'center',sort:true,width:180, templet: function (d) {
441 switch (d.state) { 441 switch (d.state) {
442 case "new" : 442 case "new" :
443 return '<button type="button" class="layui-btn layui-btn-warm layui-bg-gray layui-btn-radius layui-btn-xs p-0-15">未监控</button>' 443 return '<button type="button" class="layui-btn layui-btn-warm layui-bg-gray layui-btn-radius layui-btn-xs p-0-15">未监控</button>'
@@ -450,7 +450,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' @@ -450,7 +450,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions'
450 } 450 }
451 }} 451 }}
452 , { 452 , {
453 - title: '操作', fixed: 'right', align: 'center', fixed: 'right', 453 + title: '操作', fixed: 'right', align: 'center', fixed: 'right',width:100,
454 templet: '<div><span data-id="{{d.resId}}" class="layui-table-link tem_res_delete_btn">删除</span></div>' 454 templet: '<div><span data-id="{{d.resId}}" class="layui-table-link tem_res_delete_btn">删除</span></div>'
455 } 455 }
456 ]], 456 ]],
@@ -163,7 +163,10 @@ @@ -163,7 +163,10 @@
163 <p class="biz-count">业务总数<span id="bizTotal">0</span></p> 163 <p class="biz-count">业务总数<span id="bizTotal">0</span></p>
164 </div> 164 </div>
165 <div class="layui-card-body"> 165 <div class="layui-card-body">
166 - <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search"> 166 + <div>
  167 + <input type="search" placeholder="搜索..." id="bizInputSearch" autocomplete="off" class="layui-input layui-input-search" style="width: 180px">
  168 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="bizSearch" style="width: 50px;height: 30px;margin-top: -6px;">搜索</button>
  169 + </div>
167 <div id="bizindextree"></div> 170 <div id="bizindextree"></div>
168 </div> 171 </div>
169 </div> 172 </div>
@@ -274,7 +274,10 @@ @@ -274,7 +274,10 @@
274 <div class="layui-card"> 274 <div class="layui-card">
275 275
276 <div class="layui-card-body"> 276 <div class="layui-card-body">
277 - <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search"> 277 + <div>
  278 + <input type="search" placeholder="搜索..." autocomplete="off" id="inputSearch" class="layui-input layui-input-search" style="width: 180px">
  279 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="resSearch" style="width: 50px;height: 30px;margin-top: -6px;">搜索</button>
  280 + </div>
278 <div id="resindextree"></div> 281 <div id="resindextree"></div>
279 </div> 282 </div>
280 </div> 283 </div>
@@ -60,6 +60,12 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -60,6 +60,12 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
60 common.viewBizTopo($(this).data('busid')); 60 common.viewBizTopo($(this).data('busid'));
61 return false; 61 return false;
62 }); 62 });
  63 +
  64 + //搜索按钮
  65 + $('#bizSearch').unbind('click').on('click',function (){
  66 + busIndexKeyWord = $('#bizInputSearch').val();
  67 + loadBizTree(busIndexKeyWord)
  68 + })
63 //回车搜索 69 //回车搜索
64 $('#bizindex_keyword').keydown(function (e) { 70 $('#bizindex_keyword').keydown(function (e) {
65 if (e.keyCode === 13) { 71 if (e.keyCode === 13) {
@@ -122,7 +128,8 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -122,7 +128,8 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
122 window.setResizeEvents('autoHeight', autoHeight); 128 window.setResizeEvents('autoHeight', autoHeight);
123 admin.req({ 129 admin.req({
124 url: common.domainName + '/api-web/home/resource/countResourceGroupByBusType?keyword='+busHealthKeyWord, 130 url: common.domainName + '/api-web/home/resource/countResourceGroupByBusType?keyword='+busHealthKeyWord,
125 - }).done(function (res) { 131 + sync: true
  132 + }).always(function (res) {
126 layer.close(loading); 133 layer.close(loading);
127 laytpl($('#bizindexTpl').html()).render({list: res.data, isBiz: true}, function (html) { 134 laytpl($('#bizindexTpl').html()).render({list: res.data, isBiz: true}, function (html) {
128 bizindexTable.html(html); 135 bizindexTable.html(html);
@@ -175,6 +182,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -175,6 +182,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
175 if (val == '' || val == null || val == undefined) { 182 if (val == '' || val == null || val == undefined) {
176 val = ''; 183 val = '';
177 } 184 }
  185 + busHealthKeyWord = val;
178 admin.req({ 186 admin.req({
179 url: common.domainName + '/api-web/home/business/getBusTree?keyword=' + val + '&notExist=machineroom', 187 url: common.domainName + '/api-web/home/business/getBusTree?keyword=' + val + '&notExist=machineroom',
180 sync: true, 188 sync: true,
@@ -269,7 +277,6 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -269,7 +277,6 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
269 loadBizTree($(this).val()) 277 loadBizTree($(this).val())
270 busIndexKeyWord = $(this).val(); 278 busIndexKeyWord = $(this).val();
271 busHealthKeyWord = $(this).val(); 279 busHealthKeyWord = $(this).val();
272 - renderDefaultIndex();  
273 } 280 }
274 }); 281 });
275 282
@@ -704,6 +704,12 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -704,6 +704,12 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
704 resindexKeyword = $(this).val(); 704 resindexKeyword = $(this).val();
705 } 705 }
706 }); 706 });
  707 + //搜索按钮
  708 + $('#resSearch').unbind('click').on('click',function (){
  709 + resindexKeyword = $('#inputSearch').val();
  710 + resHealthKeyWord = $('#inputSearch').val();
  711 + loadResTree(resindexKeyword)
  712 + })
707 loadResTree(''); 713 loadResTree('');
708 //资源详细信息 714 //资源详细信息
709 function renderDetail(resId, resType) { 715 function renderDetail(resId, resType) {