fix:山西特色功能优化、日志视图迁移、巡检统计、选件归档迁移
Showing
22 changed files
with
2327 additions
and
85 deletions
@@ -264,7 +264,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -264,7 +264,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
264 | }) | 264 | }) |
265 | } else { | 265 | } else { |
266 | //附件为文档类型 | 266 | //附件为文档类型 |
267 | - common.fileviewer(filepath) | 267 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
268 | + let name = Base64.encode(filepath, true); | ||
269 | + admin.req({ | ||
270 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
271 | + type: 'get' | ||
272 | + }).done(function (res) { | ||
273 | + layer.close(loadIndex); | ||
274 | + if (res && res.success) { | ||
275 | + let win = window.parent; | ||
276 | + if (win) { | ||
277 | + window.parent.postMessage({ | ||
278 | + type: "previewFile", | ||
279 | + message: { | ||
280 | + params: { | ||
281 | + url: res.str | ||
282 | + } | ||
283 | + } | ||
284 | + }, '*') | ||
285 | + } | ||
286 | + } else { | ||
287 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
288 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
289 | + window.open(url) | ||
290 | + }); | ||
291 | + layer.close(loadIndex); | ||
292 | + } | ||
293 | + }).error(function (error) { | ||
294 | + layer.close(loadIndex); | ||
295 | + console.log(error) | ||
296 | + }) | ||
268 | } | 297 | } |
269 | }) | 298 | }) |
270 | } | 299 | } |
@@ -75,7 +75,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -75,7 +75,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
75 | }) | 75 | }) |
76 | } else { | 76 | } else { |
77 | //附件为文档类型 | 77 | //附件为文档类型 |
78 | - common.fileviewer(filepath) | 78 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
79 | + let name = Base64.encode(filepath, true); | ||
80 | + admin.req({ | ||
81 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
82 | + type: 'get' | ||
83 | + }).done(function (res) { | ||
84 | + layer.close(loadIndex); | ||
85 | + if (res && res.success) { | ||
86 | + let win = window.parent; | ||
87 | + if (win) { | ||
88 | + window.parent.postMessage({ | ||
89 | + type: "previewFile", | ||
90 | + message: { | ||
91 | + params: { | ||
92 | + url: res.str | ||
93 | + } | ||
94 | + } | ||
95 | + }, '*') | ||
96 | + } | ||
97 | + } else { | ||
98 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
99 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
100 | + window.open(url) | ||
101 | + }); | ||
102 | + layer.close(loadIndex); | ||
103 | + } | ||
104 | + }).error(function (error) { | ||
105 | + layer.close(loadIndex); | ||
106 | + console.log(error) | ||
107 | + }) | ||
79 | } | 108 | } |
80 | }) | 109 | }) |
81 | 110 |
@@ -313,7 +313,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -313,7 +313,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
313 | }) | 313 | }) |
314 | } else { | 314 | } else { |
315 | //附件为文档类型 | 315 | //附件为文档类型 |
316 | - common.fileviewer(filepath) | 316 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
317 | + let name = Base64.encode(filepath, true); | ||
318 | + admin.req({ | ||
319 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
320 | + type: 'get' | ||
321 | + }).done(function (res) { | ||
322 | + layer.close(loadIndex); | ||
323 | + if (res && res.success) { | ||
324 | + let win = window.parent; | ||
325 | + if (win) { | ||
326 | + window.parent.postMessage({ | ||
327 | + type: "previewFile", | ||
328 | + message: { | ||
329 | + params: { | ||
330 | + url: res.str | ||
331 | + } | ||
332 | + } | ||
333 | + }, '*') | ||
334 | + } | ||
335 | + } else { | ||
336 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
337 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
338 | + window.open(url) | ||
339 | + }); | ||
340 | + layer.close(loadIndex); | ||
341 | + } | ||
342 | + }).error(function (error) { | ||
343 | + layer.close(loadIndex); | ||
344 | + console.log(error) | ||
345 | + }) | ||
317 | } | 346 | } |
318 | }) | 347 | }) |
319 | } | 348 | } |
@@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + }); | ||
103 | + layer.close(loadIndex); | ||
104 | + } | ||
105 | + }).error(function (error) { | ||
106 | + layer.close(loadIndex); | ||
107 | + console.log(error) | ||
108 | + }) | ||
80 | } | 109 | } |
81 | }) | 110 | }) |
82 | 111 |
1 | +/** | ||
2 | + | ||
3 | + @Name:dropdown 下拉菜单组件 | ||
4 | + @License:MIT | ||
5 | + | ||
6 | + */ | ||
7 | + | ||
8 | +layui.define(['jquery', 'laytpl','lay'], function(exports){ | ||
9 | + "use strict"; | ||
10 | + | ||
11 | + var $ = layui.$ | ||
12 | + ,laytpl = layui.laytpl | ||
13 | + ,hint = layui.hint() | ||
14 | + ,device = layui.device() | ||
15 | + ,clickOrMousedown = (device.mobile ? 'click' : 'mousedown') | ||
16 | + | ||
17 | + //模块名 | ||
18 | + ,MOD_NAME = 'dropdown' | ||
19 | + ,MOD_INDEX = 'layui_'+ MOD_NAME +'_index' //模块索引名 | ||
20 | + | ||
21 | + //外部接口 | ||
22 | + ,dropdown = { | ||
23 | + config: {} | ||
24 | + ,index: layui[MOD_NAME] ? (layui[MOD_NAME].index + 10000) : 0 | ||
25 | + | ||
26 | + //设置全局项 | ||
27 | + ,set: function(options){ | ||
28 | + var that = this; | ||
29 | + that.config = $.extend({}, that.config, options); | ||
30 | + return that; | ||
31 | + } | ||
32 | + | ||
33 | + //事件 | ||
34 | + ,on: function(events, callback){ | ||
35 | + return layui.onevent.call(this, MOD_NAME, events, callback); | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + //操作当前实例 | ||
40 | + ,thisModule = function(){ | ||
41 | + var that = this | ||
42 | + ,options = that.config | ||
43 | + ,id = options.id; | ||
44 | + | ||
45 | + thisModule.that[id] = that; //记录当前实例对象 | ||
46 | + | ||
47 | + return { | ||
48 | + config: options | ||
49 | + //重置实例 | ||
50 | + ,reload: function(options){ | ||
51 | + that.reload.call(that, options); | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | + //字符常量 | ||
57 | + ,STR_ELEM = 'layui-dropdown', STR_HIDE = 'layui-hide', STR_DISABLED = 'layui-disabled', STR_NONE = 'layui-none' | ||
58 | + ,STR_ITEM_UP = 'layui-menu-item-up', STR_ITEM_DOWN = 'layui-menu-item-down', STR_MENU_TITLE = 'layui-menu-body-title', STR_ITEM_GROUP = 'layui-menu-item-group', STR_ITEM_PARENT = 'layui-menu-item-parent', STR_ITEM_DIV = 'layui-menu-item-divider', STR_ITEM_CHECKED = 'layui-menu-item-checked', STR_ITEM_CHECKED2 = 'layui-menu-item-checked2', STR_MENU_PANEL = 'layui-menu-body-panel', STR_MENU_PANEL_L = 'layui-menu-body-panel-left' | ||
59 | + | ||
60 | + ,STR_GROUP_TITLE = '.'+ STR_ITEM_GROUP + '>.'+ STR_MENU_TITLE | ||
61 | + | ||
62 | + //构造器 | ||
63 | + ,Class = function(options){ | ||
64 | + var that = this; | ||
65 | + that.index = ++dropdown.index; | ||
66 | + that.config = $.extend({}, that.config, dropdown.config, options); | ||
67 | + that.init(); | ||
68 | + }; | ||
69 | + | ||
70 | + //默认配置 | ||
71 | + Class.prototype.config = { | ||
72 | + trigger: 'click' //事件类型 | ||
73 | + ,content: '' //自定义菜单内容 | ||
74 | + ,className: '' //自定义样式类名 | ||
75 | + ,style: '' //设置面板 style 属性 | ||
76 | + ,show: false //是否初始即显示菜单面板 | ||
77 | + ,isAllowSpread: true //是否允许菜单组展开收缩 | ||
78 | + ,isSpreadItem: true //是否初始展开子菜单 | ||
79 | + ,data: [] //菜单数据结构 | ||
80 | + ,delay: 300 //延迟关闭的毫秒数,若 trigger 为 hover 时才生效 | ||
81 | + }; | ||
82 | + | ||
83 | + //重载实例 | ||
84 | + Class.prototype.reload = function(options){ | ||
85 | + var that = this; | ||
86 | + that.config = $.extend({}, that.config, options); | ||
87 | + that.init(true); | ||
88 | + }; | ||
89 | + | ||
90 | + //初始化准备 | ||
91 | + Class.prototype.init = function(rerender){ | ||
92 | + var that = this | ||
93 | + ,options = that.config | ||
94 | + ,elem = options.elem = $(options.elem); | ||
95 | + | ||
96 | + //若 elem 非唯一 | ||
97 | + if(elem.length > 1){ | ||
98 | + layui.each(elem, function(){ | ||
99 | + dropdown.render($.extend({}, options, { | ||
100 | + elem: this | ||
101 | + })); | ||
102 | + }); | ||
103 | + return that; | ||
104 | + } | ||
105 | + | ||
106 | + //若重复执行 render,则视为 reload 处理 | ||
107 | + if(!rerender && elem[0] && elem.data(MOD_INDEX)){; | ||
108 | + var newThat = thisModule.getThis(elem.data(MOD_INDEX)); | ||
109 | + if(!newThat) return; | ||
110 | + | ||
111 | + return newThat.reload(options); | ||
112 | + }; | ||
113 | + | ||
114 | + //初始化 id 参数 | ||
115 | + options.id = ('id' in options) ? options.id : that.index; | ||
116 | + | ||
117 | + if(options.show) that.render(rerender); //初始即显示 | ||
118 | + that.events(); //事件 | ||
119 | + }; | ||
120 | + | ||
121 | + //渲染 | ||
122 | + Class.prototype.render = function(rerender){ | ||
123 | + var that = this | ||
124 | + ,options = that.config | ||
125 | + ,elemBody = $('body') | ||
126 | + | ||
127 | + //默认菜单内容 | ||
128 | + ,getDefaultView = function(){ | ||
129 | + var elemUl = $('<ul class="layui-menu layui-dropdown-menu"></ul>'); | ||
130 | + if(options.data.length > 0 ){ | ||
131 | + eachItemView(elemUl, options.data) | ||
132 | + } else { | ||
133 | + elemUl.html('<li class="layui-menu-item-none">no menu</li>'); | ||
134 | + } | ||
135 | + return elemUl; | ||
136 | + } | ||
137 | + | ||
138 | + //遍历菜单项 | ||
139 | + ,eachItemView = function(views, data){ | ||
140 | + //var views = []; | ||
141 | + layui.each(data, function(index, item){ | ||
142 | + //是否存在子级 | ||
143 | + var isChild = item.child && item.child.length > 0 | ||
144 | + ,isSpreadItem = ('isSpreadItem' in item) ? item.isSpreadItem : options.isSpreadItem | ||
145 | + ,title = item.templet | ||
146 | + ? laytpl(item.templet).render(item) | ||
147 | + : (options.templet ? laytpl(options.templet).render(item) : item.title) | ||
148 | + | ||
149 | + //初始类型 | ||
150 | + ,type = function(){ | ||
151 | + if(isChild){ | ||
152 | + item.type = item.type || 'parent'; | ||
153 | + } | ||
154 | + if(item.type){ | ||
155 | + return ({ | ||
156 | + group: 'group' | ||
157 | + ,parent: 'parent' | ||
158 | + ,'-': '-' | ||
159 | + })[item.type] || 'parent'; | ||
160 | + } | ||
161 | + return ''; | ||
162 | + }(); | ||
163 | + | ||
164 | + if(type !== '-' && (!item.title && !item.id && !isChild)) return; | ||
165 | + | ||
166 | + //列表元素 | ||
167 | + var viewLi = $(['<li'+ function(){ | ||
168 | + var className = { | ||
169 | + group: 'layui-menu-item-group'+ ( | ||
170 | + options.isAllowSpread ? ( | ||
171 | + isSpreadItem ? ' layui-menu-item-down' : ' layui-menu-item-up' | ||
172 | + ) : '' | ||
173 | + ) | ||
174 | + ,parent: STR_ITEM_PARENT | ||
175 | + ,'-': 'layui-menu-item-divider' | ||
176 | + }; | ||
177 | + if(isChild || type){ | ||
178 | + return ' class="'+ className[type] +'"'; | ||
179 | + } | ||
180 | + return ''; | ||
181 | + }() +'>' | ||
182 | + | ||
183 | + //标题区 | ||
184 | + ,function(){ | ||
185 | + //是否超文本 | ||
186 | + var viewText = ('href' in item) ? ( | ||
187 | + '<a href="'+ item.href +'" target="'+ (item.target || '_self') +'">'+ title +'</a>' | ||
188 | + ) : title; | ||
189 | + | ||
190 | + //是否存在子级 | ||
191 | + if(isChild){ | ||
192 | + return '<div class="'+ STR_MENU_TITLE +'">'+ viewText + function(){ | ||
193 | + if(type === 'parent'){ | ||
194 | + return '<i class="layui-icon layui-icon-right"></i>'; | ||
195 | + } else if(type === 'group' && options.isAllowSpread){ | ||
196 | + return '<i class="layui-icon layui-icon-'+ (isSpreadItem ? 'up' : 'down') +'"></i>'; | ||
197 | + } else { | ||
198 | + return ''; | ||
199 | + } | ||
200 | + }() +'</div>' | ||
201 | + | ||
202 | + } | ||
203 | + return '<div class="'+ STR_MENU_TITLE +'">'+ viewText +'</div>'; | ||
204 | + }() | ||
205 | + ,'</li>'].join('')); | ||
206 | + | ||
207 | + viewLi.data('item', item); | ||
208 | + | ||
209 | + //子级区 | ||
210 | + if(isChild){ | ||
211 | + var elemPanel = $('<div class="layui-panel layui-menu-body-panel"></div>') | ||
212 | + ,elemUl = $('<ul></ul>'); | ||
213 | + | ||
214 | + if(type === 'parent'){ | ||
215 | + elemPanel.append(eachItemView(elemUl, item.child)); | ||
216 | + viewLi.append(elemPanel); | ||
217 | + } else { | ||
218 | + viewLi.append(eachItemView(elemUl, item.child)); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + views.append(viewLi); | ||
223 | + }); | ||
224 | + return views; | ||
225 | + } | ||
226 | + | ||
227 | + //主模板 | ||
228 | + ,TPL_MAIN = ['<div class="layui-dropdown layui-border-box layui-panel layui-anim layui-anim-downbit">' | ||
229 | + ,'</div>'].join(''); | ||
230 | + | ||
231 | + //如果是右键事件,则每次触发事件时,将允许重新渲染 | ||
232 | + if(options.trigger === 'contextmenu' || lay.isTopElem(options.elem[0])) rerender = true; | ||
233 | + | ||
234 | + //判断是否已经打开了下拉菜单面板 | ||
235 | + if(!rerender && options.elem.data(MOD_INDEX +'_opened')) return; | ||
236 | + | ||
237 | + //记录模板对象 | ||
238 | + that.elemView = $(TPL_MAIN); | ||
239 | + that.elemView.append(options.content || getDefaultView()); | ||
240 | + | ||
241 | + //初始化某些属性 | ||
242 | + if(options.className) that.elemView.addClass(options.className); | ||
243 | + if(options.style) that.elemView.attr('style', options.style); | ||
244 | + | ||
245 | + | ||
246 | + //记录当前执行的实例索引 | ||
247 | + dropdown.thisId = options.id; | ||
248 | + | ||
249 | + //插入视图 | ||
250 | + that.remove(); //移除非当前绑定元素的面板 | ||
251 | + elemBody.append(that.elemView); | ||
252 | + options.elem.data(MOD_INDEX +'_opened', true); | ||
253 | + | ||
254 | + //坐标定位 | ||
255 | + that.position(); | ||
256 | + thisModule.prevElem = that.elemView; //记录当前打开的元素,以便在下次关闭 | ||
257 | + thisModule.prevElem.data('prevElem', options.elem); //将当前绑定的元素,记录在打开元素的 data 对象中 | ||
258 | + | ||
259 | + //阻止全局事件 | ||
260 | + that.elemView.find('.layui-menu').on(clickOrMousedown, function(e){ | ||
261 | + layui.stope(e); | ||
262 | + }); | ||
263 | + | ||
264 | + //触发菜单列表事件 | ||
265 | + that.elemView.find('.layui-menu li').on('click', function(e){ | ||
266 | + var othis = $(this) | ||
267 | + ,data = othis.data('item') || {} | ||
268 | + ,isChild = data.child && data.child.length > 0; | ||
269 | + | ||
270 | + if(!isChild && data.type !== '-'){ | ||
271 | + that.remove(); | ||
272 | + typeof options.click === 'function' && options.click(data, othis); | ||
273 | + } | ||
274 | + }); | ||
275 | + | ||
276 | + //触发菜单组展开收缩 | ||
277 | + that.elemView.find(STR_GROUP_TITLE).on('click', function(e){ | ||
278 | + var othis = $(this) | ||
279 | + ,elemGroup = othis.parent() | ||
280 | + ,data = elemGroup.data('item') || {} | ||
281 | + | ||
282 | + if(data.type === 'group' && options.isAllowSpread){ | ||
283 | + thisModule.spread(elemGroup); | ||
284 | + } | ||
285 | + }); | ||
286 | + | ||
287 | + //如果是鼠标移入事件,则鼠标移出时自动关闭 | ||
288 | + if(options.trigger === 'mouseenter'){ | ||
289 | + that.elemView.on('mouseenter', function(){ | ||
290 | + clearTimeout(thisModule.timer); | ||
291 | + }).on('mouseleave', function(){ | ||
292 | + that.delayRemove(); | ||
293 | + }); | ||
294 | + } | ||
295 | + | ||
296 | + }; | ||
297 | + | ||
298 | + //位置定位 | ||
299 | + Class.prototype.position = function(obj){ | ||
300 | + var that = this | ||
301 | + ,options = that.config; | ||
302 | + | ||
303 | + lay.position(options.elem[0], that.elemView[0], { | ||
304 | + position: options.position | ||
305 | + ,e: that.e | ||
306 | + ,clickType: options.trigger === 'contextmenu' ? 'right' : null | ||
307 | + ,align: options.align || null | ||
308 | + }); | ||
309 | + }; | ||
310 | + | ||
311 | + //删除视图 | ||
312 | + Class.prototype.remove = function(){ | ||
313 | + var that = this | ||
314 | + ,options = that.config | ||
315 | + ,elemPrev = thisModule.prevElem; | ||
316 | + | ||
317 | + //若存在已打开的面板元素,则移除 | ||
318 | + if(elemPrev){ | ||
319 | + elemPrev.data('prevElem') && ( | ||
320 | + elemPrev.data('prevElem').data(MOD_INDEX +'_opened', false) | ||
321 | + ); | ||
322 | + elemPrev.remove(); | ||
323 | + } | ||
324 | + }; | ||
325 | + | ||
326 | + //延迟删除视图 | ||
327 | + Class.prototype.delayRemove = function(){ | ||
328 | + var that = this | ||
329 | + ,options = that.config; | ||
330 | + clearTimeout(thisModule.timer); | ||
331 | + | ||
332 | + thisModule.timer = setTimeout(function(){ | ||
333 | + that.remove(); | ||
334 | + }, options.delay); | ||
335 | + }; | ||
336 | + | ||
337 | + //事件 | ||
338 | + Class.prototype.events = function(){ | ||
339 | + var that = this | ||
340 | + ,options = that.config; | ||
341 | + | ||
342 | + //如果传入 hover,则解析为 mouseenter | ||
343 | + if(options.trigger === 'hover') options.trigger = 'mouseenter'; | ||
344 | + | ||
345 | + //解除上一个事件 | ||
346 | + if(that.prevElem) that.prevElem.off(options.trigger, that.prevElemCallback); | ||
347 | + | ||
348 | + //记录被绑定的元素及回调 | ||
349 | + that.prevElem = options.elem; | ||
350 | + that.prevElemCallback = function(e){ | ||
351 | + clearTimeout(thisModule.timer); | ||
352 | + that.e = e; | ||
353 | + that.render(); | ||
354 | + e.preventDefault(); | ||
355 | + | ||
356 | + //组件打开完毕的时间 | ||
357 | + typeof options.ready === 'function' && options.ready(that.elemView, options.elem, that.e.target); | ||
358 | + }; | ||
359 | + | ||
360 | + //触发元素事件 | ||
361 | + options.elem.on(options.trigger, that.prevElemCallback); | ||
362 | + | ||
363 | + //如果是鼠标移入事件 | ||
364 | + if(options.trigger === 'mouseenter'){ | ||
365 | + //直行鼠标移出事件 | ||
366 | + options.elem.on('mouseleave', function(){ | ||
367 | + that.delayRemove(); | ||
368 | + }); | ||
369 | + } | ||
370 | + }; | ||
371 | + | ||
372 | + //记录所有实例 | ||
373 | + thisModule.that = {}; //记录所有实例对象 | ||
374 | + | ||
375 | + //获取当前实例对象 | ||
376 | + thisModule.getThis = function(id){ | ||
377 | + var that = thisModule.that[id]; | ||
378 | + if(!that) hint.error(id ? (MOD_NAME +' instance with ID \''+ id +'\' not found') : 'ID argument required'); | ||
379 | + return that; | ||
380 | + }; | ||
381 | + | ||
382 | + //设置菜单组展开和收缩状态 | ||
383 | + thisModule.spread = function(othis){ | ||
384 | + //菜单组展开和收缩 | ||
385 | + var elemIcon = othis.children('.'+ STR_MENU_TITLE).find('.layui-icon'); | ||
386 | + if(othis.hasClass(STR_ITEM_UP)){ | ||
387 | + othis.removeClass(STR_ITEM_UP).addClass(STR_ITEM_DOWN); | ||
388 | + elemIcon.removeClass('layui-icon-down').addClass('layui-icon-up'); | ||
389 | + } else { | ||
390 | + othis.removeClass(STR_ITEM_DOWN).addClass(STR_ITEM_UP); | ||
391 | + elemIcon.removeClass('layui-icon-up').addClass('layui-icon-down') | ||
392 | + } | ||
393 | + }; | ||
394 | + | ||
395 | + //全局事件 | ||
396 | + ;!function(){ | ||
397 | + var _WIN = $(window) | ||
398 | + ,_DOC = $(document); | ||
399 | + | ||
400 | + //自适应定位 | ||
401 | + _WIN.on('resize', function(){ | ||
402 | + if(!dropdown.thisId) return; | ||
403 | + var that = thisModule.getThis(dropdown.thisId); | ||
404 | + if(!that) return; | ||
405 | + | ||
406 | + if(!that.elemView[0] || !$('.'+ STR_ELEM)[0]){ | ||
407 | + return false; | ||
408 | + } | ||
409 | + | ||
410 | + var options = that.config; | ||
411 | + | ||
412 | + if(options.trigger === 'contextmenu'){ | ||
413 | + that.remove(); | ||
414 | + } else { | ||
415 | + that.position(); | ||
416 | + } | ||
417 | + }); | ||
418 | + | ||
419 | + | ||
420 | + | ||
421 | + //点击任意处关闭 | ||
422 | + _DOC.on(clickOrMousedown, function(e){ | ||
423 | + if(!dropdown.thisId) return; | ||
424 | + var that = thisModule.getThis(dropdown.thisId) | ||
425 | + if(!that) return; | ||
426 | + | ||
427 | + var options = that.config; | ||
428 | + | ||
429 | + //如果触发的是绑定的元素,或者属于绑定元素的子元素,则不关闭 | ||
430 | + //满足条件:当前绑定的元素不是 body document,或者不是鼠标右键事件 | ||
431 | + if(!(lay.isTopElem(options.elem[0]) || options.trigger === 'contextmenu')){ | ||
432 | + if( | ||
433 | + e.target === options.elem[0] || | ||
434 | + options.elem.find(e.target)[0] || | ||
435 | + e.target === that.elemView[0] || | ||
436 | + (that.elemView && that.elemView.find(e.target)[0]) | ||
437 | + ) return; | ||
438 | + } | ||
439 | + | ||
440 | + that.remove(); | ||
441 | + }); | ||
442 | + | ||
443 | + //基础菜单的静态元素事件 | ||
444 | + var ELEM_LI = '.layui-menu:not(.layui-dropdown-menu) li'; | ||
445 | + _DOC.on('click', ELEM_LI, function(e){ | ||
446 | + var othis = $(this) | ||
447 | + ,parent = othis.parents('.layui-menu').eq(0) | ||
448 | + ,isChild = othis.hasClass(STR_ITEM_GROUP) || othis.hasClass(STR_ITEM_PARENT) | ||
449 | + ,filter = parent.attr('lay-filter') || parent.attr('id') | ||
450 | + ,options = lay.options(this); | ||
451 | + | ||
452 | + //非触发元素 | ||
453 | + if(othis.hasClass(STR_ITEM_DIV)) return; | ||
454 | + | ||
455 | + //非菜单组 | ||
456 | + if(!isChild){ | ||
457 | + //选中 | ||
458 | + parent.find('.'+ STR_ITEM_CHECKED).removeClass(STR_ITEM_CHECKED); //清除选中样式 | ||
459 | + parent.find('.'+ STR_ITEM_CHECKED2).removeClass(STR_ITEM_CHECKED2); //清除父级菜单选中样式 | ||
460 | + othis.addClass(STR_ITEM_CHECKED); //添加选中样式 | ||
461 | + othis.parents('.'+ STR_ITEM_PARENT).addClass(STR_ITEM_CHECKED2); //添加父级菜单选中样式 | ||
462 | + | ||
463 | + //触发事件 | ||
464 | + layui.event.call(this, MOD_NAME, 'click('+ filter +')', options); | ||
465 | + } | ||
466 | + }); | ||
467 | + | ||
468 | + //基础菜单的展开收缩事件 | ||
469 | + _DOC.on('click', (ELEM_LI + STR_GROUP_TITLE), function(e){ | ||
470 | + var othis = $(this) | ||
471 | + ,elemGroup = othis.parents('.'+ STR_ITEM_GROUP +':eq(0)') | ||
472 | + ,options = lay.options(elemGroup[0]); | ||
473 | + | ||
474 | + if(('isAllowSpread' in options) ? options.isAllowSpread : true){ | ||
475 | + thisModule.spread(elemGroup); | ||
476 | + }; | ||
477 | + }); | ||
478 | + | ||
479 | + //判断子级菜单是否超出屏幕 | ||
480 | + var ELEM_LI_PAR = '.layui-menu .'+ STR_ITEM_PARENT | ||
481 | + _DOC.on('mouseenter', ELEM_LI_PAR, function(e){ | ||
482 | + var othis = $(this) | ||
483 | + ,elemPanel = othis.find('.'+ STR_MENU_PANEL); | ||
484 | + | ||
485 | + if(!elemPanel[0]) return; | ||
486 | + var rect = elemPanel[0].getBoundingClientRect(); | ||
487 | + | ||
488 | + //是否超出右侧屏幕 | ||
489 | + if(rect.right > _WIN.width()){ | ||
490 | + elemPanel.addClass(STR_MENU_PANEL_L); | ||
491 | + //不允许超出左侧屏幕 | ||
492 | + rect = elemPanel[0].getBoundingClientRect(); | ||
493 | + if(rect.left < 0){ | ||
494 | + elemPanel.removeClass(STR_MENU_PANEL_L); | ||
495 | + } | ||
496 | + } | ||
497 | + | ||
498 | + //是否超出底部屏幕 | ||
499 | + if(rect.bottom > _WIN.height()){ | ||
500 | + elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height())); | ||
501 | + }; | ||
502 | + }).on('mouseleave', ELEM_LI_PAR, function(e){ | ||
503 | + var othis = $(this) | ||
504 | + ,elemPanel = othis.children('.'+ STR_MENU_PANEL); | ||
505 | + | ||
506 | + elemPanel.removeClass(STR_MENU_PANEL_L); | ||
507 | + elemPanel.css('margin-top', 0); | ||
508 | + }); | ||
509 | + | ||
510 | + }(); | ||
511 | + | ||
512 | + //重载实例 | ||
513 | + dropdown.reload = function(id, options){ | ||
514 | + var that = thisModule.getThis(id); | ||
515 | + if(!that) return this; | ||
516 | + | ||
517 | + that.reload(options); | ||
518 | + return thisModule.call(that); | ||
519 | + }; | ||
520 | + | ||
521 | + //核心入口 | ||
522 | + dropdown.render = function(options){ | ||
523 | + var inst = new Class(options); | ||
524 | + return thisModule.call(inst); | ||
525 | + }; | ||
526 | + | ||
527 | + exports(MOD_NAME, dropdown); | ||
528 | +}); |
@@ -57,7 +57,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -57,7 +57,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
57 | }); | 57 | }); |
58 | } | 58 | } |
59 | //通知类型 | 59 | //通知类型 |
60 | - form.on('radio(docType)', function (data) { | 60 | + form.on('select(slt-docType)', function (data) { |
61 | if(data.value == '1'){ | 61 | if(data.value == '1'){ |
62 | $("#period").show(); | 62 | $("#period").show(); |
63 | $("#backDiv").show(); | 63 | $("#backDiv").show(); |
@@ -335,7 +335,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -335,7 +335,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
335 | }) | 335 | }) |
336 | } else { | 336 | } else { |
337 | //附件为文档类型 | 337 | //附件为文档类型 |
338 | - common.fileviewer(filepath) | 338 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
339 | + let name = Base64.encode(filepath, true); | ||
340 | + admin.req({ | ||
341 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
342 | + type: 'get' | ||
343 | + }).done(function (res) { | ||
344 | + layer.close(loadIndex); | ||
345 | + if (res && res.success) { | ||
346 | + let win = window.parent; | ||
347 | + if (win) { | ||
348 | + window.parent.postMessage({ | ||
349 | + type: "previewFile", | ||
350 | + message: { | ||
351 | + params: { | ||
352 | + url: res.str | ||
353 | + } | ||
354 | + } | ||
355 | + }, '*') | ||
356 | + } | ||
357 | + } else { | ||
358 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
359 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
360 | + window.open(url) | ||
361 | + }); | ||
362 | + layer.close(loadIndex); | ||
363 | + } | ||
364 | + }).error(function (error) { | ||
365 | + layer.close(loadIndex); | ||
366 | + console.log(error) | ||
367 | + }) | ||
339 | } | 368 | } |
340 | }) | 369 | }) |
341 | } | 370 | } |
@@ -374,13 +403,17 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -374,13 +403,17 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
374 | $("#backDiv").show(); | 403 | $("#backDiv").show(); |
375 | $("#resultDiv").show(); | 404 | $("#resultDiv").show(); |
376 | } | 405 | } |
377 | - $("input[type='radio'][name='docType'][value = '"+res.object.docType+"']").attr("checked",true); | 406 | + /* $("input[type='radio'][name='docType'][value = '"+res.object.docType+"']").attr("checked",true); |
378 | 407 | ||
379 | - $("input[type='radio'][name='docType']").attr('disabled','disabled'); | 408 | + $("input[type='radio'][name='docType']").attr('disabled','disabled');*/ |
409 | + //$("select[name='docType'][value = '"+res.object.docType+"']").attr("checked",true); | ||
410 | + $("#slt-docType").attr('disabled','disabled'); | ||
411 | + form.render('select'); | ||
380 | 412 | ||
381 | }) | 413 | }) |
382 | }else{ | 414 | }else{ |
383 | - $("input[type='radio'][name='docType']").removeAttr('disabled'); | 415 | + $("#slt-docType").removeAttr('disabled'); |
416 | + form.render('select'); | ||
384 | } | 417 | } |
385 | } | 418 | } |
386 | 419 |
@@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + }); | ||
103 | + layer.close(loadIndex); | ||
104 | + } | ||
105 | + }).error(function (error) { | ||
106 | + layer.close(loadIndex); | ||
107 | + console.log(error) | ||
108 | + }) | ||
80 | } | 109 | } |
81 | }) | 110 | }) |
82 | 111 |
@@ -270,7 +270,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -270,7 +270,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
270 | }) | 270 | }) |
271 | } else { | 271 | } else { |
272 | //附件为文档类型 | 272 | //附件为文档类型 |
273 | - common.fileviewer(filepath) | 273 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
274 | + let name = Base64.encode(filepath, true); | ||
275 | + admin.req({ | ||
276 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
277 | + type: 'get' | ||
278 | + }).done(function (res) { | ||
279 | + layer.close(loadIndex); | ||
280 | + if (res && res.success) { | ||
281 | + let win = window.parent; | ||
282 | + if (win) { | ||
283 | + window.parent.postMessage({ | ||
284 | + type: "previewFile", | ||
285 | + message: { | ||
286 | + params: { | ||
287 | + url: res.str | ||
288 | + } | ||
289 | + } | ||
290 | + }, '*') | ||
291 | + } | ||
292 | + } else { | ||
293 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
294 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
295 | + window.open(url) | ||
296 | + }); | ||
297 | + layer.close(loadIndex); | ||
298 | + } | ||
299 | + }).error(function (error) { | ||
300 | + layer.close(loadIndex); | ||
301 | + console.log(error) | ||
302 | + }) | ||
274 | } | 303 | } |
275 | }) | 304 | }) |
276 | } | 305 | } |
@@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + }); | ||
103 | + layer.close(loadIndex); | ||
104 | + } | ||
105 | + }).error(function (error) { | ||
106 | + layer.close(loadIndex); | ||
107 | + console.log(error) | ||
108 | + }) | ||
80 | } | 109 | } |
81 | }) | 110 | }) |
82 | 111 |
1 | - | ||
2 | layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect', 'laydate', 'upload'], function (exports) { | 1 | layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect', 'laydate', 'upload'], function (exports) { |
3 | var $ = layui.$; | 2 | var $ = layui.$; |
4 | var form = layui.form; | 3 | var form = layui.form; |
@@ -161,7 +160,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -161,7 +160,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
161 | var fileName = [] | 160 | var fileName = [] |
162 | uploadInst = upload.render({ | 161 | uploadInst = upload.render({ |
163 | elem: '#attachment', //绑定元素 | 162 | elem: '#attachment', //绑定元素 |
164 | - url: common.domainName + '/api-web/machineRoom/meetingApply/upload?accessToken='+accessToken, | 163 | + url: common.domainName + '/api-web/machineRoom/meetingApply/upload?accessToken=' + accessToken, |
165 | data: param, | 164 | data: param, |
166 | multiple: true, | 165 | multiple: true, |
167 | auto: false, //选择文件后不自动上传 | 166 | auto: false, //选择文件后不自动上传 |
@@ -171,9 +170,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -171,9 +170,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
171 | choose: function (obj) { | 170 | choose: function (obj) { |
172 | //选择文件后回调 | 171 | //选择文件后回调 |
173 | var files = this.files = obj.pushFile(); | 172 | var files = this.files = obj.pushFile(); |
174 | - if(typeof(files)!=undefined){ | ||
175 | - if(Object.getOwnPropertyNames(files).length>2){ | ||
176 | - $("#attachment").attr("disabled","disabled"); | 173 | + if (typeof (files) != undefined) { |
174 | + if (Object.getOwnPropertyNames(files).length > 2) { | ||
175 | + $("#attachment").attr("disabled", "disabled"); | ||
177 | layer.msg('目前最多支持上传三个文件!', { | 176 | layer.msg('目前最多支持上传三个文件!', { |
178 | icon: 7, time: 3000 | 177 | icon: 7, time: 3000 |
179 | }); | 178 | }); |
@@ -265,7 +264,38 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -265,7 +264,38 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
265 | }) | 264 | }) |
266 | } else { | 265 | } else { |
267 | //附件为文档类型 | 266 | //附件为文档类型 |
268 | - common.fileviewer(filepath) | 267 | + //common.fileviewer(filepath) |
268 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); | ||
269 | + let name = Base64.encode(filepath, true); | ||
270 | + admin.req({ | ||
271 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
272 | + type: 'get' | ||
273 | + }).done(function (res) { | ||
274 | + layer.close(loadIndex); | ||
275 | + if (res && res.success) { | ||
276 | + let win = window.parent; | ||
277 | + if (win) { | ||
278 | + window.parent.postMessage({ | ||
279 | + type: "previewFile", | ||
280 | + message: { | ||
281 | + params: { | ||
282 | + url: res.str | ||
283 | + } | ||
284 | + } | ||
285 | + }, '*') | ||
286 | + } | ||
287 | + } else { | ||
288 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
289 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
290 | + window.open(url) | ||
291 | + layer.close(loadIndex); | ||
292 | + }); | ||
293 | + | ||
294 | + } | ||
295 | + }).error(function (error) { | ||
296 | + layer.close(loadIndex); | ||
297 | + console.log(error) | ||
298 | + }) | ||
269 | } | 299 | } |
270 | }) | 300 | }) |
271 | } | 301 | } |
@@ -76,13 +76,42 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,13 +76,42 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + layer.close(loadIndex); | ||
103 | + }); | ||
104 | + | ||
105 | + } | ||
106 | + }).error(function (error) { | ||
107 | + layer.close(loadIndex); | ||
108 | + console.log(error) | ||
109 | + }) | ||
80 | } | 110 | } |
81 | }) | 111 | }) |
82 | 112 | ||
83 | $('.attachment-download-btn').on('click',function () { | 113 | $('.attachment-download-btn').on('click',function () { |
84 | var id = $(this).data('id') | 114 | var id = $(this).data('id') |
85 | - var suffix = $(this).data('suffix') | ||
86 | var url = domainName + `/api-web/openoffice/download/${id}?accessToken=` + accessToken | 115 | var url = domainName + `/api-web/openoffice/download/${id}?accessToken=` + accessToken |
87 | window.open(url) | 116 | window.open(url) |
88 | }) | 117 | }) |
1 | +layui.define(['tree', 'treeTable', 'table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', 'sessions', 'xmSelect', "commonDetail", 'view', 'dropdown','echarts'], function (exports) { | ||
2 | + var $ = layui.$; | ||
3 | + var form = layui.form; | ||
4 | + var layer = layui.layer; | ||
5 | + var laydate = layui.laydate; | ||
6 | + var laytpl = layui.laytpl; | ||
7 | + var common = layui.common; | ||
8 | + var domainName = common.domainName; | ||
9 | + var dropdown = layui.dropdown; | ||
10 | + var admin = layui.admin; | ||
11 | + var tree = layui.tree; | ||
12 | + var table = layui.table; | ||
13 | + var tableChild = layui.tableChild; | ||
14 | + var treeTable = layui.treeTable; | ||
15 | + | ||
16 | + exports('newLogIndex', function () { | ||
17 | + var resTypeVal = ""; | ||
18 | + var accessToken = localStorage.getItem("accessToken"); | ||
19 | + | ||
20 | + var selectBusType = []; | ||
21 | + | ||
22 | + console.log('====日志加载中===='); | ||
23 | + initDropDateTime(); | ||
24 | + resTypeInit(); | ||
25 | + renderDefaultLogType(); | ||
26 | + initTable(); | ||
27 | + loadChart(); | ||
28 | + // HOST_X86SERVER(服务器)、数据库(DATABASE_)、 | ||
29 | + // 中间件(MIDDLEWARE_WEBLOGIC)对应一体化的业务 | ||
30 | + // NETSAFE_(安全设备)对应一体化的安全 | ||
31 | + // NETHARDWARE_(网络设备)对应一体化的网络 | ||
32 | + | ||
33 | + function renderPage(){ | ||
34 | + loadChart(); | ||
35 | + //上述方法等价于 | ||
36 | + table.reload('logTable', { | ||
37 | + where: getParams() | ||
38 | + , page: { | ||
39 | + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] | ||
40 | + , theme: '#1E9FFF' | ||
41 | + } | ||
42 | + }); //只重载数据 | ||
43 | + } | ||
44 | + | ||
45 | + function renderDefaultLogType(resType){ | ||
46 | + if(!resType){ | ||
47 | + resType = "HOST_X86SERVER"; | ||
48 | + resTypeVal = resType; | ||
49 | + } | ||
50 | + $("."+resType).attr("useing", "useing") | ||
51 | + .css("background-color", "#1E9FFF") | ||
52 | + .css("color", "grey"); | ||
53 | + } | ||
54 | + | ||
55 | + function resTypeInit() { | ||
56 | + xmSelect.render({ | ||
57 | + el: '#resTypeList', | ||
58 | + name: 'resType', | ||
59 | + tips: '类型', | ||
60 | + //监听方法 | ||
61 | + on: function (data) { | ||
62 | + var isAdd = data.isAdd; | ||
63 | + $(".alaysis").css("background-color", "grey") | ||
64 | + .css("color", "white") | ||
65 | + .removeAttr("selected").removeAttr("useing"); | ||
66 | + if (isAdd) { | ||
67 | + resTypeVal = data.change[0]["value"]; | ||
68 | + renderPage(); | ||
69 | + renderDefaultLogType(resTypeVal); | ||
70 | + } else { | ||
71 | + resTypeVal = ""; | ||
72 | + } | ||
73 | + }, | ||
74 | + radio: true, | ||
75 | + filterable: true, | ||
76 | + clickClose: true, | ||
77 | + data: [ | ||
78 | + {'name': '服务器', 'value': 'HOST_X86SERVER', selected: true}, | ||
79 | + {'name': '数据库', 'value': 'DATABASE_'}, | ||
80 | + {'name': '中间件', 'value': 'MIDDLEWARE_WEBLOGIC'}, | ||
81 | + {'name': '安全设备', 'value': 'NETSAFE_'}, | ||
82 | + {'name': '网络设备', 'value': 'NETHARDWARE_'}, | ||
83 | + ] | ||
84 | + }); | ||
85 | + } | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | + $(".alaysis").click(function(){ | ||
90 | + var $this = $(this); | ||
91 | + //$(".alaysis[selected=selected]"); | ||
92 | + if($this.attr("useing") == "useing"){ | ||
93 | + $this.css("color","white"); | ||
94 | + if($this.attr("selected") == "selected"){ | ||
95 | + $this.removeAttr("selected").css("color","grey"); | ||
96 | + | ||
97 | + }else{ | ||
98 | + $(".alaysis[useing='useing']").removeAttr("selected").css("color","grey"); | ||
99 | + $this.attr("selected","selected").css("color","white"); | ||
100 | + } | ||
101 | + renderPage(); | ||
102 | + } | ||
103 | + }) | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + $('#log-search').on('click',function () { | ||
108 | + // 获取选中的资源类型 | ||
109 | + renderPage(); | ||
110 | + }); | ||
111 | + | ||
112 | + function getParams() { | ||
113 | + var $logTypeSelected = $(".alaysis[selected=selected]"); | ||
114 | + var logTypeVal = ""; | ||
115 | + if($logTypeSelected){ | ||
116 | + logTypeVal = $logTypeSelected.attr("logType"); | ||
117 | + } | ||
118 | + logTypeVal = logTypeVal?logTypeVal:""; | ||
119 | + console.log(logTypeVal); | ||
120 | + return { | ||
121 | + type:$('#searchDataType').val(), | ||
122 | + access_token: accessToken, | ||
123 | + restype: resTypeVal, | ||
124 | + bustype: selectBusType.join(','), | ||
125 | + timeRange: $('#searchDataRange').val(), | ||
126 | + keyWords: $('#searchKeyWords').val(), | ||
127 | + logType: logTypeVal | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | + // 计柱状图表 | ||
132 | + function loadChart() { | ||
133 | + $("#log-echarts").empty(); | ||
134 | + document.getElementById('log-echarts').setAttribute('_echarts_instance_', '') | ||
135 | + var myChart = echarts.init(document.getElementById('log-echarts')); | ||
136 | + var option; | ||
137 | + | ||
138 | + var yMax = 500; | ||
139 | + var dataShadow = []; | ||
140 | + | ||
141 | + var loading = layer.load(2); | ||
142 | + admin.req({ | ||
143 | + url: domainName + '/api-web/log/detail/getBarData' | ||
144 | + , data: getParams() | ||
145 | + , success(response) { | ||
146 | + layer.close(loading) | ||
147 | + if(response.success){ | ||
148 | + var map = response.map; | ||
149 | + var x = []; | ||
150 | + var data = []; | ||
151 | + if(map){ | ||
152 | + x = map.dataAxis; | ||
153 | + data = map.data; | ||
154 | + | ||
155 | + if(data.length<1){ | ||
156 | + var html = "<div style='padding-top:100px;text-align: center;font-size: 20px'><span style='color: red'>无数据</span></div>" | ||
157 | + $("#log-echarts").html(html); | ||
158 | + } | ||
159 | + } | ||
160 | + setOption(x,data); | ||
161 | + } | ||
162 | + } | ||
163 | + , error(error) { | ||
164 | + /*layer.close(loading)*/ | ||
165 | + } | ||
166 | + }) | ||
167 | + | ||
168 | + | ||
169 | + | ||
170 | + function setOption(dataAxis,data){ | ||
171 | + for (var i = 0; i < data.length; i++) { | ||
172 | + dataShadow.push(yMax); | ||
173 | + } | ||
174 | + option = { | ||
175 | + title: { | ||
176 | + text: '', | ||
177 | + subtext: '' | ||
178 | + }, | ||
179 | + tooltip: { | ||
180 | + trigger: 'axis', | ||
181 | + axisPointer: { | ||
182 | + type: 'shadow' | ||
183 | + }, | ||
184 | + formatter(params){ | ||
185 | + return params[0].name +":"+params[0].value+"条"; | ||
186 | + } | ||
187 | + }, | ||
188 | + toolbox: { | ||
189 | + show: true, | ||
190 | + left: 'right', | ||
191 | + top: 'top', | ||
192 | + feature: { | ||
193 | + mark: {show: true}, | ||
194 | + magicType: {show: true, type: ['line', 'bar', 'tiled']}, | ||
195 | + saveAsImage: {show: true} | ||
196 | + } | ||
197 | + }, | ||
198 | + grid:{ | ||
199 | + x:75, | ||
200 | + y:50, | ||
201 | + x2:20, | ||
202 | + y2:50 | ||
203 | + }, | ||
204 | + xAxis: { | ||
205 | + data: dataAxis, | ||
206 | + axisLabel: { | ||
207 | + inside: false, | ||
208 | + show:true, | ||
209 | + textStyle: { | ||
210 | + color: '#000' | ||
211 | + }, | ||
212 | + rotate:60 | ||
213 | + }, | ||
214 | + axisTick: { | ||
215 | + show: false | ||
216 | + }, | ||
217 | + axisLine: { | ||
218 | + show: false | ||
219 | + } | ||
220 | + //,z: 10 | ||
221 | + }, | ||
222 | + yAxis: { | ||
223 | + axisLine: { | ||
224 | + show: false | ||
225 | + }, | ||
226 | + axisTick: { | ||
227 | + show: false | ||
228 | + }, | ||
229 | + axisLabel: { | ||
230 | + textStyle: { | ||
231 | + color: '#999' | ||
232 | + }, | ||
233 | + formatter:'{value}条' | ||
234 | + } | ||
235 | + }, | ||
236 | + /*dataZoom: [ | ||
237 | + { | ||
238 | + type: 'inside' | ||
239 | + } | ||
240 | + ],*/ | ||
241 | + series: [ | ||
242 | + { | ||
243 | + type: 'bar', | ||
244 | + showBackground: true, | ||
245 | + itemStyle: { | ||
246 | + color: new echarts.graphic.LinearGradient( | ||
247 | + 0, 0, 0, 1, | ||
248 | + [ | ||
249 | + {offset: 0, color: '#83bff6'}, | ||
250 | + {offset: 0.5, color: '#188df0'}, | ||
251 | + {offset: 1, color: '#188df0'} | ||
252 | + ] | ||
253 | + ) | ||
254 | + }, | ||
255 | + label: { | ||
256 | + show: false, | ||
257 | + position: 'insideBottom', | ||
258 | + color: '#FFFFFF', | ||
259 | + formatter: function (params) { | ||
260 | + let txtArry = params.name.split(''); | ||
261 | + let rs = ""; | ||
262 | + for (var i = 0; i < txtArry.length; i++) { | ||
263 | + rs += txtArry[i] + "\n"; | ||
264 | + } | ||
265 | + return rs; | ||
266 | + } | ||
267 | + }, | ||
268 | + emphasis: { | ||
269 | + show:false, | ||
270 | + focus: 'series', | ||
271 | + itemStyle: { | ||
272 | + color: new echarts.graphic.LinearGradient( | ||
273 | + 0, 0, 0, 1, | ||
274 | + [ | ||
275 | + {offset: 0, color: '#2378f7'}, | ||
276 | + {offset: 0.7, color: '#2378f7'}, | ||
277 | + {offset: 1, color: '#83bff6'} | ||
278 | + ] | ||
279 | + ) | ||
280 | + } | ||
281 | + }, | ||
282 | + data: data | ||
283 | + } | ||
284 | + ] | ||
285 | + }; | ||
286 | + | ||
287 | + myChart.setOption(option) | ||
288 | + } | ||
289 | + | ||
290 | + } | ||
291 | + | ||
292 | + function formartContents(item) { | ||
293 | + | ||
294 | + var contents = item.contents; | ||
295 | + var itemhtml = ''; | ||
296 | + if (contents) { | ||
297 | + try { | ||
298 | + var json = JSON.parse(contents); | ||
299 | + Object.keys(json).forEach(function (key) { | ||
300 | + itemhtml += `<div class="log-item"><div class="item-left">${key}</div><div class="item-right">${json[key]}</div></div>`; | ||
301 | + }) | ||
302 | + }catch (e) { | ||
303 | + | ||
304 | + } | ||
305 | + } | ||
306 | + var html = ` | ||
307 | + <div class="log-content-line1"> | ||
308 | + <div style="width: 25%"><span>IP : </span>${item.host == null ? '-' : item.host}</div> | ||
309 | + <div style="width: 25%"><span>类型 : </span>${item.type == null ? '-' : item.type}</div> | ||
310 | + <div style="width: 50%"><span>标签 : </span><span>${item.tags == null || !item.tags? '-' : item.tags | ||
311 | + }</span></div> | ||
312 | + </div> | ||
313 | + <div class="log-content-line2">${item.msg == null ? item.contents : item.msg}</div> | ||
314 | + <div class="log-content-line3" style="display: none">${itemhtml}</div>`; | ||
315 | + return html; | ||
316 | + } | ||
317 | + | ||
318 | + /** | ||
319 | + * 加载日志数据 | ||
320 | + */ | ||
321 | + function initTable() { | ||
322 | + | ||
323 | + var cols = [ | ||
324 | + {type: 'numbers', title: '序号', align: 'center'}, | ||
325 | + {field: 'datetime', title: '时间', width: 180, height: '60px', align: 'center', sort: false}, | ||
326 | + { | ||
327 | + field: 'contents1', title: '事件', align: 'center', sort: false, templet: function (d) { | ||
328 | + return formartContents(d); | ||
329 | + } | ||
330 | + } | ||
331 | + ]; | ||
332 | + | ||
333 | + table.render({ | ||
334 | + elem: '#logTable' | ||
335 | + , url: domainName + '/api-web/log/detail/listPage' | ||
336 | + , where: getParams() | ||
337 | + , cellMinWidth: 80 | ||
338 | + , page: { | ||
339 | + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] | ||
340 | + , theme: '#1E9FFF' | ||
341 | + } | ||
342 | + , autoSort: false | ||
343 | + , limit: common.limit | ||
344 | + , limits: common.limits | ||
345 | + , loading:false | ||
346 | + , cols: [cols] | ||
347 | + , done: function (res) { | ||
348 | + | ||
349 | + } | ||
350 | + }); | ||
351 | + | ||
352 | + //监听行单击事件(双击事件为:rowDouble) | ||
353 | + table.on('row(log-table-filter)', function (obj) { | ||
354 | + var data = obj.data; | ||
355 | + $(obj.tr[0]).find('td').eq(2).find('.log-content-line3').toggle(); | ||
356 | + //标注选中样式 | ||
357 | + obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); | ||
358 | + }); | ||
359 | + } | ||
360 | + | ||
361 | + | ||
362 | + function dateFormat(fmt, date) { | ||
363 | + let ret; | ||
364 | + const opt = { | ||
365 | + "Y+": date.getFullYear().toString(), // 年 | ||
366 | + "m+": (date.getMonth() + 1).toString(), // 月 | ||
367 | + "d+": date.getDate().toString(), // 日 | ||
368 | + "H+": date.getHours().toString(), // 时 | ||
369 | + "M+": date.getMinutes().toString(), // 分 | ||
370 | + "S+": date.getSeconds().toString() // 秒 | ||
371 | + // 有其他格式化字符需求可以继续添加,必须转化成字符串 | ||
372 | + }; | ||
373 | + for (let k in opt) { | ||
374 | + ret = new RegExp("(" + k + ")").exec(fmt); | ||
375 | + if (ret) { | ||
376 | + fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) | ||
377 | + }; | ||
378 | + }; | ||
379 | + return fmt; | ||
380 | + } | ||
381 | + $("#time-select").click(function () { | ||
382 | + $(".layui-dropdown").css("display","block"); | ||
383 | + }) | ||
384 | + | ||
385 | + // 加载搜索时间选择 | ||
386 | + function initDropDateTime() { | ||
387 | + $(".layui-dropdown").css("display","block"); | ||
388 | + | ||
389 | + function setDataVal(start,end,value) { | ||
390 | + if(start && start != null && end && end != null){ | ||
391 | + value = dateFormat("YYYY-mm-dd HH:MM:SS", start) +" - " + dateFormat("YYYY-mm-dd HH:MM:SS", end); | ||
392 | + } | ||
393 | + $('#time-select-span').text(value); | ||
394 | + $('#searchDataRange').val(value); | ||
395 | + $(".layui-dropdown").css("display","none"); | ||
396 | + | ||
397 | + | ||
398 | + } | ||
399 | + // 加载默认时间 | ||
400 | + var initdata = new Date(); | ||
401 | + initdata.setDate(initdata.getDate() - 1); | ||
402 | + setDataVal(initdata,new Date()); | ||
403 | + $('#searchDataType').val('d'); | ||
404 | + | ||
405 | + | ||
406 | + var defaultLeft = ''; | ||
407 | + var dataTimeRange = false; | ||
408 | + var dataTimeDropdown = dropdown.render({ | ||
409 | + elem: '#time-select' | ||
410 | + , content: ['<div class="layui-tab layui-tab-brief" lay-filter="overview_time_tab">' | ||
411 | + , '<ul class="layui-tab-title">' | ||
412 | + , '<li class="layui-this">快速选择</li>' | ||
413 | + , '<li>自定义时间段</li>' | ||
414 | + , '</ul>' | ||
415 | + , '<div class="layui-tab-content">' | ||
416 | + , '<div class="layui-tab-item layui-text layui-show"><div class="display-flex" ><div class="time-tools border-left" ><div data-type="m" data-size="5">最近5分钟</div><div data-type="m" data-size="15">最近15分钟</div><div data-type="h" data-size="1">最近1小时</div><div data-type="h" data-size="3">最近3小时</div><div data-type="h" data-size="6">最近6小时</div><div data-type="h" data-size="12">最近12小时</div><div data-type="h" data-size="24">最近24小时</div></div><div class="time-tools"><div data-type="d" data-size="3">最近3天</div><div data-type="d" data-size="7">最近7天</div><div data-type="d" data-size="15">最近15天</div><div data-type="M" data-size="1">最近1个月</div><div data-type="M" data-size="3">最近3个月</div><div data-type="M" data-size="6">最近6个月</div><div data-type="y" data-size="1">最近1年</div></div><!--<div class="time-tools"><div data-type="td">今天</div><div data-type="yd">昨天</div><div data-type="tw">本周</div><div data-type="lw">上周</div><div data-type="tm">本月</div><div data-type="lm">上月</div><div data-type="ty">今年</div></div>--></div></div>' | ||
417 | + , '<div class="layui-tab-item" id="time"><div class="site-demo-laydate"><div class="layui-inline" id="datetimeRange"></div></div></div>' | ||
418 | + , '</div>' | ||
419 | + , '</div>'].join('') | ||
420 | + , style: 'min-width: 370px; height: auto; padding: 0 15px;margin-left:15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);' | ||
421 | + , click: function (data, othis) { | ||
422 | + $(".layui-dropdown").css("display","block"); | ||
423 | + } | ||
424 | + , ready: function () { | ||
425 | + $('.time-tools div').on('click', function () { | ||
426 | + var that = $(this); | ||
427 | + // data-type="m" data-size="15" | ||
428 | + var type = that.attr('data-type'); | ||
429 | + var size = that.attr('data-size'); | ||
430 | + | ||
431 | + // 当前时间 | ||
432 | + var endTime = new Date(); | ||
433 | + | ||
434 | + // 开始时间 | ||
435 | + var startTime = new Date(); | ||
436 | + | ||
437 | + if(type == 'm'){ | ||
438 | + // 分钟 | ||
439 | + startTime.setMinutes(startTime.getMinutes() - size); | ||
440 | + } else if(type == 'h'){ | ||
441 | + // 小时 | ||
442 | + startTime.setHours(startTime.getHours() - size); | ||
443 | + } else if(type == 'd'){ | ||
444 | + // 天 | ||
445 | + startTime.setDate(startTime.getDate() - size); | ||
446 | + } else if(type == 'M'){ | ||
447 | + // 月 | ||
448 | + startTime.setMonth(startTime.getMonth() - size); | ||
449 | + } else if(type == 'y'){ | ||
450 | + // 年 | ||
451 | + startTime.setFullYear(startTime.getFullYear() - size); | ||
452 | + } | ||
453 | + $('#searchDataType').val(type); | ||
454 | + setDataVal(startTime,endTime); | ||
455 | + | ||
456 | + }); | ||
457 | + | ||
458 | + | ||
459 | + | ||
460 | + layui.use('element', function (element) { | ||
461 | + element.render('tab'); | ||
462 | + // tab页切换事件 | ||
463 | + element.on('tab(overview_time_tab)', function (data) { | ||
464 | + if (defaultLeft == '') { | ||
465 | + defaultLeft = $('.layui-dropdown').css('left') | ||
466 | + } | ||
467 | + | ||
468 | + if (data.index == 1) { | ||
469 | + loadDataTime(); | ||
470 | + } else { | ||
471 | + //loadQuickMenu(); | ||
472 | + $('.layui-dropdown').css({'left': defaultLeft}); | ||
473 | + } | ||
474 | + }); | ||
475 | + | ||
476 | + | ||
477 | + }); | ||
478 | + } | ||
479 | + }); | ||
480 | + | ||
481 | + | ||
482 | + var loadDataTime = function () { | ||
483 | + $('#datetimeRange .layui-laydate-range').remove(); | ||
484 | + // 日期 | ||
485 | + laydate.render({ | ||
486 | + elem: '#datetimeRange' | ||
487 | + , position: 'static' | ||
488 | + , type: 'datetime' | ||
489 | + , range: true | ||
490 | + , btns:['clear', 'confirm'] | ||
491 | + , ready: function (date) { | ||
492 | + $('.layui-dropdown').css({'left': 'calc(100% - 620px)'}); | ||
493 | + } | ||
494 | + , done: function (value, date, endDate) { | ||
495 | + $('#time-select-span').text(value); | ||
496 | + $('#searchDataRange').val(value); | ||
497 | + setDataVal(null,null,value); | ||
498 | + $('#searchDataType').val('d'); | ||
499 | + } | ||
500 | + }); | ||
501 | + } | ||
502 | + } | ||
503 | + }); | ||
504 | + | ||
505 | +}); |
@@ -243,7 +243,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -243,7 +243,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
243 | var fileName = [] | 243 | var fileName = [] |
244 | uploadInst = upload.render({ | 244 | uploadInst = upload.render({ |
245 | elem: '#attachment', //绑定元素 | 245 | elem: '#attachment', //绑定元素 |
246 | - url: common.domainName + '/api-web/recoveryverify/upload?accessToken='+accessToken, | 246 | + url: common.domainName + '/api-web/recoveryverify/upload?accessToken=' + accessToken, |
247 | data: param, | 247 | data: param, |
248 | multiple: true, | 248 | multiple: true, |
249 | auto: false, //选择文件后不自动上传 | 249 | auto: false, //选择文件后不自动上传 |
@@ -253,7 +253,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -253,7 +253,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
253 | choose: function (obj) { | 253 | choose: function (obj) { |
254 | //选择文件后回调 | 254 | //选择文件后回调 |
255 | var files = this.files = obj.pushFile(); | 255 | var files = this.files = obj.pushFile(); |
256 | - if (typeof(files) != undefined) { | 256 | + if (typeof (files) != undefined) { |
257 | if (Object.getOwnPropertyNames(files).length > 2) { | 257 | if (Object.getOwnPropertyNames(files).length > 2) { |
258 | $("#attachment").attr("disabled", "disabled"); | 258 | $("#attachment").attr("disabled", "disabled"); |
259 | layer.msg('目前最多支持上传三个文件!', { | 259 | layer.msg('目前最多支持上传三个文件!', { |
@@ -347,7 +347,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -347,7 +347,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
347 | }) | 347 | }) |
348 | } else { | 348 | } else { |
349 | //附件为文档类型 | 349 | //附件为文档类型 |
350 | - common.fileviewer(filepath) | 350 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
351 | + let name = Base64.encode(filepath, true); | ||
352 | + admin.req({ | ||
353 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
354 | + type: 'get' | ||
355 | + }).done(function (res) { | ||
356 | + layer.close(loadIndex); | ||
357 | + if (res && res.success) { | ||
358 | + let win = window.parent; | ||
359 | + if (win) { | ||
360 | + window.parent.postMessage({ | ||
361 | + type: "previewFile", | ||
362 | + message: { | ||
363 | + params: { | ||
364 | + url: res.str | ||
365 | + } | ||
366 | + } | ||
367 | + }, '*') | ||
368 | + } | ||
369 | + } else { | ||
370 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
371 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
372 | + window.open(url) | ||
373 | + }); | ||
374 | + layer.close(loadIndex); | ||
375 | + } | ||
376 | + }).error(function (error) { | ||
377 | + layer.close(loadIndex); | ||
378 | + console.log(error) | ||
379 | + }) | ||
351 | } | 380 | } |
352 | }) | 381 | }) |
353 | } | 382 | } |
@@ -388,7 +417,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -388,7 +417,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
388 | vu = "恢复服务器"; | 417 | vu = "恢复服务器"; |
389 | break; | 418 | break; |
390 | } | 419 | } |
391 | - tr += '<tr data-id="' + v.id + '" data-recordId="'+v.recordId+'" data-usefulness="'+v.usefulness+'" >' + | 420 | + tr += '<tr data-id="' + v.id + '" data-recordId="' + v.recordId + '" data-usefulness="' + v.usefulness + '" >' + |
392 | '<td>' + vu + '</td>' + | 421 | '<td>' + vu + '</td>' + |
393 | '<td>' + v.ip + '</td>' + | 422 | '<td>' + v.ip + '</td>' + |
394 | '<td>' + v.os + '</td>' + | 423 | '<td>' + v.os + '</td>' + |
@@ -403,23 +432,23 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -403,23 +432,23 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
403 | var tdArr = []; | 432 | var tdArr = []; |
404 | var id = $(this).closest('tr').attr('data-id'); | 433 | var id = $(this).closest('tr').attr('data-id'); |
405 | var recordId = $(this).closest('tr').attr('data-recordId'); | 434 | var recordId = $(this).closest('tr').attr('data-recordId'); |
406 | - var usefulness = $(this).closest('tr').attr('data-usefulness'); | 435 | + var usefulness = $(this).closest('tr').attr('data-usefulness'); |
407 | tdArr.push(usefulness); | 436 | tdArr.push(usefulness); |
408 | $(this).closest('tr').find('td').not(':first').not(':last').each(function (t, index) { | 437 | $(this).closest('tr').find('td').not(':first').not(':last').each(function (t, index) { |
409 | if (!toEdit) { | 438 | if (!toEdit) { |
410 | - this.innerHTML = this.firstChild.value.replace(/</g, '<').replace(/>/g, '>'); | ||
411 | - if (this.innerHTML == '' || this.innerHTML == undefined) { | ||
412 | - layer.msg('请填写完整', { | ||
413 | - icon: 7, time: 3000 | ||
414 | - }); | ||
415 | - tdArr = []; | ||
416 | - $(this).closest('tr').remove(); | ||
417 | - return; | ||
418 | - } | ||
419 | - tdArr.push(this.innerHTML); | 439 | + this.innerHTML = this.firstChild.value.replace(/</g, '<').replace(/>/g, '>'); |
440 | + if (this.innerHTML == '' || this.innerHTML == undefined) { | ||
441 | + layer.msg('请填写完整', { | ||
442 | + icon: 7, time: 3000 | ||
443 | + }); | ||
444 | + tdArr = []; | ||
445 | + $(this).closest('tr').remove(); | ||
446 | + return; | ||
447 | + } | ||
448 | + tdArr.push(this.innerHTML); | ||
420 | 449 | ||
421 | } else { | 450 | } else { |
422 | - this.innerHTML = '<input type="text" value="' + this.innerHTML.replace(/"/g, '"').replace(/<\/?.+?>/g, '').replace(/ /g, '') + '"/>'; | 451 | + this.innerHTML = '<input type="text" value="' + this.innerHTML.replace(/"/g, '"').replace(/<\/?.+?>/g, '').replace(/ /g, '') + '"/>'; |
423 | } | 452 | } |
424 | }) | 453 | }) |
425 | if (toEdit) { | 454 | if (toEdit) { |
@@ -434,8 +463,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -434,8 +463,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
434 | 'id': id, | 463 | 'id': id, |
435 | 'recordId': recordId | 464 | 'recordId': recordId |
436 | } | 465 | } |
437 | - devicesBak.forEach(e=>{ | ||
438 | - if(deviceObj.id ==e.id){ | 466 | + devicesBak.forEach(e => { |
467 | + if (deviceObj.id == e.id) { | ||
439 | devicesBak.pop(e); | 468 | devicesBak.pop(e); |
440 | devicesBak.push(deviceObj); | 469 | devicesBak.push(deviceObj); |
441 | } | 470 | } |
@@ -452,7 +481,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | @@ -452,7 +481,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect | ||
452 | } | 481 | } |
453 | 482 | ||
454 | 483 | ||
455 | - | ||
456 | }) | 484 | }) |
457 | } | 485 | } |
458 | } | 486 | } |
@@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + }); | ||
103 | + layer.close(loadIndex); | ||
104 | + } | ||
105 | + }).error(function (error) { | ||
106 | + layer.close(loadIndex); | ||
107 | + console.log(error) | ||
108 | + }) | ||
80 | } | 109 | } |
81 | }) | 110 | }) |
82 | 111 |
@@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | @@ -76,7 +76,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function | ||
76 | }) | 76 | }) |
77 | } else { | 77 | } else { |
78 | //附件为文档类型 | 78 | //附件为文档类型 |
79 | - common.fileviewer(filepath) | 79 | + var loadIndex = layer.load(1, {shade: [0.3], content: ''}); |
80 | + let name = Base64.encode(filepath, true); | ||
81 | + admin.req({ | ||
82 | + url: domainName + `/api-web/openoffice/convertPdfMJ?pathBase64=${name}`, | ||
83 | + type: 'get' | ||
84 | + }).done(function (res) { | ||
85 | + layer.close(loadIndex); | ||
86 | + if (res && res.success) { | ||
87 | + let win = window.parent; | ||
88 | + if (win) { | ||
89 | + window.parent.postMessage({ | ||
90 | + type: "previewFile", | ||
91 | + message: { | ||
92 | + params: { | ||
93 | + url: res.str | ||
94 | + } | ||
95 | + } | ||
96 | + }, '*') | ||
97 | + } | ||
98 | + } else { | ||
99 | + layer.confirm("文档不支持预览,是否下载!", function () { | ||
100 | + const url = domainName + `/api-web/openoffice/download/${id}?accessToken=${accessToken}`; | ||
101 | + window.open(url) | ||
102 | + }); | ||
103 | + layer.close(loadIndex); | ||
104 | + } | ||
105 | + }).error(function (error) { | ||
106 | + layer.close(loadIndex); | ||
107 | + console.log(error) | ||
108 | + }) | ||
80 | } | 109 | } |
81 | }) | 110 | }) |
82 | 111 |
@@ -35,7 +35,7 @@ layui.define(['laytpl', 'layer'], function (exports) { | @@ -35,7 +35,7 @@ layui.define(['laytpl', 'layer'], function (exports) { | ||
35 | * @param isError 是否异常触发 | 35 | * @param isError 是否异常触发 |
36 | */ | 36 | */ |
37 | const errorHandel = (status, res,isError) => { | 37 | const errorHandel = (status, res,isError) => { |
38 | - if(res.success){ | 38 | + if(res.success || isError==false){ |
39 | return true; | 39 | return true; |
40 | } | 40 | } |
41 | console.log(' =================================') | 41 | console.log(' =================================') |
@@ -9,9 +9,14 @@ | @@ -9,9 +9,14 @@ | ||
9 | <div class="layui-form-item"> | 9 | <div class="layui-form-item"> |
10 | <div class="layui-inline inline-onethird"> | 10 | <div class="layui-inline inline-onethird"> |
11 | <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>文件类型</label> | 11 | <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>文件类型</label> |
12 | - <div class="layui-input-block"> | ||
13 | - <input type="radio" lay-filter="docType" name="docType" value="0" title="应急预案" checked> | ||
14 | - <input type="radio" lay-filter="docType" name="docType" value="1" title="演练报告"> | 12 | + <div class="layui-input-inline"> |
13 | + <select name="docType" id="slt-docType" | ||
14 | + lay-filter="slt-docType" > | ||
15 | + <option value="0">应急预案</option> | ||
16 | + <option value="1">演练报告</option> | ||
17 | + </select> | ||
18 | + <!-- <input type="radio" lay-filter="docType" name="docType" value="0" title="应急预案" checked> | ||
19 | + <input type="radio" lay-filter="docType" name="docType" value="1" title="演练报告">--> | ||
15 | </div> | 20 | </div> |
16 | </div> | 21 | </div> |
17 | <div class="layui-inline inline-onethird"> | 22 | <div class="layui-inline inline-onethird"> |
@@ -116,8 +121,8 @@ | @@ -116,8 +121,8 @@ | ||
116 | </div> | 121 | </div> |
117 | 122 | ||
118 | <div class="layui-form-item"> | 123 | <div class="layui-form-item"> |
119 | - <label class="layui-form-label textarea-label" style="text-overflow: clip;width: 160px"><span | ||
120 | - style="color: red;font-size: 16px">*</span>预案内容/演练内容</label> | 124 | + <label class="layui-form-label textarea-label" style="text-overflow: clip;"><span |
125 | + style="color: red;font-size: 16px">*</span>内容</label> | ||
121 | <div class="layui-input-block"> | 126 | <div class="layui-input-block"> |
122 | <textarea class="layui-textarea" name="emergencyContent" maxlength="500" | 127 | <textarea class="layui-textarea" name="emergencyContent" maxlength="500" |
123 | placeholder="预案内容/演练内容" lay-verify="required"></textarea> | 128 | placeholder="预案内容/演练内容" lay-verify="required"></textarea> |
@@ -158,8 +163,8 @@ | @@ -158,8 +163,8 @@ | ||
158 | </div> | 163 | </div> |
159 | </div> | 164 | </div> |
160 | <div class="layui-form-item"> | 165 | <div class="layui-form-item"> |
161 | - <label class="layui-form-label textarea-label" style="text-overflow: clip;width: 160px"><span | ||
162 | - style="color: red;font-size: 16px">*</span>预案缺陷/演练汇总</label> | 166 | + <label class="layui-form-label textarea-label" style="text-overflow: clip;"><span |
167 | + style="color: red;font-size: 16px">*</span>缺陷/汇总</label> | ||
163 | <div class="layui-input-block"> | 168 | <div class="layui-input-block"> |
164 | <textarea class="layui-textarea" name="defect" maxlength="100" placeholder="方案缺陷/演练汇总"></textarea> | 169 | <textarea class="layui-textarea" name="defect" maxlength="100" placeholder="方案缺陷/演练汇总"></textarea> |
165 | </div> | 170 | </div> |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> | 9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> |
10 | <div class="layui-form-item" > | 10 | <div class="layui-form-item" > |
11 | <div class="layui-inline inline-onethird"> | 11 | <div class="layui-inline inline-onethird"> |
12 | - <label class="layui-form-label">报表类型</label> | 12 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>报表类型</label> |
13 | <div class="layui-input-inline"> | 13 | <div class="layui-input-inline"> |
14 | <select name="docType" id="slt-docType" | 14 | <select name="docType" id="slt-docType" |
15 | lay-filter="slt-docType" > | 15 | lay-filter="slt-docType" > |
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | <div class="layui-inline inline-onethird"> | 21 | <div class="layui-inline inline-onethird"> |
22 | - <label class="layui-form-label">操作类型</label> | 22 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>操作类型</label> |
23 | <div class="layui-input-inline"> | 23 | <div class="layui-input-inline"> |
24 | <select name="actionType" id="slt-actionType" | 24 | <select name="actionType" id="slt-actionType" |
25 | lay-filter="slt-actionType" > | 25 | lay-filter="slt-actionType" > |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
32 | <div class="layui-inline inline-onethird"> | 32 | <div class="layui-inline inline-onethird"> |
33 | - <label class="layui-form-label">设备型号</label> | 33 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>设备型号</label> |
34 | <div class="layui-input-inline"> | 34 | <div class="layui-input-inline"> |
35 | <input type="text" class="layui-input" name="deviceModel" id="deviceModel" lay-verify="required"> | 35 | <input type="text" class="layui-input" name="deviceModel" id="deviceModel" lay-verify="required"> |
36 | </div> | 36 | </div> |
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | </div> | 38 | </div> |
39 | <div class="layui-form-item"> | 39 | <div class="layui-form-item"> |
40 | <div class="layui-inline inline-onethird"> | 40 | <div class="layui-inline inline-onethird"> |
41 | - <label class="layui-form-label">机房</label> | 41 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>机房</label> |
42 | <div class="layui-input-inline"> | 42 | <div class="layui-input-inline"> |
43 | <select name="machineRoomId" id="slt-staffadd-machine" | 43 | <select name="machineRoomId" id="slt-staffadd-machine" |
44 | lay-filter="slt-staffadd-machine" lay-verify="required"> | 44 | lay-filter="slt-staffadd-machine" lay-verify="required"> |
@@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
47 | </div> | 47 | </div> |
48 | </div> | 48 | </div> |
49 | <div class="layui-inline inline-onethird"> | 49 | <div class="layui-inline inline-onethird"> |
50 | - <label class="layui-form-label">选择单位</label> | 50 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>选择单位</label> |
51 | <div class="layui-input-inline"> | 51 | <div class="layui-input-inline"> |
52 | <select name="manufacturerId" id="slt-staffadd-group" | 52 | <select name="manufacturerId" id="slt-staffadd-group" |
53 | lay-filter="slt-staffadd-group" lay-verify="required"> | 53 | lay-filter="slt-staffadd-group" lay-verify="required"> |
@@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | <div class="layui-inline inline-onethird"> | 59 | <div class="layui-inline inline-onethird"> |
60 | - <label class="layui-form-label">申请人</label> | 60 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>申请人</label> |
61 | <div class="layui-input-inline"> | 61 | <div class="layui-input-inline"> |
62 | <input type="text" class="layui-input" name="applyUser" id="applyUser" lay-verify="required"> | 62 | <input type="text" class="layui-input" name="applyUser" id="applyUser" lay-verify="required"> |
63 | </div> | 63 | </div> |
@@ -65,19 +65,19 @@ | @@ -65,19 +65,19 @@ | ||
65 | </div> | 65 | </div> |
66 | <div class="layui-form-item"> | 66 | <div class="layui-form-item"> |
67 | <div class="layui-inline inline-onethird"> | 67 | <div class="layui-inline inline-onethird"> |
68 | - <label class="layui-form-label">联系方式</label> | 68 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>联系方式</label> |
69 | <div class="layui-input-inline"> | 69 | <div class="layui-input-inline"> |
70 | <input type="text" class="layui-input" name="phone" id="phone" lay-verify="required|phone"> | 70 | <input type="text" class="layui-input" name="phone" id="phone" lay-verify="required|phone"> |
71 | </div> | 71 | </div> |
72 | </div> | 72 | </div> |
73 | <div class="layui-inline inline-onethird"> | 73 | <div class="layui-inline inline-onethird"> |
74 | - <label class="layui-form-label">进入时间</label> | 74 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>进入时间</label> |
75 | <div class="layui-input-inline"> | 75 | <div class="layui-input-inline"> |
76 | <input type="text" class="layui-input" name="enterTime" id="enterTime" lay-verify="required"> | 76 | <input type="text" class="layui-input" name="enterTime" id="enterTime" lay-verify="required"> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | <div class="layui-inline inline-onethird"> | 79 | <div class="layui-inline inline-onethird"> |
80 | - <label class="layui-form-label">出来时间</label> | 80 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>出来时间</label> |
81 | <div class="layui-input-inline"> | 81 | <div class="layui-input-inline"> |
82 | <input type="text" class="layui-input" name="outTime" id="outTime" lay-verify="required"> | 82 | <input type="text" class="layui-input" name="outTime" id="outTime" lay-verify="required"> |
83 | </div> | 83 | </div> |
@@ -85,7 +85,7 @@ | @@ -85,7 +85,7 @@ | ||
85 | </div> | 85 | </div> |
86 | <div class="layui-form-item" > | 86 | <div class="layui-form-item" > |
87 | <div class="layui-inline inline-onethird"> | 87 | <div class="layui-inline inline-onethird"> |
88 | - <label class="layui-form-label">现物理位置</label> | 88 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>现物理位置</label> |
89 | <div class="layui-input-inline"> | 89 | <div class="layui-input-inline"> |
90 | <input type="text" class="layui-input" name="localPlace" id= "localPlace" lay-verify="required"> | 90 | <input type="text" class="layui-input" name="localPlace" id= "localPlace" lay-verify="required"> |
91 | </div> | 91 | </div> |
@@ -97,7 +97,7 @@ | @@ -97,7 +97,7 @@ | ||
97 | </div> | 97 | </div> |
98 | </div> | 98 | </div> |
99 | <div class="layui-inline inline-onethird"> | 99 | <div class="layui-inline inline-onethird"> |
100 | - <label class="layui-form-label">值班人</label> | 100 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>值班人</label> |
101 | <div class="layui-input-inline"> | 101 | <div class="layui-input-inline"> |
102 | <input type="text" class="layui-input" name="watchkeeper" id= "watchkeeper" lay-verify="required"> | 102 | <input type="text" class="layui-input" name="watchkeeper" id= "watchkeeper" lay-verify="required"> |
103 | </div> | 103 | </div> |
@@ -105,26 +105,26 @@ | @@ -105,26 +105,26 @@ | ||
105 | </div> | 105 | </div> |
106 | <div class="layui-form-item"> | 106 | <div class="layui-form-item"> |
107 | <div class="layui-inline inline-onethird"> | 107 | <div class="layui-inline inline-onethird"> |
108 | - <label class="layui-form-label">设备负责人(甲方)</label> | 108 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>设备负责人</label> |
109 | <div class="layui-input-inline"> | 109 | <div class="layui-input-inline"> |
110 | <input type="text" class="layui-input" name="machineRoomLeader" id="machineRoomLeader" lay-verify="required"> | 110 | <input type="text" class="layui-input" name="machineRoomLeader" id="machineRoomLeader" lay-verify="required"> |
111 | </div> | 111 | </div> |
112 | </div> | 112 | </div> |
113 | <div class="layui-inline inline-onethird"> | 113 | <div class="layui-inline inline-onethird"> |
114 | - <label class="layui-form-label">总集成</label> | 114 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>总集成</label> |
115 | <div class="layui-input-inline"> | 115 | <div class="layui-input-inline"> |
116 | <input type="text" class="layui-input" name="integration" id="integration" lay-verify="required"> | 116 | <input type="text" class="layui-input" name="integration" id="integration" lay-verify="required"> |
117 | </div> | 117 | </div> |
118 | </div> | 118 | </div> |
119 | <div class="layui-inline inline-onethird"> | 119 | <div class="layui-inline inline-onethird"> |
120 | - <label class="layui-form-label">运维负责人</label> | 120 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>运维负责人</label> |
121 | <div class="layui-input-inline"> | 121 | <div class="layui-input-inline"> |
122 | <input type="text" class="layui-input" name="operationUser" id="operationUser" lay-verify="required"> | 122 | <input type="text" class="layui-input" name="operationUser" id="operationUser" lay-verify="required"> |
123 | </div> | 123 | </div> |
124 | </div> | 124 | </div> |
125 | </div> | 125 | </div> |
126 | <div class="layui-form-item"> | 126 | <div class="layui-form-item"> |
127 | - <label class="layui-form-label textarea-label">进入事由</label> | 127 | + <label class="layui-form-label textarea-label"><span style="color: red;font-size: 16px">*</span>进入事由</label> |
128 | <div class="layui-input-block"> | 128 | <div class="layui-input-block"> |
129 | <textarea class="layui-textarea" name="reason" id="reason" lay-verify="required"></textarea> | 129 | <textarea class="layui-textarea" name="reason" id="reason" lay-verify="required"></textarea> |
130 | </div> | 130 | </div> |
@@ -9,13 +9,13 @@ | @@ -9,13 +9,13 @@ | ||
9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> | 9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> |
10 | <div class="layui-form-item"> | 10 | <div class="layui-form-item"> |
11 | <div class="layui-inline inline-onethird"> | 11 | <div class="layui-inline inline-onethird"> |
12 | - <label class="layui-form-label">合同编号</label> | 12 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>合同编号</label> |
13 | <div class="layui-input-inline"> | 13 | <div class="layui-input-inline"> |
14 | <input type="text" class="layui-input" name="contractId" maxlength="25" id="contractId" lay-verify="required"> | 14 | <input type="text" class="layui-input" name="contractId" maxlength="25" id="contractId" lay-verify="required"> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | <div class="layui-inline inline-onethird"> | 17 | <div class="layui-inline inline-onethird"> |
18 | - <label class="layui-form-label">调整要求</label> | 18 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>调整要求</label> |
19 | <div class="layui-input-inline"> | 19 | <div class="layui-input-inline"> |
20 | <select name="adjustType" id="slt-adjustType-group" | 20 | <select name="adjustType" id="slt-adjustType-group" |
21 | lay-filter="slt-adjustType-group" > | 21 | lay-filter="slt-adjustType-group" > |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | <div class="layui-inline inline-onethird"> | 26 | <div class="layui-inline inline-onethird"> |
27 | - <label class="layui-form-label">城市A</label> | 27 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>城市A</label> |
28 | <div class="layui-input-inline"> | 28 | <div class="layui-input-inline"> |
29 | <select name="localCity" id="slt-localCity-group" | 29 | <select name="localCity" id="slt-localCity-group" |
30 | lay-filter="slt-localCity-group"> | 30 | lay-filter="slt-localCity-group"> |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | </div> | 35 | </div> |
36 | <div class="layui-form-item"> | 36 | <div class="layui-form-item"> |
37 | <div class="layui-inline inline-onethird"> | 37 | <div class="layui-inline inline-onethird"> |
38 | - <label class="layui-form-label">城市Z</label> | 38 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>城市Z</label> |
39 | <div class="layui-input-inline"> | 39 | <div class="layui-input-inline"> |
40 | <select name="targetCity" id="slt-targetCity-group" | 40 | <select name="targetCity" id="slt-targetCity-group" |
41 | lay-filter="slt-targetCity-group"> | 41 | lay-filter="slt-targetCity-group"> |
@@ -44,13 +44,13 @@ | @@ -44,13 +44,13 @@ | ||
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | <div class="layui-inline inline-onethird"> | 46 | <div class="layui-inline inline-onethird"> |
47 | - <label class="layui-form-label">申请单位</label> | 47 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>申请单位</label> |
48 | <div class="layui-input-inline"> | 48 | <div class="layui-input-inline"> |
49 | <input type="text" class="layui-input" name="applyCity" id="applyCity" lay-verify="required"> | 49 | <input type="text" class="layui-input" name="applyCity" id="applyCity" lay-verify="required"> |
50 | </div> | 50 | </div> |
51 | </div> | 51 | </div> |
52 | <div class="layui-inline inline-onethird"> | 52 | <div class="layui-inline inline-onethird"> |
53 | - <label class="layui-form-label">业务类型</label> | 53 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>业务类型</label> |
54 | <div class="layui-input-inline"> | 54 | <div class="layui-input-inline"> |
55 | <input type="text" class="layui-input" name="busyType" id="busyType" lay-verify="required"> | 55 | <input type="text" class="layui-input" name="busyType" id="busyType" lay-verify="required"> |
56 | </div> | 56 | </div> |
@@ -58,19 +58,19 @@ | @@ -58,19 +58,19 @@ | ||
58 | </div> | 58 | </div> |
59 | <div class="layui-form-item"> | 59 | <div class="layui-form-item"> |
60 | <div class="layui-inline inline-onethird"> | 60 | <div class="layui-inline inline-onethird"> |
61 | - <label class="layui-form-label">端口速率</label> | 61 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>端口速率</label> |
62 | <div class="layui-input-inline"> | 62 | <div class="layui-input-inline"> |
63 | <input type="text" class="layui-input" name="portSpeed" id="portSpeed" lay-verify="required"> | 63 | <input type="text" class="layui-input" name="portSpeed" id="portSpeed" lay-verify="required"> |
64 | </div> | 64 | </div> |
65 | </div> | 65 | </div> |
66 | <div class="layui-inline inline-onethird"> | 66 | <div class="layui-inline inline-onethird"> |
67 | - <label class="layui-form-label">线路速率</label> | 67 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>线路速率</label> |
68 | <div class="layui-input-inline"> | 68 | <div class="layui-input-inline"> |
69 | <input type="text" class="layui-input" name="electricSpeed" id="electricSpeed" lay-verify="required"> | 69 | <input type="text" class="layui-input" name="electricSpeed" id="electricSpeed" lay-verify="required"> |
70 | </div> | 70 | </div> |
71 | </div> | 71 | </div> |
72 | <div class="layui-inline inline-onethird"> | 72 | <div class="layui-inline inline-onethird"> |
73 | - <label class="layui-form-label">调整时间</label> | 73 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>调整时间</label> |
74 | <div class="layui-input-inline"> | 74 | <div class="layui-input-inline"> |
75 | <input type="text" class="layui-input" name="adjustTime" id="adjustTime" lay-verify="required"> | 75 | <input type="text" class="layui-input" name="adjustTime" id="adjustTime" lay-verify="required"> |
76 | </div> | 76 | </div> |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> | 9 | <input hidden name="id" id="id" lay-verify="checkReportIsExist"> |
10 | <div class="layui-form-item"> | 10 | <div class="layui-form-item"> |
11 | <div class="layui-inline inline-onethird"> | 11 | <div class="layui-inline inline-onethird"> |
12 | - <label class="layui-form-label">机房</label> | 12 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>机房</label> |
13 | <div class="layui-input-inline"> | 13 | <div class="layui-input-inline"> |
14 | <select name="machineRoomId" id="slt-staffadd-machine" lay-verify="required" | 14 | <select name="machineRoomId" id="slt-staffadd-machine" lay-verify="required" |
15 | lay-filter="slt-staffadd-machine"> | 15 | lay-filter="slt-staffadd-machine"> |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | </div> | 18 | </div> |
19 | </div> | 19 | </div> |
20 | <div class="layui-inline inline-onethird"> | 20 | <div class="layui-inline inline-onethird"> |
21 | - <label class="layui-form-label">选择单位</label> | 21 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>选择单位</label> |
22 | <div class="layui-input-inline"> | 22 | <div class="layui-input-inline"> |
23 | <select name="manufacturerId" id="slt-staffadd-group" | 23 | <select name="manufacturerId" id="slt-staffadd-group" |
24 | lay-filter="slt-staffadd-group" lay-verify="required"> | 24 | lay-filter="slt-staffadd-group" lay-verify="required"> |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | </div> | 28 | </div> |
29 | </div> | 29 | </div> |
30 | <div class="layui-inline inline-onethird"> | 30 | <div class="layui-inline inline-onethird"> |
31 | - <label class="layui-form-label">申请人</label> | 31 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>申请人</label> |
32 | <div class="layui-input-inline"> | 32 | <div class="layui-input-inline"> |
33 | <input type="text" class="layui-input" name="applyUser" id="applyUser" lay-verify="required"> | 33 | <input type="text" class="layui-input" name="applyUser" id="applyUser" lay-verify="required"> |
34 | </div> | 34 | </div> |
@@ -36,19 +36,19 @@ | @@ -36,19 +36,19 @@ | ||
36 | </div> | 36 | </div> |
37 | <div class="layui-form-item"> | 37 | <div class="layui-form-item"> |
38 | <div class="layui-inline inline-onethird"> | 38 | <div class="layui-inline inline-onethird"> |
39 | - <label class="layui-form-label">联系方式</label> | 39 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>联系方式</label> |
40 | <div class="layui-input-inline"> | 40 | <div class="layui-input-inline"> |
41 | <input type="text" class="layui-input" name="phone" id="phone" lay-verify="required|phone"> | 41 | <input type="text" class="layui-input" name="phone" id="phone" lay-verify="required|phone"> |
42 | </div> | 42 | </div> |
43 | </div> | 43 | </div> |
44 | <div class="layui-inline inline-onethird"> | 44 | <div class="layui-inline inline-onethird"> |
45 | - <label class="layui-form-label">进入时间</label> | 45 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>进入时间</label> |
46 | <div class="layui-input-inline"> | 46 | <div class="layui-input-inline"> |
47 | <input type="text" class="layui-input" name="enterTime" id="enterTime" lay-verify="required"> | 47 | <input type="text" class="layui-input" name="enterTime" id="enterTime" lay-verify="required"> |
48 | </div> | 48 | </div> |
49 | </div> | 49 | </div> |
50 | <div class="layui-inline inline-onethird"> | 50 | <div class="layui-inline inline-onethird"> |
51 | - <label class="layui-form-label">出来时间</label> | 51 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>出来时间</label> |
52 | <div class="layui-input-inline"> | 52 | <div class="layui-input-inline"> |
53 | <input type="text" class="layui-input" name="outTime" id="outTime" lay-verify="required"> | 53 | <input type="text" class="layui-input" name="outTime" id="outTime" lay-verify="required"> |
54 | </div> | 54 | </div> |
@@ -56,19 +56,19 @@ | @@ -56,19 +56,19 @@ | ||
56 | </div> | 56 | </div> |
57 | <div class="layui-form-item"> | 57 | <div class="layui-form-item"> |
58 | <div class="layui-inline inline-onethird"> | 58 | <div class="layui-inline inline-onethird"> |
59 | - <label class="layui-form-label">机房负责人(甲方)</label> | 59 | + <label class="layui-form-label" ><span style="color: red;font-size: 16px">*</span>机房负责人</label> |
60 | <div class="layui-input-inline"> | 60 | <div class="layui-input-inline"> |
61 | <input type="text" class="layui-input" name="machineRoomLeader" id="machineRoomLeader" lay-verify="required"> | 61 | <input type="text" class="layui-input" name="machineRoomLeader" id="machineRoomLeader" lay-verify="required"> |
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | <div class="layui-inline inline-onethird"> | 64 | <div class="layui-inline inline-onethird"> |
65 | - <label class="layui-form-label">项目管理员(甲方)</label> | 65 | + <label class="layui-form-label" ><span style="color: red;font-size: 16px">*</span>项目管理员</label> |
66 | <div class="layui-input-inline"> | 66 | <div class="layui-input-inline"> |
67 | <input type="text" class="layui-input" name="projectLeader" id="projectLeader" lay-verify="required"> | 67 | <input type="text" class="layui-input" name="projectLeader" id="projectLeader" lay-verify="required"> |
68 | </div> | 68 | </div> |
69 | </div> | 69 | </div> |
70 | <div class="layui-inline inline-onethird"> | 70 | <div class="layui-inline inline-onethird"> |
71 | - <label class="layui-form-label">运维负责人</label> | 71 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>运维负责人</label> |
72 | <div class="layui-input-inline"> | 72 | <div class="layui-input-inline"> |
73 | <input type="text" class="layui-input" name="operationUser" id="operationUser" lay-verify="required"> | 73 | <input type="text" class="layui-input" name="operationUser" id="operationUser" lay-verify="required"> |
74 | </div> | 74 | </div> |
@@ -76,20 +76,20 @@ | @@ -76,20 +76,20 @@ | ||
76 | </div> | 76 | </div> |
77 | <div class="layui-form-item" > | 77 | <div class="layui-form-item" > |
78 | <div class="layui-inline inline-half"> | 78 | <div class="layui-inline inline-half"> |
79 | - <label class="layui-form-label">携带物品</label> | 79 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>携带物品</label> |
80 | <div class="layui-input-inline"> | 80 | <div class="layui-input-inline"> |
81 | <input type="text" class="layui-input" name="belongings" id="belongings" lay-verify="required"> | 81 | <input type="text" class="layui-input" name="belongings" id="belongings" lay-verify="required"> |
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | <div class="layui-inline inline-half"> | 84 | <div class="layui-inline inline-half"> |
85 | - <label class="layui-form-label">值班人</label> | 85 | + <label class="layui-form-label"><span style="color: red;font-size: 16px">*</span>值班人</label> |
86 | <div class="layui-input-inline"> | 86 | <div class="layui-input-inline"> |
87 | <input type="text" class="layui-input" name="watchkeeper" id= "watchkeeper" lay-verify="required"> | 87 | <input type="text" class="layui-input" name="watchkeeper" id= "watchkeeper" lay-verify="required"> |
88 | </div> | 88 | </div> |
89 | </div> | 89 | </div> |
90 | </div> | 90 | </div> |
91 | <div class="layui-form-item"> | 91 | <div class="layui-form-item"> |
92 | - <label class="layui-form-label textarea-label">进入事由</label> | 92 | + <label class="layui-form-label textarea-label"><span style="color: red;font-size: 16px">*</span>进入事由</label> |
93 | <div class="layui-input-block"> | 93 | <div class="layui-input-block"> |
94 | <textarea class="layui-textarea" name="reason" id="reason" lay-verify="required"></textarea> | 94 | <textarea class="layui-textarea" name="reason" id="reason" lay-verify="required"></textarea> |
95 | </div> | 95 | </div> |
1 | +<title>日志视图</title> | ||
2 | +<style> | ||
3 | + .display-flex{ | ||
4 | + display: flex; | ||
5 | + } | ||
6 | + .log-header { | ||
7 | + border-bottom: solid 1px #C9C9C9; | ||
8 | + margin-bottom: 6px; | ||
9 | + } | ||
10 | + | ||
11 | + .log-header .title { | ||
12 | + width: 200px; | ||
13 | + font-weight: bold; | ||
14 | + } | ||
15 | + | ||
16 | + .log-header .tools { | ||
17 | + width: calc(100% - 200px); | ||
18 | + text-align: right; | ||
19 | + } | ||
20 | + | ||
21 | + .dropDownbtn{ | ||
22 | + width: 100%; | ||
23 | + border-top-right-radius: 0px; | ||
24 | + border-right: 1px solid #C9C9C9;; | ||
25 | + border-bottom-right-radius: 0px; | ||
26 | + } | ||
27 | + .dropDownbtn:hover{ | ||
28 | + border: 1px solid #C9C9C9; | ||
29 | + /* border-top-right-radius: 2px; | ||
30 | + border-right: solid 1px #009688; | ||
31 | + border-right: none; | ||
32 | + border-bottom-right-radius: 2px;*/ | ||
33 | + } | ||
34 | + | ||
35 | + .log-search-input input{ | ||
36 | + border: 1px solid #C9C9C9; | ||
37 | + /*border-left: none;*/ | ||
38 | + margin-top: -1px; | ||
39 | + margin-left: -2px; | ||
40 | + border-right: none; | ||
41 | + border-top-right-radius: 0px; | ||
42 | + border-bottom-right-radius: 0px; | ||
43 | + } | ||
44 | + | ||
45 | + .log-search-input input:hover{ | ||
46 | + border: 1px solid #C9C9C9; | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + .time-select{ | ||
51 | + position: relative; | ||
52 | + width: 350px; | ||
53 | + | ||
54 | + } | ||
55 | + | ||
56 | + .time-select button{ | ||
57 | + width: 100%; | ||
58 | + border: 1px solid #C9C9C9; | ||
59 | + margin-left: -3px; | ||
60 | + border-top-left-radius: 0px; | ||
61 | + border-bottom-left-radius: 0px; | ||
62 | + } | ||
63 | + | ||
64 | + .time-select button:hover{ | ||
65 | + border: 1px solid #C9C9C9; | ||
66 | + } | ||
67 | + | ||
68 | + .time-tools{ | ||
69 | + flex-direction: column; | ||
70 | + width: 50%; | ||
71 | + text-align: center; | ||
72 | + } | ||
73 | + .border-left{ | ||
74 | + border-right: 1px solid #C9C9C9;; | ||
75 | + } | ||
76 | + | ||
77 | + .time-tools div{ | ||
78 | + margin: 2px 5px; | ||
79 | + border-radius: 2px; | ||
80 | + } | ||
81 | + .time-tools div:hover{ | ||
82 | + background: #C9C9C9; | ||
83 | + } | ||
84 | + | ||
85 | + div[lay-id="logTable"] .layui-table-cell{ | ||
86 | + height: auto; | ||
87 | + } | ||
88 | + | ||
89 | + | ||
90 | + .log-item{ | ||
91 | + display: flex; | ||
92 | + flex-direction: row; | ||
93 | + } | ||
94 | + .log-item .item-left{ | ||
95 | + text-align: right; | ||
96 | + border-right: solid 1px gainsboro; | ||
97 | + padding-right: 10px; | ||
98 | + width: 15%; | ||
99 | + | ||
100 | + } | ||
101 | + .log-item .item-right{ | ||
102 | + text-align: left; | ||
103 | + padding-left: 10px; | ||
104 | + width: 85%; | ||
105 | + max-width: 85%; | ||
106 | + word-wrap:break-word; | ||
107 | + word-break: break-all; | ||
108 | + } | ||
109 | + .layui-card-header { | ||
110 | + line-height: initial; | ||
111 | + } | ||
112 | + | ||
113 | + .log-content-line1{ | ||
114 | + display: flex; | ||
115 | + flex-direction: row | ||
116 | + } | ||
117 | + .log-content-line1 div{ | ||
118 | + width: 33%; | ||
119 | + text-align: left; | ||
120 | + font-weight: 100; | ||
121 | + color: #000; | ||
122 | + } | ||
123 | + | ||
124 | + .log-content-line1 div span{ | ||
125 | + | ||
126 | + } | ||
127 | + | ||
128 | + .log-content-line2{ | ||
129 | + text-align: left; | ||
130 | + word-wrap:break-word; | ||
131 | + word-break: break-all; | ||
132 | + } | ||
133 | + | ||
134 | + .log-content-line3{ | ||
135 | + display: none; | ||
136 | + border-top: dashed 1px grey; | ||
137 | + } | ||
138 | + | ||
139 | + | ||
140 | +</style> | ||
141 | +<article class="page-container"> | ||
142 | + <div class="page-panel"> | ||
143 | + <div class="main"> | ||
144 | + <div class="layui-card"> | ||
145 | + <div class="layui-card-header"> | ||
146 | + <form class="layui-form layui-card-header" lay-filter="form_log_condition" onsubmit="return false;"> | ||
147 | + <input type="hidden" id="searchDataRange"> | ||
148 | + <input type="hidden" id="searchDataType"> | ||
149 | + <!--<div class="display-flex log-header"> | ||
150 | + <div class="title">新搜索</div> | ||
151 | + <div class="layui-inline layui-btn-group time-group tools" id="createTimeBtn" > | ||
152 | + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">新建</button> | ||
153 | + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">打开</button> | ||
154 | + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">保存</button> | ||
155 | + </div> | ||
156 | + </div>--> | ||
157 | + <!----> | ||
158 | + <div class="layui-row"> | ||
159 | + <div class="layui-col-md2"> | ||
160 | + <div style="width: 120px" id="resTypeList"></div> | ||
161 | + <!--<select id="resTypeList" name="modules" lay-search=""> | ||
162 | + <option value="">直接选择或搜索选择</option> | ||
163 | + <option value="HOST_X86SERVER">服务器</option> | ||
164 | + <option value="DATABASE_">数据库</option> | ||
165 | + <option value="MIDDLEWARE_WEBLOGIC">中间件</option> | ||
166 | + <option value="NETSAFE_">安全设备</option> | ||
167 | + <option value="NETHARDWARE_">网络设备</option> | ||
168 | + </select>--> | ||
169 | + </div> | ||
170 | + <div class="layui-col-md9"> | ||
171 | + <div class="layui-row"> | ||
172 | + <div class="layui-col-md8"> | ||
173 | + <input type="text" id="searchKeyWords" name="historywarningkw" placeholder="输入关键字,回车搜索" autocomplete="off" class="layui-input"> | ||
174 | + </div> | ||
175 | + <div class="layui-col-md4"> | ||
176 | + <div class="layui-btn layui-btn-primary" style="margin-bottom: 8px;border-left: 0px" id="time-select"> | ||
177 | + <span id="time-select-span"> | ||
178 | + </span> | ||
179 | + </div> | ||
180 | + </div> | ||
181 | + </div> | ||
182 | + </div> | ||
183 | + <div class="layui-col-md1"> | ||
184 | + <button class="layui-btn layui-btn-normal" style="margin-bottom: 8px;margin-left: 10px" id="log-search"> | ||
185 | + 搜索 | ||
186 | + </button> | ||
187 | + </div> | ||
188 | + </div> | ||
189 | + <div class="layui-row"> | ||
190 | + <div class="layui-col-md12"> | ||
191 | + <div class="layui-btn-group"> | ||
192 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis NETHARDWARE_" logType="Alarm">自身告警情况</button> | ||
193 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis NETHARDWARE_" logType="TrapAlarm">设备Trap告警</button> | ||
194 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis NETHARDWARE_" logType="ConfigChange">网络配置情况</button> | ||
195 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis HOST_X86SERVER" logType="OsAccountAuthOperation">运行账号及权限</button> | ||
196 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis HOST_X86SERVER" logType="AccountLogin">账号登录</button> | ||
197 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis DATABASE_" logType="BatchDelete">批量删除</button> | ||
198 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis DATABASE_" logType="TableSpaceDelete">表空间删除</button> | ||
199 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis MIDDLEWARE_WEBLOGIC" logType="AccountLogin">登录信息</button> | ||
200 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis NETSAFE_" logType="AbnormalAccess">非正常访问</button> | ||
201 | + <button type="button" style="background-color: grey" class="layui-btn layui-btn-xs alaysis NETSAFE_" logType="ConfigChange">策略变动</button> | ||
202 | + </div> | ||
203 | + </div> | ||
204 | + </div> | ||
205 | + </form> | ||
206 | + </div> | ||
207 | + | ||
208 | + <div class="layui-card" style="min-height: 200px"> | ||
209 | + <div class="layui-card-body"> | ||
210 | + <div style="display: flex;height: 200px" class="layui-card-echart"> | ||
211 | + <div style="flex-grow: 1"> | ||
212 | + <div class="pie-chart" id="log-echarts"></div> | ||
213 | + </div> | ||
214 | + </div> | ||
215 | + </div> | ||
216 | + </div> | ||
217 | + | ||
218 | + <div class="layui-card"> | ||
219 | + <div class="layui-card-body"> | ||
220 | + <div style="display: flex" class="layui-card-echart"> | ||
221 | + <div style="flex-grow: 1"> | ||
222 | + <div style="display: flex;flex-direction: row"> | ||
223 | + <div style="width: 200px;display: inline-flex"> | ||
224 | + | ||
225 | + </div> | ||
226 | + </div> | ||
227 | + <!--<div class="layui-row alaysis NETHARDWARE_" style="display: none"> | ||
228 | + <div class="layui-col-md12"> | ||
229 | + <div class="layui-btn-group"> | ||
230 | + <button type="button" class="layui-btn layui-btn-xs">自身告警情况</button> | ||
231 | + <button type="button" class="layui-btn layui-btn-xs">设备Trap告警</button> | ||
232 | + <button type="button" class="layui-btn layui-btn-xs">网络配置情况</button> | ||
233 | + </div> | ||
234 | + </div> | ||
235 | + </div> | ||
236 | + <div class="layui-row alaysis HOST_X86SERVER" style="display: none"> | ||
237 | + <div class="layui-col-md12"> | ||
238 | + <div class="layui-btn-group"> | ||
239 | + <button type="button" class="layui-btn layui-btn-xs">运行账号及权限</button> | ||
240 | + <button type="button" class="layui-btn layui-btn-xs">账号登录</button> | ||
241 | + </div> | ||
242 | + </div> | ||
243 | + </div> | ||
244 | + <div class="layui-row alaysis DATABASE_" style="display: none"> | ||
245 | + <div class="layui-col-md12"> | ||
246 | + <div class="layui-btn-group"> | ||
247 | + <button type="button" class="layui-btn layui-btn-xs">批量删除</button> | ||
248 | + <button type="button" class="layui-btn layui-btn-xs">表空间删除</button> | ||
249 | + </div> | ||
250 | + </div> | ||
251 | + </div> | ||
252 | + <div class="layui-row alaysis MIDDLEWARE_WEBLOGIC" style="display: none"> | ||
253 | + <div class="layui-col-md12"> | ||
254 | + <div class="layui-btn-group"> | ||
255 | + <button type="button" class="layui-btn layui-btn-xs">登录信息</button> | ||
256 | + </div> | ||
257 | + </div> | ||
258 | + </div> | ||
259 | + <div class="layui-row alaysis NETSAFE_" style="display: none"> | ||
260 | + <div class="layui-col-md12"> | ||
261 | + <div class="layui-btn-group"> | ||
262 | + <button type="button" class="layui-btn layui-btn-xs">非正常访问</button> | ||
263 | + <button type="button" class="layui-btn layui-btn-xs">策略变动</button> | ||
264 | + </div> | ||
265 | + </div> | ||
266 | + </div>--> | ||
267 | + <table id="logTable" lay-filter="log-table-filter"></table> | ||
268 | + </div> | ||
269 | + </div> | ||
270 | + </div> | ||
271 | + </div> | ||
272 | + </div> | ||
273 | + </div> | ||
274 | + </div> | ||
275 | +</article> | ||
276 | + | ||
277 | +<script type="text/html" id="expandAll"> | ||
278 | + <div class="detailView"> | ||
279 | + {{# layui.each(d, function(index, item){ }} | ||
280 | + | ||
281 | + <div style="border-bottom: #c1b8b8 dashed 1px;margin-top: 5px;margin-left: 10%"> | ||
282 | + <div style="display: inline-block;width: 30%;height: 25px;line-height: 25px;">{{index}}</div> | ||
283 | + <div style="display: inline-block;width: 60%;height: 25px;line-height: 25px;">{{item}}</div> | ||
284 | + </div> | ||
285 | + | ||
286 | + {{# }) }} | ||
287 | + </div> | ||
288 | +</script> | ||
289 | + | ||
290 | + | ||
291 | +<script> | ||
292 | + layui.use('newLogIndex', function (fn) { | ||
293 | + fn(); | ||
294 | + }); | ||
295 | +</script> |
1 | +/** | ||
2 | + | ||
3 | + @Name:dropdown 下拉菜单组件 | ||
4 | + @License:MIT | ||
5 | + | ||
6 | + */ | ||
7 | + | ||
8 | +layui.define(['jquery', 'laytpl','lay'], function(exports){ | ||
9 | + "use strict"; | ||
10 | + | ||
11 | + var $ = layui.$ | ||
12 | + ,laytpl = layui.laytpl | ||
13 | + ,hint = layui.hint() | ||
14 | + ,device = layui.device() | ||
15 | + ,clickOrMousedown = (device.mobile ? 'click' : 'mousedown') | ||
16 | + | ||
17 | + //模块名 | ||
18 | + ,MOD_NAME = 'dropdown' | ||
19 | + ,MOD_INDEX = 'layui_'+ MOD_NAME +'_index' //模块索引名 | ||
20 | + | ||
21 | + //外部接口 | ||
22 | + ,dropdown = { | ||
23 | + config: {} | ||
24 | + ,index: layui[MOD_NAME] ? (layui[MOD_NAME].index + 10000) : 0 | ||
25 | + | ||
26 | + //设置全局项 | ||
27 | + ,set: function(options){ | ||
28 | + var that = this; | ||
29 | + that.config = $.extend({}, that.config, options); | ||
30 | + return that; | ||
31 | + } | ||
32 | + | ||
33 | + //事件 | ||
34 | + ,on: function(events, callback){ | ||
35 | + return layui.onevent.call(this, MOD_NAME, events, callback); | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + //操作当前实例 | ||
40 | + ,thisModule = function(){ | ||
41 | + var that = this | ||
42 | + ,options = that.config | ||
43 | + ,id = options.id; | ||
44 | + | ||
45 | + thisModule.that[id] = that; //记录当前实例对象 | ||
46 | + | ||
47 | + return { | ||
48 | + config: options | ||
49 | + //重置实例 | ||
50 | + ,reload: function(options){ | ||
51 | + that.reload.call(that, options); | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | + //字符常量 | ||
57 | + ,STR_ELEM = 'layui-dropdown', STR_HIDE = 'layui-hide', STR_DISABLED = 'layui-disabled', STR_NONE = 'layui-none' | ||
58 | + ,STR_ITEM_UP = 'layui-menu-item-up', STR_ITEM_DOWN = 'layui-menu-item-down', STR_MENU_TITLE = 'layui-menu-body-title', STR_ITEM_GROUP = 'layui-menu-item-group', STR_ITEM_PARENT = 'layui-menu-item-parent', STR_ITEM_DIV = 'layui-menu-item-divider', STR_ITEM_CHECKED = 'layui-menu-item-checked', STR_ITEM_CHECKED2 = 'layui-menu-item-checked2', STR_MENU_PANEL = 'layui-menu-body-panel', STR_MENU_PANEL_L = 'layui-menu-body-panel-left' | ||
59 | + | ||
60 | + ,STR_GROUP_TITLE = '.'+ STR_ITEM_GROUP + '>.'+ STR_MENU_TITLE | ||
61 | + | ||
62 | + //构造器 | ||
63 | + ,Class = function(options){ | ||
64 | + var that = this; | ||
65 | + that.index = ++dropdown.index; | ||
66 | + that.config = $.extend({}, that.config, dropdown.config, options); | ||
67 | + that.init(); | ||
68 | + }; | ||
69 | + | ||
70 | + //默认配置 | ||
71 | + Class.prototype.config = { | ||
72 | + trigger: 'click' //事件类型 | ||
73 | + ,content: '' //自定义菜单内容 | ||
74 | + ,className: '' //自定义样式类名 | ||
75 | + ,style: '' //设置面板 style 属性 | ||
76 | + ,show: false //是否初始即显示菜单面板 | ||
77 | + ,isAllowSpread: true //是否允许菜单组展开收缩 | ||
78 | + ,isSpreadItem: true //是否初始展开子菜单 | ||
79 | + ,data: [] //菜单数据结构 | ||
80 | + ,delay: 300 //延迟关闭的毫秒数,若 trigger 为 hover 时才生效 | ||
81 | + }; | ||
82 | + | ||
83 | + //重载实例 | ||
84 | + Class.prototype.reload = function(options){ | ||
85 | + var that = this; | ||
86 | + that.config = $.extend({}, that.config, options); | ||
87 | + that.init(true); | ||
88 | + }; | ||
89 | + | ||
90 | + //初始化准备 | ||
91 | + Class.prototype.init = function(rerender){ | ||
92 | + var that = this | ||
93 | + ,options = that.config | ||
94 | + ,elem = options.elem = $(options.elem); | ||
95 | + | ||
96 | + //若 elem 非唯一 | ||
97 | + if(elem.length > 1){ | ||
98 | + layui.each(elem, function(){ | ||
99 | + dropdown.render($.extend({}, options, { | ||
100 | + elem: this | ||
101 | + })); | ||
102 | + }); | ||
103 | + return that; | ||
104 | + } | ||
105 | + | ||
106 | + //若重复执行 render,则视为 reload 处理 | ||
107 | + if(!rerender && elem[0] && elem.data(MOD_INDEX)){; | ||
108 | + var newThat = thisModule.getThis(elem.data(MOD_INDEX)); | ||
109 | + if(!newThat) return; | ||
110 | + | ||
111 | + return newThat.reload(options); | ||
112 | + }; | ||
113 | + | ||
114 | + //初始化 id 参数 | ||
115 | + options.id = ('id' in options) ? options.id : that.index; | ||
116 | + | ||
117 | + if(options.show) that.render(rerender); //初始即显示 | ||
118 | + that.events(); //事件 | ||
119 | + }; | ||
120 | + | ||
121 | + //渲染 | ||
122 | + Class.prototype.render = function(rerender){ | ||
123 | + var that = this | ||
124 | + ,options = that.config | ||
125 | + ,elemBody = $('body') | ||
126 | + | ||
127 | + //默认菜单内容 | ||
128 | + ,getDefaultView = function(){ | ||
129 | + var elemUl = $('<ul class="layui-menu layui-dropdown-menu"></ul>'); | ||
130 | + if(options.data.length > 0 ){ | ||
131 | + eachItemView(elemUl, options.data) | ||
132 | + } else { | ||
133 | + elemUl.html('<li class="layui-menu-item-none">no menu</li>'); | ||
134 | + } | ||
135 | + return elemUl; | ||
136 | + } | ||
137 | + | ||
138 | + //遍历菜单项 | ||
139 | + ,eachItemView = function(views, data){ | ||
140 | + //var views = []; | ||
141 | + layui.each(data, function(index, item){ | ||
142 | + //是否存在子级 | ||
143 | + var isChild = item.child && item.child.length > 0 | ||
144 | + ,isSpreadItem = ('isSpreadItem' in item) ? item.isSpreadItem : options.isSpreadItem | ||
145 | + ,title = item.templet | ||
146 | + ? laytpl(item.templet).render(item) | ||
147 | + : (options.templet ? laytpl(options.templet).render(item) : item.title) | ||
148 | + | ||
149 | + //初始类型 | ||
150 | + ,type = function(){ | ||
151 | + if(isChild){ | ||
152 | + item.type = item.type || 'parent'; | ||
153 | + } | ||
154 | + if(item.type){ | ||
155 | + return ({ | ||
156 | + group: 'group' | ||
157 | + ,parent: 'parent' | ||
158 | + ,'-': '-' | ||
159 | + })[item.type] || 'parent'; | ||
160 | + } | ||
161 | + return ''; | ||
162 | + }(); | ||
163 | + | ||
164 | + if(type !== '-' && (!item.title && !item.id && !isChild)) return; | ||
165 | + | ||
166 | + //列表元素 | ||
167 | + var viewLi = $(['<li'+ function(){ | ||
168 | + var className = { | ||
169 | + group: 'layui-menu-item-group'+ ( | ||
170 | + options.isAllowSpread ? ( | ||
171 | + isSpreadItem ? ' layui-menu-item-down' : ' layui-menu-item-up' | ||
172 | + ) : '' | ||
173 | + ) | ||
174 | + ,parent: STR_ITEM_PARENT | ||
175 | + ,'-': 'layui-menu-item-divider' | ||
176 | + }; | ||
177 | + if(isChild || type){ | ||
178 | + return ' class="'+ className[type] +'"'; | ||
179 | + } | ||
180 | + return ''; | ||
181 | + }() +'>' | ||
182 | + | ||
183 | + //标题区 | ||
184 | + ,function(){ | ||
185 | + //是否超文本 | ||
186 | + var viewText = ('href' in item) ? ( | ||
187 | + '<a href="'+ item.href +'" target="'+ (item.target || '_self') +'">'+ title +'</a>' | ||
188 | + ) : title; | ||
189 | + | ||
190 | + //是否存在子级 | ||
191 | + if(isChild){ | ||
192 | + return '<div class="'+ STR_MENU_TITLE +'">'+ viewText + function(){ | ||
193 | + if(type === 'parent'){ | ||
194 | + return '<i class="layui-icon layui-icon-right"></i>'; | ||
195 | + } else if(type === 'group' && options.isAllowSpread){ | ||
196 | + return '<i class="layui-icon layui-icon-'+ (isSpreadItem ? 'up' : 'down') +'"></i>'; | ||
197 | + } else { | ||
198 | + return ''; | ||
199 | + } | ||
200 | + }() +'</div>' | ||
201 | + | ||
202 | + } | ||
203 | + return '<div class="'+ STR_MENU_TITLE +'">'+ viewText +'</div>'; | ||
204 | + }() | ||
205 | + ,'</li>'].join('')); | ||
206 | + | ||
207 | + viewLi.data('item', item); | ||
208 | + | ||
209 | + //子级区 | ||
210 | + if(isChild){ | ||
211 | + var elemPanel = $('<div class="layui-panel layui-menu-body-panel"></div>') | ||
212 | + ,elemUl = $('<ul></ul>'); | ||
213 | + | ||
214 | + if(type === 'parent'){ | ||
215 | + elemPanel.append(eachItemView(elemUl, item.child)); | ||
216 | + viewLi.append(elemPanel); | ||
217 | + } else { | ||
218 | + viewLi.append(eachItemView(elemUl, item.child)); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + views.append(viewLi); | ||
223 | + }); | ||
224 | + return views; | ||
225 | + } | ||
226 | + | ||
227 | + //主模板 | ||
228 | + ,TPL_MAIN = ['<div class="layui-dropdown layui-border-box layui-panel layui-anim layui-anim-downbit">' | ||
229 | + ,'</div>'].join(''); | ||
230 | + | ||
231 | + //如果是右键事件,则每次触发事件时,将允许重新渲染 | ||
232 | + if(options.trigger === 'contextmenu' || lay.isTopElem(options.elem[0])) rerender = true; | ||
233 | + | ||
234 | + //判断是否已经打开了下拉菜单面板 | ||
235 | + if(!rerender && options.elem.data(MOD_INDEX +'_opened')) return; | ||
236 | + | ||
237 | + //记录模板对象 | ||
238 | + that.elemView = $(TPL_MAIN); | ||
239 | + that.elemView.append(options.content || getDefaultView()); | ||
240 | + | ||
241 | + //初始化某些属性 | ||
242 | + if(options.className) that.elemView.addClass(options.className); | ||
243 | + if(options.style) that.elemView.attr('style', options.style); | ||
244 | + | ||
245 | + | ||
246 | + //记录当前执行的实例索引 | ||
247 | + dropdown.thisId = options.id; | ||
248 | + | ||
249 | + //插入视图 | ||
250 | + that.remove(); //移除非当前绑定元素的面板 | ||
251 | + elemBody.append(that.elemView); | ||
252 | + options.elem.data(MOD_INDEX +'_opened', true); | ||
253 | + | ||
254 | + //坐标定位 | ||
255 | + that.position(); | ||
256 | + thisModule.prevElem = that.elemView; //记录当前打开的元素,以便在下次关闭 | ||
257 | + thisModule.prevElem.data('prevElem', options.elem); //将当前绑定的元素,记录在打开元素的 data 对象中 | ||
258 | + | ||
259 | + //阻止全局事件 | ||
260 | + that.elemView.find('.layui-menu').on(clickOrMousedown, function(e){ | ||
261 | + layui.stope(e); | ||
262 | + }); | ||
263 | + | ||
264 | + //触发菜单列表事件 | ||
265 | + that.elemView.find('.layui-menu li').on('click', function(e){ | ||
266 | + var othis = $(this) | ||
267 | + ,data = othis.data('item') || {} | ||
268 | + ,isChild = data.child && data.child.length > 0; | ||
269 | + | ||
270 | + if(!isChild && data.type !== '-'){ | ||
271 | + that.remove(); | ||
272 | + typeof options.click === 'function' && options.click(data, othis); | ||
273 | + } | ||
274 | + }); | ||
275 | + | ||
276 | + //触发菜单组展开收缩 | ||
277 | + that.elemView.find(STR_GROUP_TITLE).on('click', function(e){ | ||
278 | + var othis = $(this) | ||
279 | + ,elemGroup = othis.parent() | ||
280 | + ,data = elemGroup.data('item') || {} | ||
281 | + | ||
282 | + if(data.type === 'group' && options.isAllowSpread){ | ||
283 | + thisModule.spread(elemGroup); | ||
284 | + } | ||
285 | + }); | ||
286 | + | ||
287 | + //如果是鼠标移入事件,则鼠标移出时自动关闭 | ||
288 | + if(options.trigger === 'mouseenter'){ | ||
289 | + that.elemView.on('mouseenter', function(){ | ||
290 | + clearTimeout(thisModule.timer); | ||
291 | + }).on('mouseleave', function(){ | ||
292 | + that.delayRemove(); | ||
293 | + }); | ||
294 | + } | ||
295 | + | ||
296 | + }; | ||
297 | + | ||
298 | + //位置定位 | ||
299 | + Class.prototype.position = function(obj){ | ||
300 | + var that = this | ||
301 | + ,options = that.config; | ||
302 | + | ||
303 | + lay.position(options.elem[0], that.elemView[0], { | ||
304 | + position: options.position | ||
305 | + ,e: that.e | ||
306 | + ,clickType: options.trigger === 'contextmenu' ? 'right' : null | ||
307 | + ,align: options.align || null | ||
308 | + }); | ||
309 | + }; | ||
310 | + | ||
311 | + //删除视图 | ||
312 | + Class.prototype.remove = function(){ | ||
313 | + var that = this | ||
314 | + ,options = that.config | ||
315 | + ,elemPrev = thisModule.prevElem; | ||
316 | + | ||
317 | + //若存在已打开的面板元素,则移除 | ||
318 | + if(elemPrev){ | ||
319 | + elemPrev.data('prevElem') && ( | ||
320 | + elemPrev.data('prevElem').data(MOD_INDEX +'_opened', false) | ||
321 | + ); | ||
322 | + elemPrev.remove(); | ||
323 | + } | ||
324 | + }; | ||
325 | + | ||
326 | + //延迟删除视图 | ||
327 | + Class.prototype.delayRemove = function(){ | ||
328 | + var that = this | ||
329 | + ,options = that.config; | ||
330 | + clearTimeout(thisModule.timer); | ||
331 | + | ||
332 | + thisModule.timer = setTimeout(function(){ | ||
333 | + that.remove(); | ||
334 | + }, options.delay); | ||
335 | + }; | ||
336 | + | ||
337 | + //事件 | ||
338 | + Class.prototype.events = function(){ | ||
339 | + var that = this | ||
340 | + ,options = that.config; | ||
341 | + | ||
342 | + //如果传入 hover,则解析为 mouseenter | ||
343 | + if(options.trigger === 'hover') options.trigger = 'mouseenter'; | ||
344 | + | ||
345 | + //解除上一个事件 | ||
346 | + if(that.prevElem) that.prevElem.off(options.trigger, that.prevElemCallback); | ||
347 | + | ||
348 | + //记录被绑定的元素及回调 | ||
349 | + that.prevElem = options.elem; | ||
350 | + that.prevElemCallback = function(e){ | ||
351 | + clearTimeout(thisModule.timer); | ||
352 | + that.e = e; | ||
353 | + that.render(); | ||
354 | + e.preventDefault(); | ||
355 | + | ||
356 | + //组件打开完毕的时间 | ||
357 | + typeof options.ready === 'function' && options.ready(that.elemView, options.elem, that.e.target); | ||
358 | + }; | ||
359 | + | ||
360 | + //触发元素事件 | ||
361 | + options.elem.on(options.trigger, that.prevElemCallback); | ||
362 | + | ||
363 | + //如果是鼠标移入事件 | ||
364 | + if(options.trigger === 'mouseenter'){ | ||
365 | + //直行鼠标移出事件 | ||
366 | + options.elem.on('mouseleave', function(){ | ||
367 | + that.delayRemove(); | ||
368 | + }); | ||
369 | + } | ||
370 | + }; | ||
371 | + | ||
372 | + //记录所有实例 | ||
373 | + thisModule.that = {}; //记录所有实例对象 | ||
374 | + | ||
375 | + //获取当前实例对象 | ||
376 | + thisModule.getThis = function(id){ | ||
377 | + var that = thisModule.that[id]; | ||
378 | + if(!that) hint.error(id ? (MOD_NAME +' instance with ID \''+ id +'\' not found') : 'ID argument required'); | ||
379 | + return that; | ||
380 | + }; | ||
381 | + | ||
382 | + //设置菜单组展开和收缩状态 | ||
383 | + thisModule.spread = function(othis){ | ||
384 | + //菜单组展开和收缩 | ||
385 | + var elemIcon = othis.children('.'+ STR_MENU_TITLE).find('.layui-icon'); | ||
386 | + if(othis.hasClass(STR_ITEM_UP)){ | ||
387 | + othis.removeClass(STR_ITEM_UP).addClass(STR_ITEM_DOWN); | ||
388 | + elemIcon.removeClass('layui-icon-down').addClass('layui-icon-up'); | ||
389 | + } else { | ||
390 | + othis.removeClass(STR_ITEM_DOWN).addClass(STR_ITEM_UP); | ||
391 | + elemIcon.removeClass('layui-icon-up').addClass('layui-icon-down') | ||
392 | + } | ||
393 | + }; | ||
394 | + | ||
395 | + //全局事件 | ||
396 | + ;!function(){ | ||
397 | + var _WIN = $(window) | ||
398 | + ,_DOC = $(document); | ||
399 | + | ||
400 | + //自适应定位 | ||
401 | + _WIN.on('resize', function(){ | ||
402 | + if(!dropdown.thisId) return; | ||
403 | + var that = thisModule.getThis(dropdown.thisId); | ||
404 | + if(!that) return; | ||
405 | + | ||
406 | + if(!that.elemView[0] || !$('.'+ STR_ELEM)[0]){ | ||
407 | + return false; | ||
408 | + } | ||
409 | + | ||
410 | + var options = that.config; | ||
411 | + | ||
412 | + if(options.trigger === 'contextmenu'){ | ||
413 | + that.remove(); | ||
414 | + } else { | ||
415 | + that.position(); | ||
416 | + } | ||
417 | + }); | ||
418 | + | ||
419 | + | ||
420 | + | ||
421 | + //点击任意处关闭 | ||
422 | + _DOC.on(clickOrMousedown, function(e){ | ||
423 | + if(!dropdown.thisId) return; | ||
424 | + var that = thisModule.getThis(dropdown.thisId) | ||
425 | + if(!that) return; | ||
426 | + | ||
427 | + var options = that.config; | ||
428 | + | ||
429 | + //如果触发的是绑定的元素,或者属于绑定元素的子元素,则不关闭 | ||
430 | + //满足条件:当前绑定的元素不是 body document,或者不是鼠标右键事件 | ||
431 | + if(!(lay.isTopElem(options.elem[0]) || options.trigger === 'contextmenu')){ | ||
432 | + if( | ||
433 | + e.target === options.elem[0] || | ||
434 | + options.elem.find(e.target)[0] || | ||
435 | + e.target === that.elemView[0] || | ||
436 | + (that.elemView && that.elemView.find(e.target)[0]) | ||
437 | + ) return; | ||
438 | + } | ||
439 | + | ||
440 | + that.remove(); | ||
441 | + }); | ||
442 | + | ||
443 | + //基础菜单的静态元素事件 | ||
444 | + var ELEM_LI = '.layui-menu:not(.layui-dropdown-menu) li'; | ||
445 | + _DOC.on('click', ELEM_LI, function(e){ | ||
446 | + var othis = $(this) | ||
447 | + ,parent = othis.parents('.layui-menu').eq(0) | ||
448 | + ,isChild = othis.hasClass(STR_ITEM_GROUP) || othis.hasClass(STR_ITEM_PARENT) | ||
449 | + ,filter = parent.attr('lay-filter') || parent.attr('id') | ||
450 | + ,options = lay.options(this); | ||
451 | + | ||
452 | + //非触发元素 | ||
453 | + if(othis.hasClass(STR_ITEM_DIV)) return; | ||
454 | + | ||
455 | + //非菜单组 | ||
456 | + if(!isChild){ | ||
457 | + //选中 | ||
458 | + parent.find('.'+ STR_ITEM_CHECKED).removeClass(STR_ITEM_CHECKED); //清除选中样式 | ||
459 | + parent.find('.'+ STR_ITEM_CHECKED2).removeClass(STR_ITEM_CHECKED2); //清除父级菜单选中样式 | ||
460 | + othis.addClass(STR_ITEM_CHECKED); //添加选中样式 | ||
461 | + othis.parents('.'+ STR_ITEM_PARENT).addClass(STR_ITEM_CHECKED2); //添加父级菜单选中样式 | ||
462 | + | ||
463 | + //触发事件 | ||
464 | + layui.event.call(this, MOD_NAME, 'click('+ filter +')', options); | ||
465 | + } | ||
466 | + }); | ||
467 | + | ||
468 | + //基础菜单的展开收缩事件 | ||
469 | + _DOC.on('click', (ELEM_LI + STR_GROUP_TITLE), function(e){ | ||
470 | + var othis = $(this) | ||
471 | + ,elemGroup = othis.parents('.'+ STR_ITEM_GROUP +':eq(0)') | ||
472 | + ,options = lay.options(elemGroup[0]); | ||
473 | + | ||
474 | + if(('isAllowSpread' in options) ? options.isAllowSpread : true){ | ||
475 | + thisModule.spread(elemGroup); | ||
476 | + }; | ||
477 | + }); | ||
478 | + | ||
479 | + //判断子级菜单是否超出屏幕 | ||
480 | + var ELEM_LI_PAR = '.layui-menu .'+ STR_ITEM_PARENT | ||
481 | + _DOC.on('mouseenter', ELEM_LI_PAR, function(e){ | ||
482 | + var othis = $(this) | ||
483 | + ,elemPanel = othis.find('.'+ STR_MENU_PANEL); | ||
484 | + | ||
485 | + if(!elemPanel[0]) return; | ||
486 | + var rect = elemPanel[0].getBoundingClientRect(); | ||
487 | + | ||
488 | + //是否超出右侧屏幕 | ||
489 | + if(rect.right > _WIN.width()){ | ||
490 | + elemPanel.addClass(STR_MENU_PANEL_L); | ||
491 | + //不允许超出左侧屏幕 | ||
492 | + rect = elemPanel[0].getBoundingClientRect(); | ||
493 | + if(rect.left < 0){ | ||
494 | + elemPanel.removeClass(STR_MENU_PANEL_L); | ||
495 | + } | ||
496 | + } | ||
497 | + | ||
498 | + //是否超出底部屏幕 | ||
499 | + if(rect.bottom > _WIN.height()){ | ||
500 | + elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height())); | ||
501 | + }; | ||
502 | + }).on('mouseleave', ELEM_LI_PAR, function(e){ | ||
503 | + var othis = $(this) | ||
504 | + ,elemPanel = othis.children('.'+ STR_MENU_PANEL); | ||
505 | + | ||
506 | + elemPanel.removeClass(STR_MENU_PANEL_L); | ||
507 | + elemPanel.css('margin-top', 0); | ||
508 | + }); | ||
509 | + | ||
510 | + }(); | ||
511 | + | ||
512 | + //重载实例 | ||
513 | + dropdown.reload = function(id, options){ | ||
514 | + var that = thisModule.getThis(id); | ||
515 | + if(!that) return this; | ||
516 | + | ||
517 | + that.reload(options); | ||
518 | + return thisModule.call(that); | ||
519 | + }; | ||
520 | + | ||
521 | + //核心入口 | ||
522 | + dropdown.render = function(options){ | ||
523 | + var inst = new Class(options); | ||
524 | + return thisModule.call(inst); | ||
525 | + }; | ||
526 | + | ||
527 | + exports(MOD_NAME, dropdown); | ||
528 | +}); |
-
Please register or login to post a comment