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