Authored by 鲁尚清

weblogic资源列表增加扩展字段T3和IOP

@@ -17,6 +17,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -17,6 +17,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
17 var curBizResType = '';//当前业务所在的资源类型 17 var curBizResType = '';//当前业务所在的资源类型
18 18
19 var sortKey = ''; 19 var sortKey = '';
  20 + var fieldExpandArr=[];//获取扩展的表格字段
20 21
21 22
22 function autoHeight(el) { 23 function autoHeight(el) {
@@ -402,72 +403,102 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -402,72 +403,102 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
402 resTypeList.push(v.value); 403 resTypeList.push(v.value);
403 busId=v.pid; 404 busId=v.pid;
404 }); 405 });
405 - //获取配置的列  
406 - common.getTableCols({  
407 - domId: 'bizListTable',  
408 - moduleId: 'bizIndex',  
409 - resType: 'OperatingSystem'  
410 - },function (retCols) {  
411 - if (retCols) {  
412 - cols = retCols;  
413 - }  
414 - bizListTable = table.render({  
415 - elem: '#bizListTable'  
416 - , toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板  
417 - //, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板  
418 - , defaultToolbar: ['filter']  
419 - , drag: {toolbar: false}  
420 - , url: common.domainName + '/api-web/home/res-list/' + resTypeList.toString()  
421 - , where: {  
422 - access_token: accessToken,  
423 - resName: busIndexKeyWord,  
424 - resHealth: $("#biz_resStatus").val(),  
425 - busId: busId,  
426 - colonlyId: $("#biz_res_colony").val(),  
427 - parentId: $("#biz_res_cluster").val(),  
428 - linkState: $("#bizlink_state").val(),  
429 - state: $("#biz_state").val(),  
430 - resCategory: 'resources',  
431 - }  
432 - , height: 'full-165'  
433 - , cellMinWidth: 80  
434 - , page: {  
435 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
436 - , theme: '#1E9FFF'  
437 - }  
438 - , autoSort: false  
439 - , cols: [cols]  
440 - , done: function (res) {  
441 - soulTable.render(this);  
442 - getResCount(busId, resTypeList.toString());  
443 - commonCols.colsClickEvent();  
444 - //表格排序监听 joke add 20200408  
445 - table.on('sort(bizListTable)', function (obj) {  
446 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
447 - if (obj.type != null) {  
448 - sortKey = obj.field + ' ' + obj.type;  
449 - } else {  
450 - sortKey = '';  
451 - }  
452 - reloadTable();  
453 - })  
454 - //触发拖动列事件,参数为保存按钮的id  
455 - common.dragCols("bizIndex_cols_save");  
456 - //保存列顺序  
457 - $("#bizIndex_cols_save").unbind("click").on("click", function () {  
458 - var params = {  
459 - domId: 'bizListTable',  
460 - moduleId: 'bizIndex',  
461 - resType: 'OperatingSystem',  
462 - cols: bizListTable.config.cols 406 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  407 + admin.req({
  408 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  409 + , done: function (res) {
  410 + if (res && res.data ) {
  411 + let arr=res.data;
  412 + if(fieldExpandArr.indexOf(resType)!=-1){
  413 + }else{
  414 + fieldExpandArr.push(resType);
  415 + if(arr.length>0){
  416 + arr.map(item=>{
  417 + let listStr='';
  418 + if(item.list && item.list.length>0){
  419 + listStr=item.list.join(',')
  420 + }
  421 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  422 + templet:` <div>
  423 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  424 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  425 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  426 + </div></div>`})
  427 + })
463 } 428 }
464 - common.saveTableCols(params);  
465 - });  
466 - resTopo(); 429 + }
  430 + } else {
  431 + console.log(res.msg);
467 } 432 }
468 - }); 433 + }
469 }); 434 });
470 - 435 + setTimeout(function (){
  436 + //获取配置的列
  437 + common.getTableCols({
  438 + domId: 'bizListTable',
  439 + moduleId: 'bizIndex',
  440 + resType: 'OperatingSystem'
  441 + },function (retCols) {
  442 + if (retCols) {
  443 + cols = retCols;
  444 + }
  445 + bizListTable = table.render({
  446 + elem: '#bizListTable'
  447 + , toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板
  448 + //, toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
  449 + , defaultToolbar: ['filter']
  450 + , drag: {toolbar: false}
  451 + , url: common.domainName + '/api-web/home/res-list/' + resTypeList.toString()
  452 + , where: {
  453 + access_token: accessToken,
  454 + resName: busIndexKeyWord,
  455 + resHealth: $("#biz_resStatus").val(),
  456 + busId: busId,
  457 + colonlyId: $("#biz_res_colony").val(),
  458 + parentId: $("#biz_res_cluster").val(),
  459 + linkState: $("#bizlink_state").val(),
  460 + state: $("#biz_state").val(),
  461 + resCategory: 'resources',
  462 + }
  463 + , height: 'full-165'
  464 + , cellMinWidth: 80
  465 + , page: {
  466 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  467 + , theme: '#1E9FFF'
  468 + }
  469 + , autoSort: false
  470 + , cols: [cols]
  471 + , done: function (res) {
  472 + soulTable.render(this);
  473 + getResCount(busId, resTypeList.toString());
  474 + commonCols.colsClickEvent();
  475 + //表格排序监听 joke add 20200408
  476 + table.on('sort(bizListTable)', function (obj) {
  477 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  478 + if (obj.type != null) {
  479 + sortKey = obj.field + ' ' + obj.type;
  480 + } else {
  481 + sortKey = '';
  482 + }
  483 + reloadTable();
  484 + })
  485 + //触发拖动列事件,参数为保存按钮的id
  486 + common.dragCols("bizIndex_cols_save");
  487 + //保存列顺序
  488 + $("#bizIndex_cols_save").unbind("click").on("click", function () {
  489 + var params = {
  490 + domId: 'bizListTable',
  491 + moduleId: 'bizIndex',
  492 + resType: 'OperatingSystem',
  493 + cols: bizListTable.config.cols
  494 + }
  495 + common.saveTableCols(params);
  496 + });
  497 + resTopo();
  498 + }
  499 + });
  500 + });
  501 + },300)
471 } 502 }
472 //获取业务下的资源类型健康统计 503 //获取业务下的资源类型健康统计
473 function renderBizResTypeCard(bizId) { 504 function renderBizResTypeCard(bizId) {
@@ -500,75 +531,106 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -500,75 +531,106 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
500 renderBizSerach(resType, busId, true); 531 renderBizSerach(resType, busId, true);
501 form.render(null, 'biz-list-form'); 532 form.render(null, 'biz-list-form');
502 var cols = commonCols.resTypeCls[resType]; 533 var cols = commonCols.resTypeCls[resType];
503 - //获取配置的列  
504 - common.getTableCols({  
505 - domId: 'bizParentList',  
506 - moduleId: 'bizIndex',  
507 - resType: resType  
508 - },function (retCols) {  
509 - if (retCols) {  
510 - cols = retCols;  
511 - }  
512 - bizParentList = table.render({  
513 - elem: '#bizListTable'  
514 - , url: common.domainName + '/api-web/home/res-list/' + resType  
515 - , toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板  
516 - , defaultToolbar: ['filter']  
517 - , drag: {toolbar: false}  
518 - , where: {  
519 - access_token: accessToken,  
520 - resName: busIndexKeyWord,  
521 - resHealth: $("#biz_resStatus").val(),  
522 - busId: busId,  
523 - colonlyId: $("#biz_res_colony").val(),  
524 - parentId: $("#biz_res_cluster").val(),  
525 - linkState: $("#bizlink_state").val(),  
526 - state: $("#biz_state").val(),  
527 - resCategory: 'resources' 534 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  535 + admin.req({
  536 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  537 + , done: function (res) {
  538 + if (res && res.data ) {
  539 + let arr=res.data;
  540 + if(fieldExpandArr.indexOf(resType)!=-1){
  541 + }else{
  542 + fieldExpandArr.push(resType);
  543 + if(arr.length>0){
  544 + arr.map(item=>{
  545 + let listStr='';
  546 + if(item.list && item.list.length>0){
  547 + listStr=item.list.join(',')
  548 + }
  549 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  550 + templet:` <div>
  551 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  552 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  553 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  554 + </div></div>`})
  555 + })
  556 + }
  557 + }
  558 + } else {
  559 + console.log(res.msg);
528 } 560 }
529 - , height: 'full-165'  
530 - , cellMinWidth: 80  
531 - , page: {  
532 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
533 - , theme: '#1E9FFF' 561 + }
  562 + });
  563 + setTimeout(function (){
  564 + //获取配置的列
  565 + common.getTableCols({
  566 + domId: 'bizParentList',
  567 + moduleId: 'bizIndex',
  568 + resType: resType
  569 + },function (retCols) {
  570 + if (retCols) {
  571 + cols = retCols;
534 } 572 }
535 - , autoSort: false  
536 - , cols: [cols]  
537 - , done: function (res) {  
538 - soulTable.render(this)  
539 - getResCount(busId, resType) 573 + bizParentList = table.render({
  574 + elem: '#bizListTable'
  575 + , url: common.domainName + '/api-web/home/res-list/' + resType
  576 + , toolbar: '#bizList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
  577 + , defaultToolbar: ['filter']
  578 + , drag: {toolbar: false}
  579 + , where: {
  580 + access_token: accessToken,
  581 + resName: busIndexKeyWord,
  582 + resHealth: $("#biz_resStatus").val(),
  583 + busId: busId,
  584 + colonlyId: $("#biz_res_colony").val(),
  585 + parentId: $("#biz_res_cluster").val(),
  586 + linkState: $("#bizlink_state").val(),
  587 + state: $("#biz_state").val(),
  588 + resCategory: 'resources'
  589 + }
  590 + , height: 'full-165'
  591 + , cellMinWidth: 80
  592 + , page: {
  593 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  594 + , theme: '#1E9FFF'
  595 + }
  596 + , autoSort: false
  597 + , cols: [cols]
  598 + , done: function (res) {
  599 + soulTable.render(this)
  600 + getResCount(busId, resType)
540 601
541 - commonCols.colsClickEvent(); 602 + commonCols.colsClickEvent();
542 603
543 - //表格排序监听 joke add 20200408  
544 - table.on('sort(bizListTable)', function (obj) {  
545 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
546 - if (obj.type != null) {  
547 - sortKey = obj.field + ' ' + obj.type;  
548 - } else {  
549 - sortKey = '';  
550 - }  
551 - reloadTable();  
552 - }) 604 + //表格排序监听 joke add 20200408
  605 + table.on('sort(bizListTable)', function (obj) {
  606 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  607 + if (obj.type != null) {
  608 + sortKey = obj.field + ' ' + obj.type;
  609 + } else {
  610 + sortKey = '';
  611 + }
  612 + reloadTable();
  613 + })
553 614
554 - //触发拖动列事件,参数为保存按钮的id  
555 - common.dragCols("bizIndex_cols_save"); 615 + //触发拖动列事件,参数为保存按钮的id
  616 + common.dragCols("bizIndex_cols_save");
556 617
557 - bizLoadRightResTypeSelectEvent(busId,resType,'normal');  
558 - //保存列顺序  
559 - $("#bizIndex_cols_save").unbind("click").on("click", function () {  
560 - var params = {  
561 - domId: 'bizParentList',  
562 - moduleId: 'bizIndex',  
563 - resType: resType,  
564 - cols: bizParentList.config.cols  
565 - }  
566 - common.saveTableCols(params);  
567 - });  
568 - resTopo();  
569 - } 618 + bizLoadRightResTypeSelectEvent(busId,resType,'normal');
  619 + //保存列顺序
  620 + $("#bizIndex_cols_save").unbind("click").on("click", function () {
  621 + var params = {
  622 + domId: 'bizParentList',
  623 + moduleId: 'bizIndex',
  624 + resType: resType,
  625 + cols: bizParentList.config.cols
  626 + }
  627 + common.saveTableCols(params);
  628 + });
  629 + resTopo();
  630 + }
  631 + });
570 }); 632 });
571 - }); 633 + },300)
572 } 634 }
573 //资源列表 635 //资源列表
574 function renderList(busId, resType) { 636 function renderList(busId, resType) {
@@ -582,74 +644,105 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -582,74 +644,105 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
582 644
583 form.render(null, 'biz-list-form'); 645 form.render(null, 'biz-list-form');
584 var cols = commonCols.resTypeCls[resType]; 646 var cols = commonCols.resTypeCls[resType];
585 - //获取配置的列  
586 - common.getTableCols({  
587 - domId: 'bizListTable',  
588 - moduleId: 'bizIndex',  
589 - resType: resType  
590 - },function (retCols) {  
591 - if (retCols) {  
592 - cols = retCols;  
593 - }  
594 - bizListTable = table.render({  
595 - elem: '#bizListTable'  
596 - , toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe634;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板  
597 - , defaultToolbar: ['filter']  
598 - , drag: {toolbar: false}  
599 - , url: common.domainName + '/api-web/home/res-list/' + resType  
600 - , where: {  
601 - access_token: accessToken,  
602 - resName: busIndexKeyWord,  
603 - resHealth: $("#biz_resStatus").val(),  
604 - busId: busId,  
605 - colonlyId: $("#biz_res_colony").val(),  
606 - parentId: $("#biz_res_cluster").val(),  
607 - linkState: $("#bizlink_state").val(),  
608 - state: $("#biz_state").val(),  
609 - resCategory: 'resources' 647 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  648 + admin.req({
  649 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  650 + , done: function (res) {
  651 + if (res && res.data ) {
  652 + let arr=res.data;
  653 + if(fieldExpandArr.indexOf(resType)!=-1){
  654 + }else{
  655 + fieldExpandArr.push(resType);
  656 + if(arr.length>0){
  657 + arr.map(item=>{
  658 + let listStr='';
  659 + if(item.list && item.list.length>0){
  660 + listStr=item.list.join(',')
  661 + }
  662 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  663 + templet:` <div>
  664 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  665 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  666 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  667 + </div></div>`})
  668 + })
  669 + }
  670 + }
  671 + } else {
  672 + console.log(res.msg);
610 } 673 }
611 - , height: 'full-165'  
612 - , cellMinWidth: 80  
613 - , page: {  
614 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
615 - , theme: '#1E9FFF' 674 + }
  675 + });
  676 + setTimeout(function (){
  677 + //获取配置的列
  678 + common.getTableCols({
  679 + domId: 'bizListTable',
  680 + moduleId: 'bizIndex',
  681 + resType: resType
  682 + },function (retCols) {
  683 + if (retCols) {
  684 + cols = retCols;
616 } 685 }
617 - , autoSort: false  
618 - , cols: [cols]  
619 - , done: function (res) {  
620 - soulTable.render(this)  
621 - getResCount(busId, resType) 686 + bizListTable = table.render({
  687 + elem: '#bizListTable'
  688 + , toolbar: '<div><button id="bizIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe634;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板
  689 + , defaultToolbar: ['filter']
  690 + , drag: {toolbar: false}
  691 + , url: common.domainName + '/api-web/home/res-list/' + resType
  692 + , where: {
  693 + access_token: accessToken,
  694 + resName: busIndexKeyWord,
  695 + resHealth: $("#biz_resStatus").val(),
  696 + busId: busId,
  697 + colonlyId: $("#biz_res_colony").val(),
  698 + parentId: $("#biz_res_cluster").val(),
  699 + linkState: $("#bizlink_state").val(),
  700 + state: $("#biz_state").val(),
  701 + resCategory: 'resources'
  702 + }
  703 + , height: 'full-165'
  704 + , cellMinWidth: 80
  705 + , page: {
  706 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  707 + , theme: '#1E9FFF'
  708 + }
  709 + , autoSort: false
  710 + , cols: [cols]
  711 + , done: function (res) {
  712 + soulTable.render(this)
  713 + getResCount(busId, resType)
622 714
623 - commonCols.colsClickEvent(); 715 + commonCols.colsClickEvent();
624 716
625 - //表格排序监听 joke add 20200408  
626 - table.on('sort(bizListTable)', function (obj) {  
627 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
628 - if (obj.type != null) {  
629 - sortKey = obj.field + ' ' + obj.type;  
630 - } else {  
631 - sortKey = '';  
632 - }  
633 - reloadTable();  
634 - }) 717 + //表格排序监听 joke add 20200408
  718 + table.on('sort(bizListTable)', function (obj) {
  719 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  720 + if (obj.type != null) {
  721 + sortKey = obj.field + ' ' + obj.type;
  722 + } else {
  723 + sortKey = '';
  724 + }
  725 + reloadTable();
  726 + })
635 727
636 - //触发拖动列事件,参数为保存按钮的id  
637 - common.dragCols("bizIndex_cols_save"); 728 + //触发拖动列事件,参数为保存按钮的id
  729 + common.dragCols("bizIndex_cols_save");
638 730
639 - //保存列顺序  
640 - $("#bizIndex_cols_save").unbind("click").on("click", function () {  
641 - var params = {  
642 - domId: 'bizListTable',  
643 - moduleId: 'bizIndex',  
644 - resType: resType,  
645 - cols: bizListTable.config.cols  
646 - }  
647 - common.saveTableCols(params);  
648 - });  
649 - resTopo();  
650 - } 731 + //保存列顺序
  732 + $("#bizIndex_cols_save").unbind("click").on("click", function () {
  733 + var params = {
  734 + domId: 'bizListTable',
  735 + moduleId: 'bizIndex',
  736 + resType: resType,
  737 + cols: bizListTable.config.cols
  738 + }
  739 + common.saveTableCols(params);
  740 + });
  741 + resTopo();
  742 + }
  743 + });
651 }); 744 });
652 - }); 745 + },300)
653 } 746 }
654 747
655 //树表格 748 //树表格
@@ -676,140 +769,170 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -676,140 +769,170 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
676 } 769 }
677 770
678 var cols = commonCols.resTypeCls[resType]; 771 var cols = commonCols.resTypeCls[resType];
679 - 772 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
680 admin.req({ 773 admin.req({
681 - url: common.domainName + "/api-web/home/virtual-res-list/" + resType  
682 - , data: {  
683 - ptId: $("#biz_virtual_platForm_select").val(),  
684 - health: $("#biz_treetable_resStatus").val(),  
685 - busId: busId,  
686 - keyWords: $("#biz_treetable_keyword").val(),  
687 - state: $("#biz_treetable_res_state").val()  
688 - } 774 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
689 , done: function (res) { 775 , done: function (res) {
690 - if (res.code == 0) {  
691 - var bizTableTreeVirtual;  
692 - //获取配置的列  
693 - common.getTableCols({  
694 - domId: 'bizTableTreeVirtual',  
695 - moduleId: 'bizIndex',  
696 - resType: resType  
697 - },function (retCols) {  
698 - if (retCols) {  
699 - cols = retCols; 776 + if (res && res.data ) {
  777 + let arr=res.data;
  778 + if(fieldExpandArr.indexOf(resType)!=-1){
  779 + }else{
  780 + fieldExpandArr.push(resType);
  781 + if(arr.length>0){
  782 + arr.map(item=>{
  783 + let listStr='';
  784 + if(item.list && item.list.length>0){
  785 + listStr=item.list.join(',')
  786 + }
  787 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  788 + templet:` <div>
  789 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  790 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  791 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  792 + </div></div>`})
  793 + })
700 } 794 }
701 - bizTableTreeVirtual = table.render({  
702 - elem: '#biz_virtual_platform_treeTable',  
703 - data: res.data,  
704 - treeConfig: { //表格树所需配置  
705 - showField: 'resName' //表格树显示的字段  
706 - , treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。  
707 - , treepid: ''//父级id字段名称  
708 - , iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer  
709 - },  
710 - tree: {  
711 - iconIndex: 1  
712 - },  
713 - page: false,  
714 - limit: 9999,  
715 - autoColumnWidth: false,  
716 - cols: [cols]  
717 - , height: 'full-220',  
718 - done: function (res){  
719 - soulTable.render(this);  
720 - common.treeTableDragCols('#biz_virtual_platform_treeTable', '#bizTreeList-top-head-info-tpl');  
721 - bizLoadRightResTypeSelectEvent(busId,resType,'tree');  
722 - // 保存列顺序  
723 - $('#biz_virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){  
724 - common.saveTableCols({  
725 - domId: 'bizTableTreeVirtual',  
726 - moduleId: 'bizIndex',  
727 - resType: resType,  
728 - cols: bizTableTreeVirtual.config.cols  
729 - });  
730 - });  
731 - commonCols.colsClickEvent();  
732 - resTopo(); 795 + }
  796 + } else {
  797 + console.log(res.msg);
  798 + }
  799 + }
  800 + });
  801 + setTimeout(function (){
  802 + admin.req({
  803 + url: common.domainName + "/api-web/home/virtual-res-list/" + resType
  804 + , data: {
  805 + ptId: $("#biz_virtual_platForm_select").val(),
  806 + health: $("#biz_treetable_resStatus").val(),
  807 + busId: busId,
  808 + keyWords: $("#biz_treetable_keyword").val(),
  809 + state: $("#biz_treetable_res_state").val()
  810 + }
  811 + , done: function (res) {
  812 + if (res.code == 0) {
  813 + var bizTableTreeVirtual;
  814 + //获取配置的列
  815 + common.getTableCols({
  816 + domId: 'bizTableTreeVirtual',
  817 + moduleId: 'bizIndex',
  818 + resType: resType
  819 + },function (retCols) {
  820 + if (retCols) {
  821 + cols = retCols;
733 } 822 }
734 - });  
735 - /*bizTableTreeVirtual.on('tool(tableEvent)',function (obj) {  
736 - if(!obj.data.treeList){  
737 - var field = obj.field; //单元格字段  
738 - var value = obj.value; //修改后的值  
739 - var data = obj.data; //当前行数据  
740 - var event = obj.event; //当前单元格事件属性值  
741 - var subResType = '';  
742 - if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){  
743 - subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';  
744 - }else if(data.resType.indexOf('CLUSTER')>-1){  
745 - subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';  
746 - }else if(data.resType.indexOf('PHYSICSHOST')>-1){  
747 - subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';  
748 - }else{  
749 - subResType = data.resType 823 + bizTableTreeVirtual = table.render({
  824 + elem: '#biz_virtual_platform_treeTable',
  825 + data: res.data,
  826 + treeConfig: { //表格树所需配置
  827 + showField: 'resName' //表格树显示的字段
  828 + , treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。
  829 + , treepid: ''//父级id字段名称
  830 + , iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer
  831 + },
  832 + tree: {
  833 + iconIndex: 1
  834 + },
  835 + page: false,
  836 + limit: 9999,
  837 + autoColumnWidth: false,
  838 + cols: [cols]
  839 + , height: 'full-220',
  840 + done: function (res){
  841 + soulTable.render(this);
  842 + common.treeTableDragCols('#biz_virtual_platform_treeTable', '#bizTreeList-top-head-info-tpl');
  843 + bizLoadRightResTypeSelectEvent(busId,resType,'tree');
  844 + // 保存列顺序
  845 + $('#biz_virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){
  846 + common.saveTableCols({
  847 + domId: 'bizTableTreeVirtual',
  848 + moduleId: 'bizIndex',
  849 + resType: resType,
  850 + cols: bizTableTreeVirtual.config.cols
  851 + });
  852 + });
  853 + commonCols.colsClickEvent();
  854 + resTopo();
750 } 855 }
751 - if(event === 'loadChildren'){  
752 - $.ajax({  
753 - url: common.domainName + "/api-web/home/virtual-res-list/" + subResType  
754 - , type: "get"  
755 - , data: {  
756 - ptId: $("#biz_virtual_platForm_select").val(),  
757 - health: $("#treetable_resStatus").val(),  
758 - busId: busId,  
759 - keyWords: $("#biz_treetable_keyword").val(),  
760 - state: $("#biz_treetable_state").val(),  
761 - access_token:accessToken,  
762 - parentId:data.resId  
763 - }  
764 - , success: function (res) {  
765 - if (res.data.length > 0) {  
766 - obj.loadChildren(res.data);  
767 - commonCols.colsClickEvent(); 856 + });
  857 + /*bizTableTreeVirtual.on('tool(tableEvent)',function (obj) {
  858 + if(!obj.data.treeList){
  859 + var field = obj.field; //单元格字段
  860 + var value = obj.value; //修改后的值
  861 + var data = obj.data; //当前行数据
  862 + var event = obj.event; //当前单元格事件属性值
  863 + var subResType = '';
  864 + if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){
  865 + subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';
  866 + }else if(data.resType.indexOf('CLUSTER')>-1){
  867 + subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';
  868 + }else if(data.resType.indexOf('PHYSICSHOST')>-1){
  869 + subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';
  870 + }else{
  871 + subResType = data.resType
  872 + }
  873 + if(event === 'loadChildren'){
  874 + $.ajax({
  875 + url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
  876 + , type: "get"
  877 + , data: {
  878 + ptId: $("#biz_virtual_platForm_select").val(),
  879 + health: $("#treetable_resStatus").val(),
  880 + busId: busId,
  881 + keyWords: $("#biz_treetable_keyword").val(),
  882 + state: $("#biz_treetable_state").val(),
  883 + access_token:accessToken,
  884 + parentId:data.resId
768 } 885 }
769 - }  
770 - }) 886 + , success: function (res) {
  887 + if (res.data.length > 0) {
  888 + obj.loadChildren(res.data);
  889 + commonCols.colsClickEvent();
  890 + }
  891 + }
  892 + })
  893 + }
771 } 894 }
772 - }  
773 - });*/  
774 - //统计总数  
775 - // $('#biz_virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#biz-treetable-countTpl').html()).render(res.data.length)); 895 + });*/
  896 + //统计总数
  897 + // $('#biz_virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#biz-treetable-countTpl').html()).render(res.data.length));
  898 + });
  899 + } else {
  900 + console.log(data.msg);
  901 + }
  902 + layer.closeAll();
  903 + //关键字回车事件
  904 + $('#biz_treetable_keyword').keydown(function (e) {
  905 + if (e.keyCode === 13) {
  906 + renderTreeTable(busId, curTreeNode.data.id)
  907 + return false;
  908 + }
  909 + });
  910 + //选择资源状态
  911 + form.on('select(biz_treetable_resStatus)', function (data) {
  912 + renderTreeTable(busId, curTreeNode.data.id);
  913 + });
  914 + //选择业务
  915 + form.on('select(treetableBizTypes)', function (data) {
  916 + renderTreeTable(busId, curTreeNode.data.id);
  917 + });
  918 + //选择业务
  919 + form.on('select(biz_treetable_res_state)', function (data) {
  920 + renderTreeTable(busId, curTreeNode.data.id);
  921 + });
  922 +
  923 + //选择平台
  924 + form.on('select(biz_virtual_platForm_select)', function (data) {
  925 + renderTreeTable(busId, curTreeNode.data.id);
  926 + });
  927 + //资源连接状态选择时间
  928 + form.on('select(biz_treetable_state)', function (data) {
  929 + renderTreeTable(busId, curTreeNode.data.id);
776 }); 930 });
777 - } else {  
778 - console.log(data.msg);  
779 } 931 }
  932 + }).error(function () {
780 layer.closeAll(); 933 layer.closeAll();
781 - //关键字回车事件  
782 - $('#biz_treetable_keyword').keydown(function (e) {  
783 - if (e.keyCode === 13) {  
784 - renderTreeTable(busId, curTreeNode.data.id)  
785 - return false;  
786 - }  
787 - });  
788 - //选择资源状态  
789 - form.on('select(biz_treetable_resStatus)', function (data) {  
790 - renderTreeTable(busId, curTreeNode.data.id);  
791 - });  
792 - //选择业务  
793 - form.on('select(treetableBizTypes)', function (data) {  
794 - renderTreeTable(busId, curTreeNode.data.id);  
795 - });  
796 - //选择业务  
797 - form.on('select(biz_treetable_res_state)', function (data) {  
798 - renderTreeTable(busId, curTreeNode.data.id);  
799 - });  
800 -  
801 - //选择平台  
802 - form.on('select(biz_virtual_platForm_select)', function (data) {  
803 - renderTreeTable(busId, curTreeNode.data.id);  
804 - });  
805 - //资源连接状态选择时间  
806 - form.on('select(biz_treetable_state)', function (data) {  
807 - renderTreeTable(busId, curTreeNode.data.id);  
808 - });  
809 - }  
810 - }).error(function () {  
811 - layer.closeAll();  
812 - }); 934 + });
  935 + },300)
813 } 936 }
814 937
815 //获取资源统计 938 //获取资源统计
@@ -9,7 +9,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -9,7 +9,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
9 var common = layui.common; 9 var common = layui.common;
10 var commonCols = layui.commonCols; 10 var commonCols = layui.commonCols;
11 var sortKey = ''; 11 var sortKey = '';
12 - 12 + var fieldExpandArr=[];//获取扩展的表格字段
13 13
14 //用树表格展示的资源类型 14 //用树表格展示的资源类型
15 var treeTableResTypes = [ 15 var treeTableResTypes = [
@@ -102,71 +102,101 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -102,71 +102,101 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
102 renderSearchCondition(resType, bizId); 102 renderSearchCondition(resType, bizId);
103 103
104 var cols = commonCols.resTypeCls[resType]; 104 var cols = commonCols.resTypeCls[resType];
105 - //获取配置的列  
106 - common.getTableCols({  
107 - domId: 'bizResListTable',  
108 - moduleId: 'bizreslist',  
109 - resType: activeResType  
110 - }, function (retCols) {  
111 - if (retCols) {  
112 - cols = retCols;  
113 - }  
114 - listTable = table.render({  
115 - elem: '#bizResListTable'  
116 - , url: common.domainName + '/api-web/home/res-list/' + newResType  
117 - , where: {  
118 - access_token: accessToken,  
119 - resName: $("#biz_reslist_keyword").val(),  
120 - resHealth: $("#biz_reslist_resStatus").val(),  
121 - busId: bizId,  
122 - colonlyId: $("#biz_reslist_res_colony").val(),  
123 - parentId: $("#biz_reslist_res_cluster").val(),  
124 - linkState: $("#biz_reslist_link_state").val(),  
125 - state: $("#biz_reslist_state").val(),  
126 - // hostState: $("#biz_reslist_host_state").val(),  
127 - powerState: $("#biz_reslist_power_state").val(),  
128 - collProtocols: collProtocols  
129 -  
130 - }  
131 - , height: 'full-165'  
132 - , cellMinWidth: 80  
133 - , page: {  
134 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
135 - , theme: '#1E9FFF'  
136 - }  
137 - , toolbar: '#bizreslist_cols_save_btn' //开启头部工具栏,并为其绑定左侧模板  
138 - , defaultToolbar: ['filter']  
139 - , drag: 'simple'  
140 - , autoSort: false  
141 - , cols: [cols]  
142 - , done: function (res) {  
143 - soulTable.render(this);  
144 - getResCount(bizId, newResType)  
145 - commonCols.colsClickEvent();  
146 -  
147 - table.on('sort(bizResListTable)', function (obj) {  
148 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
149 - if (obj.type != null) {  
150 - sortKey = obj.field + ' ' + obj.type;  
151 - } else {  
152 - sortKey = ''; 105 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  106 + admin.req({
  107 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  108 + , done: function (res) {
  109 + if (res && res.data ) {
  110 + let arr=res.data;
  111 + if(fieldExpandArr.indexOf(resType)!=-1){
  112 + }else{
  113 + fieldExpandArr.push(resType);
  114 + if(arr.length>0){
  115 + arr.map(item=>{
  116 + let listStr='';
  117 + if(item.list && item.list.length>0){
  118 + listStr=item.list.join(',')
  119 + }
  120 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  121 + templet:` <div>
  122 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  123 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  124 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  125 + </div></div>`})
  126 + })
153 } 127 }
154 - reloadTable();  
155 - })  
156 -  
157 - //触发拖动列事件,参数为保存按钮的id  
158 - common.dragCols("bizreslist_cols_save");  
159 - loadRightResTypeSelectEvent(newResType, 'normal');  
160 -  
161 - initSaveColsEvent();//保存列事件  
162 - // 导出到excel  
163 - initExportDataEvent();  
164 - resFavorites();  
165 - resTopo(); 128 + }
  129 + } else {
  130 + console.log(res.msg);
166 } 131 }
167 - });  
168 - }) 132 + }
  133 + });
  134 + setTimeout(function (){
  135 + //获取配置的列
  136 + common.getTableCols({
  137 + domId: 'bizResListTable',
  138 + moduleId: 'bizreslist',
  139 + resType: activeResType
  140 + }, function (retCols) {
  141 + if (retCols) {
  142 + cols = retCols;
  143 + }
  144 + listTable = table.render({
  145 + elem: '#bizResListTable'
  146 + , url: common.domainName + '/api-web/home/res-list/' + newResType
  147 + , where: {
  148 + access_token: accessToken,
  149 + resName: $("#biz_reslist_keyword").val(),
  150 + resHealth: $("#biz_reslist_resStatus").val(),
  151 + busId: bizId,
  152 + colonlyId: $("#biz_reslist_res_colony").val(),
  153 + parentId: $("#biz_reslist_res_cluster").val(),
  154 + linkState: $("#biz_reslist_link_state").val(),
  155 + state: $("#biz_reslist_state").val(),
  156 + // hostState: $("#biz_reslist_host_state").val(),
  157 + powerState: $("#biz_reslist_power_state").val(),
  158 + collProtocols: collProtocols
169 159
  160 + }
  161 + , height: 'full-165'
  162 + , cellMinWidth: 80
  163 + , page: {
  164 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  165 + , theme: '#1E9FFF'
  166 + }
  167 + , toolbar: '#bizreslist_cols_save_btn' //开启头部工具栏,并为其绑定左侧模板
  168 + , defaultToolbar: ['filter']
  169 + , drag: 'simple'
  170 + , autoSort: false
  171 + , cols: [cols]
  172 + , done: function (res) {
  173 + soulTable.render(this);
  174 + getResCount(bizId, newResType)
  175 + commonCols.colsClickEvent();
  176 +
  177 + table.on('sort(bizResListTable)', function (obj) {
  178 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  179 + if (obj.type != null) {
  180 + sortKey = obj.field + ' ' + obj.type;
  181 + } else {
  182 + sortKey = '';
  183 + }
  184 + reloadTable();
  185 + })
  186 +
  187 + //触发拖动列事件,参数为保存按钮的id
  188 + common.dragCols("bizreslist_cols_save");
  189 + loadRightResTypeSelectEvent(newResType, 'normal');
  190 +
  191 + initSaveColsEvent();//保存列事件
  192 + // 导出到excel
  193 + initExportDataEvent();
  194 + resFavorites();
  195 + resTopo();
  196 + }
  197 + });
  198 + })
  199 + },300)
170 } 200 }
171 201
172 202
@@ -206,145 +236,175 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -206,145 +236,175 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
206 236
207 layer.load(2); //加载层。 237 layer.load(2); //加载层。
208 var cols = commonCols.resTypeCls[resType]; 238 var cols = commonCols.resTypeCls[resType];
209 -  
210 - //获取配置的列  
211 - common.getTableCols({  
212 - domId: 'bizResTreeTable',  
213 - moduleId: 'bizreslist',  
214 - resType: activeResType  
215 - }, function (ressult) {  
216 - if (ressult) {  
217 - cols = ressult; 239 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  240 + admin.req({
  241 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  242 + , done: function (res) {
  243 + if (res && res.data ) {
  244 + let arr=res.data;
  245 + if(fieldExpandArr.indexOf(resType)!=-1){
  246 + }else{
  247 + fieldExpandArr.push(resType);
  248 + if(arr.length>0){
  249 + arr.map(item=>{
  250 + let listStr='';
  251 + if(item.list && item.list.length>0){
  252 + listStr=item.list.join(',')
  253 + }
  254 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  255 + templet:` <div>
  256 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  257 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  258 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  259 + </div></div>`})
  260 + })
  261 + }
  262 + }
  263 + } else {
  264 + console.log(res.msg);
  265 + }
218 } 266 }
219 - admin.req({  
220 - url: common.domainName + "/api-web/home/virtual-res-list/" + resType  
221 - , data: {  
222 - parentId: $("#biz_virtual_platForm_select").val(),  
223 - health: $("#biz_reslist_treetable_resStatus").val(),  
224 - busId: bizId,  
225 - keyWords: $("#biz_reslist_treetable_keyword").val(),  
226 - state: $("#biz_reslist_treetable_state").val(),  
227 - linkState: $('#biz_reslist_treetable_link_state').val(),  
228 - powerState: $("#biz_reslist_treetable_power_state").val(),  
229 - serverState: $("#biz_reslist_server_state").val(),  
230 - collProtocols: collProtocols 267 + });
  268 + setTimeout(function (){
  269 + //获取配置的列
  270 + common.getTableCols({
  271 + domId: 'bizResTreeTable',
  272 + moduleId: 'bizreslist',
  273 + resType: activeResType
  274 + }, function (ressult) {
  275 + if (ressult) {
  276 + cols = ressult;
231 } 277 }
232 - , done: function (res) {  
233 - if (res.code == 0) {  
234 - treeListTable = table.render({  
235 - elem: '#bizResTreeTable',  
236 - data: res.data,  
237 - tree: {  
238 - iconIndex: 1  
239 - },  
240 - height: 'full-270',  
241 - treeConfig: { //表格树所需配置  
242 - showField: 'resName' //表格树显示的字段  
243 - , treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。  
244 - , treepid: ''//父级id字段名称  
245 - , iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer  
246 - },  
247 - cols: [cols],  
248 - drag: 'simple',  
249 - page: false,  
250 - limit: 9999,  
251 - autoColumnWidth: false,  
252 - done: function (a, b, c) {  
253 - soulTable.render(this);  
254 - //触发拖动列事件,参数为保存按钮的id  
255 - common.treeTableDragCols("#bizResTreeTable", "#bizTreeReslist_cols_save_btn");  
256 -  
257 - commonCols.colsClickEvent();  
258 - // 加载统计信息  
259 - loadRightResTypeSelectEvent(resType, 'tree');  
260 - initTreeSaveColsEvent();//保存列事件  
261 - initExportTreeDataEvent();  
262 - resFavorites();  
263 - resTopo();  
264 - }  
265 - });  
266 - } else {  
267 - console.log(data.msg); 278 + admin.req({
  279 + url: common.domainName + "/api-web/home/virtual-res-list/" + resType
  280 + , data: {
  281 + parentId: $("#biz_virtual_platForm_select").val(),
  282 + health: $("#biz_reslist_treetable_resStatus").val(),
  283 + busId: bizId,
  284 + keyWords: $("#biz_reslist_treetable_keyword").val(),
  285 + state: $("#biz_reslist_treetable_state").val(),
  286 + linkState: $('#biz_reslist_treetable_link_state').val(),
  287 + powerState: $("#biz_reslist_treetable_power_state").val(),
  288 + serverState: $("#biz_reslist_server_state").val(),
  289 + collProtocols: collProtocols
268 } 290 }
269 - layer.closeAll();  
270 - //关键字回车事件  
271 - $('#biz_reslist_treetable_keyword').unbind('keydown').keydown(function (e) {  
272 - if (e.keyCode === 13) {  
273 - renderTreeTable(bizId, resType, true) 291 + , done: function (res) {
  292 + if (res.code == 0) {
  293 + treeListTable = table.render({
  294 + elem: '#bizResTreeTable',
  295 + data: res.data,
  296 + tree: {
  297 + iconIndex: 1
  298 + },
  299 + height: 'full-270',
  300 + treeConfig: { //表格树所需配置
  301 + showField: 'resName' //表格树显示的字段
  302 + , treeid: 'resId' //treeid所对应字段的值在表格数据中必须是唯一的,且不能为空。
  303 + , treepid: ''//父级id字段名称
  304 + , iconClass: 'layui-icon-triangle-r' //小图标class样式 窗口图标 layui-icon-layer
  305 + },
  306 + cols: [cols],
  307 + drag: 'simple',
  308 + page: false,
  309 + limit: 9999,
  310 + autoColumnWidth: false,
  311 + done: function (a, b, c) {
  312 + soulTable.render(this);
  313 + //触发拖动列事件,参数为保存按钮的id
  314 + common.treeTableDragCols("#bizResTreeTable", "#bizTreeReslist_cols_save_btn");
  315 +
  316 + commonCols.colsClickEvent();
  317 + // 加载统计信息
  318 + loadRightResTypeSelectEvent(resType, 'tree');
  319 + initTreeSaveColsEvent();//保存列事件
  320 + initExportTreeDataEvent();
  321 + resFavorites();
  322 + resTopo();
  323 + }
  324 + });
  325 + } else {
  326 + console.log(data.msg);
274 } 327 }
275 - });  
276 - //选择资源状态  
277 - form.on('select(biz_reslist_treetable_resStatus)', function (data) {  
278 - renderTreeTable(bizId, resType, true);  
279 - });  
280 - //选择业务  
281 - form.on('select(treetableBizTypes)', function (data) {  
282 - renderTreeTable(bizId, resType, true);  
283 - });  
284 -  
285 - //选择平台  
286 - form.on('select(biz_reslist_virtual_platForm_select)', function (data) {  
287 - renderTreeTable(bizId, resType, true);  
288 - });  
289 - //资源状态选择事件  
290 - form.on('select(biz_reslist_treetable_state)', function (data) {  
291 - renderTreeTable(bizId, resType, true);  
292 - });  
293 - //资源连接状态选择事件  
294 - form.on('select(biz_reslist_treetable_link_state)', function (data) {  
295 - renderTreeTable(bizId, resType, true);  
296 - });  
297 - // 电源状态  
298 - form.on('select(biz_reslist_treetable_power_state)', function (data) {  
299 - renderTreeTable(bizId, resType, true);  
300 - });  
301 - /**  
302 - /**表格的增删改都会回调此方法  
303 - * 与table.on(tool(lay-filter))用法一致。  
304 - **/  
305 - /*treeListTable.on('tool(tableEvent)', function (obj) {  
306 - if (!obj.data.treeList) {  
307 - var field = obj.field; //单元格字段  
308 - var value = obj.value; //修改后的值  
309 - var data = obj.data; //当前行数据  
310 - var event = obj.event; //当前单元格事件属性值  
311 - var subResType = '';  
312 - if (data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI') {  
313 - subResType = data.resType == 'VIRTUALIZATION_VMWARE' ? 'VIRTUALIZATION_VMWARE_CLUSTER' : 'VIRTUALIZATION_HUAWEI_CLUSTER';  
314 - } else if (data.resType.indexOf('CLUSTER') > -1) {  
315 - subResType = data.resType == 'VIRTUALIZATION_VMWARE_CLUSTER' ? 'VIRTUALIZATION_VMWARE_PHYSICSHOST' : 'VIRTUALIZATION_HUAWEI_PHYSICSHOST';  
316 - } else if (data.resType.indexOf('PHYSICSHOST') > -1) {  
317 - subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';  
318 - }else{  
319 - subResType = data.resType 328 + layer.closeAll();
  329 + //关键字回车事件
  330 + $('#biz_reslist_treetable_keyword').unbind('keydown').keydown(function (e) {
  331 + if (e.keyCode === 13) {
  332 + renderTreeTable(bizId, resType, true)
320 } 333 }
321 - if(event === 'loadChildren'){  
322 - $.ajax({  
323 - url: common.domainName + "/api-web/home/virtual-res-list/" + subResType  
324 - , type: "get"  
325 - , data: {  
326 - health: $("#biz_reslist_treetable_resStatus").val(),  
327 - busId: bizId,  
328 - keyWords: $("#biz_treetable_keyword").val(),  
329 - state: $("#biz_reslist_treetable_state").val(),  
330 - access_token:accessToken,  
331 - parentId:data.resId  
332 - }  
333 - ,success:function (res) {  
334 - if(res.data.length>0){  
335 - obj.loadChildren(res.data);  
336 - commonCols.colsClickEvent(); 334 + });
  335 + //选择资源状态
  336 + form.on('select(biz_reslist_treetable_resStatus)', function (data) {
  337 + renderTreeTable(bizId, resType, true);
  338 + });
  339 + //选择业务
  340 + form.on('select(treetableBizTypes)', function (data) {
  341 + renderTreeTable(bizId, resType, true);
  342 + });
  343 +
  344 + //选择平台
  345 + form.on('select(biz_reslist_virtual_platForm_select)', function (data) {
  346 + renderTreeTable(bizId, resType, true);
  347 + });
  348 + //资源状态选择事件
  349 + form.on('select(biz_reslist_treetable_state)', function (data) {
  350 + renderTreeTable(bizId, resType, true);
  351 + });
  352 + //资源连接状态选择事件
  353 + form.on('select(biz_reslist_treetable_link_state)', function (data) {
  354 + renderTreeTable(bizId, resType, true);
  355 + });
  356 + // 电源状态
  357 + form.on('select(biz_reslist_treetable_power_state)', function (data) {
  358 + renderTreeTable(bizId, resType, true);
  359 + });
  360 + /**
  361 + /**表格的增删改都会回调此方法
  362 + * 与table.on(tool(lay-filter))用法一致。
  363 + **/
  364 + /*treeListTable.on('tool(tableEvent)', function (obj) {
  365 + if (!obj.data.treeList) {
  366 + var field = obj.field; //单元格字段
  367 + var value = obj.value; //修改后的值
  368 + var data = obj.data; //当前行数据
  369 + var event = obj.event; //当前单元格事件属性值
  370 + var subResType = '';
  371 + if (data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI') {
  372 + subResType = data.resType == 'VIRTUALIZATION_VMWARE' ? 'VIRTUALIZATION_VMWARE_CLUSTER' : 'VIRTUALIZATION_HUAWEI_CLUSTER';
  373 + } else if (data.resType.indexOf('CLUSTER') > -1) {
  374 + subResType = data.resType == 'VIRTUALIZATION_VMWARE_CLUSTER' ? 'VIRTUALIZATION_VMWARE_PHYSICSHOST' : 'VIRTUALIZATION_HUAWEI_PHYSICSHOST';
  375 + } else if (data.resType.indexOf('PHYSICSHOST') > -1) {
  376 + subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';
  377 + }else{
  378 + subResType = data.resType
  379 + }
  380 + if(event === 'loadChildren'){
  381 + $.ajax({
  382 + url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
  383 + , type: "get"
  384 + , data: {
  385 + health: $("#biz_reslist_treetable_resStatus").val(),
  386 + busId: bizId,
  387 + keyWords: $("#biz_treetable_keyword").val(),
  388 + state: $("#biz_reslist_treetable_state").val(),
  389 + access_token:accessToken,
  390 + parentId:data.resId
337 } 391 }
338 - }  
339 - }) 392 + ,success:function (res) {
  393 + if(res.data.length>0){
  394 + obj.loadChildren(res.data);
  395 + commonCols.colsClickEvent();
  396 + }
  397 + }
  398 + })
  399 + }
340 } 400 }
341 - }  
342 - });*/  
343 - }  
344 - }).error(function () {  
345 - layer.closeAll();  
346 - });  
347 - }) 401 + });*/
  402 + }
  403 + }).error(function () {
  404 + layer.closeAll();
  405 + });
  406 + })
  407 + },300)
348 } 408 }
349 409
350 //获取资源统计 410 //获取资源统计
@@ -2978,7 +2978,113 @@ layui.define(['soulTable', 'commonDetail', 'common', 'laytpl', 'view', 'admin', @@ -2978,7 +2978,113 @@ layui.define(['soulTable', 'commonDetail', 'common', 'laytpl', 'view', 'admin',
2978 }, function () { 2978 }, function () {
2979 layer.close(subtips); 2979 layer.close(subtips);
2980 }); 2980 });
  2981 + //lsq T3和IOP点击修改删除 2022-08-04
  2982 + $('.edit-delete-tpl').unbind('click').on('click',function (){
  2983 + var $T3Dom = $(this);
  2984 + //判断是字段类型T3/IOP
  2985 + let tplType=$T3Dom.data('tpltype');
  2986 + //获取资源id
  2987 + var resId = $T3Dom.data('resid');
  2988 + //获取旧数据
  2989 + let old_T3Dom=$T3Dom.text();
  2990 + //获取扩展字段id
  2991 + let expandId=$T3Dom.data('expandid');
  2992 + //获取字段为输入框或者下拉选择 0 输入框 1下拉选择
  2993 + let fieldSourceType=$T3Dom.data('fieldsourcetype');
  2994 + //获取下拉选择值
  2995 + let fieldList=$T3Dom.data('list');
  2996 + let url='/api-web/resource/expand/saveOrUpdate';
  2997 + //判断类型是输入框还是下拉列表
  2998 + let titleName='';
  2999 + let promptHtml='';
  3000 + if(fieldSourceType == '0'){
  3001 + titleName='请输入';
  3002 + promptHtml=`<input type="text" id="promptInput" name="promptInput" autocomplete="off" class="layui-input">`
  3003 + }else if(fieldSourceType== '1'){
  3004 + titleName='请选择';
  3005 + promptHtml=`<select id="promptInput" style="width:80%;cursor:pointer;" class="layui-select" lay-filter="promptInput">`
  3006 + if(fieldList){
  3007 + let fieldListArr=fieldList.split(",")
  3008 + fieldListArr.map(item=>{
  3009 + promptHtml+=`<option value="`+item+`">`+item+`</option>`;
  3010 + })
  3011 + }
  3012 + promptHtml+=`</select>`;
  3013 + }else{
  3014 + promptHtml=``
  3015 + }
  3016 + let html_tpl=`<div class="T3-IOP-prompt">`+promptHtml+`</div>`;
  3017 + layer.open({
  3018 + title: [titleName+tplType, 'font-size:14px;'],
  3019 + type: 1,
  3020 + area: ['280px','170px'],
  3021 + content: html_tpl,
  3022 + success: function () {
  3023 + $('#promptInput').val(old_T3Dom)
  3024 + }
  3025 + , id: 'lay_T3_IOP' //设定一个id,防止重复弹出
  3026 + , btn: ['清空', '保存']
  3027 + , yes: function (index, layero) {
  3028 + layer.confirm('确认要删除吗?', {icon: 3, title: '提示'}, function (index1) {
  3029 + layer.load(2);
  3030 + admin.req({
  3031 + //删除T3值
  3032 + url: common.domainName + url,
  3033 + data: {
  3034 + resId:resId,
  3035 + fieldValue:'',
  3036 + expandId:expandId,//扩展字段id
  3037 +
  3038 + },
  3039 + }).done(function (response) {
  3040 + layer.closeAll('loading');
  3041 + if (response.success) {
  3042 + layer.msg('删除成功!', {icon: 1, time: 3000});
  3043 + $T3Dom.text('');
  3044 + } else {
  3045 + layer.msg('删除失败!', {icon: 2, time: 3000});
  3046 + }
  3047 + layer.close(index);
  3048 + });
  3049 + })
  3050 + }
  3051 + , btn2:function(index, layero){
  3052 + var value = $('#promptInput').val();
  3053 + if (value !== old_T3Dom) {
  3054 + layer.load(2);
2981 3055
  3056 + admin.req({
  3057 + //修改扩展字段T3/IOp值
  3058 + url: common.domainName + url,
  3059 + data: {
  3060 + resId:resId,
  3061 + fieldValue:value,
  3062 + expandId:expandId,//扩展字段id
  3063 +
  3064 + },
  3065 + success: function (response) {
  3066 + layer.closeAll('loading');
  3067 + if (response && response.success) {
  3068 + layer.msg('修改成功', {icon: 1});
  3069 + $T3Dom.text(value);
  3070 + } else {
  3071 + layer.msg('修改失败', {icon: 2});
  3072 + }
  3073 + layer.close(index);
  3074 +
  3075 + },
  3076 + error: function (err) {
  3077 + layer.closeAll('loading');
  3078 + layer.msg('修改失败', {icon: 2});
  3079 + }
  3080 + });
  3081 + } else {
  3082 + layer.close(index);
  3083 + }
  3084 + },
  3085 + });
  3086 + })
  3087 + //end lsq T3和IOP点击修改/删除 2022-08-04
2982 function showTips(id, message, state) { 3088 function showTips(id, message, state) {
2983 subtips = layer.tips(state + "失败原因:" + message, 3089 subtips = layer.tips(state + "失败原因:" + message,
2984 '#' + id, {tips: 1}); 3090 '#' + id, {tips: 1});
1 //资源视图 1 //资源视图
2 -layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form', 'table', 'treeTable', 'sessions', "commonDetail", 'tasklist', 'view', 'reslist'], function (exports) { 2 +layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form', 'table', 'treeTable', 'sessions', "common", 'tasklist', 'view', 'reslist'], function (exports) {
3 var $ = layui.$; 3 var $ = layui.$;
4 var common = layui.common; 4 var common = layui.common;
5 var table = layui.table; 5 var table = layui.table;
@@ -809,300 +809,439 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form', @@ -809,300 +809,439 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
809 return htm; 809 return htm;
810 } 810 }
811 }); 811 });
812 - //渲染表格  
813 - table.render({  
814 - elem: '#resManageTable'  
815 - , id: 'resManageTable'  
816 - , url: common.domainName + '/api-web/home/res-list/' + resType  
817 - , where: {  
818 - access_token: accessToken,  
819 - editMode: 'true',  
820 - resName: $("#resManageIndexForm").find("input[name='resName']").val() ? $("#resManageIndexForm").find("input[name='resName']").val() : searchId,  
821 - ipOrManageIp: $("#resManageIndexForm").find("input[name='ipOrManageIp']").val(),  
822 - // admin: $("#resManageIndexForm").find("input[name='admin']").val(),  
823 - adminName: $("#resManageIndexForm").find("input[name='admin']").val(),  
824 - busId: $("#resManageIndexForm").find("input[name='busId']").val(),  
825 - state: $("#resManageIndexForm").find("select[name='state']").val(),  
826 - parentId: $("#resManageIndexForm").find("select[name='parentId']").val(),  
827 - collectionState: $("#resManageIndexForm").find("select[name='collectionState']").val()  
828 - }  
829 - , height: 'full-200'  
830 - , cellMinWidth: 80  
831 - , page: {  
832 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
833 - , theme: '#1E9FFF' 812 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  813 + admin.req({
  814 + url: this.domainName + "/api-web/resource/expand/list?resType=" + resType
  815 + , done: function (res) {
  816 + if (res && res.data ) {
  817 + let arr=res.data;
  818 + //lsq 资源管理增加扩展字段 待验证 2022-08-12
  819 + // if(this.fieldExpandArr.indexOf(resType)!=-1){
  820 + // }else{
  821 + // this.fieldExpandArr.push(resType);
  822 + if(arr.length>0){
  823 + arr.map(item=>{
  824 + let listStr='';
  825 + if(item.list && item.list.length>0){
  826 + listStr=item.list.join(',')
  827 + }
  828 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  829 + templet:` <div>
  830 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  831 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  832 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  833 + </div></div>`})
  834 + })
  835 + }
  836 + // }
  837 + } else {
  838 + console.log(res.msg);
  839 + }
834 } 840 }
835 - , limit: common.limit  
836 - , limits: common.limits  
837 - , cols: [cols]  
838 - , done: function (res, curr, count) {  
839 -  
840 - //XuHaoJie 2021/10/18 阿里云无详情页 华为云无详情页  
841 - $('button[data-restype="ALI_CLOUD_PLAT"][lay-tips="查看详情"]').remove()  
842 - $('button[data-restype="HUAWEI_CLOUD_PLAT"][lay-tips="查看详情"]').remove()  
843 - // 共享设备,厂商是H3C、HDS的设备不让查看详情页,没有数据  
844 - $('button[data-restype="STORAGE_SHARE"][data-provider="H3C"]').remove()  
845 - $('button[data-restype="STORAGE_SHARE"][data-provider="HDS"]').remove()  
846 -  
847 - lastQueryCondition = this.where;  
848 - lastQueryCondition.resType = this.url.substring(this.url.lastIndexOf("/") + 1);  
849 - (lastQueryCondition.resType === 'all') && (lastQueryCondition.resType = '')  
850 - $('table tr').hover(function (obj) {  
851 - $(obj.currentTarget).find('.layui-icon-rate').removeClass('hide');  
852 - }, function (obj) {  
853 - $(obj.currentTarget).find('.layui-icon-rate').addClass('hide');  
854 - })  
855 - tableScrollPatch($(this));  
856 - //表格排序监听 joke add 20200408  
857 - table.on('sort(resManageTable)', function (obj) {  
858 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
859 - if (obj.type != null) {  
860 - sortKey = obj.field + ' ' + obj.type;  
861 - } else {  
862 - sortKey = '';  
863 - }  
864 - reloadTable();  
865 - }) 841 + });
  842 + setTimeout(function (){
  843 + //渲染表格
  844 + table.render({
  845 + elem: '#resManageTable'
  846 + , id: 'resManageTable'
  847 + , url: common.domainName + '/api-web/home/res-list/' + resType
  848 + , where: {
  849 + access_token: accessToken,
  850 + editMode: 'true',
  851 + resName: $("#resManageIndexForm").find("input[name='resName']").val() ? $("#resManageIndexForm").find("input[name='resName']").val() : searchId,
  852 + ipOrManageIp: $("#resManageIndexForm").find("input[name='ipOrManageIp']").val(),
  853 + // admin: $("#resManageIndexForm").find("input[name='admin']").val(),
  854 + adminName: $("#resManageIndexForm").find("input[name='admin']").val(),
  855 + busId: $("#resManageIndexForm").find("input[name='busId']").val(),
  856 + state: $("#resManageIndexForm").find("select[name='state']").val(),
  857 + parentId: $("#resManageIndexForm").find("select[name='parentId']").val(),
  858 + collectionState: $("#resManageIndexForm").find("select[name='collectionState']").val()
  859 + }
  860 + , height: 'full-200'
  861 + , cellMinWidth: 80
  862 + , page: {
  863 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  864 + , theme: '#1E9FFF'
  865 + }
  866 + , limit: common.limit
  867 + , limits: common.limits
  868 + , cols: [cols]
  869 + , done: function (res, curr, count) {
  870 +
  871 + //XuHaoJie 2021/10/18 阿里云无详情页 华为云无详情页
  872 + $('button[data-restype="ALI_CLOUD_PLAT"][lay-tips="查看详情"]').remove()
  873 + $('button[data-restype="HUAWEI_CLOUD_PLAT"][lay-tips="查看详情"]').remove()
  874 + // 共享设备,厂商是H3C、HDS的设备不让查看详情页,没有数据
  875 + $('button[data-restype="STORAGE_SHARE"][data-provider="H3C"]').remove()
  876 + $('button[data-restype="STORAGE_SHARE"][data-provider="HDS"]').remove()
  877 +
  878 + lastQueryCondition = this.where;
  879 + lastQueryCondition.resType = this.url.substring(this.url.lastIndexOf("/") + 1);
  880 + (lastQueryCondition.resType === 'all') && (lastQueryCondition.resType = '')
  881 + $('table tr').hover(function (obj) {
  882 + $(obj.currentTarget).find('.layui-icon-rate').removeClass('hide');
  883 + }, function (obj) {
  884 + $(obj.currentTarget).find('.layui-icon-rate').addClass('hide');
  885 + })
  886 + tableScrollPatch($(this));
  887 + //表格排序监听 joke add 20200408
  888 + table.on('sort(resManageTable)', function (obj) {
  889 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  890 + if (obj.type != null) {
  891 + sortKey = obj.field + ' ' + obj.type;
  892 + } else {
  893 + sortKey = '';
  894 + }
  895 + reloadTable();
  896 + })
866 897
867 - //点击协议名称 进行编辑  
868 - $('[resmanage-data-edit]').unbind("click").on('click', function () {  
869 - if ($.inArray('back:resource:update', checkList) == -1) {  
870 - layer.msg('暂无权限!', {icon: 7, time: 3000});  
871 - return;  
872 - }  
873 - openEditHtml($(this).attr("resmanage-data-edit"),$(this).data("restype"),false);  
874 - });  
875 - $('[resmanage-data-delete]').unbind("click").on('click', function () {  
876 - deleteByIds($(this).attr("resmanage-data-delete"));  
877 - });  
878 - $('[resmanage-data-delete-plus]').unbind("click").on('click', function () {  
879 - compulsoryDeleteById($(this).attr("resmanage-data-delete-plus"));  
880 - });  
881 - $('[resmanage-data-console]').unbind("click").on('click', function () {  
882 - var resId = $(this).attr("resmanage-data-console");  
883 - window.open('/src/lib/extend/ssh/page/webssh.html?resId='+resId,"_blank");  
884 - });  
885 - $('[resmanage-data-stopcoll]').unbind("click").on('click', function () {  
886 - var $that = $(this)  
887 - //确认提示框  
888 - layer.confirm('确认要恢复/暂停当前资源的采集吗?', {  
889 - btn: ['确定', '取消'] //按钮  
890 - }, function () {  
891 - var loding = layer.load(2)  
892 - var opj = {  
893 - resId:$that.attr("resmanage-data-stopcoll"),  
894 - state:$that.data("param") 898 + //点击协议名称 进行编辑
  899 + $('[resmanage-data-edit]').unbind("click").on('click', function () {
  900 + if ($.inArray('back:resource:update', checkList) == -1) {
  901 + layer.msg('暂无权限!', {icon: 7, time: 3000});
  902 + return;
895 } 903 }
896 - $.ajax({  
897 - url: common.domainName + '/api-web/manage/resource/stopOrStartColl?access_token='+accessToken  
898 - ,data:JSON.stringify(opj)  
899 - ,type:'post'  
900 - ,contentType: "application/json; charset=utf-8"  
901 - ,success:function (res) {  
902 - if (res.success){  
903 - layer.close(loding);  
904 - layer.msg('操作成功', {  
905 - offset: '15px'  
906 - , icon: 1  
907 - , time: 1500  
908 - },function () {  
909 - layer.closeAll();  
910 - reloadTable();  
911 - });  
912 - } else{  
913 - layer.msg('操作异常:'+res.msg, {icon: 7, time: 3000});  
914 - }  
915 - },  
916 - error:function (res) {  
917 - layer.closeAll();  
918 - console.error(res);  
919 - }  
920 - }) 904 + openEditHtml($(this).attr("resmanage-data-edit"),$(this).data("restype"),false);
921 }); 905 });
922 - });  
923 - // 加入/移出收藏夹  
924 - $('a.layui-icon-rate').unbind('click').on('click',rate );  
925 -  
926 - function rate() {  
927 - var $aDom = $(this);  
928 - var resId = $aDom.data('id');  
929 - var favIdList = $aDom.data('favid') && $aDom.data('favid') != 'null' ? $aDom.data('favid').split(',') : [];  
930 - admin.req({  
931 - url: common.domainName + '/api-web/favorites/treeSelectData'  
932 - }).done(function (response) {  
933 - var data = response.data;  
934 - if (data.length == 0) {  
935 - var selectValue = '';  
936 - saveFavs($aDom,selectValue,resId,'true');  
937 - } else if (data.length == 1) {  
938 - var selectValue = data[0].value;  
939 - saveFavs($aDom,selectValue,resId,'false');  
940 - } else {  
941 - layer.open({  
942 - type: '1',  
943 - title: '选择收藏夹',  
944 - id: 'layer-select-favorites',  
945 - content: '<div class="div-select-favorites"><div id="slt-favorites-tree"></div></div>',  
946 - offset: '150px',  
947 - area: ['20%', '15%'],  
948 - btn: ['选择', '取消'],  
949 - resize: false,  
950 - success: function () {  
951 - admin.req({  
952 - url: common.domainName + '/api-web/favorites/treeSelectData'  
953 - }).done(function (response) {  
954 - xmSelect.render({  
955 - el: '#slt-favorites-tree',  
956 - radio: true,  
957 - clickClose: true,  
958 - autoRow: true,  
959 - filterable: true,  
960 - height: 'auto',  
961 - toolbar: {  
962 - show: true,  
963 - },  
964 - model: {  
965 - label: {  
966 - type: 'text'  
967 - }  
968 - },  
969 - tree: {  
970 - show: true,  
971 - showFolderIcon: true,  
972 - showLine: true,  
973 - indent: 20,  
974 - expandedKeys: true,  
975 - strict: false  
976 - },  
977 - data: data 906 + $('[resmanage-data-delete]').unbind("click").on('click', function () {
  907 + deleteByIds($(this).attr("resmanage-data-delete"));
  908 + });
  909 + $('[resmanage-data-delete-plus]').unbind("click").on('click', function () {
  910 + compulsoryDeleteById($(this).attr("resmanage-data-delete-plus"));
  911 + });
  912 + $('[resmanage-data-console]').unbind("click").on('click', function () {
  913 + var resId = $(this).attr("resmanage-data-console");
  914 + window.open('/src/lib/extend/ssh/page/webssh.html?resId='+resId,"_blank");
  915 + });
  916 + $('[resmanage-data-stopcoll]').unbind("click").on('click', function () {
  917 + var $that = $(this)
  918 + //确认提示框
  919 + layer.confirm('确认要恢复/暂停当前资源的采集吗?', {
  920 + btn: ['确定', '取消'] //按钮
  921 + }, function () {
  922 + var loding = layer.load(2)
  923 + var opj = {
  924 + resId:$that.attr("resmanage-data-stopcoll"),
  925 + state:$that.data("param")
  926 + }
  927 + $.ajax({
  928 + url: common.domainName + '/api-web/manage/resource/stopOrStartColl?access_token='+accessToken
  929 + ,data:JSON.stringify(opj)
  930 + ,type:'post'
  931 + ,contentType: "application/json; charset=utf-8"
  932 + ,success:function (res) {
  933 + if (res.success){
  934 + layer.close(loding);
  935 + layer.msg('操作成功', {
  936 + offset: '15px'
  937 + , icon: 1
  938 + , time: 1500
  939 + },function () {
  940 + layer.closeAll();
  941 + reloadTable();
978 }); 942 });
979 - });  
980 - },  
981 - yes: function (layerIndex) {  
982 - var selectValue = xmSelect.get('#slt-favorites-tree', true).getValue('value');  
983 - if (favIdList.length === 0 && selectValue.length === 0) {  
984 - layer.msg('请选择一个收藏夹!', {icon: 0, time: 3000});  
985 - return false; 943 + } else{
  944 + layer.msg('操作异常:'+res.msg, {icon: 7, time: 3000});
986 } 945 }
987 - var favIds = selectValue.join(',');  
988 - layer.load(2);  
989 - saveFavs($aDom,favIds,resId,'false',layerIndex); 946 + },
  947 + error:function (res) {
  948 + layer.closeAll();
  949 + console.error(res);
990 } 950 }
991 - });  
992 - }  
993 - })  
994 - } 951 + })
  952 + });
  953 + });
  954 + // 加入/移出收藏夹
  955 + $('a.layui-icon-rate').unbind('click').on('click',rate );
  956 +
  957 + function rate() {
  958 + var $aDom = $(this);
  959 + var resId = $aDom.data('id');
  960 + var favIdList = $aDom.data('favid') && $aDom.data('favid') != 'null' ? $aDom.data('favid').split(',') : [];
  961 + admin.req({
  962 + url: common.domainName + '/api-web/favorites/treeSelectData'
  963 + }).done(function (response) {
  964 + var data = response.data;
  965 + if (data.length == 0) {
  966 + var selectValue = '';
  967 + saveFavs($aDom,selectValue,resId,'true');
  968 + } else if (data.length == 1) {
  969 + var selectValue = data[0].value;
  970 + saveFavs($aDom,selectValue,resId,'false');
  971 + } else {
  972 + layer.open({
  973 + type: '1',
  974 + title: '选择收藏夹',
  975 + id: 'layer-select-favorites',
  976 + content: '<div class="div-select-favorites"><div id="slt-favorites-tree"></div></div>',
  977 + offset: '150px',
  978 + area: ['20%', '15%'],
  979 + btn: ['选择', '取消'],
  980 + resize: false,
  981 + success: function () {
  982 + admin.req({
  983 + url: common.domainName + '/api-web/favorites/treeSelectData'
  984 + }).done(function (response) {
  985 + xmSelect.render({
  986 + el: '#slt-favorites-tree',
  987 + radio: true,
  988 + clickClose: true,
  989 + autoRow: true,
  990 + filterable: true,
  991 + height: 'auto',
  992 + toolbar: {
  993 + show: true,
  994 + },
  995 + model: {
  996 + label: {
  997 + type: 'text'
  998 + }
  999 + },
  1000 + tree: {
  1001 + show: true,
  1002 + showFolderIcon: true,
  1003 + showLine: true,
  1004 + indent: 20,
  1005 + expandedKeys: true,
  1006 + strict: false
  1007 + },
  1008 + data: data
  1009 + });
  1010 + });
  1011 + },
  1012 + yes: function (layerIndex) {
  1013 + var selectValue = xmSelect.get('#slt-favorites-tree', true).getValue('value');
  1014 + if (favIdList.length === 0 && selectValue.length === 0) {
  1015 + layer.msg('请选择一个收藏夹!', {icon: 0, time: 3000});
  1016 + return false;
  1017 + }
  1018 + var favIds = selectValue.join(',');
  1019 + layer.load(2);
  1020 + saveFavs($aDom,favIds,resId,'false',layerIndex);
  1021 + }
  1022 + });
  1023 + }
  1024 + })
  1025 + }
995 1026
996 - //移出收藏夹  
997 - $('a.layui-icon-rate-solid').unbind('click').on('click',rateSolidClick ); 1027 + //移出收藏夹
  1028 + $('a.layui-icon-rate-solid').unbind('click').on('click',rateSolidClick );
998 1029
999 - function rateSolidClick() {  
1000 - var $aDom = $(this);  
1001 - var resId = $aDom.data('id');  
1002 - var favId = '';  
1003 - saveFavs($aDom,favId,resId,'false');  
1004 - } 1030 + function rateSolidClick() {
  1031 + var $aDom = $(this);
  1032 + var resId = $aDom.data('id');
  1033 + var favId = '';
  1034 + saveFavs($aDom,favId,resId,'false');
  1035 + }
1005 1036
1006 - //添加收藏夹/移出收藏夹  
1007 - function saveFavs($aDom,favIds,resId,flag,layerIndex) {  
1008 - admin.req({  
1009 - url: common.domainName + '/api-web/favorites/save/fav',  
1010 - type: 'POST',  
1011 - data: {  
1012 - favIds: favIds,  
1013 - resId: resId,  
1014 - flag: flag  
1015 - },  
1016 - error: function () { 1037 + //添加收藏夹/移出收藏夹
  1038 + function saveFavs($aDom,favIds,resId,flag,layerIndex) {
  1039 + admin.req({
  1040 + url: common.domainName + '/api-web/favorites/save/fav',
  1041 + type: 'POST',
  1042 + data: {
  1043 + favIds: favIds,
  1044 + resId: resId,
  1045 + flag: flag
  1046 + },
  1047 + error: function () {
  1048 + layer.closeAll('loading');
  1049 + }
  1050 + }).done(function (response) {
1017 layer.closeAll('loading'); 1051 layer.closeAll('loading');
1018 - }  
1019 - }).done(function (response) {  
1020 - layer.closeAll('loading');  
1021 - if (response.success) {  
1022 - if (favIds != '' || (flag == 'true' && favIds == '')) {  
1023 - $aDom.removeClass('layui-icon-rate');  
1024 - $aDom.removeClass('hide');  
1025 - $aDom.addClass('layui-icon-rate-solid');  
1026 - $aDom.unbind('click').on('click', rateSolidClick);  
1027 - $aDom.attr('lay-tips', '移出收藏夹');  
1028 - $aDom.css('color','#FEB61E').css('font-size','14px');  
1029 - $aDom.data('favid', favIds); 1052 + if (response.success) {
  1053 + if (favIds != '' || (flag == 'true' && favIds == '')) {
  1054 + $aDom.removeClass('layui-icon-rate');
  1055 + $aDom.removeClass('hide');
  1056 + $aDom.addClass('layui-icon-rate-solid');
  1057 + $aDom.unbind('click').on('click', rateSolidClick);
  1058 + $aDom.attr('lay-tips', '移出收藏夹');
  1059 + $aDom.css('color','#FEB61E').css('font-size','14px');
  1060 + $aDom.data('favid', favIds);
1030 1061
  1062 + } else {
  1063 + $aDom.removeClass('layui-icon-rate-solid');
  1064 + $aDom.addClass('layui-icon-rate');
  1065 + $aDom.unbind('click').on('click', rate);
  1066 + $aDom.addClass('hide');
  1067 + $aDom.attr('lay-tips', '加入收藏夹');
  1068 + $aDom.css('font-size','14px');
  1069 + $aDom.data('favid', '');
  1070 + }
  1071 + layer.close(layerIndex);
1031 } else { 1072 } else {
1032 - $aDom.removeClass('layui-icon-rate-solid');  
1033 - $aDom.addClass('layui-icon-rate');  
1034 - $aDom.unbind('click').on('click', rate);  
1035 - $aDom.addClass('hide');  
1036 - $aDom.attr('lay-tips', '加入收藏夹');  
1037 - $aDom.css('font-size','14px');  
1038 - $aDom.data('favid', ''); 1073 + layer.msg('保存失败!', {icon: 2, time: 3000});
1039 } 1074 }
1040 - layer.close(layerIndex);  
1041 - } else {  
1042 - layer.msg('保存失败!', {icon: 2, time: 3000});  
1043 - }  
1044 - });  
1045 - } 1075 + });
  1076 + }
1046 1077
1047 - // 打开详情页面  
1048 - $('[resmanage-data-openDetail]').unbind("click").on('click', function () {  
1049 - // if ($.inArray('back:resource:update', checkList) == -1) {  
1050 - // layer.msg('暂无权限!', {icon: 7, time: 3000});  
1051 - // return;  
1052 - // }  
1053 - //背景色改变  
1054 - $.each($(this).parents('tbody').eq(0).find('tr'),function (i,v) {  
1055 - $(this).css('background-color','');  
1056 - if($(this).hasClass('tbody-tr-background-color')){  
1057 - $(this).removeClass('tbody-tr-background-color'); 1078 + // 打开详情页面
  1079 + $('[resmanage-data-openDetail]').unbind("click").on('click', function () {
  1080 + // if ($.inArray('back:resource:update', checkList) == -1) {
  1081 + // layer.msg('暂无权限!', {icon: 7, time: 3000});
  1082 + // return;
  1083 + // }
  1084 + //背景色改变
  1085 + $.each($(this).parents('tbody').eq(0).find('tr'),function (i,v) {
  1086 + $(this).css('background-color','');
  1087 + if($(this).hasClass('tbody-tr-background-color')){
  1088 + $(this).removeClass('tbody-tr-background-color');
  1089 + }
  1090 + });
  1091 + $(this).parents('tr').eq(0).addClass("tbody-tr-background-color");
  1092 + var resId = $(this).attr("resmanage-data-openDetail");
  1093 + var resType = $(this).data("restype");
  1094 + var name = $(this).data("name");
  1095 + var ip = $(this).data("ip");
  1096 + var resTypeName = $(this).data("restypename");
  1097 + var admin = $(this).data("admin");
  1098 + var adminName = $(this).data("adminname");
  1099 + var manageIp = $(this).data("manageip");
  1100 + var collProtocol = $(this).data("collprotocol");
  1101 + var provider= $(this).data("provider");
  1102 + if (name && name != ''){
  1103 + name += ' | ';
1058 } 1104 }
1059 - });  
1060 - $(this).parents('tr').eq(0).addClass("tbody-tr-background-color");  
1061 - var resId = $(this).attr("resmanage-data-openDetail");  
1062 - var resType = $(this).data("restype");  
1063 - var name = $(this).data("name");  
1064 - var ip = $(this).data("ip");  
1065 - var resTypeName = $(this).data("restypename");  
1066 - var admin = $(this).data("admin");  
1067 - var adminName = $(this).data("adminname");  
1068 - var manageIp = $(this).data("manageip");  
1069 - var collProtocol = $(this).data("collprotocol");  
1070 - var provider= $(this).data("provider");  
1071 - if (name && name != ''){  
1072 - name += ' | ';  
1073 - }  
1074 - if (resTypeName && resType !== 'HOST_X86SERVER') {  
1075 - name += resTypeName + '|';  
1076 - }  
1077 - if (ip) {  
1078 - if (resType === 'HOST_X86SERVER') {  
1079 - if (collProtocol && (collProtocol.split(",").length > 1 || collProtocol === 'SSH')) {  
1080 - name += '应用IP-' + ip + '|'; 1105 + if (resTypeName && resType !== 'HOST_X86SERVER') {
  1106 + name += resTypeName + '|';
  1107 + }
  1108 + if (ip) {
  1109 + if (resType === 'HOST_X86SERVER') {
  1110 + if (collProtocol && (collProtocol.split(",").length > 1 || collProtocol === 'SSH')) {
  1111 + name += '应用IP-' + ip + '|';
  1112 + }
  1113 + } else {
  1114 + name += ip + '|';
1081 } 1115 }
1082 - } else {  
1083 - name += ip + '|';  
1084 } 1116 }
1085 - }  
1086 - if (resType === 'HOST_X86SERVER' && collProtocol && collProtocol.indexOf('SNMP') !== -1 ) {  
1087 - if (manageIp) {  
1088 - name += '管理IP-' + manageIp + '|'; 1117 + if (resType === 'HOST_X86SERVER' && collProtocol && collProtocol.indexOf('SNMP') !== -1 ) {
  1118 + if (manageIp) {
  1119 + name += '管理IP-' + manageIp + '|';
  1120 + }
1089 } 1121 }
1090 - }  
1091 - if (adminName){  
1092 - name += adminName + ' | ';  
1093 - }  
1094 - if (name.length>0){  
1095 - name = name.substr(0,name.length-1);  
1096 - }  
1097 - if(resType=='STORAGE_SHARE' && provider!='HUAWEI' && provider!='Inspur'){  
1098 - return false;  
1099 - }  
1100 - commonDetail.openDetail(resId,resType,name)  
1101 - });  
1102 - resTopo();  
1103 - }  
1104 - }); 1122 + if (adminName){
  1123 + name += adminName + ' | ';
  1124 + }
  1125 + if (name.length>0){
  1126 + name = name.substr(0,name.length-1);
  1127 + }
  1128 + if(resType=='STORAGE_SHARE' && provider!='HUAWEI' && provider!='Inspur'){
  1129 + return false;
  1130 + }
  1131 + commonDetail.openDetail(resId,resType,name)
  1132 + });
  1133 + resTopo();
  1134 +
  1135 + //lsq T3和IOP点击修改删除 2022-08-04
  1136 + $('.edit-delete-tpl').unbind('click').on('click',function (){
  1137 + var $T3Dom = $(this);
  1138 + //判断是字段类型T3/IOP
  1139 + let tplType=$T3Dom.data('tpltype');
  1140 + //获取资源id
  1141 + var resId = $T3Dom.data('resid');
  1142 + //获取旧数据
  1143 + let old_T3Dom=$T3Dom.text();
  1144 + //获取扩展字段id
  1145 + let expandId=$T3Dom.data('expandid');
  1146 + //获取字段为输入框或者下拉选择 0 输入框 1下拉选择
  1147 + let fieldSourceType=$T3Dom.data('fieldsourcetype');
  1148 + //获取下拉选择值
  1149 + let fieldList=$T3Dom.data('list');
  1150 + let url='/api-web/resource/expand/saveOrUpdate';
  1151 + //判断类型是输入框还是下拉列表
  1152 + let titleName='';
  1153 + let promptHtml='';
  1154 + if(fieldSourceType == '0'){
  1155 + titleName='请输入';
  1156 + promptHtml=`<input type="text" id="promptInput" name="promptInput" autocomplete="off" class="layui-input">`
  1157 + }else if(fieldSourceType== '1'){
  1158 + titleName='请选择';
  1159 + promptHtml=`<select id="promptInput" style="width:80%;cursor:pointer;" class="layui-select" lay-filter="promptInput">`
  1160 + if(fieldList){
  1161 + let fieldListArr=fieldList.split(",")
  1162 + fieldListArr.map(item=>{
  1163 + promptHtml+=`<option value="`+item+`">`+item+`</option>`;
  1164 + })
  1165 + }
  1166 + promptHtml+=`</select>`;
  1167 + }else{
  1168 + promptHtml=``
  1169 + }
  1170 + let html_tpl=`<div class="T3-IOP-prompt">`+promptHtml+`</div>`;
  1171 + layer.open({
  1172 + title: [titleName+tplType, 'font-size:14px;'],
  1173 + type: 1,
  1174 + area: ['280px','170px'],
  1175 + content: html_tpl,
  1176 + success: function () {
  1177 + $('#promptInput').val(old_T3Dom)
  1178 + }
  1179 + , id: 'lay_T3_IOP' //设定一个id,防止重复弹出
  1180 + , btn: ['清空', '保存']
  1181 + , yes: function (index, layero) {
  1182 + layer.confirm('确认要删除吗?', {icon: 3, title: '提示'}, function (index1) {
  1183 + layer.load(2);
  1184 + admin.req({
  1185 + //删除T3值
  1186 + url: common.domainName + url,
  1187 + data: {
  1188 + resId:resId,
  1189 + fieldValue:'',
  1190 + expandId:expandId,//扩展字段id
  1191 +
  1192 + },
  1193 + }).done(function (response) {
  1194 + layer.closeAll('loading');
  1195 + if (response.success) {
  1196 + layer.msg('删除成功!', {icon: 1, time: 3000});
  1197 + $T3Dom.text('');
  1198 + } else {
  1199 + layer.msg('删除失败!', {icon: 2, time: 3000});
  1200 + }
  1201 + layer.close(index);
  1202 + });
  1203 + })
  1204 + }
  1205 + , btn2:function(index, layero){
  1206 + var value = $('#promptInput').val();
  1207 + if (value !== old_T3Dom) {
  1208 + layer.load(2);
1105 1209
  1210 + admin.req({
  1211 + //修改扩展字段T3/IOp值
  1212 + url: common.domainName + url,
  1213 + data: {
  1214 + resId:resId,
  1215 + fieldValue:value,
  1216 + expandId:expandId,//扩展字段id
  1217 +
  1218 + },
  1219 + success: function (response) {
  1220 + layer.closeAll('loading');
  1221 + if (response && response.success) {
  1222 + layer.msg('修改成功', {icon: 1});
  1223 + $T3Dom.text(value);
  1224 + } else {
  1225 + layer.msg('修改失败', {icon: 2});
  1226 + }
  1227 + layer.close(index);
  1228 +
  1229 + },
  1230 + error: function (err) {
  1231 + layer.closeAll('loading');
  1232 + layer.msg('修改失败', {icon: 2});
  1233 + }
  1234 + });
  1235 + } else {
  1236 + layer.close(index);
  1237 + }
  1238 + },
  1239 + });
  1240 + })
  1241 + //end lsq T3和IOP点击修改/删除 2022-08-04
  1242 + }
  1243 + });
  1244 + },300)
1106 } 1245 }
1107 1246
1108 //处理表头和内容不能对齐的问题 1247 //处理表头和内容不能对齐的问题
@@ -4,6 +4,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -4,6 +4,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
4 var $ = layui.$; 4 var $ = layui.$;
5 var common = layui.common; 5 var common = layui.common;
6 var table = layui.table; 6 var table = layui.table;
  7 + var fieldExpandArr=[];//获取扩展的表格字段
7 8
8 //对外暴露的接口 9 //对外暴露的接口
9 exports('resindex', function (data) { 10 exports('resindex', function (data) {
@@ -169,46 +170,77 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -169,46 +170,77 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
169 } else { 170 } else {
170 cols = commonCols.resTypeCls[resType]; 171 cols = commonCols.resTypeCls[resType];
171 } 172 }
172 - resTableList = table.render({  
173 - elem: '#resindexList'  
174 - , id: 'resindexList'  
175 - , url: common.domainName + '/api-web/home/res-list/' + resType  
176 - , toolbar: '<div><button id="resTableIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>'  
177 - , where: {  
178 - access_token: accessToken,  
179 - resCategory: 'resources'  
180 - }  
181 - , height: '100'  
182 - , cellMinWidth: 80  
183 - , page: false  
184 - , cols: [cols]  
185 - , done: function (res, curr, count) {  
186 - //2021/10/18 徐毫杰 阿里云服务器更改样式  
187 - if(resType=='ALI_CLOUD_PLAT'){  
188 - $('.layui-table-view').height(170);  
189 - $('.layui-table-main').height(70);  
190 - }  
191 - //调用收藏方法  
192 - resFavorites();  
193 - resTopo();  
194 -  
195 - commonCols.colsClickEvent(editFlag);  
196 -  
197 - //触发拖动列事件,参数为保存按钮的id  
198 - common.dragCols("resTableIndex_cols_save");  
199 -  
200 - //保存列顺序  
201 - $("#resTableIndex_cols_save").unbind("click").on("click", function () {  
202 - var params = {  
203 - domId: 'resTableList',  
204 - moduleId: 'resIndex',  
205 - resType: resType,  
206 - cols: resTableList.config.cols 173 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  174 + admin.req({
  175 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  176 + , done: function (res) {
  177 + if (res && res.data ) {
  178 + let arr=res.data;
  179 + if(fieldExpandArr.indexOf(resType)!=-1){
  180 + }else{
  181 + fieldExpandArr.push(resType);
  182 + if(arr.length>0){
  183 + arr.map(item=>{
  184 + let listStr='';
  185 + if(item.list && item.list.length>0){
  186 + listStr=item.list.join(',')
  187 + }
  188 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  189 + templet:` <div>
  190 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  191 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  192 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  193 + </div></div>`})
  194 + })
  195 + }
207 } 196 }
208 - common.saveTableCols(params);  
209 - }); 197 + } else {
  198 + console.log(res.msg);
  199 + }
210 } 200 }
211 }); 201 });
  202 + setTimeout(function (){
  203 + resTableList = table.render({
  204 + elem: '#resindexList'
  205 + , id: 'resindexList'
  206 + , url: common.domainName + '/api-web/home/res-list/' + resType
  207 + , toolbar: '<div><button id="resTableIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>'
  208 + , where: {
  209 + access_token: accessToken,
  210 + resCategory: 'resources'
  211 + }
  212 + , height: '100'
  213 + , cellMinWidth: 80
  214 + , page: false
  215 + , cols: [cols]
  216 + , done: function (res, curr, count) {
  217 + //2021/10/18 徐毫杰 阿里云服务器更改样式
  218 + if(resType=='ALI_CLOUD_PLAT'){
  219 + $('.layui-table-view').height(170);
  220 + $('.layui-table-main').height(70);
  221 + }
  222 + //调用收藏方法
  223 + resFavorites();
  224 + resTopo();
  225 +
  226 + commonCols.colsClickEvent(editFlag);
  227 +
  228 + //触发拖动列事件,参数为保存按钮的id
  229 + common.dragCols("resTableIndex_cols_save");
  230 +
  231 + //保存列顺序
  232 + $("#resTableIndex_cols_save").unbind("click").on("click", function () {
  233 + var params = {
  234 + domId: 'resTableList',
  235 + moduleId: 'resIndex',
  236 + resType: resType,
  237 + cols: resTableList.config.cols
  238 + }
  239 + common.saveTableCols(params);
  240 + });
  241 + }
  242 + });
  243 + },300)
212 }); 244 });
213 } 245 }
214 //左侧树 246 //左侧树
@@ -752,148 +784,179 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -752,148 +784,179 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
752 var index = layer.load(2); //加载层 784 var index = layer.load(2); //加载层
753 785
754 var cols = commonCols.resTypeCls[resType]; 786 var cols = commonCols.resTypeCls[resType];
  787 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
755 admin.req({ 788 admin.req({
756 - url: common.domainName + "/api-web/home/virtual-res-list/" + resType  
757 - , type: "get"  
758 - , data: {  
759 - ptId: $("#virtual_platForm_select").val(),  
760 - busId: bizId,  
761 - keyWords: $("#treetable_keyword").val(),  
762 - health: $("#treetable_resStatus").val(),  
763 - state: $("#treetable_res_state").val(),  
764 - resCategory: 'resources',  
765 - collProtocols : collProtocols  
766 -  
767 - } 789 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
768 , done: function (res) { 790 , done: function (res) {
769 - layer.close(index);  
770 - if (res.code == 0) {  
771 - //渲染表格  
772 - var tableTreeVirtual;  
773 - //获取配置的列  
774 - common.getTableCols({  
775 - domId: 'tableTreeVirtual',  
776 - moduleId: 'resIndex',  
777 - resType: resType  
778 - },function (retCols) {  
779 - if (retCols) {  
780 - cols = retCols; 791 + if (res && res.data ) {
  792 + let arr=res.data;
  793 + if(fieldExpandArr.indexOf(resType)!=-1){
  794 + }else{
  795 + fieldExpandArr.push(resType);
  796 + if(arr.length>0){
  797 + arr.map(item=>{
  798 + let listStr='';
  799 + if(item.list && item.list.length>0){
  800 + listStr=item.list.join(',')
  801 + }
  802 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  803 + templet:` <div>
  804 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  805 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  806 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  807 + </div></div>`})
  808 + })
781 } 809 }
782 - tableTreeVirtual = table.render({  
783 - elem: '#virtual_platform_treeTable',  
784 - autoColumnWidth: false,  
785 - page: false,  
786 - limit: 9999,  
787 - data: res.data,  
788 - tree: {  
789 - iconIndex: 1  
790 - },  
791 - cols: [cols]  
792 - , height: 'full-220',  
793 - done: function (res) {  
794 - soulTable.render(this);  
795 -  
796 - //调用收藏方法  
797 - resFavorites();  
798 - resTopo();  
799 -  
800 - common.treeTableDragCols('#virtual_platform_treeTable', '#resTreeList-top-head-info-tpl');  
801 - loadRightResTypeSelectEvent(curTreeNode.data.id,"tree")  
802 - // 保存列顺序  
803 - $('#virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){  
804 - common.saveTableCols({  
805 - domId: 'tableTreeVirtual',  
806 - moduleId: 'resIndex',  
807 - resType: resType,  
808 - cols: tableTreeVirtual.config.cols  
809 - });  
810 - }); 810 + }
  811 + } else {
  812 + console.log(res.msg);
  813 + }
  814 + }
  815 + });
  816 + setTimeout(function (){
  817 + admin.req({
  818 + url: common.domainName + "/api-web/home/virtual-res-list/" + resType
  819 + , type: "get"
  820 + , data: {
  821 + ptId: $("#virtual_platForm_select").val(),
  822 + busId: bizId,
  823 + keyWords: $("#treetable_keyword").val(),
  824 + health: $("#treetable_resStatus").val(),
  825 + state: $("#treetable_res_state").val(),
  826 + resCategory: 'resources',
  827 + collProtocols : collProtocols
811 828
812 - commonCols.colsClickEvent(editFlag); 829 + }
  830 + , done: function (res) {
  831 + layer.close(index);
  832 + if (res.code == 0) {
  833 + //渲染表格
  834 + var tableTreeVirtual;
  835 + //获取配置的列
  836 + common.getTableCols({
  837 + domId: 'tableTreeVirtual',
  838 + moduleId: 'resIndex',
  839 + resType: resType
  840 + },function (retCols) {
  841 + if (retCols) {
  842 + cols = retCols;
813 } 843 }
814 - });  
815 - /**  
816 - /**表格的增删改都会回调此方法  
817 - * 与table.on(tool(lay-filter))用法一致。  
818 - **/  
819 - /*tableTreeVirtual.on('tool(tableEvent)',function (obj) {  
820 - if(!obj.data.treeList){  
821 - var field = obj.field; //单元格字段  
822 - var value = obj.value; //修改后的值  
823 - var data = obj.data; //当前行数据  
824 - var event = obj.event; //当前单元格事件属性值  
825 - var subResType = '';  
826 - if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){  
827 - subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';  
828 - }else if(data.resType.indexOf('CLUSTER')>-1){  
829 - subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';  
830 - }else if(data.resType.indexOf('PHYSICSHOST')>-1){  
831 - subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';  
832 - }else{  
833 - subResType = data.resType 844 + tableTreeVirtual = table.render({
  845 + elem: '#virtual_platform_treeTable',
  846 + autoColumnWidth: false,
  847 + page: false,
  848 + limit: 9999,
  849 + data: res.data,
  850 + tree: {
  851 + iconIndex: 1
  852 + },
  853 + cols: [cols]
  854 + , height: 'full-220',
  855 + done: function (res) {
  856 + soulTable.render(this);
  857 +
  858 + //调用收藏方法
  859 + resFavorites();
  860 + resTopo();
  861 +
  862 + common.treeTableDragCols('#virtual_platform_treeTable', '#resTreeList-top-head-info-tpl');
  863 + loadRightResTypeSelectEvent(curTreeNode.data.id,"tree")
  864 + // 保存列顺序
  865 + $('#virtual_platform_treeTable').next().find('.btn_save_cols').unbind('click').on('click', function (){
  866 + common.saveTableCols({
  867 + domId: 'tableTreeVirtual',
  868 + moduleId: 'resIndex',
  869 + resType: resType,
  870 + cols: tableTreeVirtual.config.cols
  871 + });
  872 + });
  873 +
  874 + commonCols.colsClickEvent(editFlag);
834 } 875 }
835 - if(event === 'loadChildren'){  
836 - $.ajax({  
837 - url: common.domainName + "/api-web/home/virtual-res-list/" + subResType  
838 - , type: "get"  
839 - , data: {  
840 - ptId: $("#virtual_platForm_select").val(),  
841 - health: $("#treetable_resStatus").val(),  
842 - busId: $("#treetableBizTypes").val(),  
843 - keyWords: $("#treetable_keyword").val(),  
844 - state: $("#treetable_state").val(),  
845 - access_token:accessToken,  
846 - parentId:data.resId  
847 - }  
848 - ,success:function (res) {  
849 - if(res.data.length>0){  
850 - obj.loadChildren(res.data);  
851 - commonCols.colsClickEvent(); 876 + });
  877 + /**
  878 + /**表格的增删改都会回调此方法
  879 + * 与table.on(tool(lay-filter))用法一致。
  880 + **/
  881 + /*tableTreeVirtual.on('tool(tableEvent)',function (obj) {
  882 + if(!obj.data.treeList){
  883 + var field = obj.field; //单元格字段
  884 + var value = obj.value; //修改后的值
  885 + var data = obj.data; //当前行数据
  886 + var event = obj.event; //当前单元格事件属性值
  887 + var subResType = '';
  888 + if(data.resType == 'VIRTUALIZATION_VMWARE' || data.resType == 'VIRTUALIZATION_HUAWEI'){
  889 + subResType = data.resType=='VIRTUALIZATION_VMWARE'?'VIRTUALIZATION_VMWARE_CLUSTER':'VIRTUALIZATION_HUAWEI_CLUSTER';
  890 + }else if(data.resType.indexOf('CLUSTER')>-1){
  891 + subResType = data.resType=='VIRTUALIZATION_VMWARE_CLUSTER'?'VIRTUALIZATION_VMWARE_PHYSICSHOST':'VIRTUALIZATION_HUAWEI_PHYSICSHOST';
  892 + }else if(data.resType.indexOf('PHYSICSHOST')>-1){
  893 + subResType = data.resType=='VIRTUALIZATION_VMWARE_PHYSICSHOST'?'VIRTUALIZATION_VMWARE_VHOST':'VIRTUALIZATION_HUAWEI_VHOST';
  894 + }else{
  895 + subResType = data.resType
  896 + }
  897 + if(event === 'loadChildren'){
  898 + $.ajax({
  899 + url: common.domainName + "/api-web/home/virtual-res-list/" + subResType
  900 + , type: "get"
  901 + , data: {
  902 + ptId: $("#virtual_platForm_select").val(),
  903 + health: $("#treetable_resStatus").val(),
  904 + busId: $("#treetableBizTypes").val(),
  905 + keyWords: $("#treetable_keyword").val(),
  906 + state: $("#treetable_state").val(),
  907 + access_token:accessToken,
  908 + parentId:data.resId
852 } 909 }
853 - }  
854 - }) 910 + ,success:function (res) {
  911 + if(res.data.length>0){
  912 + obj.loadChildren(res.data);
  913 + commonCols.colsClickEvent();
  914 + }
  915 + }
  916 + })
  917 + }
855 } 918 }
856 - }  
857 - });*/  
858 - //统计总数  
859 - // $('#virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#treetable-countTpl').html()).render(res.data.length));  
860 - });  
861 - } else {  
862 - console.log(data.msg);  
863 - }  
864 - //关键字回车事件  
865 - $('#treetable_keyword').keydown(function (e) {  
866 - if (e.keyCode === 13) {  
867 - renderTreeTable(curTreeNode.data.id)  
868 - return false; 919 + });*/
  920 + //统计总数
  921 + // $('#virtual_platform_treeTable').next().find('.layui-table-box').after(laytpl($('#treetable-countTpl').html()).render(res.data.length));
  922 + });
  923 + } else {
  924 + console.log(data.msg);
869 } 925 }
870 - });  
871 - //选择资源状态  
872 - form.on('select(treetable_resStatus)', function (data) {  
873 - renderTreeTable(curTreeNode.data.id);  
874 - });  
875 - // //选择业务  
876 - // form.on('select(treetableBizTypes)', function (data) {  
877 - // renderTreeTable(curTreeNode.data.id);  
878 - // });  
879 - //选择平台  
880 - form.on('select(virtual_platForm_select)', function (data) {  
881 - renderTreeTable(curTreeNode.data.id);  
882 - });  
883 - //选择资源连接状态  
884 - form.on('select(treetable_state)', function (data) {  
885 - renderTreeTable(curTreeNode.data.id);  
886 - });  
887 - form.on('select(treetable_res_state)', function (data) {  
888 - renderTreeTable(curTreeNode.data.id);  
889 - }); 926 + //关键字回车事件
  927 + $('#treetable_keyword').keydown(function (e) {
  928 + if (e.keyCode === 13) {
  929 + renderTreeTable(curTreeNode.data.id)
  930 + return false;
  931 + }
  932 + });
  933 + //选择资源状态
  934 + form.on('select(treetable_resStatus)', function (data) {
  935 + renderTreeTable(curTreeNode.data.id);
  936 + });
  937 + // //选择业务
  938 + // form.on('select(treetableBizTypes)', function (data) {
  939 + // renderTreeTable(curTreeNode.data.id);
  940 + // });
  941 + //选择平台
  942 + form.on('select(virtual_platForm_select)', function (data) {
  943 + renderTreeTable(curTreeNode.data.id);
  944 + });
  945 + //选择资源连接状态
  946 + form.on('select(treetable_state)', function (data) {
  947 + renderTreeTable(curTreeNode.data.id);
  948 + });
  949 + form.on('select(treetable_res_state)', function (data) {
  950 + renderTreeTable(curTreeNode.data.id);
  951 + });
890 952
891 - commonCols.colsClickEvent(editFlag); 953 + commonCols.colsClickEvent(editFlag);
892 954
893 - }  
894 - }).error(function () {  
895 - layer.close(index);  
896 - }); 955 + }
  956 + }).error(function () {
  957 + layer.close(index);
  958 + });
  959 + },300)
897 } 960 }
898 961
899 962
@@ -995,116 +1058,148 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -995,116 +1058,148 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
995 } 1058 }
996 //渲染表格 1059 //渲染表格
997 var cols = commonCols.resTypeCls[resType]; 1060 var cols = commonCols.resTypeCls[resType];
998 - //获取配置的列  
999 - common.getTableCols({  
1000 - domId: 'parentResListTable',  
1001 - moduleId: 'resIndex',  
1002 - resType: resType  
1003 - },function (retCols) {  
1004 - if(retCols){  
1005 - cols = retCols;  
1006 - }  
1007 -  
1008 - parentResListTable = table.render({  
1009 - elem: '#resListTable'  
1010 - , id: 'resListTable'  
1011 - , toolbar: '#resList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板  
1012 - , defaultToolbar: ['filter']  
1013 - , drag: {toolbar: false}  
1014 - , url: common.domainName + '/api-web/home/res-list/' + resType  
1015 - , where: {  
1016 - access_token: accessToken,  
1017 - resName: resindexKeyword,  
1018 - busId: bizId,  
1019 - resHealth: $("#resStatus").val(),  
1020 - colonlyId: $("#res_colony").val(),  
1021 - parentId: $("#res_cluster").val(),  
1022 - sortKey: sortKey,  
1023 - state: $("#state").val(),  
1024 - linkState: $("#link_state").val(),  
1025 - hostState: $("#host_state").val(),  
1026 - powerState: $("#power_state").val(),  
1027 - resCategory: 'resources' 1061 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  1062 + admin.req({
  1063 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  1064 + , done: function (res) {
  1065 + if (res && res.data ) {
  1066 + let arr=res.data;
  1067 + if(fieldExpandArr.indexOf(resType)!=-1){
  1068 + }else{
  1069 + fieldExpandArr.push(resType);
  1070 + if(arr.length>0){
  1071 + arr.map(item=>{
  1072 + let listStr='';
  1073 + if(item.list && item.list.length>0){
  1074 + listStr=item.list.join(',')
  1075 + }
  1076 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  1077 + templet:` <div>
  1078 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  1079 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  1080 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  1081 + </div></div>`})
  1082 + })
  1083 + }
  1084 + }
  1085 + } else {
  1086 + console.log(res.msg);
1028 } 1087 }
1029 - , height: 'full-165'  
1030 - , cellMinWidth: 80  
1031 - , page: {  
1032 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
1033 - , theme: '#1E9FFF' 1088 + }
  1089 + });
  1090 + setTimeout(function (){
  1091 + //获取配置的列
  1092 + common.getTableCols({
  1093 + domId: 'parentResListTable',
  1094 + moduleId: 'resIndex',
  1095 + resType: resType
  1096 + },function (retCols) {
  1097 + if(retCols){
  1098 + cols = retCols;
1034 } 1099 }
1035 - , autoSort: false  
1036 - , limit: 150  
1037 - , limits: [150, 200, 300]  
1038 - , cols: [cols]  
1039 - , done: function (res, curr, count) {  
1040 - //更改样式  
1041 - function noClick($that) {  
1042 - $that.css("color", "#666");  
1043 - $that.css("text-decoration", "none");  
1044 - $that.attr("lay-tips", "未监控到数据");  
1045 - }  
1046 1100
1047 - // 共享设备,厂商是H3C、HDS的设备不让点击并且提示暂无监控信息  
1048 - var $hsc_ = $('span[data-restype="STORAGE_SHARE"][data-provider="H3C"]');  
1049 - $.each($hsc_, function (i, v) {  
1050 - noClick($(this));  
1051 - });  
1052 - var $hds = $('span[data-restype="STORAGE_SHARE"][data-provider="HDS"]');  
1053 - $.each($hds, function (i, v) {  
1054 - noClick($(this));  
1055 - });  
1056 - //华为云,阿里云不让点击,并且提示暂无监控信息  
1057 - // var $hds = $('span[data-restype="HUAWEI_CLOUD_PLAT"]');  
1058 - // $.each($hds, function (i, v) {  
1059 - // noClick($(this));  
1060 - // });  
1061 - // var $hds = $('span[data-restype="ALI_CLOUD_PLAT"]');  
1062 - // $.each($hds, function (i, v) {  
1063 - // noClick($(this));  
1064 - // });  
1065 -  
1066 - soulTable.render(this)  
1067 -  
1068 - //调用收藏方法  
1069 - resFavorites();  
1070 - resTopo();  
1071 -  
1072 - commonCols.colsClickEvent(editFlag); 1101 + parentResListTable = table.render({
  1102 + elem: '#resListTable'
  1103 + , id: 'resListTable'
  1104 + , toolbar: '#resList-top-head-info-tpl' //开启头部工具栏,并为其绑定左侧模板
  1105 + , defaultToolbar: ['filter']
  1106 + , drag: {toolbar: false}
  1107 + , url: common.domainName + '/api-web/home/res-list/' + resType
  1108 + , where: {
  1109 + access_token: accessToken,
  1110 + resName: resindexKeyword,
  1111 + busId: bizId,
  1112 + resHealth: $("#resStatus").val(),
  1113 + colonlyId: $("#res_colony").val(),
  1114 + parentId: $("#res_cluster").val(),
  1115 + sortKey: sortKey,
  1116 + state: $("#state").val(),
  1117 + linkState: $("#link_state").val(),
  1118 + hostState: $("#host_state").val(),
  1119 + powerState: $("#power_state").val(),
  1120 + resCategory: 'resources'
  1121 + }
  1122 + , height: 'full-165'
  1123 + , cellMinWidth: 80
  1124 + , page: {
  1125 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  1126 + , theme: '#1E9FFF'
  1127 + }
  1128 + , autoSort: false
  1129 + , limit: 150
  1130 + , limits: [150, 200, 300]
  1131 + , cols: [cols]
  1132 + , done: function (res, curr, count) {
  1133 + //更改样式
  1134 + function noClick($that) {
  1135 + $that.css("color", "#666");
  1136 + $that.css("text-decoration", "none");
  1137 + $that.attr("lay-tips", "未监控到数据");
  1138 + }
1073 1139
1074 - //表格排序监听 joke add 20200408  
1075 - table.on('sort(resListTable)', function (obj) {  
1076 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
1077 - if (obj.type != null) {  
1078 - if (obj.field == 'ip') {  
1079 - sortKey = 'INET_ATON(' + obj.field + ') ' + obj.type; 1140 + // 共享设备,厂商是H3C、HDS的设备不让点击并且提示暂无监控信息
  1141 + var $hsc_ = $('span[data-restype="STORAGE_SHARE"][data-provider="H3C"]');
  1142 + $.each($hsc_, function (i, v) {
  1143 + noClick($(this));
  1144 + });
  1145 + var $hds = $('span[data-restype="STORAGE_SHARE"][data-provider="HDS"]');
  1146 + $.each($hds, function (i, v) {
  1147 + noClick($(this));
  1148 + });
  1149 + //华为云,阿里云不让点击,并且提示暂无监控信息
  1150 + // var $hds = $('span[data-restype="HUAWEI_CLOUD_PLAT"]');
  1151 + // $.each($hds, function (i, v) {
  1152 + // noClick($(this));
  1153 + // });
  1154 + // var $hds = $('span[data-restype="ALI_CLOUD_PLAT"]');
  1155 + // $.each($hds, function (i, v) {
  1156 + // noClick($(this));
  1157 + // });
  1158 +
  1159 + soulTable.render(this)
  1160 +
  1161 + //调用收藏方法
  1162 + resFavorites();
  1163 + resTopo();
  1164 +
  1165 + commonCols.colsClickEvent(editFlag);
  1166 +
  1167 + //表格排序监听 joke add 20200408
  1168 + table.on('sort(resListTable)', function (obj) {
  1169 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  1170 + if (obj.type != null) {
  1171 + if (obj.field == 'ip') {
  1172 + sortKey = 'INET_ATON(' + obj.field + ') ' + obj.type;
  1173 + } else {
  1174 + sortKey = obj.field + ' ' + obj.type;
  1175 + }
1080 } else { 1176 } else {
1081 - sortKey = obj.field + ' ' + obj.type; 1177 + sortKey = '';
1082 } 1178 }
1083 - } else {  
1084 - sortKey = '';  
1085 - }  
1086 - reloadTable();  
1087 - }) 1179 + reloadTable();
  1180 + })
1088 1181
1089 1182
1090 - //触发拖动列事件,参数为保存按钮的id  
1091 - common.dragCols("parentResIndex_cols_save"); 1183 + //触发拖动列事件,参数为保存按钮的id
  1184 + common.dragCols("parentResIndex_cols_save");
1092 1185
1093 - //保存列顺序  
1094 - $("#parentResIndex_cols_save").unbind("click").on("click", function () {  
1095 - var params = {  
1096 - domId: 'parentResListTable',  
1097 - moduleId: 'resIndex',  
1098 - resType: resType,  
1099 - cols: parentResListTable.config.cols  
1100 - }  
1101 - common.saveTableCols(params);  
1102 - });  
1103 - // 渲染统计数据  
1104 - loadRightResTypeSelectEvent(resType,"normal");  
1105 - } 1186 + //保存列顺序
  1187 + $("#parentResIndex_cols_save").unbind("click").on("click", function () {
  1188 + var params = {
  1189 + domId: 'parentResListTable',
  1190 + moduleId: 'resIndex',
  1191 + resType: resType,
  1192 + cols: parentResListTable.config.cols
  1193 + }
  1194 + common.saveTableCols(params);
  1195 + });
  1196 + // 渲染统计数据
  1197 + loadRightResTypeSelectEvent(resType,"normal");
  1198 + }
  1199 + });
1106 }); 1200 });
1107 - }); 1201 + },300)
  1202 +
1108 } 1203 }
1109 1204
1110 //资源列表 1205 //资源列表
@@ -1132,85 +1227,116 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -1132,85 +1227,116 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
1132 $('#power_state_div').show(); 1227 $('#power_state_div').show();
1133 } 1228 }
1134 var cols = commonCols.resTypeCls[resType]; 1229 var cols = commonCols.resTypeCls[resType];
1135 - //获取配置的列  
1136 - common.getTableCols({  
1137 - domId: 'resListTable',  
1138 - moduleId: 'resIndex',  
1139 - resType: resType  
1140 - },function (retCols) {  
1141 - if (retCols) {  
1142 - cols = retCols;  
1143 - }  
1144 - resListTable = table.render({  
1145 - elem: '#resListTable'  
1146 - , id: 'resListTable'  
1147 - , toolbar: '<div><button id="resIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板  
1148 - , defaultToolbar: ['filter']  
1149 - , drag: {toolbar: false}  
1150 - , url: common.domainName + '/api-web/home/res-list/' + resType  
1151 - , where: {  
1152 - access_token: accessToken,  
1153 - resName: resindexKeyword !== '' ? resindexKeyword : id,  
1154 - busId: bizId,  
1155 - resHealth: $("#resStatus").val(),  
1156 - colonlyId: $("#res_colony").val(),  
1157 - parentId: $("#res_cluster").val(),  
1158 - sortKey: sortKey,  
1159 - state: $("#state").val(),  
1160 - linkState: $("#link_state").val(),  
1161 - hostState: $("#host_state").val(),  
1162 - powerState: $("#power_state").val(),  
1163 - provider: $("#res_vendor").val(),  
1164 - resCategory: 'resources'  
1165 - }  
1166 - , height: 'full-165'  
1167 - , cellMinWidth: 80  
1168 - , page: {  
1169 - layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']  
1170 - , theme: '#1E9FFF'  
1171 - }  
1172 - , autoSort: false  
1173 - , limit: 150  
1174 - , limits: [150, 200, 300]  
1175 - , cols: [cols]  
1176 - , done: function (res, curr, count) {  
1177 - soulTable.render(this)  
1178 -  
1179 - //调用收藏方法  
1180 - resFavorites();  
1181 - resTopo();  
1182 -  
1183 - commonCols.colsClickEvent(editFlag);  
1184 - loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);  
1185 -  
1186 - //表格排序监听 joke add 20200408  
1187 - table.on('sort(resListTable)', function (obj) {  
1188 - //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:  
1189 - if (obj.type != null) {  
1190 - sortKey = obj.field + ' ' + obj.type;  
1191 - } else {  
1192 - sortKey = '';  
1193 - }  
1194 - reloadTable();  
1195 - })  
1196 -  
1197 - //触发拖动列事件,参数为保存按钮的id  
1198 - common.dragCols("resIndex_cols_save");  
1199 -  
1200 - //保存列顺序  
1201 - $("#resIndex_cols_save").unbind("click").on("click", function () {  
1202 - var params = {  
1203 - domId: 'resListTable',  
1204 - moduleId: 'resIndex',  
1205 - resType: resType,  
1206 - cols: resListTable.config.cols 1230 + //start lsq 根据资源类型resType获取动态添加的列表字段 2022-08-05
  1231 + admin.req({
  1232 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  1233 + , done: function (res) {
  1234 + if (res && res.data ) {
  1235 + let arr=res.data;
  1236 + if(fieldExpandArr.indexOf(resType)!=-1){
  1237 + }else{
  1238 + fieldExpandArr.push(resType);
  1239 + if(arr.length>0){
  1240 + arr.map(item=>{
  1241 + let listStr='';
  1242 + if(item.list && item.list.length>0){
  1243 + listStr=item.list.join(',')
  1244 + }
  1245 + cols.splice(item.fieldSort,0,{field: item.field, title: item.fieldName, align: 'center', width: 100, sort: true,
  1246 + templet:` <div>
  1247 + <div class="edit-delete-tpl T-edit-delete-tpl" lay-tips="点击修改/删除" data-fieldsourcetype="`+item.fieldSourceType+`"
  1248 + data-expandid="`+item.id+`" data-list="`+listStr+`" data-tpltype="`+item.field+`" data-resid="{{d.resId}}">
  1249 + {{d.`+item.field+` ? d.`+item.field+` : ''}}
  1250 + </div></div>`})
  1251 + })
1207 } 1252 }
1208 - common.saveTableCols(params);  
1209 - $(this).addClass("hide");  
1210 - }); 1253 + }
  1254 + } else {
  1255 + console.log(res.msg);
1211 } 1256 }
1212 - }); 1257 + }
1213 }); 1258 });
  1259 + setTimeout(function (){
  1260 + //获取配置的列
  1261 + common.getTableCols({
  1262 + domId: 'resListTable',
  1263 + moduleId: 'resIndex',
  1264 + resType: resType
  1265 + },function (retCols) {
  1266 + if (retCols) {
  1267 + cols = retCols;
  1268 + }
  1269 + resListTable = table.render({
  1270 + elem: '#resListTable'
  1271 + , id: 'resListTable'
  1272 + , toolbar: '<div><button id="resIndex_cols_save" class="layui-btn layui-btn-primary layui-btn-xs toolbar-btn" lay-tips="保存列顺序"><i class="iconfont">&#xe633;</i></button></div>' //开启头部工具栏,并为其绑定左侧模板
  1273 + , defaultToolbar: ['filter']
  1274 + , drag: {toolbar: false}
  1275 + , url: common.domainName + '/api-web/home/res-list/' + resType
  1276 + , where: {
  1277 + access_token: accessToken,
  1278 + resName: resindexKeyword !== '' ? resindexKeyword : id,
  1279 + busId: bizId,
  1280 + resHealth: $("#resStatus").val(),
  1281 + colonlyId: $("#res_colony").val(),
  1282 + parentId: $("#res_cluster").val(),
  1283 + sortKey: sortKey,
  1284 + state: $("#state").val(),
  1285 + linkState: $("#link_state").val(),
  1286 + hostState: $("#host_state").val(),
  1287 + powerState: $("#power_state").val(),
  1288 + provider: $("#res_vendor").val(),
  1289 + resCategory: 'resources'
  1290 + }
  1291 + , height: 'full-165'
  1292 + , cellMinWidth: 80
  1293 + , page: {
  1294 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  1295 + , theme: '#1E9FFF'
  1296 + }
  1297 + , autoSort: false
  1298 + , limit: 150
  1299 + , limits: [150, 200, 300]
  1300 + , cols: [cols]
  1301 + , done: function (res, curr, count) {
  1302 + soulTable.render(this)
  1303 +
  1304 + //调用收藏方法
  1305 + resFavorites();
  1306 + resTopo();
  1307 +
  1308 + commonCols.colsClickEvent(editFlag);
  1309 + loadRightResTypeSelectEvent(curTreeNode.id ? curTreeNode.id : curTreeNode.data.id, "normal", res.obj);
  1310 +
  1311 + //表格排序监听 joke add 20200408
  1312 + table.on('sort(resListTable)', function (obj) {
  1313 + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
  1314 + if (obj.type != null) {
  1315 + sortKey = obj.field + ' ' + obj.type;
  1316 + } else {
  1317 + sortKey = '';
  1318 + }
  1319 + reloadTable();
  1320 + })
  1321 +
  1322 + //触发拖动列事件,参数为保存按钮的id
  1323 + common.dragCols("resIndex_cols_save");
  1324 +
  1325 + //保存列顺序
  1326 + $("#resIndex_cols_save").unbind("click").on("click", function () {
  1327 + var params = {
  1328 + domId: 'resListTable',
  1329 + moduleId: 'resIndex',
  1330 + resType: resType,
  1331 + cols: resListTable.config.cols
  1332 + }
  1333 + common.saveTableCols(params);
  1334 + $(this).addClass("hide");
  1335 + });
  1336 + }
  1337 + });
  1338 + });
  1339 + },300)
1214 } 1340 }
1215 1341
1216 1342
@@ -8126,4 +8126,17 @@ form[lay-filter="activewarning-form"] .layui-inline { @@ -8126,4 +8126,17 @@ form[lay-filter="activewarning-form"] .layui-inline {
8126 padding: 5px; 8126 padding: 5px;
8127 color: #fff; 8127 color: #fff;
8128 cursor: pointer; 8128 cursor: pointer;
8129 -}  
  8129 +}
  8130 +/*lsq T3和IOP 2022-08-04*/
  8131 +.edit-delete-tpl{
  8132 + width: 100%;
  8133 + height: 100%;
  8134 + cursor: pointer;
  8135 +}
  8136 +.T3-IOP-prompt{
  8137 + display: flex;
  8138 + align-items: center;
  8139 + justify-content: center;
  8140 + height: 100%;
  8141 + padding: 0 20px;
  8142 +}