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,6 +403,36 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -402,6 +403,36 @@ 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 });
  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 + })
  428 + }
  429 + }
  430 + } else {
  431 + console.log(res.msg);
  432 + }
  433 + }
  434 + });
  435 + setTimeout(function (){
405 //获取配置的列 436 //获取配置的列
406 common.getTableCols({ 437 common.getTableCols({
407 domId: 'bizListTable', 438 domId: 'bizListTable',
@@ -467,7 +498,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -467,7 +498,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
467 } 498 }
468 }); 499 });
469 }); 500 });
470 - 501 + },300)
471 } 502 }
472 //获取业务下的资源类型健康统计 503 //获取业务下的资源类型健康统计
473 function renderBizResTypeCard(bizId) { 504 function renderBizResTypeCard(bizId) {
@@ -500,6 +531,36 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -500,6 +531,36 @@ 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];
  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);
  560 + }
  561 + }
  562 + });
  563 + setTimeout(function (){
503 //获取配置的列 564 //获取配置的列
504 common.getTableCols({ 565 common.getTableCols({
505 domId: 'bizParentList', 566 domId: 'bizParentList',
@@ -569,6 +630,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -569,6 +630,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
569 } 630 }
570 }); 631 });
571 }); 632 });
  633 + },300)
572 } 634 }
573 //资源列表 635 //资源列表
574 function renderList(busId, resType) { 636 function renderList(busId, resType) {
@@ -582,6 +644,36 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -582,6 +644,36 @@ 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];
  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);
  673 + }
  674 + }
  675 + });
  676 + setTimeout(function (){
585 //获取配置的列 677 //获取配置的列
586 common.getTableCols({ 678 common.getTableCols({
587 domId: 'bizListTable', 679 domId: 'bizListTable',
@@ -650,6 +742,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -650,6 +742,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
650 } 742 }
651 }); 743 });
652 }); 744 });
  745 + },300)
653 } 746 }
654 747
655 //树表格 748 //树表格
@@ -676,7 +769,36 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -676,7 +769,36 @@ 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
  773 + admin.req({
  774 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  775 + , done: function (res) {
  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 + })
  794 + }
  795 + }
  796 + } else {
  797 + console.log(res.msg);
  798 + }
  799 + }
  800 + });
  801 + setTimeout(function (){
680 admin.req({ 802 admin.req({
681 url: common.domainName + "/api-web/home/virtual-res-list/" + resType 803 url: common.domainName + "/api-web/home/virtual-res-list/" + resType
682 , data: { 804 , data: {
@@ -810,6 +932,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols @@ -810,6 +932,7 @@ layui.define(['tree', 'laypage', 'laytpl', 'admin', 'form', 'table', 'commonCols
810 }).error(function () { 932 }).error(function () {
811 layer.closeAll(); 933 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,6 +102,36 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -102,6 +102,36 @@ 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 + //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 + })
  127 + }
  128 + }
  129 + } else {
  130 + console.log(res.msg);
  131 + }
  132 + }
  133 + });
  134 + setTimeout(function (){
105 //获取配置的列 135 //获取配置的列
106 common.getTableCols({ 136 common.getTableCols({
107 domId: 'bizResListTable', 137 domId: 'bizResListTable',
@@ -166,7 +196,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -166,7 +196,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
166 } 196 }
167 }); 197 });
168 }) 198 })
169 - 199 + },300)
170 } 200 }
171 201
172 202
@@ -206,7 +236,36 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -206,7 +236,36 @@ 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 - 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 + }
  266 + }
  267 + });
  268 + setTimeout(function (){
210 //获取配置的列 269 //获取配置的列
211 common.getTableCols({ 270 common.getTableCols({
212 domId: 'bizResTreeTable', 271 domId: 'bizResTreeTable',
@@ -345,6 +404,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm @@ -345,6 +404,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'soulTable', 'sessions', 'comm
345 layer.closeAll(); 404 layer.closeAll();
346 }); 405 });
347 }) 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,6 +809,37 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form', @@ -809,6 +809,37 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
809 return htm; 809 return htm;
810 } 810 }
811 }); 811 });
  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 + }
  840 + }
  841 + });
  842 + setTimeout(function (){
812 //渲染表格 843 //渲染表格
813 table.render({ 844 table.render({
814 elem: '#resManageTable' 845 elem: '#resManageTable'
@@ -1100,9 +1131,117 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form', @@ -1100,9 +1131,117 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'upload', 'admin', 'form',
1100 commonDetail.openDetail(resId,resType,name) 1131 commonDetail.openDetail(resId,resType,name)
1101 }); 1132 });
1102 resTopo(); 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});
1103 } 1200 }
  1201 + layer.close(index);
1104 }); 1202 });
  1203 + })
  1204 + }
  1205 + , btn2:function(index, layero){
  1206 + var value = $('#promptInput').val();
  1207 + if (value !== old_T3Dom) {
  1208 + layer.load(2);
  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);
1105 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,6 +170,36 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -169,6 +170,36 @@ 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 }
  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 + }
  196 + }
  197 + } else {
  198 + console.log(res.msg);
  199 + }
  200 + }
  201 + });
  202 + setTimeout(function (){
172 resTableList = table.render({ 203 resTableList = table.render({
173 elem: '#resindexList' 204 elem: '#resindexList'
174 , id: 'resindexList' 205 , id: 'resindexList'
@@ -209,6 +240,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -209,6 +240,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
209 }); 240 });
210 } 241 }
211 }); 242 });
  243 + },300)
212 }); 244 });
213 } 245 }
214 //左侧树 246 //左侧树
@@ -752,6 +784,36 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -752,6 +784,36 @@ 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
  788 + admin.req({
  789 + url: common.domainName + "/api-web/resource/expand/list?resType=" + resType
  790 + , done: function (res) {
  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 + })
  809 + }
  810 + }
  811 + } else {
  812 + console.log(res.msg);
  813 + }
  814 + }
  815 + });
  816 + setTimeout(function (){
755 admin.req({ 817 admin.req({
756 url: common.domainName + "/api-web/home/virtual-res-list/" + resType 818 url: common.domainName + "/api-web/home/virtual-res-list/" + resType
757 , type: "get" 819 , type: "get"
@@ -894,6 +956,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -894,6 +956,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
894 }).error(function () { 956 }).error(function () {
895 layer.close(index); 957 layer.close(index);
896 }); 958 });
  959 + },300)
897 } 960 }
898 961
899 962
@@ -995,6 +1058,36 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -995,6 +1058,36 @@ 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];
  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);
  1087 + }
  1088 + }
  1089 + });
  1090 + setTimeout(function (){
998 //获取配置的列 1091 //获取配置的列
999 common.getTableCols({ 1092 common.getTableCols({
1000 domId: 'parentResListTable', 1093 domId: 'parentResListTable',
@@ -1105,6 +1198,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -1105,6 +1198,8 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
1105 } 1198 }
1106 }); 1199 });
1107 }); 1200 });
  1201 + },300)
  1202 +
1108 } 1203 }
1109 1204
1110 //资源列表 1205 //资源列表
@@ -1132,6 +1227,36 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -1132,6 +1227,36 @@ 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];
  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 + })
  1252 + }
  1253 + }
  1254 + } else {
  1255 + console.log(res.msg);
  1256 + }
  1257 + }
  1258 + });
  1259 + setTimeout(function (){
1135 //获取配置的列 1260 //获取配置的列
1136 common.getTableCols({ 1261 common.getTableCols({
1137 domId: 'resListTable', 1262 domId: 'resListTable',
@@ -1211,6 +1336,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', ' @@ -1211,6 +1336,7 @@ layui.define(['common', 'tree', 'laypage', 'laytpl', 'admin', 'form', 'table', '
1211 } 1336 }
1212 }); 1337 });
1213 }); 1338 });
  1339 + },300)
1214 } 1340 }
1215 1341
1216 1342
@@ -8127,3 +8127,16 @@ form[lay-filter="activewarning-form"] .layui-inline { @@ -8127,3 +8127,16 @@ form[lay-filter="activewarning-form"] .layui-inline {
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 +}